瀏覽代碼

矩阵遥测遥信测点排序

王波 4 天之前
父節點
當前提交
7b19bffae9

+ 1 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconTestingPoint.java

@@ -30,7 +30,7 @@ public class ProEconTestingPoint extends Model {
     /**
      * 编码
      */
-    private String nemCode;
+    private Integer nemCode;
 
     /**
      * 名称

+ 20 - 8
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/DeviceDetailsService.java

@@ -18,10 +18,7 @@ import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -130,11 +127,26 @@ public class DeviceDetailsService {
         Map<String, List<ProEconTestingPoint>> resultMap = new HashMap<>();
         Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
         QueryWrapper<ProEconTestingPoint> qw = new QueryWrapper<>();
-        qw.lambda().eq(ProEconTestingPoint::getModel, wtmap.get(wtid).getModelId()).eq(ProEconTestingPoint::getLogicalUnitId, part);
-        qw.lambda().eq(ProEconTestingPoint::getSpare3,"1");
+        qw.lambda()
+                .eq(ProEconTestingPoint::getModel, wtmap.get(wtid).getModelId())
+                .eq(ProEconTestingPoint::getLogicalUnitId, part)
+                .eq(ProEconTestingPoint::getSpare3, "1")
+                .orderByAsc(ProEconTestingPoint::getNemCode); // 添加数据库层面的排序
+
         List<ProEconTestingPoint> list = proEconTestingPointService.list(qw);
-        resultMap.put("AI", list.stream().filter(i -> i.getUniformCode().startsWith("AI")).collect(Collectors.toList()));
-        resultMap.put("DI", list.stream().filter(i -> i.getUniformCode().startsWith("DI")).collect(Collectors.toList()));
+
+        // 对AI列表按nemcod排序
+        resultMap.put("AI", list.stream()
+                .filter(i -> i.getUniformCode().startsWith("AI"))
+                .sorted(Comparator.comparing(ProEconTestingPoint::getNemCode))
+                .collect(Collectors.toList()));
+
+        // 对DI列表按nemcod排序
+        resultMap.put("DI", list.stream()
+                .filter(i -> i.getUniformCode().startsWith("DI"))
+                .sorted(Comparator.comparing(ProEconTestingPoint::getNemCode))
+                .collect(Collectors.toList()));
+
         return resultMap;
     }
 }