Browse Source

环境健康和数据质量图表日期列表修正

wangchenghong 3 years ago
parent
commit
a0a3083806

+ 8 - 1
src/main/java/com/persagy/apm/energy/report/common/service/impl/CommonServiceImpl.java

@@ -234,13 +234,20 @@ public class CommonServiceImpl implements CommonService {
             CountAndDayRateDataVo dataVo = iDataAnalysisWebService.getIotDataAnalysisData(userCode, groupCode, projectId, reportDate, targetCode);
             List<DateGraphItemVO> dateGraphItemVOList = new ArrayList<>();
             TreeMap<Date, Double> dataMap = dataVo.getDataMap();
-            if (null != dataMap && dataMap.size() != 0) {
+            /*if (null != dataMap && dataMap.size() != 0) {
                 for (Map.Entry<Date, Double> entry : dataMap.entrySet()) {
                     DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
                     dateGraphItemVO.setDate(entry.getKey());
                     dateGraphItemVO.setValue(entry.getValue());
                     dateGraphItemVOList.add(dateGraphItemVO);
                 }
+            }*/
+            List<Date> dateList = DateUtils.getDayList(reportDate, DateUtils.getMonthOff(reportDate, 1));
+            for (Date date : dateList) {
+                DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
+                dateGraphItemVO.setDate(date);
+                dateGraphItemVO.setValue(null == dataMap ? null : dataMap.get(date));
+                dateGraphItemVOList.add(dateGraphItemVO);
             }
             hotelProjectMaintenanceGraph.setMonthlyValue(dataVo.getCountRate());
             String standardValue = null;

+ 8 - 1
src/main/java/com/persagy/apm/energy/report/environment/service/impl/IEnvironmentWebServiceImpl.java

@@ -118,13 +118,20 @@ public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
                         dataInfoMap = new HashMap();
                     }
                     TreeMap<String, Double> dataMap =  new TreeMap<>(dataInfoMap);
-                    if (!CollectionUtils.isEmpty(dataMap)) {
+                    /*if (!CollectionUtils.isEmpty(dataMap)) {
                         for (Map.Entry<String, Double> entry : dataMap.entrySet()) {
                             DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
                             dateGraphItemVO.setDate(DateUtils.str2Date(entry.getKey(),DateUtils.SDF_SECOND));
                             dateGraphItemVO.setValue(entry.getValue());
                             detailInfo.add(dateGraphItemVO);
                         }
+                    }*/
+                    List<Date> dateList = DateUtils.getDayList(DateUtils.str2Date(batchQueryEnvListByParamDTO.getStartTime(), DateUtils.SDF_SECOND), DateUtils.str2Date(batchQueryEnvListByParamDTO.getEndTime(), DateUtils.SDF_SECOND));
+                    for (Date date : dateList) {
+                        DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
+                        dateGraphItemVO.setDate(date);
+                        dateGraphItemVO.setValue(null == dataMap ? null : dataMap.get(DateUtils.date2Str(date, DateUtils.SDF_SECOND)));
+                        detailInfo.add(dateGraphItemVO);
                     }
                     resultList.add(hotelProjectKpiItem);
                 }