diff --git a/.image/common/mall-feature.png b/.image/common/mall-feature.png new file mode 100644 index 000000000..4873db4db Binary files /dev/null and b/.image/common/mall-feature.png differ diff --git a/.image/common/mall-preview.png b/.image/common/mall-preview.png new file mode 100644 index 000000000..1d1d1c6e7 Binary files /dev/null and b/.image/common/mall-preview.png differ diff --git a/.image/common/ruoyi-vue-pro-architecture.png b/.image/common/ruoyi-vue-pro-architecture.png new file mode 100644 index 000000000..30c0bbe45 Binary files /dev/null and b/.image/common/ruoyi-vue-pro-architecture.png differ diff --git a/.image/common/ruoyi-vue-pro-biz.png b/.image/common/ruoyi-vue-pro-biz.png new file mode 100644 index 000000000..5a80fb247 Binary files /dev/null and b/.image/common/ruoyi-vue-pro-biz.png differ diff --git a/.image/common/yudao-cloud-architecture.png b/.image/common/yudao-cloud-architecture.png new file mode 100644 index 000000000..01e8c5a47 Binary files /dev/null and b/.image/common/yudao-cloud-architecture.png differ diff --git a/README.md b/README.md index f29242d01..a37eeedcb 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ > > 😜 给项目点点 Star 吧,这对我们真的很重要! -![架构图](https://static.iocoder.cn/ruoyi-vue-pro-architecture.png?imageView2/2/format/webp) +![架构图](/.image/common/ruoyi-vue-pro-architecture.png) * 管理后台的电脑端:Vue3 提供 [element-plus](https://gitee.com/yudaocode/yudao-ui-admin-vue3)、[vben(ant-design-vue)](https://gitee.com/yudaocode/yudao-ui-admin-vben) 两个版本,Vue2 提供 [element-ui](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master/yudao-ui-admin) 版本 * 管理后台的移动端:采用 [uni-app](https://github.com/dcloudio/uni-app) 方案,一份代码多终端适配,同时支持 APP、小程序、H5! @@ -102,7 +102,7 @@ 系统内置多种多种业务功能,可以用于快速你的业务系统: -![功能分层](https://static.iocoder.cn/ruoyi-vue-pro-biz.png?imageView2/2/format/webp) +![功能分层](/.image/common/ruoyi-vue-pro-biz.png) * 系统功能 * 基础设施 @@ -214,17 +214,19 @@ ### 商城系统 -建设中... +![功能图](/.image/common/mall-feature.png) -![功能图](http://static.iocoder.cn/mall%20%E5%8A%9F%E8%83%BD%E5%9B%BE-min.png) - -![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-admin-min.gif) - -![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-h5-min.gif) +![功能图](/.image/common/mall-preview.png) ### 会员中心 -和「商城系统」一起开发 +| | 功能 | 描述 | +|-----|------|----------------------------------| +| 🚀 | 会员管理 | 会员是 C 端的消费者,该功能用于会员的搜索与管理 | +| 🚀 | 会员标签 | 对会员的标签进行创建、查询、修改、删除等操作 | +| 🚀 | 会员等级 | 对会员的等级、成长值进行管理,可用于订单折扣等会员权益 | +| 🚀 | 会员分组 | 对会员进行分组,用于用户画像、内容推送等运营手段 | +| 🚀 | 积分签到 | 回馈给签到、消费等行为的积分,会员可订单抵现、积分兑换等途径消耗 | ## 🐨 技术栈 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java index 4739deb25..53f1a8c06 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.framework.pay.core.client; -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; /** * 支付客户端的工厂接口 @@ -21,8 +21,18 @@ public interface PayClientFactory { * 创建支付客户端 * * @param channelId 渠道编号 - * @param client 支付客户端 - * @param 支付配置 + * @param channelCode 渠道编码 + * @param config 支付配置 */ - void addOrUpdatePayClient(Long channelId, AbstractPayClient client); + void createOrUpdatePayClient(Long channelId, String channelCode, + Config config); + + /** + * 注册支付客户端 Class,用于模块中实现的 PayClient + * + * @param channel 支付渠道的编码的枚举 + * @param payClientClass 支付客户端 class + */ + void registerPayClientClass(PayChannelEnum channel, Class payClientClass); + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java index d66e64115..e8f898b2e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java @@ -9,7 +9,6 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDT import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; -import lombok.Getter; import lombok.extern.slf4j.Slf4j; import java.util.Map; @@ -36,7 +35,6 @@ public abstract class AbstractPayClient implemen /** * 支付配置 */ - @Getter protected Config config; public AbstractPayClient(Long channelId, String channelCode, Config config) { diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java index 64114b264..0b39587ab 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java @@ -1,13 +1,22 @@ package cn.iocoder.yudao.framework.pay.core.client.impl; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ReflectUtil; import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; +import cn.iocoder.yudao.framework.pay.core.client.impl.mock.MockPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.*; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import lombok.extern.slf4j.Slf4j; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import static cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum.*; + /** * 支付客户端的工厂实现类 * @@ -18,10 +27,38 @@ public class PayClientFactoryImpl implements PayClientFactory { /** * 支付客户端 Map + * * key:渠道编号 */ private final ConcurrentMap> clients = new ConcurrentHashMap<>(); + /** + * 支付客户端 Class Map + */ + private final Map> clientClass = new ConcurrentHashMap<>(); + + public PayClientFactoryImpl() { + // 微信支付客户端 + clientClass.put(WX_PUB, WxPubPayClient.class); + clientClass.put(WX_LITE, WxLitePayClient.class); + clientClass.put(WX_APP, WxAppPayClient.class); + clientClass.put(WX_BAR, WxBarPayClient.class); + clientClass.put(WX_NATIVE, WxNativePayClient.class); + // 支付包支付客户端 + clientClass.put(ALIPAY_WAP, AlipayWapPayClient.class); + clientClass.put(ALIPAY_QR, AlipayQrPayClient.class); + clientClass.put(ALIPAY_APP, AlipayAppPayClient.class); + clientClass.put(ALIPAY_PC, AlipayPcPayClient.class); + clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class); + // Mock 支付客户端 + clientClass.put(MOCK, MockPayClient.class); + } + + @Override + public void registerPayClientClass(PayChannelEnum channel, Class payClientClass) { + clientClass.put(channel, payClientClass); + } + @Override public PayClient getPayClient(Long channelId) { AbstractPayClient client = clients.get(channelId); @@ -33,12 +70,26 @@ public class PayClientFactoryImpl implements PayClientFactory { @Override @SuppressWarnings("unchecked") - public void addOrUpdatePayClient(Long channelId, AbstractPayClient client) { - AbstractPayClient prePayClient = (AbstractPayClient) clients.putIfAbsent(channelId, client); - if (prePayClient == null) { + public void createOrUpdatePayClient(Long channelId, String channelCode, + Config config) { + AbstractPayClient client = (AbstractPayClient) clients.get(channelId); + if (client == null) { + client = this.createPayClient(channelId, channelCode, config); client.init(); + clients.put(client.getId(), client); } else { - prePayClient.refresh(client.getConfig()); + client.refresh(config); } } + + @SuppressWarnings("unchecked") + private AbstractPayClient createPayClient(Long channelId, String channelCode, + Config config) { + PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode); + Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelCode)); + Class payClientClass = clientClass.get(channelEnum); + Assert.notNull(payClientClass, String.format("支付渠道(%s) Class 为空", channelCode)); + return (AbstractPayClient) ReflectUtil.newInstance(payClientClass, channelId, config); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java index c921d09b9..984256063 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -40,8 +41,7 @@ public class PayClientFactoryImplIntegrationTest { config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p"); // 创建客户端 Long channelId = RandomUtil.randomLong(); - - payClientFactory.addOrUpdatePayClient(channelId, new WxPubPayClient(channelId, config)); + payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config); PayClient client = payClientFactory.getPayClient(channelId); // 发起支付 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); @@ -64,7 +64,7 @@ public class PayClientFactoryImplIntegrationTest { config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase"); // 创建客户端 Long channelId = RandomUtil.randomLong(); - payClientFactory.addOrUpdatePayClient(channelId, new WxPubPayClient(channelId, config)); + payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config); PayClient client = payClientFactory.getPayClient(channelId); // 发起支付 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); @@ -87,7 +87,7 @@ public class PayClientFactoryImplIntegrationTest { config.setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnq90KnF4dTnlzzmxpujbI05OYqi5WxAS6cL0gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBNlrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB"); // 创建客户端 Long channelId = RandomUtil.randomLong(); - payClientFactory.addOrUpdatePayClient(channelId, new AlipayQrPayClient(channelId, config)); + payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config); PayClient client = payClientFactory.getPayClient(channelId); // 发起支付 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); @@ -111,7 +111,7 @@ public class PayClientFactoryImplIntegrationTest { config.setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnq90KnF4dTnlzzmxpujbI05OYqi5WxAS6cL0gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBNlrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB"); // 创建客户端 Long channelId = RandomUtil.randomLong(); - payClientFactory.addOrUpdatePayClient(channelId, new AlipayWapPayClient(channelId, config)); + payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config); PayClient client = payClientFactory.getPayClient(channelId); // 发起支付 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 3ada0be78..43421315f 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -110,8 +110,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { spu.setMarketPrice(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getMarketPrice)); // sku 单价最低的商品的成本价格 spu.setCostPrice(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getCostPrice)); - // sku 单价最低的商品的条形码 - spu.setBarCode(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getBarCode)); + // sku 单价最低的商品的条形码 TODO 芋艿:条形码字段,是不是可以删除 + spu.setBarCode(""); +// spu.setBarCode(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getBarCode)); // skus 库存总数 spu.setStock(getSumValue(skus, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); // 若是 spu 已有状态则不处理 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java index a8a793c77..44ec72e8a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java @@ -81,12 +81,13 @@ public class SeckillConfigController { @GetMapping("/list-all-simple") @Operation(summary = "获得所有开启状态的秒杀时段精简列表", description = "主要用于前端的下拉选项") public CommonResult> getListAllSimple() { - List list = seckillConfigService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); + List list = seckillConfigService.getSeckillConfigListByStatus( + CommonStatusEnum.ENABLE.getStatus()); return success(SeckillConfigConvert.INSTANCE.convertList1(list)); } @GetMapping("/page") - @Operation(summary = "获得秒杀活动分页") + @Operation(summary = "获得秒杀时间段分页") @PreAuthorize("@ss.hasPermission('promotion:seckill-config:query')") public CommonResult> getSeckillActivityPage(@Valid SeckillConfigPageReqVO pageVO) { PageResult pageResult = seckillConfigService.getSeckillConfigPage(pageVO); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java index 537350aed..2232ead7b 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java @@ -35,7 +35,7 @@ public class AppBargainActivityController { activity1.setId(1L); activity1.setName("618 大砍价"); activity1.setSpuId(2048L); - activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity1.setMarketPrice(50); activity1.setBargainPrice(100); activity1.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2))); @@ -47,7 +47,7 @@ public class AppBargainActivityController { activity2.setId(2L); activity2.setName("双十一砍价"); activity2.setSpuId(4096L); - activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); activity2.setMarketPrice(100); activity2.setBargainPrice(200); activity2.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2))); @@ -69,7 +69,7 @@ public class AppBargainActivityController { activity1.setId(1L); activity1.setName("618 大砍价"); activity1.setSpuId(2048L); - activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity1.setMarketPrice(50); activity1.setBargainPrice(100); activityList.add(activity1); @@ -78,7 +78,7 @@ public class AppBargainActivityController { activity2.setId(2L); activity2.setName("双十一砍价"); activity2.setSpuId(4096L); - activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); activity2.setMarketPrice(100); activity2.setBargainPrice(200); activityList.add(activity2); @@ -94,7 +94,7 @@ public class AppBargainActivityController { activity.setId(2L); activity.setName("618 大砍价"); activity.setSpuId(2048L); - activity.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity.setMarketPrice(50); activity.setBargainPrice(100); activity.setStock(10); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java index 0df8db49a..bb2bf584f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java @@ -81,7 +81,7 @@ public class AppBargainRecordController { record1.setPrice(200); record1.setPayPrice(180); record1.setStatus(1); - record1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); record1.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); page.getList().add(record1); @@ -96,7 +96,7 @@ public class AppBargainRecordController { record2.setPrice(200); record2.setPayPrice(280); record2.setStatus(2); - record2.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record2.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); record2.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); page.getList().add(record2); @@ -111,7 +111,7 @@ public class AppBargainRecordController { record3.setPrice(200); record3.setPayPrice(380); record3.setStatus(2); - record3.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record3.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); record3.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); record3.setOrderId(100L); page.getList().add(record3); @@ -127,7 +127,7 @@ public class AppBargainRecordController { record4.setPrice(200); record4.setPayPrice(380); record4.setStatus(3); - record4.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record4.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); record4.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); record4.setOrderId(100L); page.getList().add(record4); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java index 216ec5285..75693f90b 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java @@ -38,7 +38,7 @@ public class AppCombinationActivityController { activity1.setName("618 大拼团"); activity1.setUserSize(3); activity1.setSpuId(2048L); - activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity1.setMarketPrice(50); activity1.setCombinationPrice(100); activityList.add(activity1); @@ -48,7 +48,7 @@ public class AppCombinationActivityController { activity2.setName("双十一拼团"); activity2.setUserSize(5); activity2.setSpuId(4096L); - activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); activity2.setMarketPrice(100); activity2.setCombinationPrice(200); activityList.add(activity2); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java index 74cd39c5a..7496e2e0e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java @@ -41,7 +41,7 @@ public class AppCombinationRecordController { summary.getAvatars().add("https://thirdwx.qlogo.cn/mmopen/vi_32/ouwtwJycbic2JrCoZjETict0klxd1uRuicRneKk00ewMcCClxVcVHQT91Sh9MJGtwibf1fOicD1WpwSP4icJM6eQq1AA/132"); summary.getAvatars().add("https://thirdwx.qlogo.cn/mmopen/vi_32/RpUrhwens58qc99OcGs993xL4M5QPOe05ekqF9Eia440kRicAlicicIdQWicHBmy2bzLgHzHguWEzHHxnIgeictL7bLA/132"); summary.getAvatars().add("https://thirdwx.qlogo.cn/mmopen/vi_32/S4tfqmxc8GZGsKc1K4mnhpvtG16gtMrLnTQfDibhr7jJich9LRI5RQKZDoqEjZM3azMib5nic7F4ZXKMEgYyLO08KA/132"); - summary.getAvatars().add("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + summary.getAvatars().add("https://static.iocoder.cn/mall/132.jpeg"); return success(summary); } @@ -61,7 +61,7 @@ public class AppCombinationRecordController { record.setExpireTime(new Date()); record.setUserSize(10); record.setUserCount(i); - record.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); record.setActivityId(1L); record.setSpuName("活动:" + i); list.add(record); @@ -84,7 +84,7 @@ public class AppCombinationRecordController { headRecord.setUserCount(3); headRecord.setStatus(1); headRecord.setActivityId(10L); - headRecord.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + headRecord.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); headRecord.setCombinationPrice(100); detail.setHeadRecord(headRecord); // 团员 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java index 7c4fd9ee2..098dfca67 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java @@ -39,7 +39,7 @@ public class AppSeckillActivityController { activity1.setId(1L); activity1.setName("618 大秒杀"); activity1.setSpuId(2048L); - activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity1.setMarketPrice(50); activity1.setSeckillPrice(100); activityList.add(activity1); @@ -48,7 +48,7 @@ public class AppSeckillActivityController { activity2.setId(2L); activity2.setName("双十一大秒杀"); activity2.setSpuId(4096L); - activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); activity2.setMarketPrice(100); activity2.setSeckillPrice(200); activityList.add(activity2); @@ -65,7 +65,7 @@ public class AppSeckillActivityController { activity1.setId(1L); activity1.setName("618 大秒杀"); activity1.setSpuId(2048L); - activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); activity1.setMarketPrice(50); activity1.setSeckillPrice(100); activity1.setUnitName("个"); @@ -77,7 +77,7 @@ public class AppSeckillActivityController { activity2.setId(2L); activity2.setName("双十一大秒杀"); activity2.setSpuId(4096L); - activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); + activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); activity2.setMarketPrice(100); activity2.setSeckillPrice(200); activity2.setUnitName("套"); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java index 23a5aa4bc..d59a365b9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java @@ -25,8 +25,8 @@ public class AppSeckillConfigController { public CommonResult> getSeckillConfigList() { return success(Arrays.asList( new AppSeckillConfigRespVO().setId(1L).setStartTime("00:00").setEndTime("09:59") - .setSliderPicUrls(Arrays.asList("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg", - "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132")), + .setSliderPicUrls(Arrays.asList("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg", + "https://static.iocoder.cn/mall/132.jpeg")), new AppSeckillConfigRespVO().setId(2L).setStartTime("10:00").setEndTime("12:59"), new AppSeckillConfigRespVO().setId(2L).setStartTime("13:00").setEndTime("22:59"), new AppSeckillConfigRespVO().setId(2L).setStartTime("23:00").setEndTime("23:59") diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java index 38bbe18da..6d07cfcdf 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java @@ -16,7 +16,7 @@ public interface SeckillConfigMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(SeckillConfigDO::getName, reqVO.getName()) .eqIfPresent(SeckillConfigDO::getStatus, reqVO.getStatus()) - .orderByDesc(SeckillConfigDO::getId)); + .orderByAsc(SeckillConfigDO::getStartTime)); } default List selectListByStatus(Integer status) { diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java index b8cae96ff..ed89d0a50 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java @@ -11,7 +11,6 @@ import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.module.member.controller.app.auth.vo.*; import cn.iocoder.yudao.module.member.convert.auth.AuthConvert; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; -import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.module.member.service.user.MemberUserService; import cn.iocoder.yudao.module.system.api.logger.LoginLogApi; import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO; @@ -60,9 +59,6 @@ public class MemberAuthServiceImpl implements MemberAuthService { @Resource private WxMaService wxMaService; - @Resource - private MemberUserMapper userMapper; - @Override public AppAuthLoginRespVO login(AppAuthLoginReqVO reqVO) { // 使用手机 + 密码,进行登录。 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index ef198f8f9..c5b674cc8 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -168,9 +168,6 @@ public class MemberUserServiceImpl implements MemberUserService { @Override public boolean isPasswordMatch(String rawPassword, String encodedPassword) { - if(true) { - return true; - } return passwordEncoder.matches(rawPassword, encodedPassword); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/wallet/WalletPayClient.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/wallet/WalletPayClient.java index 08cc52654..7e23f5cf7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/wallet/WalletPayClient.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/wallet/WalletPayClient.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.pay.framework.pay.wallet; +import cn.hutool.extra.spring.SpringUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; @@ -7,6 +8,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import lombok.extern.slf4j.Slf4j; @@ -23,30 +25,26 @@ import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeC @Slf4j public class WalletPayClient extends AbstractPayClient { - private PayWalletService payWalletService; + private PayWalletService wallService; - public WalletPayClient(Long channelId, String channelCode, NonePayClientConfig config) { - super(channelId, channelCode, config); - } - - public WalletPayClient(Long channelId, String channelCode, NonePayClientConfig config, - PayWalletService payWalletService) { - this(channelId, channelCode, config); - this.payWalletService = payWalletService; + public WalletPayClient(Long channelId, NonePayClientConfig config) { + super(channelId, PayChannelEnum.WALLET.getCode(), config); } @Override protected void doInit() { - // 钱包支付,无需初始化 + if (wallService == null) { + wallService = SpringUtil.getBean(PayWalletService.class); + } } @Override protected PayOrderRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { try { - PayWalletTransactionDO transaction = payWalletService.pay(reqDTO.getOutTradeNo(), reqDTO.getPrice()); + PayWalletTransactionDO transaction = wallService.pay(reqDTO.getOutTradeNo(), reqDTO.getPrice()); return PayOrderRespDTO.successOf(transaction.getNo(), transaction.getCreator(), transaction.getTransactionTime(), - reqDTO.getOutTradeNo(), "WALLET_PAY_SUCCESS"); // TODO @jason:transaction 作为 traData 好了; + reqDTO.getOutTradeNo(), transaction); } catch (Throwable ex) { log.error("[doUnifiedOrder] 失败", ex); Integer errorCode = INTERNAL_SERVER_ERROR.getCode(); @@ -74,10 +72,10 @@ public class WalletPayClient extends AbstractPayClient { @Override protected PayRefundRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) { try { - PayWalletTransactionDO payWalletTransaction = payWalletService.refund(reqDTO.getOutRefundNo(), + PayWalletTransactionDO payWalletTransaction = wallService.refund(reqDTO.getOutRefundNo(), reqDTO.getRefundPrice(), reqDTO.getReason()); return PayRefundRespDTO.successOf(payWalletTransaction.getNo(), payWalletTransaction.getTransactionTime(), - reqDTO.getOutRefundNo(), "WALLET_REFUND_SUCCESS"); + reqDTO.getOutRefundNo(), payWalletTransaction); } catch (Throwable ex) { log.error("[doUnifiedRefund] 失败", ex); Integer errorCode = INTERNAL_SERVER_ERROR.getCode(); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java index 3504b98cd..37cf1bfc9 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java @@ -8,12 +8,6 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; -import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; -import cn.iocoder.yudao.framework.pay.core.client.impl.mock.MockPayClient; -import cn.iocoder.yudao.framework.pay.core.client.impl.mock.MockPayClientConfig; -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.*; import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; @@ -22,7 +16,6 @@ import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; import cn.iocoder.yudao.module.pay.framework.pay.wallet.WalletPayClient; -import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -64,14 +57,15 @@ public class PayChannelServiceImpl implements PayChannelService { @Resource private Validator validator; - @Resource - private PayWalletService payWalletService; /** * 初始化 {@link #payClientFactory} 缓存 */ @PostConstruct public void initLocalCache() { + // 注册钱包支付 Class + payClientFactory.registerPayClientClass(PayChannelEnum.WALLET, WalletPayClient.class); + // 注意:忽略自动多租户,因为要全局初始化缓存 TenantUtils.executeIgnore(() -> { // 第一步:查询数据 @@ -85,55 +79,13 @@ public class PayChannelServiceImpl implements PayChannelService { log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); } log.info("[initLocalCache][缓存支付渠道,数量为:{}]", channels.size()); - // 第二步:构建缓存:创建或更新支付 Client - channels.forEach(payChannel ->{ - AbstractPayClient payClient = createPayClient(payChannel.getId(), payChannel.getCode(), payChannel.getConfig()); - payClientFactory.addOrUpdatePayClient(payChannel.getId(), payClient); - }); + // 第二步:构建缓存:创建或更新支付 Client + channels.forEach(payChannel -> payClientFactory.createOrUpdatePayClient(payChannel.getId(), + payChannel.getCode(), payChannel.getConfig())); this.channelCache = channels; }); } - @SuppressWarnings("unchecked") - private AbstractPayClient createPayClient( - Long channelId, String channelCode, Config config) { - PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode); - Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelEnum)); - // 创建客户端 - switch (channelEnum) { - // 微信支付 - case WX_PUB: - return (AbstractPayClient) new WxPubPayClient(channelId, (WxPayClientConfig) config); - case WX_LITE: - return (AbstractPayClient) new WxLitePayClient(channelId, (WxPayClientConfig) config); - case WX_APP: - return (AbstractPayClient) new WxAppPayClient(channelId, (WxPayClientConfig) config); - case WX_BAR: - return (AbstractPayClient) new WxBarPayClient(channelId, (WxPayClientConfig) config); - case WX_NATIVE: - return (AbstractPayClient) new WxNativePayClient(channelId, (WxPayClientConfig) config); - // 支付宝支付 - case ALIPAY_WAP: - return (AbstractPayClient) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); - case ALIPAY_QR: - return (AbstractPayClient) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config); - case ALIPAY_APP: - return (AbstractPayClient) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config); - case ALIPAY_PC: - return (AbstractPayClient) new AlipayPcPayClient(channelId, (AlipayPayClientConfig) config); - case ALIPAY_BAR: - return (AbstractPayClient) new AlipayBarPayClient(channelId, (AlipayPayClientConfig) config); - // 其它支付 - case MOCK: - return (AbstractPayClient) new MockPayClient(channelId, (MockPayClientConfig) config); - case WALLET: - return (AbstractPayClient) new WalletPayClient( - channelId, channelCode, (NonePayClientConfig) config, payWalletService); - } - // 创建失败,错误日志 + 抛出异常 - log.error("[createPayClient][配置({}) 找不到合适的客户端实现]", config); - throw new IllegalArgumentException(String.format("配置(%s) 找不到合适的客户端实现", config)); - } /** * 通过定时任务轮询,刷新缓存