Commit d45213fe2a4ba290be3c27c9d4bf55cc3e3d2740
1 parent
b757e1fc
多模块重构 7:pay 模块的重构完成
Showing
21 changed files
with
271 additions
and
148 deletions
pom.xml
| @@ -10,9 +10,10 @@ | @@ -10,9 +10,10 @@ | ||
| 10 | <modules> | 10 | <modules> |
| 11 | <module>yudao-dependencies</module> | 11 | <module>yudao-dependencies</module> |
| 12 | <module>yudao-framework</module> | 12 | <module>yudao-framework</module> |
| 13 | + | ||
| 13 | <module>yudao-admin-server</module> | 14 | <module>yudao-admin-server</module> |
| 14 | <module>yudao-user-server</module> | 15 | <module>yudao-user-server</module> |
| 15 | - <module>yudao-core-service</module> | 16 | + |
| 16 | <module>yudao-module-member</module> | 17 | <module>yudao-module-member</module> |
| 17 | <!-- <module>yudao-module-bpm</module>--> | 18 | <!-- <module>yudao-module-bpm</module>--> |
| 18 | <module>yudao-module-system</module> | 19 | <module>yudao-module-system</module> |
yudao-core-service/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | - <parent> | ||
| 6 | - <groupId>cn.iocoder.boot</groupId> | ||
| 7 | - <artifactId>yudao</artifactId> | ||
| 8 | - <version>${revision}</version> | ||
| 9 | - </parent> | ||
| 10 | - <modelVersion>4.0.0</modelVersion> | ||
| 11 | - | ||
| 12 | - <artifactId>yudao-core-service</artifactId> | ||
| 13 | - <packaging>jar</packaging> | ||
| 14 | - | ||
| 15 | - <name>yudao-core-service</name> | ||
| 16 | - <description> | ||
| 17 | - 公共服务,通过 jar 包的方式,被 yudao-admin-server、yudao-user-service 使用。例如说: | ||
| 18 | - 1. 日志相关:访问日志、登录日志、异常日志等等 | ||
| 19 | - 2. 认证相关:在线 Session | ||
| 20 | - 3. 短信相关:短信模板、短信日志 | ||
| 21 | - 等等 | ||
| 22 | - </description> | ||
| 23 | - <url>https://github.com/YunaiV/ruoyi-vue-pro</url> | ||
| 24 | - | ||
| 25 | - <dependencies> | ||
| 26 | - <!-- 业务组件 --> | ||
| 27 | - <dependency> | ||
| 28 | - <groupId>cn.iocoder.boot</groupId> | ||
| 29 | - <artifactId>yudao-spring-boot-starter-biz-dict</artifactId> | ||
| 30 | - </dependency> | ||
| 31 | - <dependency> | ||
| 32 | - <groupId>cn.iocoder.boot</groupId> | ||
| 33 | - <artifactId>yudao-spring-boot-starter-biz-sms</artifactId> | ||
| 34 | - </dependency> | ||
| 35 | - <dependency> | ||
| 36 | - <groupId>cn.iocoder.boot</groupId> | ||
| 37 | - <artifactId>yudao-spring-boot-starter-biz-pay</artifactId> | ||
| 38 | - </dependency> | ||
| 39 | - <dependency> | ||
| 40 | - <groupId>cn.iocoder.boot</groupId> | ||
| 41 | - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | ||
| 42 | - </dependency> | ||
| 43 | - | ||
| 44 | - <!-- Web 相关 --> | ||
| 45 | - <dependency> | ||
| 46 | - <groupId>cn.iocoder.boot</groupId> | ||
| 47 | - <artifactId>yudao-spring-boot-starter-web</artifactId> | ||
| 48 | - </dependency> | ||
| 49 | - <!-- spring boot 配置所需依赖 --> | ||
| 50 | - <dependency> | ||
| 51 | - <groupId>org.springframework.boot</groupId> | ||
| 52 | - <artifactId>spring-boot-configuration-processor</artifactId> | ||
| 53 | - <optional>true</optional> | ||
| 54 | - </dependency> | ||
| 55 | - | ||
| 56 | - <dependency> | ||
| 57 | - <groupId>cn.iocoder.boot</groupId> | ||
| 58 | - <artifactId>yudao-spring-boot-starter-security</artifactId> | ||
| 59 | - </dependency> | ||
| 60 | - | ||
| 61 | - <!-- DB 相关 --> | ||
| 62 | - <dependency> | ||
| 63 | - <groupId>cn.iocoder.boot</groupId> | ||
| 64 | - <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | ||
| 65 | - </dependency> | ||
| 66 | - | ||
| 67 | - <dependency> | ||
| 68 | - <groupId>cn.iocoder.boot</groupId> | ||
| 69 | - <artifactId>yudao-spring-boot-starter-redis</artifactId> | ||
| 70 | - </dependency> | ||
| 71 | - | ||
| 72 | - <!-- Config 配置中心相关 --> | ||
| 73 | - <dependency> | ||
| 74 | - <groupId>cn.iocoder.boot</groupId> | ||
| 75 | - <artifactId>yudao-spring-boot-starter-config</artifactId> | ||
| 76 | - </dependency> | ||
| 77 | - | ||
| 78 | - <!-- 消息队列相关 --> | ||
| 79 | - <dependency> | ||
| 80 | - <groupId>cn.iocoder.boot</groupId> | ||
| 81 | - <artifactId>yudao-spring-boot-starter-mq</artifactId> | ||
| 82 | - </dependency> | ||
| 83 | - | ||
| 84 | - <!-- 服务保障相关 --> | ||
| 85 | - <dependency> | ||
| 86 | - <groupId>cn.iocoder.boot</groupId> | ||
| 87 | - <artifactId>yudao-spring-boot-starter-protection</artifactId> | ||
| 88 | - </dependency> | ||
| 89 | - | ||
| 90 | - <!-- Test 测试相关 --> | ||
| 91 | - <dependency> | ||
| 92 | - <groupId>cn.iocoder.boot</groupId> | ||
| 93 | - <artifactId>yudao-spring-boot-starter-test</artifactId> | ||
| 94 | - <scope>test</scope> | ||
| 95 | - </dependency> | ||
| 96 | - | ||
| 97 | - <!-- 工具类相关 --> | ||
| 98 | - | ||
| 99 | - <dependency> | ||
| 100 | - <groupId>com.google.guava</groupId> | ||
| 101 | - <artifactId>guava</artifactId> | ||
| 102 | - </dependency> | ||
| 103 | - | ||
| 104 | - </dependencies> | ||
| 105 | - | ||
| 106 | -</project> |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/modules/pay/service/package-info.java deleted
| 1 | -package cn.iocoder.yudao.coreservice.modules.pay.service; |
yudao-module-bpm/yudao-module-bpm-activiti/src/test/resources/sql/create_tables.sql
| 1 | --- bpm 开头的 DB | ||
| 2 | - | ||
| 3 | CREATE TABLE IF NOT EXISTS "bpm_form" ( | 1 | CREATE TABLE IF NOT EXISTS "bpm_form" ( |
| 4 | "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | 2 | "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, |
| 5 | "name" varchar(63) NOT NULL, | 3 | "name" varchar(63) NOT NULL, |
| @@ -13,4 +11,18 @@ CREATE TABLE IF NOT EXISTS "bpm_form" ( | @@ -13,4 +11,18 @@ CREATE TABLE IF NOT EXISTS "bpm_form" ( | ||
| 13 | "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | 11 | "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 14 | "deleted" bit NOT NULL DEFAULT FALSE, | 12 | "deleted" bit NOT NULL DEFAULT FALSE, |
| 15 | PRIMARY KEY ("id") | 13 | PRIMARY KEY ("id") |
| 16 | -) COMMENT '动态表单'; | 14 | + ) COMMENT '动态表单'; |
| 15 | + | ||
| 16 | +CREATE TABLE IF NOT EXISTS "bpm_user_group" ( | ||
| 17 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 18 | + "name" varchar(63) NOT NULL, | ||
| 19 | + "description" varchar(255) NOT NULL, | ||
| 20 | + "status" tinyint NOT NULL, | ||
| 21 | + "member_user_ids" varchar(255) NOT NULL, | ||
| 22 | + "creator" varchar(64) DEFAULT '', | ||
| 23 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 24 | + "updater" varchar(64) DEFAULT '', | ||
| 25 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 26 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 27 | + PRIMARY KEY ("id") | ||
| 28 | + ) COMMENT '用户组'; |
yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml
| @@ -48,3 +48,7 @@ yudao: | @@ -48,3 +48,7 @@ yudao: | ||
| 48 | base-package2: cn.iocoder.yudao.module | 48 | base-package2: cn.iocoder.yudao.module |
| 49 | core-service: | 49 | core-service: |
| 50 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 | 50 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 |
| 51 | + pay: | ||
| 52 | + pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify | ||
| 53 | + pay-return-url: http://niubi.natapp1.cc/api/pay/order/return | ||
| 54 | + refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayChannelDOTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java
| 1 | -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant; | 1 | +package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | 4 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayChannelCoreMapperTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java
| 1 | -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.merchant; | 1 | +package cn.iocoder.yudao.module.pay.dal.mysql.merchant; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.IoUtil; | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.BaseDbAndRedisIntegrationTest; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; | 4 | +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; |
| 6 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 8 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; |
| 9 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 9 | +import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; | ||
| 10 | import org.junit.jupiter.api.Test; | 10 | import org.junit.jupiter.api.Test; |
| 11 | 11 | ||
| 12 | import javax.annotation.Resource; | 12 | import javax.annotation.Resource; |
| @@ -15,10 +15,10 @@ import java.io.FileNotFoundException; | @@ -15,10 +15,10 @@ import java.io.FileNotFoundException; | ||
| 15 | import java.util.List; | 15 | import java.util.List; |
| 16 | 16 | ||
| 17 | @Resource | 17 | @Resource |
| 18 | -public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | 18 | +public class PayChannelMapperIntegrationTest extends BaseDbIntegrationTest { |
| 19 | 19 | ||
| 20 | @Resource | 20 | @Resource |
| 21 | - private PayChannelCoreMapper payChannelCoreMapper; | 21 | + private PayChannelMapper payChannelMapper; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * 插入 {@link PayChannelEnum#WX_PUB} 初始配置 | 24 | * 插入 {@link PayChannelEnum#WX_PUB} 初始配置 |
| @@ -42,7 +42,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | @@ -42,7 +42,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | ||
| 42 | config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase"); | 42 | config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase"); |
| 43 | payChannelDO.setConfig(config); | 43 | payChannelDO.setConfig(config); |
| 44 | // 执行插入 | 44 | // 执行插入 |
| 45 | - payChannelCoreMapper.insert(payChannelDO); | 45 | + payChannelMapper.insert(payChannelDO); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | // TODO @ouyang:Zfb 改成 AlipayQr | 48 | // TODO @ouyang:Zfb 改成 AlipayQr |
| @@ -67,7 +67,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | @@ -67,7 +67,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | ||
| 67 | // 创建客户端 | 67 | // 创建客户端 |
| 68 | payChannelDO.setConfig(config); | 68 | payChannelDO.setConfig(config); |
| 69 | // 执行插入 | 69 | // 执行插入 |
| 70 | - payChannelCoreMapper.insert(payChannelDO); | 70 | + payChannelMapper.insert(payChannelDO); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| @@ -75,7 +75,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | @@ -75,7 +75,7 @@ public class PayChannelCoreMapperTest extends BaseDbAndRedisIntegrationTest { | ||
| 75 | */ | 75 | */ |
| 76 | @Test | 76 | @Test |
| 77 | public void testSelectList() { | 77 | public void testSelectList() { |
| 78 | - List<PayChannelDO> payChannels = payChannelCoreMapper.selectList(); | 78 | + List<PayChannelDO> payChannels = payChannelMapper.selectList(); |
| 79 | System.out.println(payChannels.size()); | 79 | System.out.println(payChannels.size()); |
| 80 | } | 80 | } |
| 81 | 81 |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayOrderCoreServiceTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceIntegrationTest.java
| 1 | -package cn.iocoder.yudao.coreservice.modules.pay.service.order; | 1 | +package cn.iocoder.yudao.module.pay.service.order; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.BaseDbIntegrationTest; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.impl.PayAppCoreServiceImpl; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.impl.PayChannelCoreServiceImpl; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; | ||
| 8 | -import cn.iocoder.yudao.coreservice.modules.pay.service.order.impl.PayOrderCoreServiceImpl; | 3 | +import cn.iocoder.yudao.module.pay.service.merchant.PayAppServiceImpl; |
| 4 | +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelServiceImpl; | ||
| 5 | +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderCreateReqDTO; | ||
| 6 | +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; | ||
| 7 | +import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; | ||
| 9 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 8 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 10 | import cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration; | 9 | import cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration; |
| 11 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 10 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| @@ -15,12 +14,12 @@ import org.springframework.context.annotation.Import; | @@ -15,12 +14,12 @@ import org.springframework.context.annotation.Import; | ||
| 15 | import javax.annotation.Resource; | 14 | import javax.annotation.Resource; |
| 16 | import java.time.Duration; | 15 | import java.time.Duration; |
| 17 | 16 | ||
| 18 | -@Import({PayOrderCoreServiceImpl.class, PayAppCoreServiceImpl.class, | ||
| 19 | - PayChannelCoreServiceImpl.class, YudaoPayAutoConfiguration.class}) | ||
| 20 | -public class PayOrderCoreServiceTest extends BaseDbIntegrationTest { | 17 | +@Import({PayOrderServiceImpl.class, PayAppServiceImpl.class, |
| 18 | + PayChannelServiceImpl.class, YudaoPayAutoConfiguration.class}) | ||
| 19 | +public class PayOrderServiceIntegrationTest extends BaseDbIntegrationTest { | ||
| 21 | 20 | ||
| 22 | @Resource | 21 | @Resource |
| 23 | - private PayOrderCoreService payOrderCoreService; | 22 | + private PayOrderService payOrderService; |
| 24 | 23 | ||
| 25 | @Test | 24 | @Test |
| 26 | public void testCreatePayOrder() { | 25 | public void testCreatePayOrder() { |
| @@ -34,7 +33,7 @@ public class PayOrderCoreServiceTest extends BaseDbIntegrationTest { | @@ -34,7 +33,7 @@ public class PayOrderCoreServiceTest extends BaseDbIntegrationTest { | ||
| 34 | reqDTO.setAmount(100); | 33 | reqDTO.setAmount(100); |
| 35 | reqDTO.setExpireTime(DateUtils.addTime(Duration.ofDays(1))); | 34 | reqDTO.setExpireTime(DateUtils.addTime(Duration.ofDays(1))); |
| 36 | // 发起请求 | 35 | // 发起请求 |
| 37 | - payOrderCoreService.createPayOrder(reqDTO); | 36 | + payOrderService.createPayOrder(reqDTO); |
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | @Test | 39 | @Test |
| @@ -46,7 +45,7 @@ public class PayOrderCoreServiceTest extends BaseDbIntegrationTest { | @@ -46,7 +45,7 @@ public class PayOrderCoreServiceTest extends BaseDbIntegrationTest { | ||
| 46 | reqDTO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); | 45 | reqDTO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); |
| 47 | reqDTO.setUserIp("127.0.0.1"); | 46 | reqDTO.setUserIp("127.0.0.1"); |
| 48 | // 发起请求 | 47 | // 发起请求 |
| 49 | - payOrderCoreService.submitPayOrder(reqDTO); | 48 | + payOrderService.submitPayOrder(reqDTO); |
| 50 | } | 49 | } |
| 51 | 50 | ||
| 52 | } | 51 | } |
yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/service/package-info.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.service; |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisIntegrationTest.java
| 1 | -package cn.iocoder.yudao.coreservice; | 1 | +package cn.iocoder.yudao.module.pay.test; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; | 3 | import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; |
| 4 | import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; | 4 | import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/BaseDbIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbIntegrationTest.java
| 1 | -package cn.iocoder.yudao.coreservice; | 1 | +package cn.iocoder.yudao.module.pay.test; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; | 3 | import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; |
| 4 | import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; | 4 | import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; |
yudao-core-service/src/test-integration/java/cn/iocoder/yudao/coreservice/BaseRedisIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseRedisIntegrationTest.java
| 1 | -package cn.iocoder.yudao.coreservice; | 1 | +package cn.iocoder.yudao.module.pay.test; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | 3 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; |
| 4 | import org.redisson.spring.starter.RedissonAutoConfiguration; | 4 | import org.redisson.spring.starter.RedissonAutoConfiguration; |
yudao-core-service/src/test-integration/resources/application-integration-test.yaml renamed to yudao-module-pay/yudao-module-pay-impl/src/test-integration/resources/application-integration-test.yaml
| @@ -88,6 +88,7 @@ yudao: | @@ -88,6 +88,7 @@ yudao: | ||
| 88 | info: | 88 | info: |
| 89 | version: 1.0.0 | 89 | version: 1.0.0 |
| 90 | base-package: cn.iocoder.yudao.adminserver | 90 | base-package: cn.iocoder.yudao.adminserver |
| 91 | + base-package2: cn.iocoder.yudao.module | ||
| 91 | core-service: | 92 | core-service: |
| 92 | base-package: cn.iocoder.yudao.coreservice | 93 | base-package: cn.iocoder.yudao.coreservice |
| 93 | pay: | 94 | pay: |
yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceTest.java
| 1 | package cn.iocoder.yudao.module.pay.service.merchant; | 1 | package cn.iocoder.yudao.module.pay.service.merchant; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.RandomUtil; | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppCreateReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; |
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; |
| @@ -30,11 +31,6 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | @@ -30,11 +31,6 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 30 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; | 31 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; |
| 31 | import static org.junit.jupiter.api.Assertions.*; | 32 | import static org.junit.jupiter.api.Assertions.*; |
| 32 | 33 | ||
| 33 | -/** | ||
| 34 | - * {@link PayAppServiceImpl} 的单元测试类 | ||
| 35 | - * | ||
| 36 | - * @author 芋艿 | ||
| 37 | - */ | ||
| 38 | @Import(PayAppServiceImpl.class) | 34 | @Import(PayAppServiceImpl.class) |
| 39 | public class PayAppServiceTest extends BaseDbUnitTest { | 35 | public class PayAppServiceTest extends BaseDbUnitTest { |
| 40 | 36 |
yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceTest.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.merchant; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.merchant; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | ||
| 5 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; |
| 7 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| @@ -14,9 +15,11 @@ import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayChannelMapper; | @@ -14,9 +15,11 @@ import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayChannelMapper; | ||
| 14 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; | 15 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; |
| 15 | import com.alibaba.fastjson.JSON; | 16 | import com.alibaba.fastjson.JSON; |
| 16 | import org.junit.jupiter.api.Test; | 17 | import org.junit.jupiter.api.Test; |
| 18 | +import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 17 | import org.springframework.context.annotation.Import; | 19 | import org.springframework.context.annotation.Import; |
| 18 | 20 | ||
| 19 | import javax.annotation.Resource; | 21 | import javax.annotation.Resource; |
| 22 | +import javax.validation.Validator; | ||
| 20 | import java.util.List; | 23 | import java.util.List; |
| 21 | 24 | ||
| 22 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | 25 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| @@ -37,6 +40,11 @@ public class PayChannelServiceTest extends BaseDbUnitTest { | @@ -37,6 +40,11 @@ public class PayChannelServiceTest extends BaseDbUnitTest { | ||
| 37 | @Resource | 40 | @Resource |
| 38 | private PayChannelMapper channelMapper; | 41 | private PayChannelMapper channelMapper; |
| 39 | 42 | ||
| 43 | + @MockBean | ||
| 44 | + private PayClientFactory payClientFactory; | ||
| 45 | + @MockBean | ||
| 46 | + private Validator validator; | ||
| 47 | + | ||
| 40 | @Test | 48 | @Test |
| 41 | public void testCreateWechatVersion2Channel_success() { | 49 | public void testCreateWechatVersion2Channel_success() { |
| 42 | // 准备参数 | 50 | // 准备参数 |
yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
| @@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil; | @@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil; | ||
| 4 | import cn.hutool.core.util.RandomUtil; | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 6 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 7 | +import cn.iocoder.yudao.framework.pay.config.PayProperties; | ||
| 8 | +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | ||
| 7 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 9 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 8 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; | 10 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| 9 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; | 11 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; |
| @@ -12,8 +14,12 @@ import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; | @@ -12,8 +14,12 @@ import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; | ||
| 12 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; | 14 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; |
| 13 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | 15 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 14 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; | 16 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; |
| 17 | +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; | ||
| 18 | +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; | ||
| 19 | +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; | ||
| 15 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; | 20 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; |
| 16 | import org.junit.jupiter.api.Test; | 21 | import org.junit.jupiter.api.Test; |
| 22 | +import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 17 | import org.springframework.context.annotation.Import; | 23 | import org.springframework.context.annotation.Import; |
| 18 | 24 | ||
| 19 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
| @@ -30,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | @@ -30,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| 30 | * | 36 | * |
| 31 | * @author 芋艿 | 37 | * @author 芋艿 |
| 32 | */ | 38 | */ |
| 33 | -@Import(PayOrderServiceImpl.class) | 39 | +@Import({PayOrderServiceImpl.class}) |
| 34 | public class PayOrderServiceTest extends BaseDbUnitTest { | 40 | public class PayOrderServiceTest extends BaseDbUnitTest { |
| 35 | 41 | ||
| 36 | @Resource | 42 | @Resource |
| @@ -39,6 +45,17 @@ public class PayOrderServiceTest extends BaseDbUnitTest { | @@ -39,6 +45,17 @@ public class PayOrderServiceTest extends BaseDbUnitTest { | ||
| 39 | @Resource | 45 | @Resource |
| 40 | private PayOrderMapper orderMapper; | 46 | private PayOrderMapper orderMapper; |
| 41 | 47 | ||
| 48 | + @MockBean | ||
| 49 | + private PayClientFactory payClientFactory; | ||
| 50 | + @MockBean | ||
| 51 | + private PayProperties properties; | ||
| 52 | + @MockBean | ||
| 53 | + private PayAppService appService; | ||
| 54 | + @MockBean | ||
| 55 | + private PayChannelService channelService; | ||
| 56 | + @MockBean | ||
| 57 | + private PayNotifyService notifyService; | ||
| 58 | + | ||
| 42 | public String generateNo() { | 59 | public String generateNo() { |
| 43 | return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999); | 60 | return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999); |
| 44 | } | 61 | } |
yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.refund; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.refund; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 4 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 5 | +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | ||
| 5 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 6 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; | 8 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; |
| @@ -10,8 +11,14 @@ import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; | @@ -10,8 +11,14 @@ import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; | ||
| 10 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; | 11 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; |
| 11 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | 12 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; |
| 12 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; | 13 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; |
| 14 | +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; | ||
| 15 | +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; | ||
| 16 | +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; | ||
| 17 | +import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService; | ||
| 18 | +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | ||
| 13 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; | 19 | import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; |
| 14 | import org.junit.jupiter.api.Test; | 20 | import org.junit.jupiter.api.Test; |
| 21 | +import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 15 | import org.springframework.context.annotation.Import; | 22 | import org.springframework.context.annotation.Import; |
| 16 | 23 | ||
| 17 | import javax.annotation.Resource; | 24 | import javax.annotation.Resource; |
| @@ -22,12 +29,6 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | @@ -22,12 +29,6 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | ||
| 22 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 29 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 23 | import static org.junit.jupiter.api.Assertions.assertEquals; | 30 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 24 | 31 | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * {@link PayRefundServiceImpl} 的单元测试类 | ||
| 28 | - * | ||
| 29 | - * @author aquan | ||
| 30 | - */ | ||
| 31 | @Import(PayRefundServiceImpl.class) | 32 | @Import(PayRefundServiceImpl.class) |
| 32 | public class PayRefundServiceTest extends BaseDbUnitTest { | 33 | public class PayRefundServiceTest extends BaseDbUnitTest { |
| 33 | 34 | ||
| @@ -37,6 +38,18 @@ public class PayRefundServiceTest extends BaseDbUnitTest { | @@ -37,6 +38,18 @@ public class PayRefundServiceTest extends BaseDbUnitTest { | ||
| 37 | @Resource | 38 | @Resource |
| 38 | private PayRefundMapper refundMapper; | 39 | private PayRefundMapper refundMapper; |
| 39 | 40 | ||
| 41 | + @MockBean | ||
| 42 | + private PayClientFactory payClientFactory; | ||
| 43 | + @MockBean | ||
| 44 | + private PayOrderService orderService; | ||
| 45 | + @MockBean | ||
| 46 | + private PayOrderExtensionService orderExtensionService; | ||
| 47 | + @MockBean | ||
| 48 | + private PayAppService appService; | ||
| 49 | + @MockBean | ||
| 50 | + private PayChannelService channelService; | ||
| 51 | + @MockBean | ||
| 52 | + private PayNotifyService notifyService; | ||
| 40 | 53 | ||
| 41 | @Test | 54 | @Test |
| 42 | public void testGetRefundPage() { | 55 | public void testGetRefundPage() { |
yudao-module-pay/yudao-module-pay-impl/src/test/resources/application-unit-test.yaml
0 → 100644
| 1 | +spring: | ||
| 2 | + main: | ||
| 3 | + lazy-initialization: true # 开启懒加载,加快速度 | ||
| 4 | + banner-mode: off # 单元测试,禁用 Banner | ||
| 5 | + | ||
| 6 | +--- #################### 数据库相关配置 #################### | ||
| 7 | + | ||
| 8 | +spring: | ||
| 9 | + # 数据源配置项 | ||
| 10 | + datasource: | ||
| 11 | + name: ruoyi-vue-pro | ||
| 12 | + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写 | ||
| 13 | + driver-class-name: org.h2.Driver | ||
| 14 | + username: sa | ||
| 15 | + password: | ||
| 16 | + schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具 | ||
| 17 | + druid: | ||
| 18 | + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 | ||
| 19 | + initial-size: 1 # 单元测试,配置为 1,提升启动速度 | ||
| 20 | + | ||
| 21 | + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | ||
| 22 | + redis: | ||
| 23 | + host: 127.0.0.1 # 地址 | ||
| 24 | + port: 16379 # 端口(单元测试,使用 16379 端口) | ||
| 25 | + database: 0 # 数据库索引 | ||
| 26 | + | ||
| 27 | +mybatis: | ||
| 28 | + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 | ||
| 29 | + | ||
| 30 | +--- #################### 定时任务相关配置 #################### | ||
| 31 | + | ||
| 32 | +--- #################### 配置中心相关配置 #################### | ||
| 33 | + | ||
| 34 | +--- #################### 服务保障相关配置 #################### | ||
| 35 | + | ||
| 36 | +# Lock4j 配置项(单元测试,禁用 Lock4j) | ||
| 37 | + | ||
| 38 | +# Resilience4j 配置项 | ||
| 39 | + | ||
| 40 | +--- #################### 监控相关配置 #################### | ||
| 41 | + | ||
| 42 | +--- #################### 芋道相关配置 #################### | ||
| 43 | + | ||
| 44 | +# 芋道配置项,设置当前项目所有自定义的配置 | ||
| 45 | +yudao: | ||
| 46 | + info: | ||
| 47 | + base-package: cn.iocoder.yudao.module.member.dal.mysql | ||
| 48 | + base-package2: cn.iocoder.yudao.module | ||
| 49 | + core-service: | ||
| 50 | + base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 | ||
| 51 | + captcha: | ||
| 52 | + timeout: 5m | ||
| 53 | + width: 160 | ||
| 54 | + height: 60 |
yudao-module-pay/yudao-module-pay-impl/src/test/resources/logback-spring.xml
0 → 100644
yudao-module-pay/yudao-module-pay-impl/src/test/resources/sql/clean.sql
0 → 100644
yudao-module-pay/yudao-module-pay-impl/src/test/resources/sql/create_tables.sql
0 → 100644
| 1 | +CREATE TABLE IF NOT EXISTS "pay_merchant" | ||
| 2 | +( | ||
| 3 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 4 | + "no" varchar(32) NOT NULL, | ||
| 5 | + "name" varchar(64) NOT NULL, | ||
| 6 | + "short_name" varchar(64) NOT NULL, | ||
| 7 | + "status" tinyint NOT NULL, | ||
| 8 | + "remark" varchar(255) DEFAULT NULL, | ||
| 9 | + "creator" varchar(64) DEFAULT '', | ||
| 10 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 11 | + "updater" varchar(64) DEFAULT '', | ||
| 12 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 13 | + "deleted" bit(1) NOT NULL DEFAULT FALSE, | ||
| 14 | + PRIMARY KEY ("id") | ||
| 15 | +) COMMENT '支付商户信息'; | ||
| 16 | + | ||
| 17 | +CREATE TABLE IF NOT EXISTS "pay_app" ( | ||
| 18 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 19 | + "name" varchar(64) NOT NULL, | ||
| 20 | + "status" tinyint NOT NULL, | ||
| 21 | + "remark" varchar(255) DEFAULT NULL, | ||
| 22 | + `pay_notify_url` varchar(1024) NOT NULL, | ||
| 23 | + `refund_notify_url` varchar(1024) NOT NULL, | ||
| 24 | + `merchant_id` bigint(20) NOT NULL, | ||
| 25 | + "creator" varchar(64) DEFAULT '', | ||
| 26 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 27 | + "updater" varchar(64) DEFAULT '', | ||
| 28 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 29 | + "deleted" bit(1) NOT NULL DEFAULT FALSE, | ||
| 30 | + PRIMARY KEY ("id") | ||
| 31 | +) COMMENT = '支付应用信息'; | ||
| 32 | + | ||
| 33 | +CREATE TABLE IF NOT EXISTS "pay_channel" ( | ||
| 34 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 35 | + "code" varchar(32) NOT NULL, | ||
| 36 | + "status" tinyint(4) NOT NULL, | ||
| 37 | + "remark" varchar(255) DEFAULT NULL, | ||
| 38 | + "fee_rate" double NOT NULL DEFAULT 0, | ||
| 39 | + "merchant_id" bigint(20) NOT NULL, | ||
| 40 | + "app_id" bigint(20) NOT NULL, | ||
| 41 | + "config" varchar(10240) NOT NULL, | ||
| 42 | + "creator" varchar(64) NULL DEFAULT '', | ||
| 43 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 44 | + "updater" varchar(64) NULL DEFAULT '', | ||
| 45 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 46 | + "deleted" bit(1) NOT NULL DEFAULT FALSE, | ||
| 47 | + PRIMARY KEY ("id") | ||
| 48 | +) COMMENT = '支付渠道'; | ||
| 49 | + | ||
| 50 | +CREATE TABLE IF NOT EXISTS `pay_order` ( | ||
| 51 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 52 | + `merchant_id` bigint(20) NOT NULL, | ||
| 53 | + `app_id` bigint(20) NOT NULL, | ||
| 54 | + `channel_id` bigint(20) DEFAULT NULL, | ||
| 55 | + `channel_code` varchar(32) DEFAULT NULL, | ||
| 56 | + `merchant_order_id` varchar(64) NOT NULL, | ||
| 57 | + `subject` varchar(32) NOT NULL, | ||
| 58 | + `body` varchar(128) NOT NULL, | ||
| 59 | + `notify_url` varchar(1024) NOT NULL, | ||
| 60 | + `notify_status` tinyint(4) NOT NULL, | ||
| 61 | + `amount` bigint(20) NOT NULL, | ||
| 62 | + `channel_fee_rate` double DEFAULT 0, | ||
| 63 | + `channel_fee_amount` bigint(20) DEFAULT 0, | ||
| 64 | + `status` tinyint(4) NOT NULL, | ||
| 65 | + `user_ip` varchar(50) NOT NULL, | ||
| 66 | + `expire_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 67 | + `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, | ||
| 68 | + `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, | ||
| 69 | + `success_extension_id` bigint(20) DEFAULT NULL COMMENT '支付成功的订单拓展单编号', | ||
| 70 | + `refund_status` tinyint(4) NOT NULL, | ||
| 71 | + `refund_times` tinyint(4) NOT NULL, | ||
| 72 | + `refund_amount` bigint(20) NOT NULL, | ||
| 73 | + `channel_user_id` varchar(255) DEFAULT NULL, | ||
| 74 | + `channel_order_no` varchar(64) DEFAULT NULL, | ||
| 75 | + `creator` varchar(64) DEFAULT '', | ||
| 76 | + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 77 | + `updater` varchar(64) DEFAULT '', | ||
| 78 | + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 79 | + `deleted` bit(1) NOT NULL DEFAULT FALSE, | ||
| 80 | + PRIMARY KEY ("id") | ||
| 81 | +) COMMENT = '支付订单'; | ||
| 82 | + | ||
| 83 | +CREATE TABLE IF NOT EXISTS `pay_refund` ( | ||
| 84 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 85 | + `merchant_id` bigint(20) NOT NULL, | ||
| 86 | + `app_id` bigint(20) NOT NULL, | ||
| 87 | + `channel_id` bigint(20) NOT NULL, | ||
| 88 | + `channel_code` varchar(32) NOT NULL, | ||
| 89 | + `order_id` bigint(20) NOT NULL, | ||
| 90 | + `trade_no` varchar(64) NOT NULL, | ||
| 91 | + `merchant_order_id` varchar(64) NOT NULL, | ||
| 92 | + `merchant_refund_no` varchar(64) NOT NULL, | ||
| 93 | + `notify_url` varchar(1024) NOT NULL, | ||
| 94 | + `notify_status` tinyint(4) NOT NULL, | ||
| 95 | + `status` tinyint(4) NOT NULL, | ||
| 96 | + `type` tinyint(4) NOT NULL, | ||
| 97 | + `pay_amount` bigint(20) NOT NULL, | ||
| 98 | + `refund_amount` bigint(20) NOT NULL, | ||
| 99 | + `reason` varchar(256) NOT NULL, | ||
| 100 | + `user_ip` varchar(50) NULL DEFAULT NULL, | ||
| 101 | + `channel_order_no` varchar(64) NOT NULL, | ||
| 102 | + `channel_refund_no` varchar(64) NULL DEFAULT NULL, | ||
| 103 | + `channel_error_code` varchar(128) NULL DEFAULT NULL, | ||
| 104 | + `channel_error_msg` varchar(256) NULL DEFAULT NULL, | ||
| 105 | + `channel_extras` varchar(1024) NULL DEFAULT NULL, | ||
| 106 | + `expire_time` datetime(0) NULL DEFAULT NULL, | ||
| 107 | + `success_time` datetime(0) NULL DEFAULT NULL, | ||
| 108 | + `notify_time` datetime(0) NULL DEFAULT NULL, | ||
| 109 | + `creator` varchar(64) NULL DEFAULT '', | ||
| 110 | + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 111 | + `updater` varchar(64) NULL DEFAULT '', | ||
| 112 | + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 113 | + `deleted` bit(1) NOT NULL DEFAULT FALSE, | ||
| 114 | + PRIMARY KEY ("id") | ||
| 115 | +) COMMENT = '退款订单'; |