Browse Source

修改获取默认计算发数时间方法:如果数据库中没有设置默认时间,则取当前时刻-1小时

shaohongbo 3 years ago
parent
commit
a8c1511ea2

+ 4 - 3
src/main/java/com/persagy/apm/diagnose/indicatorrecord/service/impl/MonitorIndicatorRecordServiceImpl.java

@@ -270,12 +270,14 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
 
         for (Map.Entry<String, Double> entry : timeDataMap.entrySet()) {
             Date dataTime = DateUtils.str2Date(entry.getKey(), DateUtils.SDF_SECOND);
+            if(dataTime.getTime()==lastComputeTime.getTime()){
+                continue;
+            }
             if (dataTime.getTime() > System.currentTimeMillis()) {
                 break;
             }
             computeCalculateDTO.setDataTime(dataTime);
             Double targetData;
-
             targetData = computeObjTargetDataByCalculate(computeCalculateDTO, formula);
             if (targetData == null) {
                 break;
@@ -295,8 +297,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
     private Date getDefultStartTime() throws Exception {
         Date lastComputeTime;
         if (StringUtils.isBlank(computePropertiesConfig.getDStartTime())) {
-
-            lastComputeTime = DateUtils.get15MinLite(new Date());
+            lastComputeTime = DateUtils.get15MinLite(DateUtils.addHours(new Date(),-1));
         } else {
             lastComputeTime = DateUtils.str2Date(computePropertiesConfig.getDStartTime(), DateUtils.SDF_SECOND);
         }