From 198f4b6c32f02ba66d9135866131a8bdc933fe01 Mon Sep 17 00:00:00 2001 From: daixiaogang <2510234660@qq.com> Date: Sun, 17 Sep 2023 22:17:41 +0800 Subject: [PATCH] =?UTF-8?q?sku=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessProductPublishTaskService.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java b/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java index bed48edc..8a2e0441 100644 --- a/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java @@ -78,8 +78,6 @@ import com.ms.api.service.MoveCollectTaskService; import com.ms.api.service.MoveProductPublishBufferService; import com.ms.api.service.MoveProductPublishQueueService; import com.ms.api.service.MoveProductPublishToPicQueueService; -import com.ms.api.service.MoveShopConfigService; -import com.ms.api.service.MoveShopSettingService; import com.ms.api.service.RsyncCategoryQueueService; import com.ms.api.service.Shop1688DsAuthService; import com.ms.api.service.ShopService; @@ -87,7 +85,6 @@ import com.ms.api.tool.CommonTool; import com.ms.api.tool.DsJsonRequestTemplate; import com.ms.api.tool.ImageTool; import com.ms.api.tool.MoveTool; -import com.ms.api.tool.SecurityTool; import com.ms.api.tool.TailorImgTool; import com.ms.api.util.DdRequestUtil; import com.ms.api.util.MoveUtil; @@ -101,7 +98,6 @@ import com.ms.dal.entity.MoveProductPublishBuffer; import com.ms.dal.entity.MoveProductPublishQueue; import com.ms.dal.entity.MoveProductPublishToPicQueue; import com.ms.dal.entity.RsyncCategoryQueue; -import com.ms.dal.entity.Shop; import com.ms.dal.entity.Shop1688DsAuth; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -193,10 +189,14 @@ public class ProcessProductPublishTaskService extends TaskBaseService { } @Override - public boolean isCirculate() {return true;} + public boolean isCirculate() { + return true; + } @Override - public int getIntervalTimeSecond() {return 1;} + public int getIntervalTimeSecond() { + return 1; + } /** * 任务管理器名称 @@ -243,10 +243,10 @@ public class ProcessProductPublishTaskService extends TaskBaseService { // 更新move_task_detail MoveCollectTaskDetail moveCollectTaskDetail = moveCollectTaskDetailService.selectByPrimaryKey(queueMsg.getMoveCollectTaskDetailId()); - if(ObjectUtil.isEmpty(moveCollectTaskDetail)){ + if (ObjectUtil.isEmpty(moveCollectTaskDetail)) { E.throwMSException("moveCollectTaskDetail is null"); } - log.info("来源商品id:" + moveCollectTaskDetail.getSourceItemId(), " 标题: "+ moveCollectTaskDetail.getSourceItemId()); + log.info("来源商品id:" + moveCollectTaskDetail.getSourceItemId(), " 标题: " + moveCollectTaskDetail.getSourceItemId()); long publishWaitSeconds = startTime - queueMsg.getGmtCreate().getTime(); moveCollectTaskDetail.setPublishWaitSeconds((int) publishWaitSeconds); int affect = moveCollectTaskDetailService.updateByPrimaryKeySelective(moveCollectTaskDetail); @@ -1760,7 +1760,6 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return price > 0 ? CommonTool.numFormat(price, 2) : CommonTool.numFormat(defaultPrice, 2); } - public boolean checkBuildSkuCondition(String skuPropStr, String cAv, String sAv) { int position = skuPropStr.indexOf(";" + cAv + ";"); boolean checkColor = (cAv.isEmpty() || position != -1); @@ -1772,12 +1771,11 @@ public class ProcessProductPublishTaskService extends TaskBaseService { skuPropStr = skuPropStr.trim().replaceAll("^;+|;+$", ""); sAv = StringUtils.isNotBlank(sAv) ? sAv.trim() : ""; sAv = sAv.trim().replaceAll("^;+|;+$", ""); - if (ObjectUtil.isNotEmpty(sAv) && ObjectUtil.isNotEmpty(skuPropStr)) { + if (ObjectUtil.isEmpty(sAv) && ObjectUtil.isEmpty(skuPropStr)) { checkSize = true; } else { String[] skuPropArr = skuPropStr.split(";"); String[] sAvArr = sAv.split(";"); - if (arraysAreEqual(skuPropArr, sAvArr)) { checkSize = true; } @@ -1786,7 +1784,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return checkColor && checkSize; } - private String removeSubstring(String str, int start, int length) { + private String removeSubstring(String str, int start, int length) { return str.substring(0, start) + str.substring(start + length); } @@ -1801,7 +1799,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { for (Map.Entry entry : skuMap.entrySet()) { JSONObject skuInfo = (JSONObject) entry.getValue(); - if(ObjectUtil.isNotEmpty(skuInfo)){ + if (ObjectUtil.isNotEmpty(skuInfo)) { // double price = skuInfo.getDouble("price"); // // if (skuInfo.containsKey("newPrice") && skuInfo.getDouble("newPrice") > 0) { @@ -1963,7 +1961,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { Object[] processedResult = processAddSkuMinPrice(priceCondition, minPrice, colorMap, sizeMap, skuMap, defaultColorImg); colorMap = (JSONObject) processedResult[0]; - sizeMap= (JSONObject) processedResult[1]; + sizeMap = (JSONObject) processedResult[1]; skuMap = (JSONObject) processedResult[2]; skus.put("skuMap", skuMap); @@ -1986,9 +1984,9 @@ public class ProcessProductPublishTaskService extends TaskBaseService { // colorMap = (JSONObject) result[0]; // skuMap = (JSONObject) result[1]; // } else { - Object[] result = appendSkuMinPriceSizeToSkuMap(priceCondition, minPrice, colorMap, sizeMap, skuMap, defaultColorImg); - sizeMap = (JSONObject) result[0]; - skuMap = (JSONObject) result[1]; + Object[] result = appendSkuMinPriceSizeToSkuMap(priceCondition, minPrice, colorMap, sizeMap, skuMap, defaultColorImg); + sizeMap = (JSONObject) result[0]; + skuMap = (JSONObject) result[1]; // } } @@ -2792,7 +2790,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { private MoveProductPublishQueueBO lockProductPublishQueue() { String taskDetailIdStr = redisService.pop(RedisKeyConst.MOVE_PRODUCT_PUBLISH_QUEUE); - if (StrUtil.isBlank(taskDetailIdStr)){ + if (StrUtil.isBlank(taskDetailIdStr)) { log.info("no redis publish queue key"); return null; }