From e4ae940bef0b29ed025450cfcb304e8145e850b1 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Fri, 15 Sep 2023 10:44:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=90=AC=E5=AE=B6=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/task/ProcessProductPublishTaskService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2120b875..ef3de4c4 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 @@ -806,7 +806,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { StrObjMap mStrObjmap = new StrObjMap(); mStrObjmap.put("name",attribute.getPropertyName()); mStrObjmap.put("diy_type",attribute.getDiyType()); - mStrObjmap.put("value",ObjectUtil.isNotEmpty(attribute.getOptions())?attribute.getOptions().get(0):0); + mStrObjmap.put("value",ObjectUtil.isNotEmpty(attribute.getOptions())?attribute.getOptions().get(0).getValue():0); matchList.add(mStrObjmap); matchAttrs.put(currAid, matchList); } From ba31af68a5f652b56c78ceeac53ad3e3090a627d Mon Sep 17 00:00:00 2001 From: daixiaogang <2510234660@qq.com> Date: Fri, 15 Sep 2023 10:59:18 +0800 Subject: [PATCH 2/4] buildSpec --- ms-biz/src/main/java/com/ms/api/biz/MoveService.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/biz/MoveService.java b/ms-biz/src/main/java/com/ms/api/biz/MoveService.java index f593372d..1c85842d 100644 --- a/ms-biz/src/main/java/com/ms/api/biz/MoveService.java +++ b/ms-biz/src/main/java/com/ms/api/biz/MoveService.java @@ -11,6 +11,7 @@ import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +import java.util.stream.Stream; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -45,7 +46,6 @@ import com.doudian.open.core.AccessToken; import com.ms.api.bo.MoveProductPublishQueueBO; import com.ms.api.bo.MoveShopConfigBO; import com.ms.api.bo.MoveShopSettingBO; -import com.ms.api.bo.ShopBO; import com.ms.api.common.ApiResult; import com.ms.api.common.E; import com.ms.api.common.MSException; @@ -201,12 +201,11 @@ public class MoveService { productDetailBase.put("categoryLeafId", queueMsg.getCid()); // 尺寸模版 - if(StrUtil.isNotBlank(queueMsg.getCid())){ + if (StrUtil.isNotBlank(queueMsg.getCid())) { Long size = getSizeTemplateId(shopId, Long.parseLong(queueMsg.getCid())); productDetailBase.put("sizeTemplateId", size); } - // 发货时间 long deliveryDelayDay = condition.getDeliveryDelayDay(); if (deliveryDelayDay == 0) { @@ -352,7 +351,7 @@ public class MoveService { ProductGetProductUpdateRuleParam param = new ProductGetProductUpdateRuleParam(); param.setCategoryId(Long.valueOf(cid)); ApiResult productUpdateRuleRet = DdRequestUtil.getBrandListV2FromDdNotEx(param, accessToken); - if(!productUpdateRuleRet.isSuccess()){ + if (!productUpdateRuleRet.isSuccess()) { return new HashMap<>(); } ProductGetProductUpdateRuleData productUpdateRule = productUpdateRuleRet.getData(); @@ -1033,8 +1032,8 @@ public class MoveService { String colorSpecStr = colorSpecArr.isEmpty() ? "" : ddColorName + "|" + String.join(",", colorSpecArr); String sizeSpecStr = sizeSpecArr.isEmpty() ? "" : ddSizeName + "|" + String.join(",", sizeSpecArr); - String spec = colorSpecStr + "^" + sizeSpecStr; - String specName = ddColorName + "-" + ddSizeName; + String spec = Stream.of(colorSpecStr, sizeSpecStr).filter(StrUtil::isNotBlank).collect(Collectors.joining("^")); + String specName = Stream.of(colorSpecArr.isEmpty() ? "" : ddColorName, sizeSpecArr.isEmpty() ? "" : ddSizeName).filter(StrUtil::isNotBlank).collect(Collectors.joining("^")); // String skuSpecStr = getSkuSpecStr(queueMsg, deliveryDelayDay); // log.info("skuSpecStr: " + skuSpecStr); From eb3cc6f3573b15bf96ba44f63dd773f3c9d6afe2 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Fri, 15 Sep 2023 11:01:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=90=AC=E5=AE=B6=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessProductPublishTaskService.java | 4 +++- .../main/java/com/ms/api/tool/CommonTool.java | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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 ef3de4c4..718f5d88 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 @@ -806,7 +806,9 @@ public class ProcessProductPublishTaskService extends TaskBaseService { StrObjMap mStrObjmap = new StrObjMap(); mStrObjmap.put("name",attribute.getPropertyName()); mStrObjmap.put("diy_type",attribute.getDiyType()); - mStrObjmap.put("value",ObjectUtil.isNotEmpty(attribute.getOptions())?attribute.getOptions().get(0).getValue():0); + String valueStr = ObjectUtil.isNotEmpty(attribute.getOptions())?attribute.getOptions().get(0).getValue():"0"; + Object valueObj = CommonTool.convertToNumericType(valueStr); + mStrObjmap.put("value",valueObj); matchList.add(mStrObjmap); matchAttrs.put(currAid, matchList); } diff --git a/ms-biz/src/main/java/com/ms/api/tool/CommonTool.java b/ms-biz/src/main/java/com/ms/api/tool/CommonTool.java index 54f43256..ea085a61 100644 --- a/ms-biz/src/main/java/com/ms/api/tool/CommonTool.java +++ b/ms-biz/src/main/java/com/ms/api/tool/CommonTool.java @@ -998,4 +998,24 @@ public class CommonTool { } return len; } + + public static Object convertToNumericType(String value) { + try { + return Integer.parseInt(value); + } catch (NumberFormatException e1) { + try { + return Long.parseLong(value); + } catch (NumberFormatException e2) { + try { + return Float.parseFloat(value); + } catch (NumberFormatException e3) { + try { + return Double.parseDouble(value); + } catch (NumberFormatException e4) { + return null; + } + } + } + } + } } From 53f4fb81c8bb1b6818f7e2b69e18f310bef2a4fa Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Fri, 15 Sep 2023 11:24:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=90=AC=E5=AE=B6=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ms/api/task/ProcessProductPublishTaskService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 718f5d88..c36d0dbf 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 @@ -807,8 +807,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService { mStrObjmap.put("name",attribute.getPropertyName()); mStrObjmap.put("diy_type",attribute.getDiyType()); String valueStr = ObjectUtil.isNotEmpty(attribute.getOptions())?attribute.getOptions().get(0).getValue():"0"; - Object valueObj = CommonTool.convertToNumericType(valueStr); - mStrObjmap.put("value",valueObj); +// Object valueObj = CommonTool.convertToNumericType(valueStr); + mStrObjmap.put("value",Integer.parseInt(valueStr)); matchList.add(mStrObjmap); matchAttrs.put(currAid, matchList); }