From a78aa770c793ba193e8de83dc351b77ffcdbc80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B3=89=E4=BD=B3?= <1107186916@qq.com> Date: Sun, 20 Sep 2026 16:45:56 +0800 Subject: [PATCH] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E9=87=91=E8=9D=B6?= =?UTF-8?q?=E5=AE=A2=E5=95=86=E5=AE=9A=E6=97=B6=E5=90=8C=E6=AD=A5=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E6=89=A7=E8=A1=8C=E6=97=A5=E5=BF=97=E5=B9=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=89=8B=E5=8A=A8=E8=A7=A6=E5=8F=91=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blade-service/blade-transport/pom.xml | 5 ++ .../controller/CustomerArchiveController.java | 10 ---- .../impl/CustomerArchiveServiceImpl.java | 20 +++++-- .../CustomerArchiveSyncKingdeeDataTest.java | 55 +++++++++++++++++++ 4 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 blade-service/blade-transport/src/test/java/org/springblade/transport/CustomerArchiveSyncKingdeeDataTest.java diff --git a/blade-service/blade-transport/pom.xml b/blade-service/blade-transport/pom.xml index 1a69b04b..a1230a9b 100644 --- a/blade-service/blade-transport/pom.xml +++ b/blade-service/blade-transport/pom.xml @@ -47,6 +47,11 @@ org.springframework.boot spring-boot-starter-amqp + + org.springframework.boot + spring-boot-starter-test + test + io.minio minio diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/CustomerArchiveController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/CustomerArchiveController.java index 07c55e02..3c44fd00 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/CustomerArchiveController.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/CustomerArchiveController.java @@ -193,16 +193,6 @@ public class CustomerArchiveController extends BladeController { return R.data(customerArchiveService.syncKingdee(id)); } - /** - * 金蝶客商数据定时同步测试入口:手动触发 syncKingdeeCustomerData 定时任务逻辑,便于联调验证 - */ - @PostMapping("/sync-kingdee-data-test") - @ApiOperationSupport(order = 13) - @Operation(summary = "金蝶客商数据同步测试", description = "手动触发定时任务逻辑:自动推送待推送客商(approved 且 none/failed),并联动已同步客商的金蝶使用状态") - public R syncKingdeeCustomerDataTest() { - return R.data(customerArchiveService.syncKingdeeCustomerData()); - } - /** * 评分明细模板 */ diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java index 815ae544..9b2c7bde 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java @@ -37,7 +37,7 @@ import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.pojo.entity.UserCustomerScope; import org.springblade.thirdparty.bfi.constant.BfiConstant; import org.springblade.thirdparty.bfi.pojo.dto.BfiCustomerQueryDTO; import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultErrorVO; @@ -76,17 +76,16 @@ import org.springblade.transport.pojo.entity.CustomerInvoiceContact; import org.springblade.transport.pojo.entity.CustomerInvoiceInfo; import org.springblade.transport.pojo.entity.CustomerReceiptAccount; import org.springblade.transport.pojo.entity.PaymentApplication; +import org.springblade.transport.pojo.vo.CreditRatingStandardVO; import org.springblade.transport.pojo.vo.CustomerArchiveVO; import org.springblade.transport.pojo.vo.CustomerChangeRecordVO; import org.springblade.transport.pojo.vo.CustomerContactVO; import org.springblade.transport.pojo.vo.CustomerCreditScoreDetailVO; import org.springblade.transport.pojo.vo.CustomerCreditScoreVO; -import org.springblade.transport.pojo.vo.CreditRatingStandardVO; import org.springblade.transport.pojo.vo.CustomerInvoiceContactVO; import org.springblade.transport.pojo.vo.CustomerInvoiceInfoVO; import org.springblade.transport.pojo.vo.CustomerReceiptAccountVO; import org.springblade.transport.service.ICustomerArchiveService; -import org.springblade.system.pojo.entity.UserCustomerScope; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -456,11 +455,13 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl pendingList = list(Wrappers.lambdaQuery() .eq(CustomerArchive::getApprovalStatus, APPROVAL_APPROVED) .in(CustomerArchive::getKingdeeStatus, KINGDEE_STATUS_NONE, KINGDEE_STATUS_FAILED) .orderByAsc(CustomerArchive::getId)); + log.info("金蝶客商数据定时同步查询到待推送客商 {} 条", pendingList.size()); ICustomerArchiveService proxy = self(); int pushed = 0; int existed = 0; @@ -470,10 +471,16 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl creditCodes = enabledList.stream() .map(CustomerArchive::getUnifiedCreditCode) .filter(Func::isNotEmpty) @@ -505,6 +513,8 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl + * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.transport; + +import org.junit.jupiter.api.Test; +import org.springblade.transport.service.ICustomerArchiveService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * 客商档案金蝶客商数据定时同步测试:手动触发 syncKingdeeCustomerData 定时任务逻辑 + *

+ * 依赖本地环境(Nacos / 数据库 / Redis),需先启动对应中间件再执行; + * 该逻辑与定时任务 CustomerKingdeeSyncTask 共用,开关默认关闭时可通过本测试手动触发联调。 + * + * @author Chill + */ +@SpringBootTest(classes = TransportApplication.class, properties = { + "spring.profiles.active=dev", + "spring.main.allow-bean-definition-overriding=true" +}) +class CustomerArchiveSyncKingdeeDataTest { + + @Autowired + private ICustomerArchiveService customerArchiveService; + + @Test + void syncKingdeeCustomerData() { + String result = customerArchiveService.syncKingdeeCustomerData(); + System.out.println("金蝶客商数据定时同步执行结果:" + result); + } +}