|
|
@ -699,12 +699,15 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
JSONObject sourceAttrs = moveBaseData.getJSONObject("sourceAttrs");
|
|
|
|
JSONObject sourceAttrs = moveBaseData.getJSONObject("sourceAttrs");
|
|
|
|
ProductGetCatePropertyV2Data attrRetData = (ProductGetCatePropertyV2Data) categoryAttrRet.getData().get("data");
|
|
|
|
ProductGetCatePropertyV2Data attrRetData = (ProductGetCatePropertyV2Data) categoryAttrRet.getData().get("data");
|
|
|
|
List<DataItem> attributes = attrRetData.getData();
|
|
|
|
List<DataItem> attributes = attrRetData.getData();
|
|
|
|
|
|
|
|
log.info("attributes :" + JSON.toJSONString(attributes));
|
|
|
|
String title = productDetailBase.getString("title");
|
|
|
|
String title = productDetailBase.getString("title");
|
|
|
|
// Map<Long, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg);
|
|
|
|
// Map<String, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg);
|
|
|
|
|
|
|
|
// log.info("productFormatNew :" + JSON.toJSONString(productFormatNew));
|
|
|
|
Map<String, List<StrObjMap>> productFormatNew = buildProductAttrsByDd(attributes, sourceAttrs, title, queueMsg);
|
|
|
|
Map<String, List<StrObjMap>> productFormatNew = buildProductAttrsByDd(attributes, sourceAttrs, title, queueMsg);
|
|
|
|
|
|
|
|
// log.info("productFormatNew2 :" + JSON.toJSONString(productFormatNew2));
|
|
|
|
|
|
|
|
// E.throwMSException("测试");
|
|
|
|
productFormatNew = attachBrand2ProductFormatNew(brandId, brandName, productFormatNew);
|
|
|
|
productFormatNew = attachBrand2ProductFormatNew(brandId, brandName, productFormatNew);
|
|
|
|
productDetailBase.put("productFormatNew", productFormatNew);
|
|
|
|
productDetailBase.put("productFormatNew", productFormatNew);
|
|
|
|
log.info("productFormatNew :" + JSON.toJSONString(productFormatNew));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ret ret = CommonTool.successResult();
|
|
|
|
Ret ret = CommonTool.successResult();
|
|
|
|
StrObjMap returnData = new StrObjMap();
|
|
|
|
StrObjMap returnData = new StrObjMap();
|
|
|
@ -720,11 +723,14 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
long currAid = attribute.getPropertyId();
|
|
|
|
long currAid = attribute.getPropertyId();
|
|
|
|
List<StrObjMap> matchList = new ArrayList<>();
|
|
|
|
List<StrObjMap> matchList = new ArrayList<>();
|
|
|
|
StrObjMap mStrObjmap = new StrObjMap();
|
|
|
|
StrObjMap mStrObjmap = new StrObjMap();
|
|
|
|
mStrObjmap.put("name", attribute.getPropertyName());
|
|
|
|
String nameStr = ObjectUtil.isNotEmpty(attribute.getOptions()) ? attribute.getOptions().get(0).getName() : "";
|
|
|
|
|
|
|
|
mStrObjmap.put("name", nameStr);
|
|
|
|
mStrObjmap.put("diy_type", attribute.getDiyType());
|
|
|
|
mStrObjmap.put("diy_type", attribute.getDiyType());
|
|
|
|
String valueStr = 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", Integer.parseInt(valueStr));
|
|
|
|
mStrObjmap.put("value", Integer.parseInt(valueStr));
|
|
|
|
|
|
|
|
// mStrObjmap.put("type", attribute.getType());
|
|
|
|
|
|
|
|
// mStrObjmap.put("required", attribute.getRequired());
|
|
|
|
|
|
|
|
// mStrObjmap.put("attr", attribute.getPropertyName());
|
|
|
|
matchList.add(mStrObjmap);
|
|
|
|
matchList.add(mStrObjmap);
|
|
|
|
matchAttrs.put(String.valueOf(currAid), matchList);
|
|
|
|
matchAttrs.put(String.valueOf(currAid), matchList);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -867,12 +873,11 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
TreeMap<Double, Object> matchVids = new TreeMap<>(Collections.reverseOrder());
|
|
|
|
TreeMap<Double, Object> matchVids = new TreeMap<>(Collections.reverseOrder());
|
|
|
|
Map<String, String> matchSourceAttrs = new HashMap<>();
|
|
|
|
Map<String, String> matchSourceAttrs = new HashMap<>();
|
|
|
|
double maxPercent = -1;
|
|
|
|
double maxPercent = -1;
|
|
|
|
String maxMatchAttrValue = ObjectUtil.isEmpty(attribute.getOptions()) ? "0" : attribute.getOptions().get(0).getValue();
|
|
|
|
String maxMatchAttrValue = attribute.getOptions().get(0).getValue();
|
|
|
|
|
|
|
|
|
|
|
|
StrObjMap sourceValueMap = searchSourceValue(sourceAttrs, attribute.getPropertyName());
|
|
|
|
StrObjMap sourceValueMap = searchSourceValue(sourceAttrs, attribute.getPropertyName());
|
|
|
|
String sourceValue = (String) sourceValueMap.get("sourceValue");
|
|
|
|
String sourceValue = (String) sourceValueMap.get("sourceValue");
|
|
|
|
sourceValue = getDefaultValueByAttrName(attribute.getPropertyName(), sourceValue);
|
|
|
|
sourceValue = getDefaultValueByAttrName(attribute.getPropertyName(), sourceValue);
|
|
|
|
|
|
|
|
|
|
|
|
if (sourceValue != null && !sourceValue.isEmpty()) {
|
|
|
|
if (sourceValue != null && !sourceValue.isEmpty()) {
|
|
|
|
List<String> sourceValueList = splitMultiValueList(sourceValue);
|
|
|
|
List<String> sourceValueList = splitMultiValueList(sourceValue);
|
|
|
|
sourceValueList.add(0, sourceValue);
|
|
|
|
sourceValueList.add(0, sourceValue);
|
|
|
@ -913,7 +918,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
if (matchVids.isEmpty()) {
|
|
|
|
if (matchVids.isEmpty()) {
|
|
|
|
for (OptionsItem attValue : attribute.getOptions()) {
|
|
|
|
for (OptionsItem attValue : attribute.getOptions()) {
|
|
|
|
String name = attValue.getName();
|
|
|
|
String name = attValue.getName();
|
|
|
|
if ((title.contains(name) && (name.length() > 1)) || (CommonTool.checkHasOtherKeyword(name) && !name.toLowerCase().contains("海外"))) {
|
|
|
|
if ((title.contains(name) && !StringUtils.isNumeric(name) ) || (CommonTool.checkHasOtherKeyword(name) && !name.toLowerCase().contains("海外"))) {
|
|
|
|
matchVids.put(0D, attValue.getValue());
|
|
|
|
matchVids.put(0D, attValue.getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -961,10 +966,17 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
StrObjMap matchAttr = null;
|
|
|
|
StrObjMap matchAttr = null;
|
|
|
|
if (!matchVids.isEmpty()) {
|
|
|
|
if (!matchVids.isEmpty()) {
|
|
|
|
Object vid = matchVids.lastKey();
|
|
|
|
Object vid = matchVids.lastKey();
|
|
|
|
|
|
|
|
String name = getValueNameFromAttrOptions(vid, attribute.getOptions(), attribute.getPropertyName());
|
|
|
|
|
|
|
|
String value = String.valueOf(vid);
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(name)){
|
|
|
|
|
|
|
|
name = attribute.getOptions().get(0).getName();
|
|
|
|
|
|
|
|
value = attribute.getOptions().get(0).getValue();
|
|
|
|
|
|
|
|
}
|
|
|
|
matchAttr = new StrObjMap();
|
|
|
|
matchAttr = new StrObjMap();
|
|
|
|
matchAttr.put("name", getValueNameFromAttrOptions(vid, attribute.getOptions(), attribute.getPropertyName()));
|
|
|
|
matchAttr.put("name", name);
|
|
|
|
matchAttr.put("diy_type", 0);
|
|
|
|
matchAttr.put("diy_type", attribute.getDiyType());
|
|
|
|
matchAttr.put("value", vid);
|
|
|
|
matchAttr.put("value", CommonTool.convertStringToInt(value));
|
|
|
|
|
|
|
|
matchAttr.put("type",attribute.getType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (matchSourceAttrs != null && !matchSourceAttrs.isEmpty()) {
|
|
|
|
if (matchSourceAttrs != null && !matchSourceAttrs.isEmpty()) {
|
|
|
@ -980,7 +992,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
return option.getName();
|
|
|
|
return option.getName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return propertyName;
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<StrObjMap> matchProductAttributesByTimeframe(DataItem attribute, JSONObject sourceAttrs, String type) {
|
|
|
|
private List<StrObjMap> matchProductAttributesByTimeframe(DataItem attribute, JSONObject sourceAttrs, String type) {
|
|
|
@ -1020,6 +1032,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
sourceValue = getMockSourceAttrValue((String) attribute.getPropertyName());
|
|
|
|
sourceValue = getMockSourceAttrValue((String) attribute.getPropertyName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StrObjMap arr = createTimeframeEntry(sourceValue);
|
|
|
|
StrObjMap arr = createTimeframeEntry(sourceValue);
|
|
|
|
|
|
|
|
arr.put("type",attribute.getType());
|
|
|
|
|
|
|
|
arr.put("required",attribute.getRequired());
|
|
|
|
return type.equals(MoveConst.attrInputTypeTimestamp) ? new ArrayList<StrObjMap>() {{
|
|
|
|
return type.equals(MoveConst.attrInputTypeTimestamp) ? new ArrayList<StrObjMap>() {{
|
|
|
|
add(arr);
|
|
|
|
add(arr);
|
|
|
|
}} : new ArrayList<StrObjMap>() {{
|
|
|
|
}} : new ArrayList<StrObjMap>() {{
|
|
|
@ -1114,6 +1128,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
matchAttr.put("name", matchVid.getName());
|
|
|
|
matchAttr.put("name", matchVid.getName());
|
|
|
|
matchAttr.put("diy_type", 0);
|
|
|
|
matchAttr.put("diy_type", 0);
|
|
|
|
matchAttr.put("value", matchVid.getValue());
|
|
|
|
matchAttr.put("value", matchVid.getValue());
|
|
|
|
|
|
|
|
matchAttr.put("type",attribute.getType());
|
|
|
|
|
|
|
|
matchAttr.put("required",attribute.getRequired());
|
|
|
|
matchAttrList.add(matchAttr);
|
|
|
|
matchAttrList.add(matchAttr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1191,6 +1207,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
if (sourceAttrs.containsKey(attribute.getPropertyName())) {
|
|
|
|
if (sourceAttrs.containsKey(attribute.getPropertyName())) {
|
|
|
|
sourceAttrs.remove(attribute.getPropertyName());
|
|
|
|
sourceAttrs.remove(attribute.getPropertyName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// else {
|
|
|
|
// else {
|
|
|
|
// for (String key : sourceAttrs.keySet()) {
|
|
|
|
// for (String key : sourceAttrs.keySet()) {
|
|
|
|
// sourceAttrs.remove(key);
|
|
|
|
// sourceAttrs.remove(key);
|
|
|
@ -1201,8 +1218,10 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
if (sourceValue != null) {
|
|
|
|
if (sourceValue != null) {
|
|
|
|
StrObjMap matchAttr = new StrObjMap();
|
|
|
|
StrObjMap matchAttr = new StrObjMap();
|
|
|
|
matchAttr.put("name", sourceValue);
|
|
|
|
matchAttr.put("name", sourceValue);
|
|
|
|
matchAttr.put("diy_type", 0);
|
|
|
|
matchAttr.put("diy_type", attribute.getDiyType());
|
|
|
|
matchAttr.put("value", 0);
|
|
|
|
matchAttr.put("value", 0);
|
|
|
|
|
|
|
|
matchAttr.put("type",attribute.getType());
|
|
|
|
|
|
|
|
matchAttr.put("required",attribute.getRequired());
|
|
|
|
return Collections.singletonList(matchAttr);
|
|
|
|
return Collections.singletonList(matchAttr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|