diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/JsonOrderCreationRequestBody.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/JsonOrderCreationRequestBody.java index 896817d18..e2fc66839 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/JsonOrderCreationRequestBody.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/JsonOrderCreationRequestBody.java @@ -7,7 +7,7 @@ public class JsonOrderCreationRequestBody extends OrderCreationRequestBody { private final String jsonString; public JsonOrderCreationRequestBody(String jsonString) { - super(null, null); + super(null); this.jsonString = jsonString; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/OrderCreationRequestBody.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/OrderCreationRequestBody.java index 3a0fcee6d..27d88c0ee 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/OrderCreationRequestBody.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/api/shouman/OrderCreationRequestBody.java @@ -19,8 +19,6 @@ public class OrderCreationRequestBody implements RequestBody { private List orderContents; - private Map countryMap; - private final static String DEFAULT_SPLIT = ";"; private final static String LINE_BREAK = "\n"; private final static String QUOTE = ":"; @@ -30,9 +28,8 @@ public class OrderCreationRequestBody implements RequestBody { private final static String PRODUCT_GROUP_KEY = "_gpo_product_group"; private final static String PARENT_PRODUCT_GROUP_KEY = "_gpo_parent_product_group"; - public OrderCreationRequestBody(List orderContents, Map countryMap) { + public OrderCreationRequestBody(List orderContents) { this.orderContents = orderContents; - this.countryMap = countryMap; } @Override @@ -48,8 +45,6 @@ public class OrderCreationRequestBody implements RequestBody { putNonNull(json, "address", "收货人:王生 收货地址: 广东省东镇芦莞市寮步溪二路40号汇元佳科技园二栋10楼公司前台 手机:17633551138"); putNonNull(json, "addressee", "王生"); putNonNull(json, "city", "东莞市"); - String countryName = anyContent.getCountry(); - Country country = countryMap.get(countryName); putNonNull(json, "country", "CHINA"); putNonNull(json, "countryCode", "CN"); // TODO: 2023/11/29 Change to real address @@ -148,16 +143,16 @@ public class OrderCreationRequestBody implements RequestBody { for (ShoumanOrderContent necklace : necklaces) { String necklacePgValue = extractProductGroupValue(necklace.getCustomizationData().split(DEFAULT_SPLIT), PRODUCT_GROUP_KEY); for (ShoumanOrderContent gem : gems) { - String gemPgValue = extractProductGroupValue(gem.getCustomizationData().split(DEFAULT_SPLIT), PARENT_PRODUCT_GROUP_KEY); - if (necklacePgValue != null && necklacePgValue.equalsIgnoreCase(gemPgValue)) { - // We need the remark from necklace for colour/material/month/font AND we need remark from - // gem for the mention of its presence - gem.setRemark(necklace.getRemark().concat(gem.getRemark())); - // We need the custom data from necklace to parse the name - gem.setCustomizationData(necklace.getCustomizationData()); - reducedContents.add(gem); - break; - } + String gemPgValue = extractProductGroupValue(gem.getCustomizationData().split(DEFAULT_SPLIT), PARENT_PRODUCT_GROUP_KEY); + if (necklacePgValue != null && necklacePgValue.equalsIgnoreCase(gemPgValue)) { + // We need the remark from necklace for colour/material/month/font AND we need remark from + // gem for the mention of its presence + gem.setRemark(necklace.getRemark().concat(gem.getRemark())); + // We need the custom data from necklace to parse the name + gem.setCustomizationData(necklace.getCustomizationData()); + reducedContents.add(gem); + break; + } } } return reducedContents; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/ShoumanOrderCreationJob.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/ShoumanOrderCreationJob.java index 6774b5711..8888f7905 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/ShoumanOrderCreationJob.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/ShoumanOrderCreationJob.java @@ -28,14 +28,10 @@ public class ShoumanOrderCreationJob implements Job { private PlatformOrderContentMapper platformOrderContentMapper; @Autowired private IShoumanOrderService shoumanOrderService; - @Autowired - private CountryMapper countryMapper; @Override public void execute(JobExecutionContext context) throws JobExecutionException { log.info("Started Shouman order creation job"); - Map countryCodeMap = countryMapper.findAll().stream() - .collect(toMap(Country::getMabangName, Function.identity())); List shoumanOrderContents = platformOrderContentMapper.searchShoumanOrderContent(); log.info("Fetched {} shouman order contents", shoumanOrderContents.size()); @@ -47,7 +43,7 @@ public class ShoumanOrderCreationJob implements Job { log.info("Started constructing Shouman request bodies"); List shoumanOrders = new ArrayList<>(); for (Map.Entry> entry : groupedByPlatformOrderId.entrySet()) { - OrderCreationRequestBody requestBody = new OrderCreationRequestBody(entry.getValue(), countryCodeMap); + OrderCreationRequestBody requestBody = new OrderCreationRequestBody(entry.getValue()); ShoumanOrder shoumanOrder = new ShoumanOrder(); shoumanOrder.setOrderJson(requestBody.parameters().toJSONString()); shoumanOrder.setPlatformOrderId(entry.getKey());