From 466b6e9149a75e98897e8b5241fcd5841f6ee2de Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 13:37:26 +0800 Subject: [PATCH 1/9] feat: add user id to pay order do --- .../api/order/dto/PayOrderCreateReqDTO.java | 4 + .../pay/dal/dataobject/order/PayOrderDO.java | 22 +- .../service/demo/PayDemoOrderServiceImpl.java | 3 +- .../wallet/PayWalletRechargeServiceImpl.java | 3 +- .../src/test/resources/sql/create_tables.sql | 204 +++++++++--------- 5 files changed, 127 insertions(+), 109 deletions(-) diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java index a960488281..6d4e01271f 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java @@ -28,6 +28,10 @@ public class PayOrderCreateReqDTO implements Serializable { @NotEmpty(message = "用户 IP 不能为空") private String userIp; + + @NotEmpty(message = "用户 Id 不能为空") + private Long userId; + // ========== 商户相关字段 ========== /** diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java index a51b875fd1..6cad230c39 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java @@ -32,19 +32,19 @@ public class PayOrderDO extends BaseDO { private Long id; /** * 应用编号 - * + *

* 关联 {@link PayAppDO#getId()} */ private Long appId; /** * 渠道编号 - * + *

* 关联 {@link PayChannelDO#getId()} */ private Long channelId; /** * 渠道编码 - * + *

* 枚举 {@link PayChannelEnum} */ private String channelCode; @@ -53,7 +53,7 @@ public class PayOrderDO extends BaseDO { /** * 商户订单编号 - * + *

* 例如说,内部系统 A 的订单号,需要保证每个 PayAppDO 唯一 */ private String merchantOrderId; @@ -78,7 +78,7 @@ public class PayOrderDO extends BaseDO { private Integer price; /** * 渠道手续费,单位:百分比 - * + *

* 冗余 {@link PayChannelDO#getFeeRate()} */ private Double channelFeeRate; @@ -88,7 +88,7 @@ public class PayOrderDO extends BaseDO { private Integer channelFeePrice; /** * 支付状态 - * + *

* 枚举 {@link PayOrderStatusEnum} */ private Integer status; @@ -96,6 +96,10 @@ public class PayOrderDO extends BaseDO { * 用户 IP */ private String userIp; + /** + * 用户 IP + */ + private Long userId; /** * 订单失效时间 */ @@ -106,13 +110,13 @@ public class PayOrderDO extends BaseDO { private LocalDateTime successTime; /** * 支付成功的订单拓展单编号 - * + *

* 关联 {@link PayOrderExtensionDO#getId()} */ private Long extensionId; /** * 支付成功的外部订单号 - * + *

* 关联 {@link PayOrderExtensionDO#getNo()} */ private String no; @@ -126,7 +130,7 @@ public class PayOrderDO extends BaseDO { // ========== 渠道相关字段 ========== /** * 渠道用户编号 - * + *

* 例如说,微信 openid、支付宝账号 */ private String channelUserId; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java index 8173905373..76b77396d8 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java @@ -88,7 +88,8 @@ public Long createDemoOrder(Long userId, PayDemoOrderCreateReqVO createReqVO) { // 2.1 创建支付单 Long payOrderId = payOrderApi.createOrder(new PayOrderCreateReqDTO() - .setAppId(PAY_APP_ID).setUserIp(getClientIP()) // 支付应用 + .setAppId(PAY_APP_ID) // 支付应用 + .setUserIp(getClientIP()).setUserId(userId) .setMerchantOrderId(demoOrder.getId().toString()) // 业务的订单编号 .setSubject(spuName).setBody("").setPrice(price) // 价格信息 .setExpireTime(addTime(Duration.ofHours(2L)))); // 支付的过期时间 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java index b263189222..f27a14943a 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java @@ -83,7 +83,8 @@ public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, S // 2.1 创建支付单 Long payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO() - .setAppId(WALLET_PAY_APP_ID).setUserIp(userIp) + .setAppId(WALLET_PAY_APP_ID) + .setUserIp(userIp).setUserId(userId) .setMerchantOrderId(recharge.getId().toString()) // 业务的订单编号 .setSubject(WALLET_RECHARGE_ORDER_SUBJECT).setBody("") .setPrice(recharge.getPayPrice()) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql b/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql index 6ae2ce2d44..ea639ed002 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql @@ -1,9 +1,10 @@ -CREATE TABLE IF NOT EXISTS "pay_app" ( +CREATE TABLE IF NOT EXISTS "pay_app" +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, "name" varchar(64) NOT NULL, "status" tinyint NOT NULL, "remark" varchar(255) DEFAULT NULL, - `order_notify_url` varchar(1024) NOT NULL, + `order_notify_url` varchar(1024) NOT NULL, `refund_notify_url` varchar(1024) NOT NULL, "creator" varchar(64) DEFAULT '', "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -13,7 +14,8 @@ CREATE TABLE IF NOT EXISTS "pay_app" ( PRIMARY KEY ("id") ) COMMENT = '支付应用'; -CREATE TABLE IF NOT EXISTS "pay_channel" ( +CREATE TABLE IF NOT EXISTS "pay_channel" +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, "code" varchar(32) NOT NULL, "status" tinyint(4) NOT NULL, @@ -26,121 +28,127 @@ CREATE TABLE IF NOT EXISTS "pay_channel" ( "updater" varchar(64) NULL DEFAULT '', "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, "deleted" bit(1) NOT NULL DEFAULT FALSE, - "tenant_id" bigint not null default '0', + "tenant_id" bigint not null default '0', PRIMARY KEY ("id") ) COMMENT = '支付渠道'; -CREATE TABLE IF NOT EXISTS `pay_order` ( +CREATE TABLE IF NOT EXISTS `pay_order` +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, - `app_id` bigint(20) NOT NULL, - `channel_id` bigint(20) DEFAULT NULL, - `channel_code` varchar(32) DEFAULT NULL, - `merchant_order_id` varchar(64) NOT NULL, - `subject` varchar(32) NOT NULL, - `body` varchar(128) NOT NULL, - `notify_url` varchar(1024) NOT NULL, - `price` bigint(20) NOT NULL, - `channel_fee_rate` double DEFAULT 0, - `channel_fee_price` bigint(20) DEFAULT 0, - `status` tinyint(4) NOT NULL, - `user_ip` varchar(50) NOT NULL, - `expire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, - `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, - `extension_id` bigint(20) DEFAULT NULL, - `no` varchar(64) NULL, - `refund_price` bigint(20) NOT NULL, - `channel_user_id` varchar(255) DEFAULT NULL, - `channel_order_no` varchar(64) DEFAULT NULL, - `creator` varchar(64) DEFAULT '', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) DEFAULT '', - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, + `app_id` bigint(20) NOT NULL, + `channel_id` bigint(20) DEFAULT NULL, + `channel_code` varchar(32) DEFAULT NULL, + `merchant_order_id` varchar(64) NOT NULL, + `subject` varchar(32) NOT NULL, + `body` varchar(128) NOT NULL, + `notify_url` varchar(1024) NOT NULL, + `price` bigint(20) NOT NULL, + `channel_fee_rate` double DEFAULT 0, + `channel_fee_price` bigint(20) DEFAULT 0, + `status` tinyint(4) NOT NULL, + `user_ip` varchar(50) NOT NULL, + `user_id` bigint(20) NOT NULL, + `expire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, + `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, + `extension_id` bigint(20) DEFAULT NULL, + `no` varchar(64) NULL, + `refund_price` bigint(20) NOT NULL, + `channel_user_id` varchar(255) DEFAULT NULL, + `channel_order_no` varchar(64) DEFAULT NULL, + `creator` varchar(64) DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT = '支付订单'; -CREATE TABLE IF NOT EXISTS `pay_order_extension` ( +CREATE TABLE IF NOT EXISTS `pay_order_extension` +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, - `no` varchar(64) NOT NULL, - `order_id` bigint(20) NOT NULL, - `channel_id` bigint(20) NOT NULL, - `channel_code` varchar(32) NOT NULL, - `user_ip` varchar(50) NULL DEFAULT NULL, - `status` tinyint(4) NOT NULL, - `channel_extras` varchar(1024) NULL DEFAULT NULL, - `channel_error_code` varchar(64) NULL, - `channel_error_msg` varchar(64) NULL, - `channel_notify_data` varchar(1024) NULL, - `creator` varchar(64) NULL DEFAULT '', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) NULL DEFAULT '', - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, + `no` varchar(64) NOT NULL, + `order_id` bigint(20) NOT NULL, + `channel_id` bigint(20) NOT NULL, + `channel_code` varchar(32) NOT NULL, + `user_ip` varchar(50) NULL DEFAULT NULL, + `status` tinyint(4) NOT NULL, + `channel_extras` varchar(1024) NULL DEFAULT NULL, + `channel_error_code` varchar(64) NULL, + `channel_error_msg` varchar(64) NULL, + `channel_notify_data` varchar(1024) NULL, + `creator` varchar(64) NULL DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) NULL DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT = '支付订单拓展'; -CREATE TABLE IF NOT EXISTS `pay_refund` ( +CREATE TABLE IF NOT EXISTS `pay_refund` +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, - `no` varchar(64) NOT NULL, - `app_id` bigint(20) NOT NULL, - `channel_id` bigint(20) NOT NULL, - `channel_code` varchar(32) NOT NULL, - `order_id` bigint(20) NOT NULL, - `order_no` varchar(64) NOT NULL, - `merchant_order_id` varchar(64) NOT NULL, - `merchant_refund_id` varchar(64) NOT NULL, - `notify_url` varchar(1024) NOT NULL, - `status` tinyint(4) NOT NULL, - `pay_price` bigint(20) NOT NULL, - `refund_price` bigint(20) NOT NULL, - `reason` varchar(256) NOT NULL, - `user_ip` varchar(50) NULL DEFAULT NULL, - `channel_order_no` varchar(64) NOT NULL, - `channel_refund_no` varchar(64) NULL DEFAULT NULL, - `success_time` datetime(0) NULL DEFAULT NULL, - `channel_error_code` varchar(128) NULL DEFAULT NULL, - `channel_error_msg` varchar(256) NULL DEFAULT NULL, - `channel_notify_data` varchar(1024) NULL, - `creator` varchar(64) NULL DEFAULT '', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) NULL DEFAULT '', - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, + `no` varchar(64) NOT NULL, + `app_id` bigint(20) NOT NULL, + `channel_id` bigint(20) NOT NULL, + `channel_code` varchar(32) NOT NULL, + `order_id` bigint(20) NOT NULL, + `order_no` varchar(64) NOT NULL, + `merchant_order_id` varchar(64) NOT NULL, + `merchant_refund_id` varchar(64) NOT NULL, + `notify_url` varchar(1024) NOT NULL, + `status` tinyint(4) NOT NULL, + `pay_price` bigint(20) NOT NULL, + `refund_price` bigint(20) NOT NULL, + `reason` varchar(256) NOT NULL, + `user_ip` varchar(50) NULL DEFAULT NULL, + `channel_order_no` varchar(64) NOT NULL, + `channel_refund_no` varchar(64) NULL DEFAULT NULL, + `success_time` datetime(0) NULL DEFAULT NULL, + `channel_error_code` varchar(128) NULL DEFAULT NULL, + `channel_error_msg` varchar(256) NULL DEFAULT NULL, + `channel_notify_data` varchar(1024) NULL, + `creator` varchar(64) NULL DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) NULL DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT = '退款订单'; -CREATE TABLE IF NOT EXISTS `pay_notify_task` ( +CREATE TABLE IF NOT EXISTS `pay_notify_task` +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, - `app_id` bigint(20) NOT NULL, - `type` tinyint(4) NOT NULL, + `app_id` bigint(20) NOT NULL, + `type` tinyint(4) NOT NULL, `data_id` bigint(20) NOT NULL, - `merchant_order_id` varchar(64) NOT NULL, - `status` tinyint(4) NOT NULL, - `next_notify_time` datetime(0) NULL DEFAULT NULL, - `last_execute_time` datetime(0) NULL DEFAULT NULL, - `notify_times` int NOT NULL, - `max_notify_times` int NOT NULL, - `notify_url` varchar(1024) NOT NULL, - `creator` varchar(64) NULL DEFAULT '', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) NULL DEFAULT '', - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, - `tenant_id` bigint(20) NOT NULL DEFAULT 0, + `merchant_order_id` varchar(64) NOT NULL, + `status` tinyint(4) NOT NULL, + `next_notify_time` datetime(0) NULL DEFAULT NULL, + `last_execute_time` datetime(0) NULL DEFAULT NULL, + `notify_times` int NOT NULL, + `max_notify_times` int NOT NULL, + `notify_url` varchar(1024) NOT NULL, + `creator` varchar(64) NULL DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) NULL DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, + `tenant_id` bigint(20) NOT NULL DEFAULT 0, PRIMARY KEY ("id") ) COMMENT = '支付通知任务'; -CREATE TABLE IF NOT EXISTS `pay_notify_log` ( +CREATE TABLE IF NOT EXISTS `pay_notify_log` +( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, - `task_id` bigint(20) NOT NULL, - `notify_times` int NOT NULL, - `response` varchar(1024) NOT NULL, - `status` tinyint(4) NOT NULL, - `creator` varchar(64) NULL DEFAULT '', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updater` varchar(64) NULL DEFAULT '', - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `deleted` bit(1) NOT NULL DEFAULT FALSE, + `task_id` bigint(20) NOT NULL, + `notify_times` int NOT NULL, + `response` varchar(1024) NOT NULL, + `status` tinyint(4) NOT NULL, + `creator` varchar(64) NULL DEFAULT '', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updater` varchar(64) NULL DEFAULT '', + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted` bit(1) NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") ) COMMENT = '支付通知日志'; From 0ebd8b5b7bbb149b68bed5713f0f19fc2bfc8e05 Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 14:03:30 +0800 Subject: [PATCH 2/9] feat: query pay order page by user id --- .../pay/controller/admin/order/vo/PayOrderPageReqVO.java | 3 +++ .../yudao/module/pay/dal/mysql/order/PayOrderMapper.java | 1 + 2 files changed, 4 insertions(+) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java index f7ff801cb3..74a5f44ff9 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java @@ -20,6 +20,9 @@ public class PayOrderPageReqVO extends PageParam { @Schema(description = "应用编号", example = "1024") private Long appId; + @Schema(description = "用户 id", example = "1024") + private Long userId; + @Schema(description = "渠道编码", example = "wx_app") private String channelCode; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java index 95510d5f7e..bdb3bc06db 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java @@ -18,6 +18,7 @@ public interface PayOrderMapper extends BaseMapperX { default PageResult selectPage(PayOrderPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(PayOrderDO::getAppId, reqVO.getAppId()) + .eqIfPresent(PayOrderDO::getUserId, reqVO.getUserId()) .eqIfPresent(PayOrderDO::getChannelCode, reqVO.getChannelCode()) .likeIfPresent(PayOrderDO::getMerchantOrderId, reqVO.getMerchantOrderId()) .likeIfPresent(PayOrderDO::getChannelOrderNo, reqVO.getChannelOrderNo()) From 643a50f7a044aa1acf2278278c716e7ab21ff9af Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 14:04:18 +0800 Subject: [PATCH 3/9] feat: export pay order page by user id --- .../pay/controller/admin/order/vo/PayOrderExportReqVO.java | 3 +++ .../yudao/module/pay/dal/mysql/order/PayOrderMapper.java | 1 + 2 files changed, 4 insertions(+) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java index 9e4d20b918..84e75c5f88 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java @@ -15,6 +15,9 @@ public class PayOrderExportReqVO { @Schema(description = "应用编号", example = "1024") private Long appId; + @Schema(description = "用户 id", example = "1024") + private Long userId; + @Schema(description = "渠道编码", example = "wx_app") private String channelCode; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java index bdb3bc06db..c1d0f67c74 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java @@ -31,6 +31,7 @@ default PageResult selectPage(PayOrderPageReqVO reqVO) { default List selectList(PayOrderExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() .eqIfPresent(PayOrderDO::getAppId, reqVO.getAppId()) + .eqIfPresent(PayOrderDO::getUserId, reqVO.getUserId()) .eqIfPresent(PayOrderDO::getChannelCode, reqVO.getChannelCode()) .likeIfPresent(PayOrderDO::getMerchantOrderId, reqVO.getMerchantOrderId()) .likeIfPresent(PayOrderDO::getChannelOrderNo, reqVO.getChannelOrderNo()) From 5786ff45858c97fd4b564134dad8c94f7f021b9f Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 14:53:11 +0800 Subject: [PATCH 4/9] feat: sync user id from trade order to pay order --- .../yudao/module/trade/convert/order/TradeOrderConvert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java index 64f74c99f4..ba85f0df5a 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java @@ -101,7 +101,7 @@ default ProductSkuUpdateStockReqDTO convertNegative(List list) default PayOrderCreateReqDTO convert(TradeOrderDO order, List orderItems, TradeOrderProperties orderProperties) { PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO() - .setAppId(orderProperties.getAppId()).setUserIp(order.getUserIp()); + .setAppId(orderProperties.getAppId()).setUserIp(order.getUserIp()).setUserId(order.getUserId()); // 商户相关字段 createReqDTO.setMerchantOrderId(String.valueOf(order.getId())); String subject = orderItems.get(0).getSpuName(); From 054323e898b48f3af64ea1de4dbf934955f30307 Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 14:55:12 +0800 Subject: [PATCH 5/9] fix: replace @NotEmpty with @NotNull --- .../yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java index 6d4e01271f..e49a17d9c0 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java @@ -29,7 +29,7 @@ public class PayOrderCreateReqDTO implements Serializable { private String userIp; - @NotEmpty(message = "用户 Id 不能为空") + @NotNull(message = "用户 Id 不能为空") private Long userId; // ========== 商户相关字段 ========== From 093fbc43c16602462a8ea1f807c86d7e3b76403d Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Wed, 12 Jun 2024 16:09:13 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BA=A4=E6=98=93=E8=AE=A2=E5=8D=95=E6=97=B6=E6=9C=AA=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=20userId=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 22ba34868e3d222822bd714a151059f0ed8df26b) --- .../pay/controller/admin/order/vo/PayOrderBaseVO.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java index 8cb5b80fec..07eb02e333 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.order.vo; + import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import jakarta.validation.constraints.NotNull; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -21,6 +22,10 @@ public class PayOrderBaseVO { @NotNull(message = "应用编号不能为空") private Long appId; + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "用户编号不能为空") + private Long userId; + @Schema(description = "渠道编号", example = "2048") private Long channelId; From c77ec84811a04f75334a53a2d8eede19d3fb84d0 Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Mon, 17 Jun 2024 11:46:03 +0800 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/pay/dal/dataobject/order/PayOrderDO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java index 6cad230c39..8beaf39e1d 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java @@ -97,7 +97,7 @@ public class PayOrderDO extends BaseDO { */ private String userIp; /** - * 用户 IP + * 用户 ID */ private Long userId; /** From 4eb436c1304e15aa3246037633f839102ab20f32 Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Mon, 17 Jun 2024 11:46:42 +0800 Subject: [PATCH 8/9] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=20PayOrderBaseV?= =?UTF-8?q?O.userId=20=E7=9A=84=E5=BF=85=E8=A6=81=E6=80=A7=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/pay/controller/admin/order/vo/PayOrderBaseVO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java index 07eb02e333..deee1beed2 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java @@ -22,7 +22,7 @@ public class PayOrderBaseVO { @NotNull(message = "应用编号不能为空") private Long appId; - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @Schema(description = "用户编号", example = "1024") @NotNull(message = "用户编号不能为空") private Long userId; From d894a474147c208015ddf62e7e672e4a2015701e Mon Sep 17 00:00:00 2001 From: DevDengChao <2325690622@qq.com> Date: Mon, 17 Jun 2024 11:50:50 +0800 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java | 2 +- .../pay/controller/admin/order/vo/PayOrderExportReqVO.java | 2 +- .../module/pay/controller/admin/order/vo/PayOrderPageReqVO.java | 2 +- .../yudao/module/pay/dal/dataobject/order/PayOrderDO.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java index e49a17d9c0..1db5e75aae 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java @@ -29,7 +29,7 @@ public class PayOrderCreateReqDTO implements Serializable { private String userIp; - @NotNull(message = "用户 Id 不能为空") + @NotNull(message = "用户编号不能为空") private Long userId; // ========== 商户相关字段 ========== diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java index 84e75c5f88..966195084c 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java @@ -15,7 +15,7 @@ public class PayOrderExportReqVO { @Schema(description = "应用编号", example = "1024") private Long appId; - @Schema(description = "用户 id", example = "1024") + @Schema(description = "用户编号", example = "1024") private Long userId; @Schema(description = "渠道编码", example = "wx_app") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java index 74a5f44ff9..1c2e5d378e 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java @@ -20,7 +20,7 @@ public class PayOrderPageReqVO extends PageParam { @Schema(description = "应用编号", example = "1024") private Long appId; - @Schema(description = "用户 id", example = "1024") + @Schema(description = "用户编号", example = "1024") private Long userId; @Schema(description = "渠道编码", example = "wx_app") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java index 8beaf39e1d..a68cc3ab7f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java @@ -97,7 +97,7 @@ public class PayOrderDO extends BaseDO { */ private String userIp; /** - * 用户 ID + * 用户编号 */ private Long userId; /**