搬家调试

20230922-ljl-fixBug
qiushengjie 1 year ago
parent f5f1caa399
commit eb3cc6f357

@ -806,7 +806,9 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
StrObjMap mStrObjmap = new StrObjMap(); StrObjMap mStrObjmap = new StrObjMap();
mStrObjmap.put("name",attribute.getPropertyName()); mStrObjmap.put("name",attribute.getPropertyName());
mStrObjmap.put("diy_type",attribute.getDiyType()); 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); matchList.add(mStrObjmap);
matchAttrs.put(currAid, matchList); matchAttrs.put(currAid, matchList);
} }

@ -998,4 +998,24 @@ public class CommonTool {
} }
return len; 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;
}
}
}
}
}
} }

Loading…
Cancel
Save