Explorar el Código

Merge remote-tracking branch 'origin/master'

LLL hace 4 meses
padre
commit
b1a9d016ac

+ 1 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/mapper/xml/InterlockCountDayMapper.xml

@@ -15,6 +15,7 @@
         select count_num as tyl,day as time
         from interlock_count_day
         where count_type = '2' and device_id = #{deviceId} and interlock_name = #{systemName} and day > #{beginDate} and day <![CDATA[ <= ]]> #{endDate}
+        order by day
     </select>
 
     <select id="getLoopHealthLevels" resultType="org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel">

+ 29 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/impl/InterlockCountDayServiceImpl.java

@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description: interlock_count_day
@@ -68,7 +69,34 @@ public class InterlockCountDayServiceImpl extends ServiceImpl<InterlockCountDayM
 
     @Override
     public List<LoopHealthLevel> getCurrentLoopHealthLevels(String deviceId, String systemId) {
-        return mapper.getCurrentLoopHealthLevels(deviceId, systemId);
+        List<LoopHealthLevel> loopHealthLevelList = mapper.getCurrentLoopHealthLevels(deviceId, systemId);
+
+
+        ArrayList<LoopHealthLevel> loopHealthLevelResultList = new ArrayList<>();
+        ArrayList<String> djList = new ArrayList<>();
+        djList.add("A");
+        djList.add("B");
+        djList.add("C");
+        djList.add("D");
+
+        if (loopHealthLevelList.size() != 4){
+            ArrayList<String> jkdjList = new ArrayList<>();
+            for (LoopHealthLevel son : loopHealthLevelList) {
+                jkdjList.add(son.getLevel());
+            }
+            List<String> difference = djList.stream()
+                    .filter(item -> !jkdjList.contains(item))
+                    .collect(Collectors.toList());
+            for (String d:difference) {
+                LoopHealthLevel loopHealthLevel = new LoopHealthLevel();
+                loopHealthLevel.setLevel(d);
+                loopHealthLevel.setNumber("0");
+                loopHealthLevel.setTime(loopHealthLevelList.get(0).getTime());
+                loopHealthLevelList.add(loopHealthLevel);
+            }
+        }
+
+        return loopHealthLevelList;
     }
 
     @Override