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; + } + } + } + } + } }