From bb93ba7c2ce892077b16968f4dfb080438a0f3cc Mon Sep 17 00:00:00 2001 From: xxm1995 Date: Mon, 18 Mar 2024 23:30:31 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E7=BB=93=E7=AE=97=E5=8F=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=91=E9=97=AA=E4=BB=98=E6=BC=94=E7=A4=BA,=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _doc/Task.md | 7 +- .../daxpay/demo/service/AggregateService.java | 11 +- .../daxpay/sdk/code/AggregatePayEnum.java | 3 +- .../wechat/entity/WeChatPayConfig.java | 7 +- .../service/WeChatPayCallbackService.java | 1 - .../channel/wechat/WeChatPayConfigParam.java | 4 + .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 161 ++++++++++++++++++ 8 files changed, 187 insertions(+), 9 deletions(-) create mode 100644 daxpay-single/daxpay-single-start/src/main/resources/application-prod.yml diff --git a/_doc/Task.md b/_doc/Task.md index 66f6c9be..bbddbe5e 100644 --- a/_doc/Task.md +++ b/_doc/Task.md @@ -1,12 +1,13 @@ 2.0.4: - [ ] 支付流程也改为先落库后支付情况, 避免极端情况导致掉单 -- [ ] 首页驾驶舱功能: 各通道收入和支付情况 +- [x] 首页驾驶舱功能: 各通道收入和支付情况 - [x] 第一排: (数字格式)显示今日收入、支出金额,支付总订单数量、退款总订单数, 时间分支分为: 今日金额/昨日金额/七天内金额 - - [x] 第二排: (折线图)显示各通道支付分为支付金额和退款,时间分为: 今日金额/昨日金额/七天内金额 - - [x] 第三排: (饼图)显示各通道各支付方式数量和占比, 时间分为: 今日金额/昨日金额/七天内金额 + - [x] 第二排: (饼图)显示各通道各支付方式数量和占比, 时间分为: 今日金额/昨日金额/七天内金额 + - [x] 第三排: (折线图)显示各通道支付分为支付金额和退款,时间分为: 今日金额/昨日金额/七天内金额 - [ ] 报表功能 - [ ] 各通道收入和支付情况 - [ ] 微信新增V3版本接口 + - [ ] 付款码回退到V2接口 - [ ] 增加转账功能 - [ ] 云闪付支持对账功能 - [ ] 结算台DEMO增加云闪付示例 diff --git a/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/service/AggregateService.java b/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/service/AggregateService.java index ed0c3c96..bc406180 100644 --- a/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/service/AggregateService.java +++ b/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/service/AggregateService.java @@ -90,11 +90,15 @@ public class AggregateService { // 跳转支付宝中间页 return StrUtil.format("{}/aggregate/alipay?code={}", daxPayDemoProperties.getFrontH5Url(),code); } + // 微信支付 else if (ua.contains(AggregatePayEnum.UA_WECHAT_PAY.getCode())) { // 微信重定向到中间页, 因为微信需要授权后才能发起支付 return this.wxJsapiAuthPage(code); } - else { + // 云闪付 + else if (ua.contains(AggregatePayEnum.UA_UNION_PAY.getCode())) { + return StrUtil.format("{}/aggregate/wechatPay?code={}", daxPayDemoProperties.getFrontH5Url(),code); + } else { // 跳转到异常页 return StrUtil.format("{}/result/error?msg={}", daxPayDemoProperties.getFrontH5Url(), URLEncodeUtil.encode("请使用微信或支付宝扫码支付")); } @@ -247,6 +251,7 @@ public class AggregateService { } String[] wx = { "10", "11", "12", "13", "14", "15" }; String[] ali = { "25", "26", "27", "28", "29", "30" }; + String[] union = { "62" }; // 微信 if (StrUtil.startWithAny(authCode.substring(0, 2), wx)) { @@ -256,6 +261,10 @@ public class AggregateService { else if (StrUtil.startWithAny(authCode.substring(0, 2), ali)) { return PayChannelEnum.ALI; } + // 云闪付 + else if (StrUtil.startWithAny(authCode.substring(0, 2), union)) { + return PayChannelEnum.UNION_PAY; + } else { throw new BizException("不支持的支付方式"); } diff --git a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/code/AggregatePayEnum.java b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/code/AggregatePayEnum.java index c2ddb8c7..c05e4250 100644 --- a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/code/AggregatePayEnum.java +++ b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/code/AggregatePayEnum.java @@ -13,7 +13,8 @@ import lombok.Getter; public enum AggregatePayEnum { UA_ALI_PAY("Alipay", "支付宝"), - UA_WECHAT_PAY("MicroMessenger", "微信支付"); + UA_WECHAT_PAY("MicroMessenger", "微信支付"), + UA_UNION_PAY("CloudPay", "云闪付"); /** 支付渠道字符编码 */ private final String code; diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayConfig.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayConfig.java index b1f32303..23a2429e 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayConfig.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayConfig.java @@ -5,6 +5,7 @@ import cn.bootx.platform.common.core.annotation.EncryptionField; import cn.bootx.platform.common.core.function.EntityBaseFunction; import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity; import cn.bootx.platform.common.mybatisplus.handler.StringListTypeHandler; +import cn.bootx.platform.daxpay.service.code.WeChatPayCode; import cn.bootx.platform.daxpay.service.core.channel.wechat.convert.WeChatConvert; import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayConfigDto; import cn.bootx.table.modify.annotation.DbColumn; @@ -63,11 +64,13 @@ public class WeChatPayConfig extends MpBaseEntity implements EntityBaseFunction< @DbColumn(comment = "同步通知路径") private String returnUrl; - /** 接口版本, 使用v2还是v3接口 */ + /** + * 接口版本, 使用v2还是v3接口 + * @see WeChatPayCode#API_V2 + */ @DbColumn(comment = "接口版本") private String apiVersion; - /** 商户平台「API安全」中的 APIv2 密钥 */ @TableField(updateStrategy = FieldStrategy.ALWAYS) @BigField diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayCallbackService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayCallbackService.java index 34534224..0fba7715 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayCallbackService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayCallbackService.java @@ -38,7 +38,6 @@ public class WeChatPayCallbackService extends AbsCallbackStrategy { @Resource private WeChatPayConfigService weChatPayConfigService; - /** * 策略标识 */ diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayConfigParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayConfigParam.java index f9c1a1d2..69f55dab 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayConfigParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayConfigParam.java @@ -35,6 +35,10 @@ public class WeChatPayConfigParam { @Schema(description ="同步通知地址") private String returnUrl; + /** 接口版本, 使用v2还是v3接口 */ + @Schema(description = "接口版本") + private String apiVersion; + @Schema(description = "商户平台「API安全」中的 APIv2 密钥") private String apiKeyV2; diff --git a/daxpay-single/daxpay-single-start/src/main/resources/application-dev.yml b/daxpay-single/daxpay-single-start/src/main/resources/application-dev.yml index 26636ab5..76d7e30e 100644 --- a/daxpay-single/daxpay-single-start/src/main/resources/application-dev.yml +++ b/daxpay-single/daxpay-single-start/src/main/resources/application-dev.yml @@ -133,7 +133,7 @@ bootx: # 文件上传 file-upload: server-url: http://127.0.0.1:9000 -# 自动建表 +# 自动建表 生产环境关闭 table-modify: update-type: update database-type: mysql diff --git a/daxpay-single/daxpay-single-start/src/main/resources/application-prod.yml b/daxpay-single/daxpay-single-start/src/main/resources/application-prod.yml new file mode 100644 index 00000000..dacc8b74 --- /dev/null +++ b/daxpay-single/daxpay-single-start/src/main/resources/application-prod.yml @@ -0,0 +1,161 @@ +server: + port: 9000 +spring: + datasource: + dynamic: + primary: master + datasource: + # 默认数据源 + master: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/dax-pay?serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&useSSL=false&nullCatalogMeansCurrent=true + username: root + password: root + hikari: + # 30 秒, 心跳检测 + keepalive-time: 30000 + # 300 分钟, 连接最大存活时间 + max-lifetime: 18000000 + redis: + host: 127.0.0.1 + port: 6379 + database: 1 + lettuce: + cluster: + refresh: + # 自适应拓扑刷新 + adaptive: true + # 群集拓扑刷新周期 + period: 60s + #静态资源加载配置 + mvc: + static-path-pattern: /** + web: + resources: + static-locations: classpath:/static/,classpath:/public/ + thymeleaf: + cache: false + # 定时任务 + quartz: + # 持久化方式 + job-store-type: jdbc + #定时任务启动开关,true-开 false-关 + auto-startup: true + #启动时更新己存在的Job + overwrite-existing-jobs: true + properties: + org: + quartz: + scheduler: + instanceName: quartzScheduler + instanceId: AUTO + threadPool: + threadCount: 10 + threadPriority: 5 + threadsInheritContextClassLoaderOfInitializingThread: true +knife4j: + # 开启增强配置 + enable: true + # 开启生产环境屏蔽 + production: true +# 项目配置 +bootx: + common: + # 接口文档 + swagger: + enabled: false + author: bootx + version: 2.0.3 + title: 开源支付平台-单商户 + description: 开源支付平台-单商户版 + # 缓存 + cache: + # 默认超时时间 30分钟 + default-ttl: 1800 + # 序列生成器 + sequence: + # 生成方式 + type: jdbc + # 序列生成器起始值 + range-start: 1 + # 序列生成器区间, 设置1每次都会操作数据库 + range-step: 1 + # 步长 + step: 1 + # 异常 + exception: + # 显示详细异常 + show-full-message: true + starter: + # 认证 + auth: + default-password: 123456 + # 关闭超级管理员登录 + enable-admin: false + ignore-urls: + - '/actuator/**' + - '/v3/api-docs/**' + - '/doc.html' + - '/swagger-resources/**' + - '/token/**' + - '/ws/**' + - '/demo/**' + - '/test/**' + - '/webjars/**' + - '/front/**' + - '/h5/**' + - '/css/**' + - '/error' + - '/favicon.ico' + # 审计日志 + audit-log: + # 审计日志存储 + store: jdbc + # ip归属地 + ip2region: + # 数据文件路径 + file-path: /data/ip2region/ip2region.xdb + # 查询方式 + search-type: cache + # 数据权限 + data-perm: + # 需要符合AES密钥的要求 + field-decrypt-key: "UCrtxSCwYZNCIlav" + # 文件上传 + file-upload: + server-url: http://127.0.0.1:9000 +# 自动建表 生产环境关闭 +table-modify: + update-type: none +dromara: + #文件存储配置, + x-file-storage: + #默认使用的存储平台 + default-platform: local + #缩略图后缀,例如【.min.jpg】【.png】 + thumbnail-suffix: ".min.jpg" + local-plus: + # 不启用自带的访问映射, 使用自定义的访问实现 + # 存储平台标识 + - platform: local + enableStorage: true + # 文件存储路径 + storage-path: D:/data/files/ +# 支付系统配置 +dax-pay: + # 服务地址 + server-url: http://pay1.bootx.cn + # 前端h5地址 + front-h5-url: http://pay1.bootx.cn/h5/# + # 前端web地址 + front-web-url: http://pay1.bootx.cn/# + # 演示模块 + demo: + # 网关地址 + server-url: http://pay1.bootx.cn/server + # 前端h5地址 + front-h5-url: http://pay1.bootx.cn/h5/# + # 签名秘钥 + sign-secret: 123456 + # 签名方式 + sign-type: hmac_sha256