jichaobo před 3 roky
rodič
revize
4d6b234358

+ 13 - 4
fiveep-service/src/main/java/com/bizmatics/service/impl/BulletinCruxConfigServiceImpl.java

@@ -249,7 +249,9 @@ public class BulletinCruxConfigServiceImpl extends AbstractCrudService<BulletinC
                         String startTime = time + " " + startHms;
                         String endTime = time + " " + endHms;
                         List<RtData> rtData = baseMapper.getTextData(table, fieldData, deviceCode, startTime, endTime);
-                        bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        if(rtData.isEmpty()||rtData==null){
+                            bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        }
                     } else if (list.get(i).getCycle() == 2) {//本月
                         Calendar calendar = new GregorianCalendar();
                         calendar.setTime(new Date());
@@ -261,16 +263,23 @@ public class BulletinCruxConfigServiceImpl extends AbstractCrudService<BulletinC
                         calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
                         String endTime = sdf.format(calendar.getTime()) + " " + endHms;
                         List<RtData> rtData = baseMapper.getTextData(table, fieldData, deviceCode, startTime, endTime);
-                        bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        if(rtData.isEmpty()||rtData==null){
+                            bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        }
                     } else if (list.get(i).getCycle() == 3) {//本年
                         String time = sdfa.format(new Date());
                         String startTime = time + "-01-01 00:00:00";
                         String endTime = time + "-12-31 23:59:59";
                         List<RtData> rtData = baseMapper.getTextData(table, fieldData, deviceCode, startTime, endTime);
-                        bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        if(rtData.isEmpty()||rtData==null){
+                            bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        }
                     } else if (list.get(i).getCycle() == 3) {//实时值
                         List<RtData> rtData = baseMapper.getTextData(table1, field + " as textValue ", deviceCode, null, null);
-                        bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        if(rtData.isEmpty()||rtData==null){
+                            bulletinCruxConfigVo.setTextValue(rtData.get(0).getTextValue());
+                        }
+
                     }
                 } else if (list.get(i).getDataType() == 4) {//站点告警状态
                     Integer alarCount = baseMapper.getAlarmCount(siteId);