Browse Source

SDK返回不需要符号 无穷返回空

yangwanyi 3 years ago
parent
commit
62aa74793e
1 changed files with 12 additions and 5 deletions
  1. 12 5
      src/main/java/com/persagy/dye/service/impl/DyeSdkServiceImpl.java

+ 12 - 5
src/main/java/com/persagy/dye/service/impl/DyeSdkServiceImpl.java

@@ -9,6 +9,7 @@ import com.persagy.dye.pojo.dto.DyeRuleDefault;
 import com.persagy.dye.pojo.vo.DyeScaleplateVO;
 import com.persagy.dye.service.IDyeSdkService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -51,11 +52,11 @@ public class DyeSdkServiceImpl implements IDyeSdkService {
             for (Map<String, Object> map : dyeScaleplateVO.getDynamicArray()) {
                 customRule = this.dyeRuleCustomMapper.getDistrictDyeRuleCustom(dyeScaleplateVO, map.get(DyeConstant.REALTIME_NUM) == null ? 0 : Integer.parseInt(String.valueOf(map.get(DyeConstant.REALTIME_NUM))));
                 if (customRule != null) {
-                    resultMap = this.changeProperties(customRule.getUpperLimit() + customRule.getUpperSymbol(), customRule.getLowerSymbol() + customRule.getLowerLimit(), customRule.getName(), customRule.getColorValue(), customRule.getId());
+                    resultMap = this.changeProperties(String.valueOf(customRule.getUpperLimit()), String.valueOf(customRule.getLowerLimit()), customRule.getName(), customRule.getColorValue(), customRule.getId());
                 } else {
                     defaultRule = this.dyeRuleDefaultMapper.getDistrictDyeRuleDefault(dyeScaleplateVO, map.get(DyeConstant.REALTIME_NUM) == null ? 0 : Integer.parseInt(String.valueOf(map.get(DyeConstant.REALTIME_NUM))));
                     if (defaultRule != null) {
-                        resultMap = this.changeProperties(defaultRule.getUpperLimit() + defaultRule.getUpperSymbol(), defaultRule.getLowerSymbol() + defaultRule.getLowerLimit(), defaultRule.getName(), defaultRule.getColorValue(), defaultRule.getId());
+                        resultMap = this.changeProperties(String.valueOf(defaultRule.getUpperLimit()), String.valueOf(defaultRule.getLowerLimit()), defaultRule.getName(), defaultRule.getColorValue(), defaultRule.getId());
                     }
                 }
                 resultMap.put(DyeConstant.PROJECT_ID, dyeScaleplateVO.getProjectId()); // 项目ID
@@ -88,7 +89,7 @@ public class DyeSdkServiceImpl implements IDyeSdkService {
         log.debug("com.persagy.dye.service.impl.DyeSdkServiceImpl.listDyeScaleplateByType,自定义染色标尺数据:{}", customList);
         if (!customList.isEmpty()) {
             for (DyeRuleCustom customRule : customList) {
-                list.add(this.changeProperties(customRule.getUpperLimit() + customRule.getUpperSymbol(), customRule.getLowerSymbol() + customRule.getLowerLimit(), customRule.getName(), customRule.getColorValue(), customRule.getId()));
+                list.add(this.changeProperties(String.valueOf(customRule.getUpperLimit()), String.valueOf(customRule.getLowerLimit()), customRule.getName(), customRule.getColorValue(), customRule.getId()));
             }
             return list;
         }
@@ -96,7 +97,7 @@ public class DyeSdkServiceImpl implements IDyeSdkService {
         log.debug("com.persagy.dye.service.impl.DyeSdkServiceImpl.listDyeScaleplateByType,默认染色标尺数据:{}", defaultList);
         if (!defaultList.isEmpty()) {
             for (DyeRuleDefault defaultRule : defaultList) {
-                list.add(this.changeProperties(defaultRule.getUpperLimit() + defaultRule.getUpperSymbol(), defaultRule.getLowerSymbol() + defaultRule.getLowerLimit(), defaultRule.getName(), defaultRule.getColorValue(), defaultRule.getId()));
+                list.add(this.changeProperties(String.valueOf(defaultRule.getUpperLimit()), String.valueOf(defaultRule.getLowerLimit()), defaultRule.getName(), defaultRule.getColorValue(), defaultRule.getId()));
             }
         }
         return list;
@@ -131,11 +132,17 @@ public class DyeSdkServiceImpl implements IDyeSdkService {
      */
     public String replace99ToBoundless(String limit) {
         final String numLimit = "99";
-        if (limit.indexOf(numLimit) != -1) {
+
+         /*if (limit.indexOf(numLimit) != -1) {
             limit = limit.replace(numLimit, "∞");
             if (limit.indexOf("-") == -1) { // 正无穷拼接加号
                 limit = "+" + limit;
             }
+        }*/
+
+        // SDK不需要返回无穷 但凡是无穷的给空就行
+        if (limit.indexOf(numLimit) != -1) {
+            return StringUtils.EMPTY;
         }
         return limit;
     }