From 931276f72b04e81336f0612f1f20f388e5f50551 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 1 Jul 2021 11:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ResultCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionGoodsBuyerController.java | 23 +- .../controller/common/UploadController.java | 2 +- .../java/cn/lili/common/enums/ResultCode.java | 214 ++++++------------ .../serviceimpl/ConnectServiceImpl.java | 2 +- .../DistributionSelectedGoodsService.java | 7 + .../DistributionSelectedGoodsServiceImpl.java | 12 + .../plugin/impl/AliFileManagerPlugin.java | 15 +- .../serviceimpl/CategoryServiceImpl.java | 3 +- .../goods/serviceimpl/GoodsServiceImpl.java | 8 +- .../MemberNoticeSenterServiceImpl.java | 3 +- .../member/serviceimpl/MemberServiceImpl.java | 8 +- .../WechatMPMessageServiceImpl.java | 3 +- .../serviceimpl/WechatMessageServiceImpl.java | 3 +- .../message/util/WechatMessageUtil.java | 6 +- .../cart/render/impl/CheckDataRender.java | 3 +- .../cart/render/impl/SkuPromotionRender.java | 3 +- .../serviceimpl/AfterSaleServiceImpl.java | 2 +- .../OrderComplaintServiceImpl.java | 6 +- .../serviceimpl/OrderItemServiceImpl.java | 3 +- .../order/serviceimpl/OrderServiceImpl.java | 2 +- .../page/entity/vos/ArticleCategoryVO.java | 1 + .../serviceimpl/CouponServiceImpl.java | 29 ++- .../serviceimpl/FullDiscountServiceImpl.java | 20 +- .../serviceimpl/MemberCouponServiceImpl.java | 4 +- .../serviceimpl/PintuanServiceImpl.java | 13 +- .../serviceimpl/PointsGoodsServiceImpl.java | 5 +- .../PromotionGoodsServiceImpl.java | 5 +- .../serviceimpl/PromotionServiceImpl.java | 3 +- .../serviceimpl/SeckillServiceImpl.java | 9 +- .../promotion/tools/PromotionTools.java | 7 +- .../other/CustomWordsController.java | 3 +- .../promotion/CouponManagerController.java | 2 +- 32 files changed, 198 insertions(+), 231 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java index 088e5143..2a97f34b 100644 --- a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java @@ -11,6 +11,7 @@ import cn.lili.modules.distribution.service.DistributionSelectedGoodsService; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -50,13 +51,25 @@ public class DistributionGoodsBuyerController { } @ApiOperation(value = "选择分销商品") - @ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path") + @ApiImplicitParams({ + @ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"), + @ApiImplicitParam(name = "checked", value = "是否选择", required = true, dataType = "boolean", paramType = "query") + }) @GetMapping(value = "/checked/{distributionGoodsId}") public ResultMessage distributionCheckGoods( - @NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId) { - if(distributionSelectedGoodsService.add(distributionGoodsId)){ - return ResultUtil.success(); + @NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId,Boolean checked) { + Boolean result=false; + if(checked){ + result=distributionSelectedGoodsService.add(distributionGoodsId); + }else { + result=distributionSelectedGoodsService.delete(distributionGoodsId); } - throw new ServiceException(ResultCode.ERROR); + //判断操作结果 + if(result){ + return ResultUtil.success(ResultCode.SUCCESS); + }else{ + throw new ServiceException(ResultCode.ERROR); + } + } } diff --git a/common-api/src/main/java/cn/lili/controller/common/UploadController.java b/common-api/src/main/java/cn/lili/controller/common/UploadController.java index d2e84495..d4f5cdfd 100644 --- a/common-api/src/main/java/cn/lili/controller/common/UploadController.java +++ b/common-api/src/main/java/cn/lili/controller/common/UploadController.java @@ -100,7 +100,7 @@ public class UploadController { fileService.save(newFile); } catch (Exception e) { log.error("文件上传失败", e); - throw new ServiceException(ResultCode.OSS_EXCEPTION); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } return ResultUtil.data(result); } diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java index d1b6598e..bd499283 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -27,25 +27,15 @@ public enum ResultCode { * 参数异常 */ PARAMS_ERROR(4002, "参数异常"), - /** - * 非法请求 - */ - ILLEGAL_REQUEST_ERROR(4003, "非法请求,请重新刷新页面操作"), - - /** - * 高频访问错误 - */ - LIMIT_ERROR(4004,"访问过于频繁,请稍后再试"), - - /** * 系统异常 */ - WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"), VERIFICATION_EXIST(1002, "验证码服务异常"), + LIMIT_ERROR(1003,"访问过于频繁,请稍后再试"), + ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"), /** * 分类 */ @@ -58,6 +48,7 @@ public enum ResultCode { CATEGORY_SAVE_ERROR(10007, "此类别下存在商品不能删除"), CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"), CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"), + CATEGORY_DELETE_FLAG_ERROR(10010, "子类状态不能与父类不一致!"), /** * 商品 @@ -77,181 +68,124 @@ public enum ResultCode { GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"), MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"), GOODS_PARAMS_ERROR(11013,"商品参数错误,刷新后重试"), + PHYSICAL_GOODS_NEED_TEMP(11014,"实物商品需选择配送模板"), + VIRTUAL_GOODS_NOT_NEED_TEMP(11015,"实物商品需选择配送模板"), + GOODS_TYPE_ERROR(11016, "需选择商品类型"), /** * 参数 */ PARAMETER_SAVE_ERROR(12001, "参数添加失败"), - PARAMETER_UPDATE_ERROR(12002, "参数编辑失败"), /** * 规格 */ SPEC_SAVE_ERROR(13001, "规格修改失败"), - SPEC_UPDATE_ERROR(13002, "规格修改失败"), - SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"), /** * 品牌 */ BRAND_SAVE_ERROR(14001, "品牌添加失败"), - BRAND_UPDATE_ERROR(14002, "品牌修改失败"), - BRAND_DISABLE_ERROR(14003, "品牌禁用失败"), - BRAND_DELETE_ERROR(14004, "品牌删除失败"), - BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"), - BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"), - BRAND_NOT_EXIST(20004, "品牌不存在"), /** * 用户 */ USER_EDIT_SUCCESS(20001, "用户修改成功"), - USER_NOT_EXIST(20002, "用户不存在"), - USER_NOT_LOGIN(20003, "用户未登录"), - USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"), - USER_AUTHORITY_ERROR(20005, "权限不足"), - USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"), - USER_NAME_EXIST(20007, "该用户名已被注册"), - USER_PHONE_EXIST(20008, "该手机号已被注册"), - USER_PHONE_NOT_EXIST(20009, "手机号不存在"), - USER_PASSWORD_ERROR(20010, "密码不正确"), - USER_NOT_PHONE(20011, "非当前用户的手机号"), - USER_CONNECT_ERROR(20012, "联合第三方登录,授权信息错误"), - USER_RECEIPT_REPEAT_ERROR(20013, "会员发票信息重复"), - USER_RECEIPT_NOT_EXIST(20014, "会员发票信息不存在"), - USER_EDIT_ERROR(20015, "用户修改失败"), - USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"), - USER_COLLECTION_EXIST(20017, "无法重复收藏"), - USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"), - DELETE_EXIST(20019, "无法重复收藏"), - - NOT_BINDING_USER(20020,"未绑定用户"), + USER_NOT_BINDING(20020,"未绑定用户"), + USER_AUTO_REGISTER_ERROR(20021,"自动注册失败,请稍后重试"), + USER_OVERDUE_CONNECT_ERROR(20022,"授权信息已过期,请重新授权/登录"), + USER_CONNECT_BANDING_ERROR(20023,"当前联合登陆方式,已绑定其他账号,需进行解绑操作"), + USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"), /** * 权限 */ PERMISSION_DEPARTMENT_ROLE_ERROR(21001, "角色已绑定部门,请逐个删除"), - PERMISSION_USER_ROLE_ERROR(21002, "角色已绑定管理员,请逐个删除"), - PERMISSION_MENU_ROLE_ERROR(21003, "菜单已绑定角色,请先删除或编辑角色"), - PERMISSION_DEPARTMENT_DELETE_ERROR(21004, "部门已经绑定管理员,请先删除或编辑管理员"), - PERMISSION_BEYOND_TEN(21005, "最多可以设置10个角色"), /** * 分销 */ DISTRIBUTION_CLOSE(22000, "分销功能关闭"), - DISTRIBUTION_NOT_EXIST(22001, "分销员不存在"), - DISTRIBUTION_IS_APPLY(22002, "分销员已申请,无需重复提交"), - DISTRIBUTION_AUDIT_ERROR(22003, "审核分销员失败"), - DISTRIBUTION_RETREAT_ERROR(22004, "分销员清退失败"), - DISTRIBUTION_CASH_NOT_EXIST(22005, "分销员提现记录不存在"), - DISTRIBUTION_GOODS_DOUBLE(22006, "不能重复添加分销商品"), /** * 购物车 */ CART_ERROR(30001, "读取结算页的购物车异常"), - CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"), - CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"), - SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"), /** * 订单 */ ORDER_ERROR(31001, "创建订单异常,请稍后重试"), - ORDER_NOT_EXIST(31002, "订单不存在"), - ORDER_DELIVERED_ERROR(31003, "订单状态错误,无法进行确认收货"), - ORDER_UPDATE_PRICE_ERROR(31004, "已支付的订单不能修改金额"), - ORDER_LOGISTICS_ERROR(31005, "物流错误"), - ORDER_DELIVER_ERROR(31006, "物流错误"), - ORDER_NOT_USER(31007, "非当前会员的订单"), - ORDER_TAKE_ERROR(31008, "当前订单无法核销"), - MEMBER_ADDRESS_NOT_EXIST(31009, "订单无收货地址,请先配置收货地址"), - ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"), - ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"), - ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"), - - BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"), + ORDER_BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"), + ORDER_ITEM_NOT_EXIST(31014, "当前订单项不存在!"), /** * 支付 */ PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"), - PAY_SUCCESS(32001, "支付成功"), - PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"), - PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"), - PAY_CASHIER_ERROR(32004, "收银台信息获取错误"), - PAY_ERROR(32005, "支付业务异常,请稍后重试"), - PAY_BAN(32006, "当前订单不需要付款,请返回订单列表重新操作"), - PAY_PARTIAL_ERROR(32007, "该订单已部分支付,请前往订单中心进行支付"), - PAY_NOT_SUPPORT(32008, "支付暂不支持"), - PAY_CLIENT_TYPE_ERROR(32009, "错误的客户端"), - PAY_POINT_ENOUGH(32010, "积分不足,不能兑换"), - PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"), - CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"), @@ -259,39 +193,32 @@ public enum ResultCode { * 售后 */ AFTER_SALES_NOT_PAY_ERROR(33001, "当前订单未支付,不能申请售后"), - AFTER_SALES_CANCEL_ERROR(33002, "当前售后单无法取消"), - AFTER_SALES_BAN(33003, "订单状态不允许申请售后,请联系平台或商家"), - AFTER_SALES_DOUBLE_ERROR(33004, "售后已审核,无法重复操作"), - AFTER_SALES_LOGISTICS_ERROR(33005, "物流公司错误,请重新选择"), - AFTER_STATUS_ERROR(33006, "售后状态错误,请刷新页面"), + RETURN_MONEY_OFFLINE_BANK_ERROR(33007, "当账号类型为银行转账时,银行信息不能为空"), /** * 投诉 */ COMPLAINT_ORDER_ITEM_EMPTY_ERROR(33100, "订单不存在"), - COMPLAINT_SKU_EMPTY_ERROR(33101, "商品已下架,如需投诉请联系平台客服"), - COMPLAINT_ERROR(33102, "投诉异常,请稍后重试"), + COMPLAINT_NOT_EXIT(33103, "当前投诉记录不存在"), + COMPLAINT_ARBITRATION_RESULT_ERROR(33104, "结束订单投诉时,仲裁结果不能为空"), + COMPLAINT_APPEAL_CONTENT_ERROR(33105, "商家申诉时,申诉内容不能为空"), + /** * 余额 */ WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"), - WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"), - WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"), - WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"), - WALLET_REMARK_ERROR(34004, "请填写审核备注!"), - WALLET_APPLY_ERROR(34005, "提现申请异常!"), /** @@ -300,62 +227,68 @@ public enum ResultCode { EVALUATION_DOUBLE_ERROR(35001, "无法重复提交评价"), /** - * 签到 + * 活动 */ - MEMBER_SIGN_REPEAT(40001, "请勿重复签到"), + PROMOTION_GOODS_NOT_EXIT(40001, "当前促销商品不存在!"), + PROMOTION_SAME_ACTIVE_EXIST(40002,"当前时间内已存在同类活动"), + PROMOTION_START_TIME_ERROR(40003,"活动起始时间不能大于活动结束时间"), + PROMOTION_TIME_ERROR(40004,"活动起始时间必须大于当前时间"), + PROMOTION_SAME_ERROR(40005,"当前时间段已存在相同活动!"), + PROMOTION_GOODS_ERROR(40006,"请选择要参与活动的商品"), + PROMOTION_STATUS_END(40007,"当前活动已停止"), + PROMOTION_UPDATE_ERROR(40008,"当前活动已开始/结束,无法编辑!"), /** * 优惠券 */ COUPON_EDIT_STATUS_SUCCESS(41001, "修改状态成功!"), - COUPON_CANCELLATION_SUCCESS(41002, "会员优惠券作废成功"), - COUPON_EXPIRED(41003, "优惠券已使用/已过期,不能使用"), - COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"), - COUPON_RECEIVE_ERROR(41005, "当前优惠券状态不可领取"), - COUPON_NUM_INSUFFICIENT_ERROR(41006, "优惠券剩余领取数量不足"), - COUPON_NOT_EXIST(41007, "当前优惠券不存在"), + COUPON_LIMIT_NUM_LESS_THAN_0(41008, "领取限制数量不能为负数"), + COUPON_LIMIT_GREATER_THAN_PUBLISH(41009, "领取限制数量超出发行数量"), + COUPON_DISCOUNT_ERROR(41010, "优惠券折扣必须小于10且大于0"), + COUPON_SCOPE_TYPE_GOODS_ERROR(41011, "当前关联范围类型为指定商品时,商品列表不能为空"), + COUPON_SCOPE_TYPE_CATEGORY_ERROR(41012, "当前关联范围类型为部分商品分类时,范围关联的id不能为空"), + COUPON_SCOPE_TYPE_STORE_ERROR(41013, "当前关联范围类型为部分店铺分类时,范围关联的id不能为空"), + COUPON_SCOPE_ERROR(41014, "指定商品范围关联id无效!"), + COUPON_MEMBER_NOT_EXIST(41015, "没有当前会员优惠券"), + COUPON_MEMBER_STATUS_ERROR(41016, "当前会员优惠券已过期/作废无法变更状态!"), + /** * 拼团 */ PINTUAN_MANUAL_OPEN_SUCCESS(42001, "手动开启拼团活动成功"), - PINTUAN_MANUAL_CLOSE_SUCCESS(42002, "手动关闭拼团活动成功"), - PINTUAN_ADD_SUCCESS(42003, "添加拼团活动成功"), - PINTUAN_EDIT_SUCCESS(42004, "修改拼团活动成功"), - PINTUAN_DELETE_SUCCESS(42005, "删除拼团活动成功"), - PINTUAN_MANUAL_OPEN_ERROR(42006, "手动开启拼团活动失败"), - PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"), - PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"), - PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"), - PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"), - PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"), - PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"), + PINTUAN_NOT_EXIST_ERROR(42013,"当前拼团商品不存在!"), /** * 满额活动 */ FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"), - FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"), - FULL_DISCOUNT_MODIFY_ERROR(43003,"当前编辑的满优惠活动已经开始或者已经结束,无法修改"), + FULL_DISCOUNT_NOT_EXIST_ERROR(43004,"当前要操作的满优惠活动不存在!"), + FULL_DISCOUNT_WAY_ERROR(43005,"请选择一种优惠方式!"), + FULL_DISCOUNT_GIFT_ERROR(43006,"请选择赠品!"), + FULL_DISCOUNT_COUPON_TIME_ERROR(43007,"赠送的优惠券有效时间必须大于活动时间"), + FULL_DISCOUNT_MONEY_ERROR(43008,"请填写满减金额"), + FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009,"满减金额不能大于优惠门槛"), + FULL_RATE_NUM_ERROR(43010,"请填写打折数值"), /** * 直播 @@ -370,6 +303,8 @@ public enum ResultCode { SECKILL_UPDATE_ERROR(45002,"当前秒杀活动活动已经开始,无法修改!"), SECKILL_PRICE_ERROR(45003,"活动价格不能大于商品原价"), SECKILL_TIME_ERROR(45004,"时刻参数异常"), + SECKILL_DELETE_ERROR(45005,"该秒杀活动活动的状态不能删除"), + SECKILL_CLOSE_ERROR(45006,"该秒杀活动活动的状态不能关闭"), /** @@ -381,40 +316,36 @@ public enum ResultCode { COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004,"优惠券活动最多指定10个优惠券"), COUPON_ACTIVITY_ITEM_NUM_ERROR(46005,"赠券数量必须大于0"), + /** + * 其他促销 + */ + MEMBER_SIGN_REPEAT(47001, "请勿重复签到"), + POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"), /** * 店铺 */ STORE_NOT_EXIST(50001, "此店铺不存在"), - STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"), - STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"), - STORE_NOT_OPEN(50004, "该会员未开通店铺"), + STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"), /** * 结算单 */ BILL_CHECK_ERROR(51001, "只有已出账结算单可以核对"), - BILL_COMPLETE_ERROR(51002, "只有已审核结算单可以支付"), /** * 文章 */ ARTICLE_CATEGORY_NAME_EXIST(60001, "文章分类名称已存在"), - ARTICLE_CATEGORY_PARENT_NOT_EXIST(60002, "文章分类父分类不存在"), - ARTICLE_CATEGORY_BEYOND_TWO(60003, "最多为二级分类,操作失败"), - ARTICLE_CATEGORY_DELETE_ERROR(60004, "该文章分类下存在子分类,不能删除"), - ARTICLE_CATEGORY_HAS_ARTICLE(60005, "该文章分类下存在文章,不能删除"), - ARTICLE_CATEGORY_NO_DELETION(60007, "默认文章分类不能进行删除"), - ARTICLE_NO_DELETION(60008, "默认文章不能进行删除"), @@ -422,79 +353,66 @@ public enum ResultCode { * 页面 */ PAGE_NOT_EXIST(61001, "页面不存在"), - PAGE_OPEN_DELETE_ERROR(61002, "当前页面为开启状态,无法删除"), - PAGE_DELETE_ERROR(61003, "当前页面为唯一页面,无法删除"), - PAGE_RELEASE_ERROR(61004, "页面已发布,无需重复提交"), /** * 设置 */ SETTING_NOT_TO_SET(70001, "该参数不需要设置"), - ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"), - ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"), - ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"), - LOGISTICS_NOT_SETTING(70005,"您还未配置快递查询"), - ORDER_SETTING_ERROR(70006,"系统订单配置异常"), - ALI_SMS_SETTING_ERROR(70007,"您还未配置阿里云短信"), - SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"), /** * 站内信 */ NOTICE_NOT_EXIST(80001, "当前消息模板不存在"), - NOTICE_ERROR(80002, "修改站内信异常,请稍后重试"), + NOTICE_SEND_ERROR(80003, "发送站内信异常,请检查系统日志"), + /** * OSS */ OSS_NOT_EXIST(80101, "OSS未配置"), - - OSS_EXCEPTION(80102, "文件上传失败,请稍后重试"), + OSS_EXCEPTION_ERROR(80102, "文件上传失败,请稍后重试"), + OSS_DELETE_ERROR(80102, "图片删除失败"), /** * 验证码 */ VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"), - VERIFICATION_ERROR(80202, "验证失败"), - VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"), - VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"), /** * 微信相关异常 */ WECHAT_CONNECT_NOT_SETTING(80300, "微信联合登陆信息未配置"), - WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"), - WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"), - WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"), - WECHAT_JSAPI_SIGN_ERROR(80304,"微信JsApi签名异常"), + WECHAT_CERT_ERROR(80305,"证书获取失败"), + WECHAT_MP_MESSAGE_TMPL_ERROR(80306,"未能获取到微信模版消息id"), + WECHAT_ERROR(80307,"微信接口异常"), + APP_VERSION_EXIST(80307, "APP版本已存在"), - WECHAT_CERT_ERROR(80505,"证书获取失败"), - - APP_VERSION_EXIST(80600, "APP版本已存在"), - + /** + * 其他 + */ CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"), - CUSTOM_WORDS_NOT_EXIST_ERROR(90000, "当前自定义分词不存在!"), + CUSTOM_WORDS_NOT_EXIST_ERROR(90001, "当前自定义分词不存在!"), + CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"), CONNECT_NOT_EXIST(90000,"登录方式不存在"), - ; private final Integer code; diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java index 4976dafe..e9aa36f5 100644 --- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java @@ -108,7 +108,7 @@ public class ConnectServiceImpl extends ServiceImpl impl CookieUtil.addCookie(CONNECT_TYPE, type, 1800, ThreadContextHolder.getHttpResponse()); //自动登录失败,则把信息缓存起来 cache.put(ConnectService.cacheKey(type, uuid), authUser, 30L, TimeUnit.MINUTES); - throw new ServiceException(ResultCode.NOT_BINDING_USER); + throw new ServiceException(ResultCode.USER_NOT_BINDING); } } catch (Exception e) { log.error("联合登陆异常:", e); diff --git a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java index 3912291d..994d5d8a 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java +++ b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java @@ -16,4 +16,11 @@ public interface DistributionSelectedGoodsService extends IService() + .eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoodsId) + .eq(DistributionSelectedGoods::getDistributionId,distributionId)); + } } diff --git a/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java b/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java index cbcfba6a..a189b8f2 100644 --- a/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java +++ b/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java @@ -1,6 +1,7 @@ package cn.lili.modules.file.plugin.impl; import cn.hutool.core.util.StrUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.file.plugin.FileManagerPlugin; import cn.lili.modules.system.entity.dos.Setting; @@ -76,7 +77,7 @@ public class AliFileManagerPlugin implements FileManagerPlugin { if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) { Setting setting = settingService.get(SettingEnum.OSS_SETTING.name()); if (setting == null || StrUtil.isBlank(setting.getSettingValue())) { - throw new ServiceException("您还未配置阿里云OSS存储"); + throw new ServiceException(ResultCode.OSS_NOT_EXIST); } nextInitSetting = System.currentTimeMillis() + interval; ossSetting = new Gson().fromJson(setting.getSettingValue(), OssSetting.class); @@ -107,13 +108,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片上传失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片上传失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. @@ -138,13 +139,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片上传失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片上传失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. @@ -169,13 +170,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片删除失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_DELETE_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片删除失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_DELETE_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java index 6f350d1c..37907ce9 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java @@ -3,6 +3,7 @@ package cn.lili.modules.goods.serviceimpl; import cn.hutool.core.util.StrUtil; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; @@ -174,7 +175,7 @@ public class CategoryServiceImpl extends ServiceImpl i if (category.getParentId() != null && !category.getParentId().equals("0")) { Category parentCategory = this.getById(category.getParentId()); if (!parentCategory.getDeleteFlag().equals(category.getDeleteFlag())) { - throw new ServiceException("子类状态不能与父类不一致!"); + throw new ServiceException(ResultCode.CATEGORY_DELETE_FLAG_ERROR); } } UpdateWrapper updateWrapper = new UpdateWrapper<>(); diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 10bf49bf..86023b2b 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -395,16 +395,16 @@ public class GoodsServiceImpl extends ServiceImpl implements switch (goods.getGoodsType()) { case "PHYSICAL_GOODS": if (goods.getTemplateId().equals("0")) { - throw new ServiceException("实物商品需选择配送模板"); + throw new ServiceException(ResultCode.PHYSICAL_GOODS_NEED_TEMP); } break; case "VIRTUAL_GOODS": if (!goods.getTemplateId().equals("0")) { - throw new ServiceException("虚拟商品不需要选择配送模板"); + throw new ServiceException(ResultCode.VIRTUAL_GOODS_NOT_NEED_TEMP); } break; default: - throw new ServiceException("需选择商品类型"); + throw new ServiceException(ResultCode.GOODS_TYPE_ERROR); } //检查商品是否存在--修改商品时使用 if (goods.getId() != null) { @@ -435,7 +435,7 @@ public class GoodsServiceImpl extends ServiceImpl implements goods.setStoreName(storeDetail.getStoreName()); goods.setSelfOperated(storeDetail.getSelfOperated()); } else { - throw new ServiceException("当前未登录店铺"); + throw new ServiceException(ResultCode.STORE_NOT_LOGIN_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java index 1b752381..3026fba6 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.member.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.StringUtils; import cn.lili.modules.member.entity.dos.MemberNoticeSenter; @@ -78,7 +79,7 @@ public class MemberNoticeSenterServiceImpl extends ServiceImpl impleme throw e; } catch (Exception e) { log.error("自动注册异常:", e); - throw new ServiceException("自动注册失败,请稍后重试"); + throw new ServiceException(ResultCode.USER_AUTO_REGISTER_ERROR); } } @@ -529,7 +529,7 @@ public class MemberServiceImpl extends ServiceImpl impleme ConnectAuthUser connectAuthUser = getConnectAuthUser(uuid, connectType); if (connectAuthUser == null) { - throw new ServiceException("授权信息已过期,请从新授权/登录"); + throw new ServiceException(ResultCode.USER_OVERDUE_CONNECT_ERROR); } //检测是否已经绑定过用户 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -541,13 +541,13 @@ public class MemberServiceImpl extends ServiceImpl impleme connectAuthUser.setConnectEnum(authInterface); return connectAuthUser; } else { - throw new ServiceException("当前联合登陆方式,已绑定其他账号,需进行解绑操作"); + throw new ServiceException(ResultCode.USER_CONNECT_BANDING_ERROR); } } catch (Exception e) { throw e; } } else { - throw new ServiceException("暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"); + throw new ServiceException(ResultCode.USER_CONNECT_NOT_EXIST_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java b/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java index 9a37909a..f8fcd822 100644 --- a/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.base.entity.enums.ClientTypeEnum; import cn.lili.modules.message.entity.dos.WechatMPMessage; @@ -114,7 +115,7 @@ public class WechatMPMessageServiceImpl extends ServiceImpl limitNum) { - throw new ServiceException("购买数量超过拼团活动限制数量"); + throw new ServiceException(ResultCode.PINTUAN_LIMIT_NUM_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java index 4c4e44a5..f9eb6744 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java @@ -473,7 +473,7 @@ public class AfterSaleServiceImpl extends ServiceImpl implements orderBatchDeliverDTOList.add(orderBatchDeliverDTO); } } catch (Exception e) { - throw new ServiceException(ResultCode.BATCH_DELIVER_ERROR); + throw new ServiceException(ResultCode.ORDER_BATCH_DELIVER_ERROR); } //循环检查是否符合规范 checkBatchDeliver(orderBatchDeliverDTOList); diff --git a/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java b/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java index 9ca34f72..f6f0f901 100644 --- a/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java +++ b/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java @@ -34,6 +34,7 @@ public class ArticleCategoryVO extends ArticleCategory { children.sort(new Comparator() { @Override public int compare(ArticleCategoryVO o1, ArticleCategoryVO o2) { + System.out.println(o1.getArticleCategoryName()+":"+o2.getArticleCategoryName()); return o1.getSort().compareTo(o2.getSort()); } }); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index 14444691..1fd5bee2 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -130,7 +131,7 @@ public class CouponServiceImpl extends ServiceImpl impleme List couponVOS = this.mongoTemplate.find(query, CouponVO.class); couponVOS = couponVOS.parallelStream().filter(i -> Boolean.FALSE.equals(i.getDeleteFlag())).collect(Collectors.toList()); if (couponVOS.isEmpty()) { - throw new ServiceException("优惠券不存在"); + throw new ServiceException(ResultCode.COUPON_NOT_EXIST); } for (CouponVO couponVO : couponVOS) { if (promotionStatus.name().equals(PromotionStatusEnum.START.name())) { @@ -282,23 +283,21 @@ public class CouponServiceImpl extends ServiceImpl impleme private void checkParam(CouponVO coupon) { if (coupon.getCouponLimitNum() < 0) { - throw new ServiceException("领取限制数量不能为负数"); + throw new ServiceException(ResultCode.COUPON_LIMIT_NUM_LESS_THAN_0); } //如果发行数量是0则判断领取限制数量 if (coupon.getPublishNum() != 0 && coupon.getCouponLimitNum() > coupon.getPublishNum()) { - throw new ServiceException("领取限制数量超出发行数量"); + throw new ServiceException(ResultCode.COUPON_LIMIT_GREATER_THAN_PUBLISH); } - if (coupon.getCouponType().equals(CouponTypeEnum.PRICE.name()) && coupon.getPrice() > coupon.getConsumeThreshold()) { - throw new ServiceException("优惠券面额必须小于优惠券消费限额"); - } else if (coupon.getCouponType().equals(CouponTypeEnum.DISCOUNT.name()) && (coupon.getCouponDiscount() < 0 && coupon.getCouponDiscount() > 10)) { - throw new ServiceException("优惠券折扣必须小于10且大于0"); + if (coupon.getCouponType().equals(CouponTypeEnum.DISCOUNT.name()) && (coupon.getCouponDiscount() < 0 && coupon.getCouponDiscount() > 10)) { + throw new ServiceException(ResultCode.COUPON_DISCOUNT_ERROR); } if (coupon.getRangeDayType() != null && coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { long nowTime = DateUtil.getDateline() * 1000; if (coupon.getStartTime().getTime() < nowTime && coupon.getEndTime().getTime() > nowTime) { - throw new ServiceException("活动时间小于当前时间,不能进行编辑删除操作"); + throw new ServiceException(ResultCode.PROMOTION_TIME_ERROR); } PromotionTools.checkPromotionTime(coupon.getStartTime().getTime(), coupon.getEndTime().getTime()); @@ -316,24 +315,24 @@ public class CouponServiceImpl extends ServiceImpl impleme */ private void checkCouponScope(CouponVO coupon) { if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name()) && (coupon.getPromotionGoodsList() == null || coupon.getPromotionGoodsList().isEmpty())) { - throw new ServiceException("当前关联范围类型为指定商品时,商品列表不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_GOODS_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为指定商品时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_GOODS_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS_CATEGORY.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为部分商品分类时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_CATEGORY_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_SHOP_CATEGORY.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为部分店铺分类时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_STORE_ERROR); } if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name())) { String[] split = coupon.getScopeId().split(","); if (split.length <= 0) { - throw new ServiceException("指定商品范围关联id无效!"); + throw new ServiceException(ResultCode.COUPON_SCOPE_ERROR); } for (String id : split) { GoodsSku goodsSku = goodsSkuService.getGoodsSkuByIdFromCache(id); if (goodsSku == null) { - throw new ServiceException("商品已下架"); + throw new ServiceException(ResultCode.GOODS_NOT_EXIST); } } } @@ -375,7 +374,7 @@ public class CouponServiceImpl extends ServiceImpl impleme private CouponVO checkStatus(String id) { CouponVO coupon = this.mongoTemplate.findById(id, CouponVO.class); if (coupon == null) { - throw new ServiceException("当前优惠券活动不存在"); + throw new ServiceException(ResultCode.COUPON_NOT_EXIST); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(FullDiscount::getIsCoupon, true).eq(FullDiscount::getCouponId, id); FullDiscount fullDiscount = fullDiscountService.getOne(queryWrapper); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java index f60682df..404afe4a 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java @@ -201,7 +201,7 @@ public class FullDiscountServiceImpl extends ServiceImpl queryWrapper = PromotionTools.checkActiveTime(statTime, endTime, PromotionTypeEnum.FULL_DISCOUNT, storeId, id); Integer sameNum = this.count(queryWrapper); if (sameNum > 0) { - throw new ServiceException("当前时间内已存在同类活动"); + throw new ServiceException(ResultCode.PROMOTION_SAME_ACTIVE_EXIST); } } @@ -267,11 +267,11 @@ public class FullDiscountServiceImpl extends ServiceImpl fullMoney) { - throw new ServiceException("满减金额不能大于优惠门槛"); + throw new ServiceException(ResultCode.FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS); } } @@ -301,11 +301,11 @@ public class FullDiscountServiceImpl extends ServiceImpl= rateLimit || fullRate <= 0) { - throw new ServiceException("请填写打折数值"); + throw new ServiceException(ResultCode.FULL_RATE_NUM_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java index dbd32e5b..410caf25 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java @@ -164,7 +164,7 @@ public class MemberCouponServiceImpl extends ServiceImpl impl PintuanVO pintuanVO = mongoTemplate.findById(id, PintuanVO.class); if (pintuanVO == null) { log.error("拼团活动id[" + id + "]的拼团活动不存在!"); - throw new ServiceException("网络出现异常!"); + throw new ServiceException(ResultCode.ERROR); } return pintuanVO; } @@ -170,7 +171,7 @@ public class PintuanServiceImpl extends ServiceImpl impl Pintuan pintuan = this.getById(id); if (pintuan == null) { log.error("拼团活动id[" + id + "]的拼团活动不存在!"); - throw new ServiceException("网络出现异常!"); + throw new ServiceException(ResultCode.ERROR); } return pintuan; } @@ -204,7 +205,7 @@ public class PintuanServiceImpl extends ServiceImpl impl public boolean modifyPintuan(PintuanVO pintuan) { PintuanVO pintuanVO = this.checkExist(pintuan.getId()); if (!pintuan.getPromotionStatus().equals(PromotionStatusEnum.NEW.name())) { - throw new ServiceException("只有活动状态为新活动时(活动未开始)才可编辑!"); + throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR); } //检查促销时间 PromotionTools.checkPromotionTime(pintuan.getStartTime().getTime(), pintuan.getEndTime().getTime()); @@ -358,7 +359,7 @@ public class PintuanServiceImpl extends ServiceImpl impl memberVO.setOrderSn(""); PromotionGoods promotionGoods = promotionGoodsService.getPromotionGoods(PromotionTypeEnum.PINTUAN, order.getPromotionId(), skuId); if (promotionGoods == null) { - throw new ServiceException("当前拼团商品不存在!"); + throw new ServiceException(ResultCode.PINTUAN_NOT_EXIST_ERROR); } pintuanShareVO.setPromotionGoods(promotionGoods); Pintuan pintuanById = this.getPintuanById(order.getPromotionId()); @@ -381,7 +382,7 @@ public class PintuanServiceImpl extends ServiceImpl impl QueryWrapper queryWrapper = PromotionTools.checkActiveTime(startTime, endTime, PromotionTypeEnum.PINTUAN, storeId, pintuanId); List list = this.list(queryWrapper); if (!list.isEmpty()) { - throw new ServiceException("当前时间段已存在相同活动!"); + throw new ServiceException(ResultCode.PROMOTION_SAME_ERROR); } } @@ -484,7 +485,7 @@ public class PintuanServiceImpl extends ServiceImpl impl private PintuanVO checkExist(String pintuanId) { PintuanVO pintuan = mongoTemplate.findById(pintuanId, PintuanVO.class); if (pintuan == null) { - throw new ServiceException("当前拼团活动不存在!"); + throw new ServiceException(ResultCode.PINTUAN_NOT_EXIST_ERROR); } return pintuan; } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java index cd7273eb..042213c3 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.util.StrUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -108,7 +109,7 @@ public class PointsGoodsServiceImpl extends ServiceImpl goodsSku.getQuantity()) { - throw new ServiceException("活动库存数量不能高于商品库存"); + throw new ServiceException(ResultCode.POINT_GOODS_ACTIVE_STOCK_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index 2590e8e2..b9993dda 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -2,6 +2,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.convert.Convert; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.DateUtil; @@ -270,7 +271,7 @@ public class PromotionGoodsServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.eq(SeckillApply::getSeckillId, promotionId).eq(SeckillApply::getSkuId, skuId); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java index 4335286d..1a3aeedb 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java @@ -3,6 +3,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.date.DateTime; import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.message.PromotionMessage; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.DateUtil; @@ -452,6 +453,6 @@ public class PromotionServiceImpl implements PromotionService { */ private void throwPromotionException(PromotionTypeEnum type, String id, String status) { log.error("当前" + type.name() + "活动ID为[" + id + "] 不存在,更改活动状态至[ " + status + " ]失败!"); - throw new ServiceException("当前活动已停止"); + throw new ServiceException(ResultCode.PROMOTION_STATUS_END); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java index 1a602c84..6faa260d 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.promotion.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -153,7 +154,7 @@ public class SeckillServiceImpl extends ServiceImpl impl //检查该秒杀活动是否存在 SeckillVO seckill = checkSeckillExist(seckillVO.getId()); if (PromotionStatusEnum.START.name().equals(seckillVO.getPromotionStatus())) { - throw new ServiceException("活动已经开始,不能进行编辑删除操作"); + throw new ServiceException(ResultCode.PROMOTION_UPDATE_ERROR); } //检查秒杀活动参数 this.checkSeckillParam(seckillVO, seckillVO.getStoreId()); @@ -193,7 +194,7 @@ public class SeckillServiceImpl extends ServiceImpl impl DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.PROMOTION, (PromotionTypeEnum.SECKILL.name() + seckill.getId())), rocketmqCustomProperties.getPromotionTopic()); } else { - throw new ServiceException("该秒杀活动活动的状态不能删除"); + throw new ServiceException(ResultCode.SECKILL_DELETE_ERROR); } } @@ -237,7 +238,7 @@ public class SeckillServiceImpl extends ServiceImpl impl rocketmqCustomProperties.getPromotionTopic()); } } else { - throw new ServiceException("该秒杀活动活动的状态不能关闭"); + throw new ServiceException(ResultCode.SECKILL_CLOSE_ERROR); } } @@ -279,7 +280,7 @@ public class SeckillServiceImpl extends ServiceImpl impl private SeckillVO checkSeckillExist(String id) { SeckillVO seckill = this.mongoTemplate.findById(id, SeckillVO.class); if (seckill == null) { - throw new ServiceException("当前秒杀活动活动不存在"); + throw new ServiceException(ResultCode.SECKILL_NOT_EXIST_ERROR); } return seckill; } diff --git a/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java b/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java index 713eec95..d9d9f27e 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java +++ b/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.tools; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.DateUtil; import cn.lili.common.vo.PageVO; @@ -41,7 +42,7 @@ public class PromotionTools { //如果促销活动选择的是部分商品参加活动 if (num != -1 && goodsList == null) { - throw new ServiceException("请选择要参与活动的商品"); + throw new ServiceException(ResultCode.PROMOTION_GOODS_ERROR); } } @@ -59,12 +60,12 @@ public class PromotionTools { //如果活动起始时间小于现在时间 if (startTime < nowTime) { - throw new ServiceException("活动起始时间必须大于当前时间"); + throw new ServiceException(ResultCode.PROMOTION_START_TIME_ERROR); } //开始时间不能大于结束时间 if (startTime > endTime) { - throw new ServiceException("活动起始时间不能大于活动结束时间"); + throw new ServiceException(ResultCode.PROMOTION_TIME_ERROR); } } diff --git a/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java b/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java index aa300078..7c439a15 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java @@ -1,5 +1,6 @@ package cn.lili.controller.other; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.StringUtils; import cn.lili.modules.permission.SettingKeys; @@ -49,7 +50,7 @@ public class CustomWordsController { } if (!setting.getSettingValue().equals(secretKey)) { - throw new ServiceException("秘钥验证失败!"); + throw new ServiceException(ResultCode.CUSTOM_WORDS_SECRET_KEY_ERROR); } String res = customWordsService.deploy(); diff --git a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java index cdc4ec46..69ac05ba 100644 --- a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java @@ -112,7 +112,7 @@ public class CouponManagerController { private void setStoreInfo(CouponVO couponVO) { AuthUser currentUser = UserContext.getCurrentUser(); if (currentUser == null) { - throw new ServiceException("获取当前用户信息不存在"); + throw new ServiceException(ResultCode.USER_NOT_EXIST); } couponVO.setStoreId("platform"); couponVO.setStoreName("platform");