diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/TradeStatusEnum.java b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/TradeStatusEnum.java new file mode 100644 index 00000000..6d9f4906 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/TradeStatusEnum.java @@ -0,0 +1,40 @@ +package cn.lili.modules.order.order.entity.enums; + +/** + * 订单状态枚举 + * + * @author Chopper + * @since 2020/11/17 7:27 下午 + */ +public enum OrderStatusEnum { + + /** + * 订单状态 + */ + UNPAID("未付款"), + PAID("已付款"), + UNDELIVERED("待发货"), + DELIVERED("已发货"), + COMPLETED("已完成"), + /** + * 虚拟订单需要核验商品 + */ + TAKE("待核验"), + CANCELLED("已取消"); + + private final String description; + + OrderStatusEnum(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + public String description() { + return this.description; + } + + +} diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java index e4145c41..a32e8572 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java @@ -39,7 +39,6 @@ import cn.lili.modules.payment.kit.plugin.wechat.model.*; import cn.lili.modules.payment.service.PaymentService; import cn.lili.modules.payment.service.RefundLogService; import cn.lili.modules.system.entity.dos.Setting; -import cn.lili.modules.system.entity.dto.connect.dto.WechatConnectSettingItem; import cn.lili.modules.system.entity.dto.payment.WechatPaymentSetting; import cn.lili.modules.system.entity.enums.SettingEnum; import cn.lili.modules.system.service.SettingService; @@ -258,6 +257,9 @@ public class WechatPlugin implements Payment { WechatPaymentSetting setting = wechatPaymentSetting(); String appid = setting.getAppId(); + if (appid == null) { + throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); + } UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel() .setAppid(appid) .setMchid(setting.getMchId()) @@ -323,6 +325,9 @@ public class WechatPlugin implements Payment { WechatPaymentSetting setting = wechatPaymentSetting(); String appid = setting.getServiceAppId(); + if (appid == null) { + throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); + } UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel() .setAppid(appid) .setMchid(setting.getMchId()) @@ -391,6 +396,9 @@ public class WechatPlugin implements Payment { //微信小程序,appid 需要单独获取,这里读取了联合登陆配置的appid ,实际场景小程序自动登录,所以这个appid是最为保险的做法 //如果有2开需求,这里需要调整,修改这个appid的获取途径即可 String appid = wechatPaymentSetting().getMpAppId(); + if (StringUtils.isEmpty(appid)) { + throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); + } String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8); WechatPaymentSetting setting = wechatPaymentSetting(); diff --git a/framework/src/main/java/cn/lili/modules/system/entity/dto/payment/WechatPaymentSetting.java b/framework/src/main/java/cn/lili/modules/system/entity/dto/payment/WechatPaymentSetting.java index b3d8e9f9..6e477acc 100644 --- a/framework/src/main/java/cn/lili/modules/system/entity/dto/payment/WechatPaymentSetting.java +++ b/framework/src/main/java/cn/lili/modules/system/entity/dto/payment/WechatPaymentSetting.java @@ -53,7 +53,7 @@ public class WechatPaymentSetting { */ private String apiKey3; - public String getAppId() { + public String getAppIdValue() { if (StringUtils.isEmpty(appId)) { throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); @@ -61,14 +61,14 @@ public class WechatPaymentSetting { return appId; } - public String getMpAppId() { + public String getMpAppIdValue() { if (StringUtils.isEmpty(mpAppId)) { throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); } return mpAppId; } - public String getServiceAppId() { + public String getServiceAppIdValue() { if (StringUtils.isEmpty(serviceAppId)) { throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); }