Преглед на файлове

南沙温湿度导入修正值增加判断空处理

WuYi преди 10 часа
родител
ревизия
7df3499a5f

+ 41 - 16
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/thirtyparty/service/impl/NanShaWsdServiceImpl.java

@@ -6,6 +6,7 @@ import com.lc.ibps.api.base.constants.StateEnum;
 import com.lc.ibps.base.core.util.BeanUtils;
 import com.lc.ibps.base.core.util.Collections;
 import com.lc.ibps.base.core.util.I18nUtil;
+import com.lc.ibps.base.core.util.string.StringUtil;
 import com.lc.ibps.base.framework.id.UniqueIdUtil;
 import com.lc.ibps.base.web.context.ContextUtil;
 import com.lc.ibps.business.thirtyparty.service.NanShaWsdService;
@@ -242,8 +243,14 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 double value = Double.parseDouble(StrUtil.str(day.get("wen_shi_du_zhi_")));
                 double max = Double.parseDouble(StrUtil.str(day.get("zui_da_zhi_")));
                 double min = Double.parseDouble(StrUtil.str(day.get("zui_xiao_zhi_")));
-                double wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
-                double shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                double wenDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))){
+                    wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                }
+                double shiDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))){
+                    shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                }
                 double calculate;
                 String type = StrUtil.str(day.get("shu_ju_lei_xing_"));
                 String status = StrUtil.str(day.get("shi_fou_shi_kong_")).equals("是")?"失控":"正常";
@@ -255,11 +262,11 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 shi_ji_shi_jian_ = StrUtil.str(day.get("cai_ji_shi_jian_"));
                 if (type.equals("温度")){
                     wdfw = "温度:"+min+"~"+max+"℃";
-                    tempObj.put("fixValue",StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))?StrUtil.str(day.get("wen_du_xiu_zheng_")):"");
                     calculate = value + wenDuXiuZheng;
                 }else {
                     sdfw = "湿度:"+min+"~"+max+"%";
-                    tempObj.put("fixValue",StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))?StrUtil.str(day.get("shi_du_xiu_zheng_")):"");
                     calculate = value + shiDuXiuZheng;
                 }
                 tempObj.put("range",tempRange);
@@ -303,8 +310,14 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 double value = Double.parseDouble(StrUtil.str(day.get("wen_shi_du_zhi_")));//原值
                 double max = Double.parseDouble(StrUtil.str(day.get("zui_da_zhi_"))); //最大值
                 double min = Double.parseDouble(StrUtil.str(day.get("zui_xiao_zhi_")));//最小值
-                double wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
-                double shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                double wenDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))){
+                    wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                }
+                double shiDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))){
+                    shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                }
                 double calculate;
                 String type = StrUtil.str(day.get("shu_ju_lei_xing_"));
                 String status = StrUtil.str(day.get("shi_fou_shi_kong_")).equals("是")?"失控":"正常";
@@ -319,11 +332,11 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 tempRange.add(max);
                 if (type.equals("温度")){
                     wdfw = "温度:"+min+"~"+max+"℃";
-                    tempObj.put("fixValue",StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))?StrUtil.str(day.get("wen_du_xiu_zheng_")):"");
                     calculate = value + wenDuXiuZheng;
                 }else {
                     sdfw = "湿度:"+min+"~"+max+"%";
-                    tempObj.put("fixValue",StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))?StrUtil.str(day.get("shi_du_xiu_zheng_")):"");
                     calculate = value + shiDuXiuZheng;
                 }
                 tempObj.put("range",tempRange);
@@ -367,8 +380,14 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 double value = Double.parseDouble(StrUtil.str(day.get("wen_shi_du_zhi_")));
                 double max = Double.parseDouble(StrUtil.str(day.get("zui_da_zhi_")));
                 double min = Double.parseDouble(StrUtil.str(day.get("zui_xiao_zhi_")));
-                double wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
-                double shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                double wenDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))){
+                    wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                }
+                double shiDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))){
+                    shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                }
                 double calculate;
                 String type = StrUtil.str(day.get("shu_ju_lei_xing_"));
                 String status = StrUtil.str(day.get("shi_fou_shi_kong_")).equals("是")?"失控":"正常";
@@ -383,11 +402,11 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 tempRange.add(max);
                 if (type.equals("温度")){
                     wdfw = "温度:"+min+"~"+max+"℃";
-                    tempObj.put("fixValue",StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))?StrUtil.str(day.get("wen_du_xiu_zheng_")):"");
                     calculate = value + wenDuXiuZheng;
                 }else {
                     sdfw = "湿度:"+min+"~"+max+"%";
-                    tempObj.put("fixValue",StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))?StrUtil.str(day.get("shi_du_xiu_zheng_")):"");
                     calculate = value + shiDuXiuZheng;
                 }
                 tempObj.put("range",tempRange);
@@ -430,8 +449,14 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 double value = Double.parseDouble(StrUtil.str(day.get("wen_shi_du_zhi_")));
                 double max = Double.parseDouble(StrUtil.str(day.get("zui_da_zhi_")));
                 double min = Double.parseDouble(StrUtil.str(day.get("zui_xiao_zhi_")));
-                double wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
-                double shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                double wenDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))){
+                    wenDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                }
+                double shiDuXiuZheng = 0;
+                if(StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))){
+                    shiDuXiuZheng = Double.parseDouble(StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                }
                 double calculate;
                 String type = StrUtil.str(day.get("shu_ju_lei_xing_"));
                 String status = StrUtil.str(day.get("shi_fou_shi_kong_")).equals("是")?"失控":"正常";
@@ -446,11 +471,11 @@ public class NanShaWsdServiceImpl extends WsdBaseServiceImpl implements NanShaWs
                 tempRange.add(max);
                 if (type.equals("温度")){
                     wdfw = "温度:"+min+"~"+max+"℃";
-                    tempObj.put("fixValue",StrUtil.str(day.get("wen_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("wen_du_xiu_zheng_")))?StrUtil.str(day.get("wen_du_xiu_zheng_")):"");
                     calculate = value + wenDuXiuZheng;
                 }else {
                     sdfw = "湿度:"+min+"~"+max+"%";
-                    tempObj.put("fixValue",StrUtil.str(day.get("shi_du_xiu_zheng_")));
+                    tempObj.put("fixValue",StringUtil.isNotEmpty(StrUtil.str(day.get("shi_du_xiu_zheng_")))?StrUtil.str(day.get("shi_du_xiu_zheng_")):"");
                     calculate = value + shiDuXiuZheng;
                 }
                 tempObj.put("range",tempRange);