Selaa lähdekoodia

Merge branch 'v2.1.1' of http://39.106.8.246:3003/apm/energy-eq-run-diagnose into v2.1.1

lixing 3 vuotta sitten
vanhempi
commit
b5dea263ae

+ 13 - 25
src/main/java/com/persagy/apm/diagnose/maintenance/service/impl/ProjectDataRecordServiceImpl.java

@@ -556,10 +556,10 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
             }
             //构造实体对象
             MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
+            monitorIndicatorRecord.setProject(projectId);
+            monitorIndicatorRecord.setObjId(objId);
             monitorIndicatorRecord.setMonitorIndicatorId(saveIndicatorType.getCode());
             monitorIndicatorRecord.setDataTime(start);
-            monitorIndicatorRecord.setObjId(objId);
-            monitorIndicatorRecord.setProject(projectId);
             monitorIndicatorRecord.setDataValue(Double.valueOf(dayNum));
             monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
         }
@@ -590,6 +590,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                 checkDate = record.getDataTime();
             }
             //继续往前找报警开始日期
+            checkDate = com.persagy.apm.diagnose.utils.DateUtils.addDays(checkDate,-1);
             return getStartAlarmDate(checkDate, projectId, objId, indicatorId, operator, tempFormula);
         }
         return alarmDate;
@@ -600,29 +601,16 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
      */
     public boolean isAccordWith(String operator, Double limitVal, Double checkVal) {
         if (!StringUtils.isBlank(operator) && null != limitVal && null != checkVal) {
-            switch (operator) {
-                case "≥":
-                    if (checkVal >= limitVal) {
-                        return true;
-                    }
-                case ">":
-                    if (checkVal > limitVal) {
-                        return true;
-                    }
-                case "≤":
-                    if (checkVal <= limitVal) {
-                        return true;
-                    }
-                case "<":
-                    if (checkVal < limitVal) {
-                        return true;
-                    }
-                case "=":
-                    if (checkVal == limitVal) {
-                        return true;
-                    }
-                default:
-                    return false;
+            if ("≥".equals(operator) && checkVal >= limitVal){
+                return true;
+            }else if (">".equals(operator) && checkVal > limitVal){
+                return true;
+            }else if ("≤".equals(operator) && checkVal <= limitVal){
+                return true;
+            }else if ("<".equals(operator) && checkVal < limitVal){
+                return true;
+            }else if ("=".equals(operator) && checkVal == limitVal){
+                return true;
             }
         }
         return false;