From 31189373f177755f0b0ec18c368cc3c33e3cd007 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期四, 21 九月 2023 09:29:01 +0800
Subject: [PATCH] 设备健康列表

---
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWellJson.java        |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java       |    6 +
 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java               |    2 
 ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java               |   67 +++++++++------------
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeDeptWell.java              |   38 ++++++++++--
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java |    3 
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWell.java            |   15 ----
 7 files changed, 71 insertions(+), 62 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java
index 90223ca..3abebab 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java
@@ -54,9 +54,10 @@
 
     private Long deptId;
 
-    private Integer parentId;
+    private Long parentId;
 
     private String ancestors;
 
     private String deptName;
+
 }
diff --git a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
index 4ba7c26..9fd511f 100644
--- a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
+++ b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
@@ -81,7 +81,7 @@
         //绛夌骇
         int count0 = 0,count1 = 0,count2 = 0;
         //瑁呮暟鎹�
-        List<HealthVo> healthVos = new ArrayList<>();
+        List<TreeDeptWell> treeDeptWells = new ArrayList<>();
         if ((int) mapResult.get("code") == 200) {
             List<Map<String, Object>> listResult = (List<Map<String, Object>>) JSON.parse((String) mapResult.get("resdata"));
             //寰幆寰楀埌鏉冮檺涓嬪尮閰嶆暟鎹�
@@ -93,19 +93,21 @@
                         if(wellId!=null){
                             if(wellId.equals(equipNumber)){
                                 //杩斿洖璁惧鏁版嵁
-                                HealthVo healthVo = new HealthVo();
-                                healthVo.setId((Integer) listResult.get(i).get("id"));
-                                healthVo.setEquipName((String) listResult.get(i).get("EquipName"));
-                                healthVo.setEquipNumber((String) listResult.get(i).get("EquipNumber"));
-                                healthVo.setEquipLevel((String) listResult.get(i).get("EquipLevel"));
-                                healthVo.setEquipKey((String) listResult.get(i).get("EquipKey"));
-                                healthVo.setMeasureDate((String) listResult.get(i).get("MeasureDate"));
-                                healthVo.setLongitude(list.get(j).getLongitude());
-                                healthVo.setLatitude(list.get(j).getLatitude());
-                                healthVo.setAltitude(list.get(j).getAltitude());
-                                healthVo.setDeptId(list.get(j).getDeptId());
-                                healthVo.setAncestors(list.get(j).getAncestors());
-                                healthVos.add(healthVo);
+                                TreeDeptWell treeDeptWell = new TreeDeptWell();
+                                treeDeptWell.setId((Integer) listResult.get(i).get("id"));
+                                treeDeptWell.setEquipName((String) listResult.get(i).get("EquipName"));
+                                treeDeptWell.setEquipNumber((String) listResult.get(i).get("EquipNumber"));
+                                treeDeptWell.setEquipLevel((String) listResult.get(i).get("EquipLevel"));
+                                treeDeptWell.setEquipKey((String) listResult.get(i).get("EquipKey"));
+                                treeDeptWell.setMeasureDate((String) listResult.get(i).get("MeasureDate"));
+                                treeDeptWell.setLongitude(list.get(j).getLongitude());
+                                treeDeptWell.setLatitude(list.get(j).getLatitude());
+                                treeDeptWell.setAltitude(list.get(j).getAltitude());
+                                treeDeptWell.setDeptId(list.get(j).getDeptId());
+                                treeDeptWell.setAncestors(list.get(j).getAncestors());
+                                treeDeptWell.setParentId(list.get(j).getParentId());
+                                treeDeptWell.setDeptName(list.get(j).getDeptName());
+                                treeDeptWells.add(treeDeptWell);
                                 if(listResult.get(i).get("EquipLevel").equals("0")){
                                     count0++;
                                 }else if(listResult.get(i).get("EquipLevel").equals("1")){
@@ -136,16 +138,16 @@
                 }
             }
             //鎶婇儴闂ㄥ眰绾у拰鏁版嵁缁撳悎
-            List<TreeDeptWell> treeDeptWells = new ArrayList<>();
+//            List<TreeDeptWell> treeDeptWells = new ArrayList<>();
             for (int i = 0; i < sysDepts.size(); i++) {
+                //閮ㄩ棬ID
                 SysDept sysDept = sysDepts.get(i);
                 Long deptId = sysDept.getDeptId();
-                List<HealthVo> deptHealths = new ArrayList<>();
-                for (int j = 0; j < healthVos.size(); j++) {
-                    HealthVo healthVo = healthVos.get(j);
+                for (int j = 0; j < treeDeptWells.size(); j++) {
+                    //璁惧鐨勯儴闂↖D
+                    TreeDeptWell healthVo = treeDeptWells.get(j);
                     Long healthDeptId = healthVo.getDeptId();
                     if(deptId.equals(healthDeptId)){
-                        deptHealths.add(healthVo);
                         //鐖剁骇缁撴瀯璧嬪��
                         String thisAncestors = healthVo.getAncestors();
                         List<String> ancestorsA = Arrays.asList(thisAncestors.split(","));
@@ -155,14 +157,15 @@
                             //寰幆鏈�缁圠ist鍒ゆ柇鏄惁鏈夎鏁版嵁鐨勭埗绾э紝濡傛灉娌℃湁灏卞~杩涘幓
                             boolean wellTrue = false;
                             if(ancestor==0){
+                                //鐖剁被闆嗗悎涓�0鍒欐槸鏈�椤剁骇涓婇潰娌℃湁
                                 wellTrue = true;
                             }else {
-                                if(treeDeptWells.size()>0){
-                                    for (int l = 0; l < treeDeptWells.size(); l++) {
-                                        Long treeId = treeDeptWells.get(l).getDeptId();
-                                        if(ancestor.equals(treeId)){
-                                            wellTrue = true;
-                                        }
+                                for (int l = 0; l < treeDeptWells.size(); l++) {
+                                    //濡傛灉璇ョ埗绫婚泦鍚堝湪缁撴瀯涓凡缁忓瓨鍦ㄥ苟涓斾笉鏄澶囨暟鎹氨涓嶇敤閲嶅娣诲姞浜�
+                                    Long treeId = treeDeptWells.get(l).getDeptId();
+                                    Integer id = treeDeptWells.get(l).getId();
+                                    if(ancestor.equals(treeId) && id==null){
+                                        wellTrue = true;
                                     }
                                 }
                             }
@@ -172,26 +175,14 @@
                                 treeDeptWell.setDeptId(ancestor);
                                 treeDeptWell.setAncestors(sysDept1.getAncestors());
                                 treeDeptWell.setDeptName(sysDept1.getDeptName());
-                                treeDeptWell.setOrderNum(sysDept1.getOrderNum());
                                 treeDeptWell.setParentId(sysDept1.getParentId());
                                 treeDeptWells.add(treeDeptWell);
                             }
                         }
                     }
                 }
-                if(deptHealths.size()>0){
-                    //鏈夎澶囧睍绀�
-                    TreeDeptWell treeDeptWell = new TreeDeptWell();
-                    treeDeptWell.setDeptId(deptId);
-                    treeDeptWell.setAncestors(sysDept.getAncestors());
-                    treeDeptWell.setDeptName(sysDept.getDeptName());
-                    treeDeptWell.setOrderNum(sysDept.getOrderNum());
-                    treeDeptWell.setParentId(sysDept.getParentId());
-                    treeDeptWell.setWell(deptHealths);
-                    treeDeptWells.add(treeDeptWell);
-                }
             }
-            List<TreeSelectWell> tree = sysDeptService.wellTree(treeDeptWells);
+            List<TreeDeptWell> tree = sysDeptService.wellTree(treeDeptWells);
             TreeSelectWellJson treeSelectWellJson = new TreeSelectWellJson();
             treeSelectWellJson.setWellList(tree);
             treeSelectWellJson.setCount0(count0);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeDeptWell.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeDeptWell.java
index 5eb85b0..a247737 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeDeptWell.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeDeptWell.java
@@ -5,27 +5,53 @@
 import com.ruoyi.common.core.domain.entity.SysDept;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 @Data
 public class TreeDeptWell {
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private Long deptId;
     /** 鐖堕儴闂↖D */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private Long parentId;
 
     /** 绁栫骇鍒楄〃 */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private String ancestors;
 
     /** 閮ㄩ棬鍚嶇О */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private String deptName;
 
-    /** 鏄剧ず椤哄簭 */
-    private Integer orderNum;
+//    /** 鏄剧ず椤哄簭 */
+//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+//    private Integer orderNum;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Integer id;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private String equipName;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private String equipNumber;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private String equipKey;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private String equipLevel;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private String measureDate;
+//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+//    private Long WellDeptId;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private BigDecimal longitude;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private BigDecimal latitude;
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private BigDecimal altitude;
+//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+//    private String ancestor;
 
-    private List<HealthVo> well = new ArrayList<>();
-
-    @TableField(exist = false)
-    private List<TreeDeptWell> children = new ArrayList<TreeDeptWell>();
+    private List<TreeDeptWell> children = new ArrayList<>();
 
 }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWell.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWell.java
index f8abd28..173bc1e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWell.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWell.java
@@ -7,6 +7,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -25,18 +26,7 @@
     private String label;
 
     /** 瀛愯妭鐐� */
-    @JsonInclude(JsonInclude.Include.NON_EMPTY)
-    private List<TreeSelectWell> children;
-
-    public List<HealthVo> getWell() {
-        return well;
-    }
-
-    public void setWell(List<HealthVo> well) {
-        this.well = well;
-    }
-
-    private List<HealthVo> well = new ArrayList<>();
+    private List<TreeSelectWell> children = new ArrayList<>();
 
     public TreeSelectWell()
     {
@@ -47,7 +37,6 @@
     {
         this.id = dept.getDeptId();
         this.label = dept.getDeptName();
-        this.well = dept.getWell();
         this.children = dept.getChildren().stream().map(TreeSelectWell::new).collect(Collectors.toList());
     }
 
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWellJson.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWellJson.java
index f36d151..acba61a 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWellJson.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelectWellJson.java
@@ -19,7 +19,7 @@
 {
     private static final long serialVersionUID = 1L;
 
-    List<TreeSelectWell> wellList;
+    List<TreeDeptWell> wellList;
     int count0;
     int count1;
     int count2;
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
index 0b3d308..403ffed 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
@@ -143,6 +143,6 @@
      * @param depts
      * @return
      */
-    List<TreeSelectWell> wellTree(List<TreeDeptWell> depts);
+    List<TreeDeptWell> wellTree(List<TreeDeptWell> depts);
     List<TreeDeptWell> buildDeptWellTree(List<TreeDeptWell> depts);
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
index e0a4d85..85bdae2 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
@@ -4,6 +4,7 @@
 import java.util.stream.Collectors;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.HealthVo;
 import com.ruoyi.common.core.domain.TreeDeptWell;
 import com.ruoyi.common.core.domain.TreeSelectWell;
 import org.springframework.stereotype.Service;
@@ -366,9 +367,10 @@
     }
 
     @Override
-    public List<TreeSelectWell> wellTree(List<TreeDeptWell> depts) {
+    public List<TreeDeptWell> wellTree(List<TreeDeptWell> depts) {
         List<TreeDeptWell> deptTrees = buildDeptWellTree(depts);
-        return deptTrees.stream().map(TreeSelectWell::new).collect(Collectors.toList());
+        return deptTrees;
+//        return deptTrees.stream().map(TreeSelectWell::new).collect(Collectors.toList());
     }
 
     @Override

--
Gitblit v1.9.3