From 02bd1ae0e934f6175c479c0cb1b5d7cf11c0054c Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 17 Jul 2024 00:28:35 +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 --- .../approval/platform/ApprovalPlatformAN.java | 7 ++-- .../platform/ApprovalPlatformCommon.java | 36 +++++++++---------- .../service/order_sync/SupplierOrderSync.java | 2 +- .../interfaces/rest/base/PostRequest.java | 2 ++ 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java index 2a7efea4..6f9116d5 100644 --- a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java +++ b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformAN.java @@ -102,8 +102,11 @@ public class ApprovalPlatformAN implements ApprovalPlatform { .ifPresent(url -> { ApprovalScheduleParam approvalScheduleParam = createApprovalScheduleParam(approvalData); System.out.println(Json.gson().toJson(approvalScheduleParam)); - CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(() -> postRequest.post(url, approvalScheduleParam, ANResponse.class) - .getSuccess(), 0)); + postRequest.post(url, approvalScheduleParam, ANResponse.class); + if(false){ + CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(() -> postRequest.post(url, approvalScheduleParam, ANResponse.class) + .getSuccess(), 6)); + } }); } 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 index 45eeb063..a953f7bf 100644 --- a/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java +++ b/src/main/java/com/chint/domain/aggregates/approval/platform/ApprovalPlatformCommon.java @@ -13,31 +13,31 @@ 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; +// @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); - }); +// 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) { diff --git a/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java b/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java index 98680b1f..59de7d1c 100644 --- a/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java +++ b/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java @@ -73,7 +73,7 @@ public interface SupplierOrderSync extends SupplierAdapter { boolean isValid = true; // Process each leg - for (Leg leg : legList) { + for (Leg leg : needSyncLegs) { // Perform product check based on leg type and update the isValid flag switch (leg.getLegType()) { case LEG_TYPE_TRAIN -> diff --git a/src/main/java/com/chint/interfaces/rest/base/PostRequest.java b/src/main/java/com/chint/interfaces/rest/base/PostRequest.java index 86f8f519..b8706ced 100644 --- a/src/main/java/com/chint/interfaces/rest/base/PostRequest.java +++ b/src/main/java/com/chint/interfaces/rest/base/PostRequest.java @@ -53,6 +53,7 @@ public class PostRequest { public T post(String url, Object jsonRequest, Class responseType) { HttpPost post = new HttpPost(url); String json = gson.toJson(jsonRequest); + log.info(url); log.info(json); post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); return post(post, responseType); @@ -60,6 +61,7 @@ public class PostRequest { public T post(String url, String json, Class responseType) { HttpPost post = new HttpPost(url); + log.info(url); log.info(json); post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); return post(post, responseType);