From b632726a6915dca7bdec6cc351d18c7b90312199 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 18 Aug 2024 16:33:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E6=94=AF=E4=BB=98=EF=BC=9A=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=BA=94=E7=94=A8=EF=BC=8C=E5=A2=9E=E5=8A=A0=20appKey=20?= =?UTF-8?q?=E6=A0=87=E8=AF=86=EF=BC=8C=E7=94=A8=E4=BA=8E=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E6=96=B9=E7=9A=84=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 ++--- yudao-server/pom.xml | 60 ++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pom.xml b/pom.xml index 4634d345e..86dfebcc3 100644 --- a/pom.xml +++ b/pom.xml @@ -15,12 +15,12 @@ yudao-module-system yudao-module-infra - yudao-module-member + - yudao-module-pay - yudao-module-mall + + diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index d0c429aab..3b16fa192 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -33,11 +33,11 @@ - - cn.iocoder.boot - yudao-module-member-biz - ${revision} - + + + + + @@ -52,11 +52,11 @@ - - cn.iocoder.boot - yudao-module-pay-biz - ${revision} - + + + + + @@ -66,26 +66,26 @@ - - cn.iocoder.boot - yudao-module-promotion-biz - ${revision} - - - cn.iocoder.boot - yudao-module-product-biz - ${revision} - - - cn.iocoder.boot - yudao-module-trade-biz - ${revision} - - - cn.iocoder.boot - yudao-module-statistics-biz - ${revision} - + + + + + + + + + + + + + + + + + + + + From e850fbf675336c9ad46b84ea2d0dc5c5988f9561 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 18 Aug 2024 17:17:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E6=94=AF=E4=BB=98=EF=BC=9A=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=BA=94=E7=94=A8=EF=BC=8C=E5=A2=9E=E5=8A=A0=20appKey=20?= =?UTF-8?q?=E6=A0=87=E8=AF=86=EF=BC=8C=E7=94=A8=E4=BA=8E=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E6=96=B9=E7=9A=84=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/service/refund/PayRefundServiceImpl.java | 2 +- .../pay/service/order/PayOrderServiceTest.java | 3 +++ .../pay/service/refund/PayRefundServiceTest.java | 16 ++++++++-------- .../src/test/resources/sql/create_tables.sql | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java index 39179dfa0..8df7f8861 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java @@ -113,7 +113,7 @@ public class PayRefundServiceImpl implements PayRefundService { // 2.1 插入退款单 String no = noRedisDAO.generate(payProperties.getRefundNoPrefix()); refund = PayRefundConvert.INSTANCE.convert(reqDTO) - .setNo(no).setOrderId(order.getId()).setOrderNo(order.getNo()) + .setNo(no).setAppId(app.getId()).setOrderId(order.getId()).setOrderNo(order.getNo()) .setChannelId(order.getChannelId()).setChannelCode(order.getChannelCode()) // 商户相关的字段 .setNotifyUrl(app.getRefundNotifyUrl()) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java index b0c613af8..7fa0c8d90 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java @@ -243,6 +243,9 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { // mock 数据 PayOrderDO dbOrder = randomPojo(PayOrderDO.class, o -> o.setAppId(1L).setMerchantOrderId("10")); orderMapper.insert(dbOrder); + // mock 方法 + PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L).setOrderNotifyUrl("http://127.0.0.1")); + when(appService.validPayApp(eq(reqDTO.getAppKey()))).thenReturn(app); // 调用 Long orderId = orderService.createOrder(reqDTO); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java index 131cb44cd..c001336fc 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java @@ -212,7 +212,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { o -> o.setAppKey("demo")); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // 调用,并断言异常 assertServiceException(() -> refundService.createPayRefund(reqDTO), @@ -235,7 +235,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { o -> o.setAppKey("demo").setMerchantOrderId("100")); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(status)); when(orderService.getOrder(eq(1L), eq("100"))).thenReturn(order); @@ -252,7 +252,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { o -> o.setAppKey("demo").setMerchantOrderId("100").setPrice(10)); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) @@ -271,7 +271,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { o -> o.setAppKey("demo").setMerchantOrderId("100").setPrice(10)); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) @@ -294,7 +294,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { o -> o.setAppKey("demo").setMerchantOrderId("100").setPrice(9)); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) @@ -319,7 +319,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { .setMerchantRefundId("200").setReason("测试退款")); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) @@ -351,7 +351,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { .setMerchantRefundId("200").setReason("测试退款")); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) @@ -395,7 +395,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { .setMerchantRefundId("200").setReason("测试退款")); // mock 方法(app) PayAppDO app = randomPojo(PayAppDO.class, o -> o.setId(1L)); - when(appService.validPayApp(eq(1L))).thenReturn(app); + when(appService.validPayApp(eq("demo"))).thenReturn(app); // mock 数据(order) PayOrderDO order = randomPojo(PayOrderDO.class, o -> o.setStatus(PayOrderStatusEnum.REFUND.getStatus()) 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 6ae2ce2d4..3f9f76417 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,5 +1,6 @@ CREATE TABLE IF NOT EXISTS "pay_app" ( "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "app_key" varchar(64) NOT NULL, "name" varchar(64) NOT NULL, "status" tinyint NOT NULL, "remark" varchar(255) DEFAULT NULL,