소스 검색

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

shaohongbo 3 년 전
부모
커밋
a8c1511ea2
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      src/main/java/com/persagy/apm/diagnose/indicatorrecord/service/impl/MonitorIndicatorRecordServiceImpl.java

+ 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);
         }