From 3b868ec90464205906ce2cd785ccf352f629e295 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Fri, 15 Sep 2023 10:15:17 +0800 Subject: [PATCH] =?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 | 19 ++++++++++++++++++- 1 file changed, 18 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 f70dd5ee..723d16f8 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 @@ -788,7 +788,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService { ProductGetCatePropertyV2Data attrRetData = (ProductGetCatePropertyV2Data) categoryAttrRet.getData().get("data"); List attributes = attrRetData.getData(); String title = productDetailBase.getString("title"); - Map> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg); +// Map> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg); + Map> productFormatNew = buildProductAttrsByDd(attributes, sourceAttrs, title,queueMsg); productFormatNew = attachBrand2ProductFormatNew(brandId, brandName, productFormatNew); productDetailBase.put("productFormatNew", productFormatNew); @@ -800,6 +801,22 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return ret; } + private Map> buildProductAttrsByDd(List attributes, JSONObject sourceAttrs, String title,MoveProductPublishQueueBO queueMsg) { + Map> matchAttrs = new HashMap<>(); + for (DataItem attribute : attributes) { + long currAid = attribute.getPropertyId(); + List matchList = new ArrayList<>(); + 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); + matchList.add(mStrObjmap); + matchAttrs.put(currAid, matchList); + } + log.info(JSON.toJSONString(matchAttrs)); + return matchAttrs; + } + private String getSourceAttrBrandName(JSONObject sourceAttrs) { String brandName = ""; for (Map.Entry entry : sourceAttrs.entrySet()) {