From f0c87d7f083d9bbed612dbf5744df212022d426a Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 16 Jul 2024 21:56:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=97=B6=E5=9B=A0=E6=97=A0=E6=B3=95=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/ApprovalPlatformCommon.java | 91 +++++++++++++++++++ .../domain/service/LegDomainService.java | 2 +- .../java/com/chint/RouteApplicationTests.java | 2 +- 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java diff --git a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java new file mode 100644 index 00000000..45eeb063 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java @@ -0,0 +1,91 @@ +package com.chint.domain.aggregates.approval.platform; + +import com.chint.domain.aggregates.approval.ApprovalData; +import com.chint.domain.aggregates.approval.ApprovalResultData; +import com.chint.domain.repository.ApprovalPlatformInfoRepository; +import com.chint.domain.repository.SupplierRepository; +import com.chint.interfaces.rest.base.PostRequest; +import jakarta.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + + +@Component +public class ApprovalPlatformCommon implements ApprovalPlatform { + + @Autowired + private SupplierRepository supplierRepository; + + @Autowired + private ApprovalPlatformInfoRepository approvalPlatformInfoRepository; + + @Autowired + private PostRequest postRequest; + + @Autowired + private RedisTemplate redisTemplate; + + public static final String platformMark = "COMMON"; + + @PostConstruct + void init() { + approvalPlatformInfoRepository.findByPlatformMark(platformMark) + .ifPresent(approvalPlatformInfo -> { + String cacheKey = getCacheKey(approvalPlatformInfo.getPlatformName(), + approvalPlatformInfo.getPlatformMark()); + redisTemplate.opsForValue().set(cacheKey, approvalPlatformInfo, 1L, TimeUnit.DAYS); + }); + } + + private String getCacheKey(String platformName, String platformMark) { + return "ApprovalPlatform::" + platformName + "::" + platformMark; + } + + @Override + public void submitApproval(ApprovalData approvalData) { + + } + + @Override + public String getApprovalPlatformName() { + return ""; + } + + @Override + public void submitLegAddApproval(ApprovalData approvalData) { + + } + + @Override + public void submitLegChangeApproval(ApprovalData approvalData) { + + } + + @Override + public void submitOrderExpenseApproval(ApprovalData approvalData) { + + } + + @Override + public void submitOrderChangeApproval(ApprovalData approvalData) { + + } + + @Override + public void submitOrderRefundApproval(ApprovalData approvalData) { + + } + + @Override + public void submitLegAddOrChangeApproval(ApprovalData approvalData) { + + } + + @Override + public void receiveApprovalResultCustom(ApprovalResultData resultData) { + + } +} diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 7b64c270..1dfe745e 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -269,7 +269,7 @@ public class LegDomainService { // 根据供应商名称查找供应商并进行处理 return supplierRepository.findBySupplierName(supplierName) .map(supplier -> { - List syncAbleLegItems = ifCanSync(legs, routeOrder, supplier); + List syncAbleLegItems = ifCanSync(filteredLegItems, routeOrder, supplier); syncAbleLegItems.forEach(Leg::reloadStatus); return syncAbleLegItems; }) diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 9396b214..ca1ad2b7 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -314,7 +314,7 @@ class RouteApplicationTests { @Test void loginSign() { - String sfno = "230615020"; + String sfno = "231213086"; String syscode = "FSSC"; String billcode = "CLSQ240225000100"; String companycode = "正泰集团股份有限公司";