瀏覽代碼

Merge remote-tracking branch 'origin/master'

LLL 10 月之前
父節點
當前提交
0a60c9b267
共有 27 個文件被更改,包括 1601 次插入2 次删除
  1. 4 0
      jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 9 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/InterlockBaseMapper.java
  3. 7 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/xml/InterlockBaseMapper.xml
  4. 15 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/IInterlockBaseService.java
  5. 9 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/impl/InterlockBaseServiceImpl.java
  6. 123 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentInterlockStatusController.java
  7. 116 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentInterlockYbController.java
  8. 122 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentLoopHealthLeveController.java
  9. 107 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentTylController.java
  10. 141 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistoryLoopHealthLevelController.java
  11. 103 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistroyTylController.java
  12. 58 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/InterlockDeviceController.java
  13. 58 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/InterlockSystemController.java
  14. 23 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/InterlockAndYbStatus.java
  15. 20 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/InterlockTyl.java
  16. 22 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/LoopHealthLevel.java
  17. 22 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/RequestTargets.java
  18. 107 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/service/IDashboardINterfaceService.java
  19. 197 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/service/impl/IDashboardINterfaceServiceImpl.java
  20. 17 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/mapper/InterlockCountDayMapper.java
  21. 39 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/mapper/xml/InterlockCountDayMapper.xml
  22. 41 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/IInterlockCountDayService.java
  23. 136 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/impl/InterlockCountDayServiceImpl.java
  24. 1 1
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/DayStatisticsJob.java
  25. 1 1
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/MonthStatisticsJob.java
  26. 84 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/controller/TestDController.java
  27. 19 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/entity/ResultD.java

+ 4 - 0
jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -151,6 +151,10 @@ public class ShiroConfig {
         //测试模块排除
         filterChainDefinitionMap.put("/test/seata/**", "anon");
 
+
+        filterChainDefinitionMap.put("/testD/testD/**", "anon");
+        filterChainDefinitionMap.put("/dashboard/**/**", "anon");
+
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
         //如果cloudServer为空 则说明是单体 需要加载跨域配置【微服务跨域切换】

+ 9 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/InterlockBaseMapper.java

@@ -35,4 +35,13 @@ public interface InterlockBaseMapper extends BaseMapper<InterlockBase> {
 	 */
 	List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);
 
+	/**
+	*   author: dzc
+	*   version: 1.0
+	*   des: 查询所有的装置
+	*   date: 2024/7/2
+	*/
+	List<InterlockBase> getAllDevice();
+
+	List<InterlockBase> getAllSystemByDeviceId(@Param("id") String id);
 }

+ 7 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/xml/InterlockBaseMapper.xml

@@ -29,4 +29,11 @@
 		</if>
 	</select>
 
+	<select id="getAllDevice" resultType="org.jeecg.modules.base.entity.InterlockBase">
+		select * from interlock_base where interlock_type = '0' and has_child = '1'
+	</select>
+	<select id="getAllSystemByDeviceId" resultType="org.jeecg.modules.base.entity.InterlockBase">
+		select * from interlock_base where interlock_type = '1' and pid = #{id}
+	</select>
+
 </mapper>

+ 15 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/IInterlockBaseService.java

@@ -78,4 +78,19 @@ public interface IInterlockBaseService extends IService<InterlockBase> {
 	 */
 	List<SelectTreeModel> queryListByPid(String pid);
 
+	/**
+	*   author: dzc
+	*   version: 1.0
+	*   des: 查询所有的装置
+	*   date: 2024/7/2
+	*/
+	List<InterlockBase> getAllDevice();
+
+	/**
+	*   author: dzc
+	*   version: 1.0
+	*   des: 查询装置下的系统
+	*   date: 2024/7/2
+	*/
+	List<InterlockBase> getAllSystemByDeviceId(String id);
 }

+ 9 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/impl/InterlockBaseServiceImpl.java

@@ -322,4 +322,13 @@ public class InterlockBaseServiceImpl extends ServiceImpl<InterlockBaseMapper, I
         return sb;
     }
 
+    @Override
+    public List<InterlockBase> getAllDevice() {
+        return baseMapper.getAllDevice();
+    }
+
+    @Override
+    public List<InterlockBase> getAllSystemByDeviceId(String id) {
+        return baseMapper.getAllSystemByDeviceId(id);
+    }
 }

+ 123 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentInterlockStatusController.java

@@ -0,0 +1,123 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/3 13:38
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/currentInterlockStatus")
+@Slf4j
+public class CurrentInterlockStatusController {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockBaseService baseService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+
+        List<Map<String, Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map : targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)){
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)){
+                sysName = map.get("target").toString();
+            }
+        }
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        List<InterlockAndYbStatus> interlockStatusList = dashboardService.getCurronInterlockStatus(deviceName, sysName);
+
+
+        BigDecimal yty = BigDecimal.valueOf(0);
+        BigDecimal wty = BigDecimal.valueOf(0);
+
+        for (InterlockAndYbStatus item : interlockStatusList) {
+            if ("已投用数".equals(item.getStatusName())){
+                yty = new BigDecimal(item.getNumber());
+            }
+            if ("未投用数".equals(item.getStatusName())){
+                wty = new BigDecimal(item.getNumber());
+            }
+        }
+
+        BigDecimal total = yty.add(wty);
+
+        ResultD<String[]> result1 = new ResultD<>();
+        ResultD<String[]> result2 = new ResultD<>();
+        result1.setTarget("联锁总数");
+        result2.setTarget("未投用数");
+
+
+        ArrayList<String[]> strings1 = new ArrayList<>();
+        ArrayList<String[]> strings2 = new ArrayList<>();
+
+
+        String str1 = "2024-06-13";
+        Date data1 = format.parse(str1);
+
+        String[] v1 = new String[]{String.valueOf(total),data1.getTime()+""};
+        strings1.add(v1);
+        result1.setDatapoints(strings1);
+
+        String[] v2 = new String[]{String.valueOf(wty),data1.getTime()+""};
+        strings2.add(v2);
+        result2.setDatapoints(strings2);
+
+
+        list.add(result1);
+        list.add(result2);
+
+
+        return JSON.toJSONString(list);
+    }
+}

+ 116 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentInterlockYbController.java

@@ -0,0 +1,116 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/4 10:29
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/currentYbStatus")
+@Slf4j
+public class CurrentInterlockYbController {
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockBaseService baseService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+
+        List<Map<String, Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map : targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)) {
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)) {
+                sysName = map.get("target").toString();
+            }
+        }
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        List<InterlockAndYbStatus> interlockYbStatusList = dashboardService.getCurronYbStatus(deviceName, sysName);
+
+
+        String normalNumber = "0";  // 正常的数量
+        String anNormalNumber = "0";  // 异常的数量
+
+        for (InterlockAndYbStatus item : interlockYbStatusList) {
+            if ("正常".equals(item.getStatusName())) {
+                normalNumber = item.getNumber();
+            }
+            if ("故障".equals(item.getStatusName())) {
+                anNormalNumber = item.getNumber();
+            }
+        }
+
+
+        ResultD<String[]> result1 = new ResultD<>();
+        ResultD<String[]> result2 = new ResultD<>();
+        result1.setTarget("正常");
+        result2.setTarget("故障");
+
+
+        ArrayList<String[]> strings1 = new ArrayList<>();
+        ArrayList<String[]> strings2 = new ArrayList<>();
+
+
+        String str1 = "2024-06-13";
+        Date data1 = format.parse(str1);
+
+        String[] v1 = new String[]{normalNumber};
+        strings1.add(v1);
+        result1.setDatapoints(strings1);
+
+        String[] v2 = new String[]{anNormalNumber};
+        strings2.add(v2);
+        result2.setDatapoints(strings2);
+
+        list.add(result1);
+        list.add(result2);
+        return JSON.toJSONString(list);
+    }
+}

+ 122 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentLoopHealthLeveController.java

@@ -0,0 +1,122 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/3 9:38
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/currentloopHealthLevel")
+@Slf4j
+public class CurrentLoopHealthLeveController {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+
+        List<Map<String,Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map:targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)){
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)){
+                sysName = map.get("target").toString();
+            }
+        }
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        List<LoopHealthLevel> currentLoopHealthLevelsList = dashboardService.getCurrentLoopHealthLevels(deviceName, sysName);
+
+
+        for (LoopHealthLevel item : currentLoopHealthLevelsList) {
+            ResultD<String[]> result = new ResultD<>();
+            result.setTarget(item.getLevel());
+            ArrayList<String[]> strings = new ArrayList<>();
+            Date dateTime = format.parse(item.getTime());
+            String[] v = new String[]{item.getNumber(),String.valueOf(dateTime.getTime())};
+            strings.add(v);
+            result.setDatapoints(strings);
+            list.add(result);
+        }
+
+
+        //ResultD<String[]> a = new ResultD<>();
+        //ResultD<String[]> b = new ResultD<>();
+        //ResultD<String[]> c = new ResultD<>();
+        //
+        //a.setTarget("A");
+        //b.setTarget("B");
+        //c.setTarget("C");
+        //
+        //ArrayList<String[]> stringsA = new ArrayList<>();
+        //ArrayList<String[]> stringsB = new ArrayList<>();
+        //ArrayList<String[]> stringsC = new ArrayList<>();
+        //
+        //
+        //String str1 = "2024-06-13";
+        //Date data1 = format.parse(str1);
+        //
+        //String[] va1 = new String[]{"10",data1.getTime()+""};
+        //stringsA.add(va1);
+        //a.setDatapoints(stringsA);
+        //
+        //String[] vb1 = new String[]{"29",data1.getTime()+""};
+        //stringsB.add(vb1);
+        //b.setDatapoints(stringsB);
+        //
+        //String[] vc1 = new String[]{"17",data1.getTime()+""};
+        //stringsC.add(vc1);
+        //c.setDatapoints(stringsC);
+        //
+        //list.add(a);
+        //list.add(b);
+        //list.add(c);
+
+        return JSON.toJSONString(list);
+    }
+
+}

+ 107 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/CurrentTylController.java

@@ -0,0 +1,107 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/3 10:41
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/currentTyl")
+@Slf4j
+public class CurrentTylController {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+
+        List<Map<String,Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map:targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)){
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)){
+                sysName = map.get("target").toString();
+            }
+        }
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        List<InterlockTyl> tylList = dashboardService.getCurrentTylBySysName(deviceName, sysName);
+
+        for (InterlockTyl item:tylList) {
+            ResultD<String[]> result = new ResultD<>();
+            result.setTarget(sysName);
+            ArrayList<String[]> strings = new ArrayList<>();
+            Date dateTime = format.parse(item.getTime());
+            String[] v = new String[]{item.getTyl(),String.valueOf(dateTime.getTime())};
+            strings.add(v);
+            result.setDatapoints(strings);
+            list.add(result);
+        }
+
+
+        //ResultD<String[]> result = new ResultD<>();
+        //result.setTarget(sysName);
+        //
+        //
+        //ArrayList<String[]> strings = new ArrayList<>();
+        //
+        //
+        //String str1 = "2024-06-13";
+        //Date data1 = format.parse(str1);
+        //
+        //String[] v = new String[]{"85.00",data1.getTime()+""};
+        //strings.add(v);
+        //result.setDatapoints(strings);
+        //
+        //
+        //list.add(result);
+
+
+        return JSON.toJSONString(list);
+    }
+}

+ 141 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistoryLoopHealthLevelController.java

@@ -0,0 +1,141 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/2 16:46
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/historyloopHealthLevel")
+@Slf4j
+public class HistoryLoopHealthLevelController {
+
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
+        String beginDateStr = (String) rangeMap.get("from");
+        String endDateStr = (String) rangeMap.get("to");
+        Date beginDated = format.parse(beginDateStr);
+        Date endDated = format.parse(endDateStr);
+
+        String beginDate = format.format(beginDated);
+        String endDate = format.format(endDated);
+
+        List<Map<String,Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map:targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)){
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)){
+                sysName = map.get("target").toString();
+            }
+        }
+
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        Map<String, List<LoopHealthLevel>> loopHealthLevelMap = dashboardService.getLoopHealthLevels(deviceName, sysName, beginDate,endDate);
+
+        for (String key : loopHealthLevelMap.keySet()) {
+            ResultD<String[]> result = new ResultD<>();
+            result.setTarget(key);
+            ArrayList<String[]> strings = new ArrayList<>();
+            List<LoopHealthLevel> itemList = loopHealthLevelMap.get(key);
+            for (LoopHealthLevel item : itemList) {
+                Date dateTime = format.parse(item.getTime());
+                String[] v = new String[]{item.getNumber(),String.valueOf(dateTime.getTime())};
+                strings.add(v);
+            }
+            result.setDatapoints(strings);
+            list.add(result);
+        }
+
+
+
+        //ResultD<String[]> a = new ResultD<>();
+        //ResultD<String[]> b = new ResultD<>();
+        //
+        //a.setTarget("A");
+        //b.setTarget("B");
+        //
+        //ArrayList<String[]> stringsA = new ArrayList<>();
+        //ArrayList<String[]> stringsB = new ArrayList<>();
+        //
+        //String str1 = "2024-06-13";
+        //String str2 = "2024-06-14";
+        //String str3 = "2024-06-15";
+        //Date data1 = format.parse(str1);
+        //Date data2 = format.parse(str2);
+        //Date data3 = format.parse(str3);
+        //
+        //String[] va1 = new String[]{"10",data1.getTime()+""};
+        //String[] va2 = new String[]{"5",data2.getTime()+""};
+        //String[] va3 = new String[]{"20",data3.getTime()+""};
+        //stringsA.add(va1);
+        //stringsA.add(va2);
+        //stringsA.add(va3);
+        //a.setDatapoints(stringsA);
+        //
+        //String[] vb1 = new String[]{"25",data1.getTime()+""};
+        //String[] vb2 = new String[]{"15",data2.getTime()+""};
+        //String[] vb3 = new String[]{"8",data3.getTime()+""};
+        //stringsB.add(vb1);
+        //stringsB.add(vb2);
+        //stringsB.add(vb3);
+        //b.setDatapoints(stringsB);
+        //
+        //list.add(a);
+        //list.add(b);
+
+        return JSON.toJSONString(list);
+    }
+
+
+}

+ 103 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistroyTylController.java

@@ -0,0 +1,103 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.RequestTargets;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/1 16:45
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/historyTyl")
+@Slf4j
+public class HistroyTylController {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getDeviceSystem();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
+        String beginDateStr = (String) rangeMap.get("from");
+        String endDateStr = (String) rangeMap.get("to");
+        Date beginDated = format.parse(beginDateStr);
+        Date endDated = format.parse(endDateStr);
+
+        String beginDate = format.format(beginDated);
+        String endDate = format.format(endDated);
+
+        List<Map<String,Object>> targets = (List<Map<String, Object>>) request.get("targets");
+        String deviceName = "";
+        String sysName = "";
+        for (Map<String, Object> map:targets) {
+            String refId = (String) map.get("refId");
+            if ("A".equals(refId)){
+                deviceName = map.get("target").toString();
+            }
+            if ("B".equals(refId)){
+                sysName = map.get("target").toString();
+            }
+        }
+
+
+
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        List<InterlockTyl> tylList = dashboardService.getTylBySysNameTime(deviceName,sysName,beginDate,endDate);
+
+        ResultD<String[]> d = new ResultD<>();
+        d.setTarget(sysName);
+        ArrayList<String[]> strings = new ArrayList<>();
+
+
+        for (InterlockTyl item : tylList) {
+            String time = item.getTime();
+            Date dateTime = format.parse(time);
+            String[] v = new String[]{item.getTyl(),String.valueOf(dateTime.getTime())};
+            strings.add(v);
+        }
+        d.setDatapoints(strings);
+
+        list.add(d);
+
+        return JSON.toJSONString(list);
+    }
+}

+ 58 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/InterlockDeviceController.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/4 8:27
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/interlockDevice")
+@Slf4j
+public class InterlockDeviceController {
+
+
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+
+        List<String> list = dashboardService.getAllDevice();
+
+        return JSON.toJSONString(list);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+        ArrayList<ResultD> list = new ArrayList<>();
+        return JSON.toJSONString(list);
+    }
+}

+ 58 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/InterlockSystemController.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.dashboardInterface.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/3 15:48
+ * @package org.jeecg.modules.dashboardInterface.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/dashboard/interlockSystem")
+@Slf4j
+public class InterlockSystemController {
+
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IDashboardINterfaceService dashboardService;
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() {
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+        String deviceName = (String) request.get("target");
+        List<String> systemList = dashboardService.getSystemByDeviceName(deviceName);
+        return JSON.toJSONString(systemList);
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        return JSON.toJSONString(list);
+    }
+}

+ 23 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/InterlockAndYbStatus.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.dashboardInterface.entity;
+
+import lombok.Data;
+
+/**
+ * @author dzc
+ * @date 2024/7/1 15:24
+ * @package org.jeecg.modules.dashboardInterface.entity
+ * @project interlock_server
+ * @des
+ */
+@Data
+public class InterlockAndYbStatus {
+
+    /** 类型 正常/异常 */
+    private String statusName;
+
+    /** 数量 */
+    private String number;
+
+    /** 时间 */
+    private String time;
+}

+ 20 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/InterlockTyl.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.dashboardInterface.entity;
+
+import lombok.Data;
+
+/**
+ * @author dzc
+ * @date 2024/7/1 16:09
+ * @package org.jeecg.modules.dashboardInterface.entity
+ * @project interlock_server
+ * @des
+ */
+@Data
+public class InterlockTyl {
+
+    /** 投用率 */
+    private String tyl;
+
+    /** 时间 */
+    private String time;
+}

+ 22 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/LoopHealthLevel.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.dashboardInterface.entity;
+
+import lombok.Data;
+
+/**
+ * @author dzc
+ * @date 2024/7/3 8:32
+ * @package org.jeecg.modules.dashboardInterface.entity
+ * @project interlock_server
+ * @des
+ */
+@Data
+public class LoopHealthLevel {
+
+    /** 等级:A/B/C/D */
+    private String level;
+    /** 数量 */
+    private String number;
+    /** 时间 */
+    private String time;
+
+}

+ 22 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/entity/RequestTargets.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.dashboardInterface.entity;
+
+import lombok.Data;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.util.List;
+
+/**
+ * @author dzc
+ * @date 2024/7/2 11:28
+ * @package org.jeecg.modules.dashboardInterface.entity
+ * @project interlock_server
+ * @des
+ */
+@Data
+public class RequestTargets<T> {
+
+    private String target;
+    private String refId;
+    private String type;
+    private List<T> varFilters;
+}

+ 107 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/service/IDashboardINterfaceService.java

@@ -0,0 +1,107 @@
+package org.jeecg.modules.dashboardInterface.service;
+
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/1 15:01
+ * @package org.jeecg.modules.dashboardInterface.service
+ * @project interlock_server
+ * @des 可视化接口
+ */
+public interface IDashboardINterfaceService {
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的联锁状态
+    *   date: 2024/7/1
+    */
+    List<InterlockAndYbStatus> getCurronInterlockStatus(String deviceName,String systemName);
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的仪表状态
+    *   date: 2024/7/4
+    */
+    List<InterlockAndYbStatus> getCurronYbStatus(String deviceName,String system);
+
+
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的投用率
+    *   date: 2024/7/3
+    */
+    List<InterlockTyl> getCurrentTylBySysName(String deviceName,String systemName);
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的健康等级
+    *   date: 2024/7/3
+    */
+    List<LoopHealthLevel> getCurrentLoopHealthLevels(String deviceName,String systemName);
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁投用率统计
+    *   date: 2024/7/1
+    */
+    List<InterlockTyl> getTylBySysNameTime(String deviceName,String systemName,String beginDate,String endDate);
+
+
+    /**
+     *   author: dzc
+     *   version: 1.0
+     *   des: 联锁健康等级统计
+     *   date: 2024/7/2
+     */
+    Map<String,List<LoopHealthLevel>> getLoopHealthLevels(String deviceName,String systemName,String beginDate,String endDate);
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询 装置-系统
+    *   date: 2024/7/2
+    */
+    List<String> getDeviceSystem();
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询 所有的装置
+    *   date: 2024/7/3
+    */
+    List<String> getAllDevice();
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询 装置下的系统
+    *   date: 2024/7/3
+    */
+    List<String> getSystemByDeviceName(String deviceName);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统状态(相同系统的系统状态就是MP状态 ,该系统下的所有的联锁用的是同一个MP状态点位)
+    *   date: 2024/7/4
+    */
+    String getSystemStatus(String deviceName,String systemName);
+
+}

+ 197 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/service/impl/IDashboardINterfaceServiceImpl.java

@@ -0,0 +1,197 @@
+package org.jeecg.modules.dashboardInterface.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.dashboardInterface.service.IDashboardINterfaceService;
+import org.jeecg.modules.interlockCountDay.service.IInterlockCountDayService;
+import org.jeecg.modules.summary.service.IInterlockSummaryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dzc
+ * @date 2024/7/1 16:19
+ * @package org.jeecg.modules.dashboardInterface.service.impl
+ * @project interlock_server
+ * @des
+ */
+@Service
+public class IDashboardINterfaceServiceImpl implements IDashboardINterfaceService {
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockCountDayService countDayService;
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockBaseService baseService;
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的联锁状态
+    *   date: 2024/7/1
+    */
+    @Override
+    public List<InterlockAndYbStatus> getCurronInterlockStatus(String deviceName,String systemName) {
+        InterlockBase base1 = getBaseInfo(deviceName);
+        InterlockBase base2 = getBaseInfo(systemName);
+        return countDayService.getCurronInterlockStatus(base1.getId(),base2.getId());
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的仪表状态
+    *   date: 2024/7/4
+    */
+    @Override
+    public List<InterlockAndYbStatus> getCurronYbStatus(String deviceName, String system) {
+        InterlockBase base1 = getBaseInfo(deviceName);
+        InterlockBase base2 = getBaseInfo(system);
+        return countDayService.getYbStatus(base1.getId(), base2.getId());
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的投用率
+    *   date: 2024/7/3
+    */
+    @Override
+    public List<InterlockTyl> getCurrentTylBySysName(String deviceName, String systemName) {
+        InterlockBase base1 = getBaseInfo(deviceName);
+        InterlockBase base2 = getBaseInfo(systemName);
+        return countDayService.getCurrentTylBySysName(base1.getId(), base2.getId());
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的健康等级
+    *   date: 2024/7/3
+    */
+    @Override
+    public List<LoopHealthLevel> getCurrentLoopHealthLevels(String deviceName, String systemName) {
+        InterlockBase base1 = getBaseInfo(deviceName);
+        InterlockBase base2 = getBaseInfo(systemName);
+        return countDayService.getCurrentLoopHealthLevels(base1.getId(), base2.getId());
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁投用率统计
+    *   date: 2024/7/1
+    */
+    @Override
+    public List<InterlockTyl> getTylBySysNameTime(String deviceName,String systemName,String beginDate,String endDate) {
+        InterlockBase base = getBaseInfo(deviceName);
+        return countDayService.getTylBySysNameTime(base.getId(),systemName,beginDate,endDate);
+    }
+
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁健康等级统计
+    *   date: 2024/7/2
+    */
+    @Override
+    public Map<String, List<LoopHealthLevel>> getLoopHealthLevels(String deviceName, String systemName,String beginDate,String endDate) {
+        InterlockBase base = getBaseInfo(deviceName);
+        return countDayService.getLoopHealthLevels(base.getId(),systemName,beginDate,endDate);
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询 装置-系统
+    *   date: 2024/7/2
+    */
+    @Override
+    public List<String> getDeviceSystem() {
+
+        ArrayList<String> deviceSystemList = new ArrayList<>();
+
+        List<InterlockBase> deviceList = baseService.getAllDevice();
+        for (InterlockBase device : deviceList) {
+            List<InterlockBase> systemList = baseService.getAllSystemByDeviceId(device.getId());
+            for (InterlockBase system : systemList) {
+                deviceSystemList.add(device.getInterlockName()+"-"+system.getInterlockName());
+            }
+        }
+
+        return deviceSystemList;
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询所有的装置
+    *   date: 2024/7/3
+    */
+    @Override
+    public List<String> getAllDevice() {
+        ArrayList<String> deviceList = new ArrayList<>();
+        List<InterlockBase> list = baseService.getAllDevice();
+        for (InterlockBase item : list) {
+            deviceList.add(item.getInterlockName());
+        }
+        return deviceList;
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询装置下的系统
+    *   date: 2024/7/3
+    */
+    @Override
+    public List<String> getSystemByDeviceName(String deviceName) {
+        ArrayList<String> systemList = new ArrayList<>();
+        QueryWrapper<InterlockBase> query = new QueryWrapper<>();
+        query.eq("interlock_name",deviceName);
+        InterlockBase base = baseService.getOne(query);
+        List<InterlockBase> list = baseService.getAllSystemByDeviceId(base.getId());
+        for (InterlockBase item : list) {
+            systemList.add(item.getInterlockName());
+        }
+
+        return systemList;
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统状态(相同系统的系统状态就是MP状态 ,该系统下的所有的联锁用的是同一个MP状态点位)
+    *   date: 2024/7/4
+    */
+    @Override
+    public String getSystemStatus(String deviceName, String systemName) {
+        InterlockBase base1 = getBaseInfo(deviceName);
+        InterlockBase base2 = getBaseInfo(systemName);
+        return null;
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 根据 装置/系统 名称查询配置信息 (获取 装置/系统的id)
+    *   date: 2024/7/4
+    */
+    private InterlockBase getBaseInfo(String deviceOrSystemName) {
+        QueryWrapper<InterlockBase> query = new QueryWrapper<>();
+        query.eq("interlock_name",deviceOrSystemName);
+        return baseService.getOne(query);
+    }
+
+}

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

@@ -3,8 +3,13 @@ package org.jeecg.modules.interlockCountDay.mapper;
 import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.detail.entity.InterlockDetail;
 import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.summary.entity.InterlockSummary;
 
 /**
  * @Description: interlock_count_day
@@ -15,4 +20,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface InterlockCountDayMapper extends BaseMapper<InterlockCountDay> {
 
     List<InterlockCountDay> getCountByYearmonth(@Param("counttype") String counttype,@Param("lastmonth") String lastmonth);
+
+    List<InterlockTyl> getTylBySysNameTime(@Param("deviceId") String deviceId,@Param("systemName") String systemName,@Param("beginDate") String beginDate,@Param("endDate") String endDate);
+
+    List<LoopHealthLevel> getLoopHealthLevels(@Param("deviceId") String deviceId,@Param("systemName") String systemName,@Param("beginDate") String beginDate,@Param("endDate") String endDate);
+
+    List<LoopHealthLevel> getCurrentLoopHealthLevels(@Param("deviceId") String deviceId,@Param("systemId") String systemId);
+
+    List<InterlockAndYbStatus> getCurronInterlockStatus(@Param("deviceId") String deviceId,@Param("systemId") String systemId);
+
+    List<InterlockSummary> getSummaryList(@Param("deviceId") String deviceId,@Param("systemId") String systemId);
+
+    List<InterlockDetail> getDetailList(@Param("summaryId") String summaryId);
 }

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

@@ -10,4 +10,43 @@
         where count_type = #{counttype} and yearmonth = #{lastmonth}
         order by device_id,interlock_system_id
     </select>
+
+    <select id="getTylBySysNameTime" resultType="org.jeecg.modules.dashboardInterface.entity.InterlockTyl">
+        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}
+    </select>
+
+    <select id="getLoopHealthLevels" resultType="org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel">
+        select count_name as level ,count_num as number,day as time
+        from interlock_count_day
+        where count_type = '0' and device_id = #{deviceId} and interlock_name = #{systemName} and  day > #{beginDate} and day <![CDATA[ <= ]]> #{endDate}
+        order by day
+    </select>
+
+    <select id="getCurrentLoopHealthLevels" resultType="org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel">
+        select loop_health_level as level,count(*) as number,TO_CHAR(tag_time::timestamp, 'YYYY-MM-DD') as time
+        from interlock_summary
+        where interlock_apparatus_id = #{deviceId} and interlock_system_id = #{systemId} and loop_health_level != ''
+        group by loop_health_level,tag_time
+    </select>
+
+    <select id="getCurronInterlockStatus" resultType="org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus">
+        select interlock_status as statusName,count(*) as number,TO_CHAR(tag_time::timestamp, 'YYYY-MM-DD') as time
+        from interlock_summary
+        where interlock_apparatus_id = #{deviceId} and interlock_system_id = #{systemId} and interlock_status != ''
+        group by interlock_status,tag_time
+    </select>
+
+    <select id="getSummaryList" resultType="org.jeecg.modules.summary.entity.InterlockSummary">
+        select *
+        from interlock_summary
+        where interlock_apparatus_id = #{deviceId} and interlock_system_id = #{systemId}
+    </select>
+
+    <select id="getDetailList" resultType="org.jeecg.modules.detail.entity.InterlockDetail">
+        select *
+        from interlock_detail
+        where summaryid = #{summaryId}
+    </select>
 </mapper>

+ 41 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/IInterlockCountDayService.java

@@ -1,9 +1,13 @@
 package org.jeecg.modules.interlockCountDay.service;
 
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
 import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: interlock_count_day
@@ -14,4 +18,41 @@ import java.util.List;
 public interface IInterlockCountDayService extends IService<InterlockCountDay> {
 
     List<InterlockCountDay> getCountByYearmonth(String counttype, String lastmonth);
+
+    List<InterlockTyl> getTylBySysNameTime(String deviceId,String systemName,String beginDate,String endDate);
+
+    Map<String, List<LoopHealthLevel>> getLoopHealthLevels(String deviceId, String systemName,String beginDate,String endDate);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的健康等级 (查询联锁总表)
+    *   date: 2024/7/3
+    */
+
+    List<LoopHealthLevel> getCurrentLoopHealthLevels(String deviceId, String systemId);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的联锁状态 (查询联锁总表)
+    *   date: 2024/7/3
+    */
+    List<InterlockAndYbStatus> getCurronInterlockStatus(String deviceId, String systemId);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的投用率
+    *   date: 2024/7/3
+    */
+    List<InterlockTyl> getCurrentTylBySysName(String deviceId, String systemId);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 查询当前系统的仪表状态 (查询联锁总表)
+    *   date: 2024/7/4
+    */
+    List<InterlockAndYbStatus> getYbStatus(String deviceId, String systemId);
 }

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

@@ -1,14 +1,26 @@
 package org.jeecg.modules.interlockCountDay.service.impl;
 
+import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.dashboardInterface.entity.InterlockAndYbStatus;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
+import org.jeecg.modules.detail.entity.InterlockDetail;
 import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
 import org.jeecg.modules.interlockCountDay.mapper.InterlockCountDayMapper;
 import org.jeecg.modules.interlockCountDay.service.IInterlockCountDayService;
+import org.jeecg.modules.summary.entity.InterlockSummary;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: interlock_count_day
@@ -23,8 +35,132 @@ public class InterlockCountDayServiceImpl extends ServiceImpl<InterlockCountDayM
     @SuppressWarnings("all")
     private InterlockCountDayMapper mapper;
 
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockBaseService baseService;
+
     @Override
     public List<InterlockCountDay> getCountByYearmonth(String counttype, String lastmonth) {
         return mapper.getCountByYearmonth(counttype, lastmonth);
     }
+
+    @Override
+    public List<InterlockTyl> getTylBySysNameTime(String deviceId,String systemName,String beginDate,String endDate) {
+        return mapper.getTylBySysNameTime(deviceId,systemName,beginDate,endDate);
+    }
+
+    @Override
+    public Map<String, List<LoopHealthLevel>> getLoopHealthLevels(String deviceId, String systemName,String beginDate,String endDate) {
+        HashMap<String, List<LoopHealthLevel>> map = new HashMap<>();
+        List<LoopHealthLevel> list = mapper.getLoopHealthLevels(deviceId,systemName,beginDate,endDate);
+        for (LoopHealthLevel item : list) {
+            if (map.containsKey(item.getLevel())){
+                map.get(item.getLevel()).add(item);
+            }else {
+                ArrayList<LoopHealthLevel> sonList = new ArrayList<>();
+                sonList.add(item);
+                map.put(item.getLevel(),sonList);
+            }
+        }
+        return map;
+    }
+
+    @Override
+    public List<LoopHealthLevel> getCurrentLoopHealthLevels(String deviceId, String systemId) {
+        return mapper.getCurrentLoopHealthLevels(deviceId, systemId);
+    }
+
+    @Override
+    public List<InterlockAndYbStatus> getCurronInterlockStatus(String deviceId, String systemId) {
+        InterlockBase base = baseService.getById(systemId);
+        String tyStatusValue = base.getInterlockStatusTy();
+        String wtyStatusValue = inversionStatus(base.getInterlockStatusTy());
+        List<InterlockAndYbStatus> list = mapper.getCurronInterlockStatus(deviceId, systemId);
+        for (InterlockAndYbStatus item : list) {
+            if (tyStatusValue.equals(item.getStatusName())){
+                item.setStatusName("已投用数");
+            }
+            if (wtyStatusValue.equals(item.getStatusName())){
+                item.setStatusName("未投用数");
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<InterlockTyl> getCurrentTylBySysName(String deviceId, String systemId) {
+        ArrayList<InterlockTyl> tylList = new ArrayList<>();
+        InterlockTyl interlockTyl = new InterlockTyl();
+        BigDecimal yty = BigDecimal.valueOf(0);
+        BigDecimal wty = BigDecimal.valueOf(0);
+        List<InterlockAndYbStatus> list = getCurronInterlockStatus(deviceId, systemId);
+        for (InterlockAndYbStatus item : list) {
+            if ("已投用数".equals(item.getStatusName())){
+                yty = new BigDecimal(item.getNumber());
+            }
+            if ("未投用数".equals(item.getStatusName())){
+                wty = new BigDecimal(item.getNumber());
+            }
+        }
+        BigDecimal total = yty.add(wty);
+        BigDecimal tyl = BigDecimal.valueOf(0);
+        if ((total.compareTo(BigDecimal.valueOf(0)) != 0)){
+            tyl = yty.divide(total,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
+        }
+        interlockTyl.setTyl(String.valueOf(tyl));
+        interlockTyl.setTime(list.get(0).getTime());
+        tylList.add(interlockTyl);
+        return tylList;
+    }
+
+
+    @Override
+    public List<InterlockAndYbStatus> getYbStatus(String deviceId, String systemId) {
+        ArrayList<InterlockAndYbStatus> resultList = new ArrayList<>();
+
+        InterlockBase base = baseService.getById(systemId);
+        String ybStatusNormalValue = base.getInstrumentStatusNormal();
+        String ybStatusAnNormalValue = inversionStatus(ybStatusNormalValue);
+
+        // 查询该系统下的联锁
+        List<InterlockSummary> summaryList =  mapper.getSummaryList(deviceId, systemId);
+        int ybNormalNumber = 0;  // 该系统下 所有联锁的仪表状态 为正常的数量
+        int ybAnNormalNumber = 0;  // 该系统下 所有联锁的仪表状态 为异常的数量
+        for (InterlockSummary summary : summaryList) {
+            // 查询该联锁下的联锁条件
+            List<InterlockDetail> detailList = mapper.getDetailList(summary.getId());
+            for (InterlockDetail detail : detailList) {
+                if (ybStatusAnNormalValue.equals(detail.getInstrumentStatus())){
+                    ybAnNormalNumber++;
+                    break;
+                }
+            }
+        }
+        if (summaryList.size() > 0){
+            ybNormalNumber = summaryList.size() - ybAnNormalNumber;
+        }
+        InterlockAndYbStatus interlockAndYbStatus1 = new InterlockAndYbStatus();
+        interlockAndYbStatus1.setStatusName("正常");
+        interlockAndYbStatus1.setNumber(String.valueOf(ybNormalNumber));
+
+        InterlockAndYbStatus interlockAndYbStatus2 = new InterlockAndYbStatus();
+        interlockAndYbStatus2.setStatusName("故障");
+        interlockAndYbStatus2.setNumber(String.valueOf(ybAnNormalNumber));
+
+        resultList.add(interlockAndYbStatus1);
+        resultList.add(interlockAndYbStatus2);
+
+        return resultList;
+    }
+
+    /**
+     *   author: dzc
+     *   version: 1.0
+     *   des: 取反
+     *   date: 2024/7/03
+     */
+    private String inversionStatus(String str) {
+        if("0".equals(str)) return "1";
+        else return "0";
+    }
 }

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/DayStatisticsJob.java

@@ -201,7 +201,7 @@ public class DayStatisticsJob implements Job {
             }
             BigDecimal total = yty.add(wty);
             if ((total.compareTo(BigDecimal.valueOf(0)) != 0)){
-                tyl = yty.divide(total,2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
+                tyl = yty.divide(total,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
             }
             InterlockCountDay interlockCount = new InterlockCountDay();
             interlockCount.setInterlockSystemId(key);

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/MonthStatisticsJob.java

@@ -205,7 +205,7 @@ public class MonthStatisticsJob implements Job {
             }
             BigDecimal total = yty.add(wty);
             if ((total.compareTo(BigDecimal.valueOf(0)) != 0)){
-                tyl = yty.divide(total,2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
+                tyl = yty.divide(total,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
             }
 
             InterlockCountMonth interlockCountMonthTyl = new InterlockCountMonth();

+ 84 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/controller/TestDController.java

@@ -0,0 +1,84 @@
+package org.jeecg.modules.iotedgeCollectData.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.iotedgeCollectData.entity.ResultD;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author dzc
+ * @date 2024/6/13 10:45
+ * @package org.jeecg.modules.iotedgeCollectData.controller
+ * @project interlock_server
+ * @des
+ */
+@RestController
+@RequestMapping("/testD/testD")
+@Slf4j
+public class TestDController {
+
+
+    @GetMapping(value = "/")
+    public JSONObject testConnect() { 
+        log.info("检查服务成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("status",200);
+        return jsonObject;
+    }
+
+    @PostMapping(value = "/search")
+    public String search(@RequestBody JSONObject request) {
+        log.info("调用search接口:{}", JSON.toJSONString(request));
+        return "[\"装置1\",\"装置2\",\"装置3\"]";
+    }
+
+    @PostMapping(value = "/query")
+    public String query(@RequestBody JSONObject request) throws Exception {
+        log.info("调用query接口:{}", JSON.toJSONString(request));
+        ArrayList<ResultD> list = new ArrayList<>();
+
+        ResultD<String[]> d = new ResultD<>();
+        d.setTarget("upper_25");
+        ArrayList<String[]> strings = new ArrayList<>();
+
+        String str1 = "2024-06-13";
+        String str2 = "2024-06-14";
+        String str3 = "2024-06-15";
+        String str4 = "2024-06-16";
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Date data1 = format.parse(str1);
+        Date data2 = format.parse(str2);
+        Date data3 = format.parse(str3);
+        Date data4 = format.parse(str4);
+
+        String s = DateUtils.getDate().getTime() + "";
+        String[] v1 = new String[]{"50",data1.getTime()+""};
+        String[] v2 = new String[]{"25",data1.getTime()+""};
+        String[] v3 = new String[]{"100",data1.getTime()+""};
+        String[] v4 = new String[]{"89",data1.getTime()+""};
+        strings.add(v1);
+        strings.add(v2);
+        strings.add(v3);
+        strings.add(v4);
+        d.setDatapoints(strings);
+
+        list.add(d);
+
+        return JSON.toJSONString(list);
+    }
+
+
+
+}

+ 19 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/entity/ResultD.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.iotedgeCollectData.entity;
+
+import lombok.Data;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.util.List;
+
+/**
+ * @author dzc
+ * @date 2024/6/13 11:14
+ * @package org.jeecg.modules.iotedgeCollectData.entity
+ * @project interlock_server
+ * @des
+ */
+@Data
+public class ResultD<T> {
+    private String target;
+    private List<T> datapoints;
+}