Bläddra i källkod

Merge remote-tracking branch 'origin/master'

LLL 2 månader sedan
förälder
incheckning
800f864d2c

+ 21 - 7
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistoryLoopHealthLevelController.java

@@ -11,10 +11,7 @@ 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;
+import java.util.*;
 
 /**
  * @author dzc
@@ -55,6 +52,7 @@ public class HistoryLoopHealthLevelController {
         log.info("调用query接口:{}", JSON.toJSONString(request));
 
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy-MM");
 
         Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
         String beginDateStr = (String) rangeMap.get("from");
@@ -62,6 +60,10 @@ public class HistoryLoopHealthLevelController {
         Date beginDated = format.parse(beginDateStr);
         Date endDated = format.parse(endDateStr);
 
+        Map<String,Object> rangeRawMap = (Map<String, Object>) request.get("rangeRaw");
+        String fromType = (String) rangeRawMap.get("from");
+        String toType = (String) rangeRawMap.get("to");
+
         String beginDate = format.format(beginDated);
         String endDate = format.format(endDated);
 
@@ -80,8 +82,14 @@ public class HistoryLoopHealthLevelController {
 
 
         ArrayList<ResultD> list = new ArrayList<>();
-
-        Map<String, List<LoopHealthLevel>> loopHealthLevelMap = dashboardService.getLoopHealthLevels(deviceName, sysName, beginDate,endDate);
+        Map<String, List<LoopHealthLevel>> loopHealthLevelMap  = new HashMap<>();
+        if ("now/y".equals(fromType)){
+            beginDate = formatMonth.format(beginDated);
+            endDate = formatMonth.format(endDated);
+            loopHealthLevelMap = dashboardService.getLoopHealthLevelsMonth(deviceName, sysName, beginDate,endDate);
+        }else {
+            loopHealthLevelMap = dashboardService.getLoopHealthLevels(deviceName, sysName, beginDate,endDate);
+        }
 
         for (String key : loopHealthLevelMap.keySet()) {
             ResultD<String[]> result = new ResultD<>();
@@ -89,7 +97,13 @@ public class HistoryLoopHealthLevelController {
             ArrayList<String[]> strings = new ArrayList<>();
             List<LoopHealthLevel> itemList = loopHealthLevelMap.get(key);
             for (LoopHealthLevel item : itemList) {
-                Date dateTime = format.parse(item.getTime());
+                Date dateTime = new Date();
+                if ("now/y".equals(fromType)){
+                    dateTime = formatMonth.parse(item.getTime());
+                }else {
+                    dateTime = format.parse(item.getTime());
+                }
+
                 String[] v = new String[]{item.getNumber(),String.valueOf(dateTime.getTime())};
                 strings.add(v);
             }

+ 24 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/dashboardInterface/controller/HistroyTylController.java

@@ -54,6 +54,8 @@ public class HistroyTylController {
     public String query(@RequestBody JSONObject request) throws Exception {
         log.info("调用query接口:{}", JSON.toJSONString(request));
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy-MM");
+
 
         Map<String,Object> rangeMap = (Map<String, Object>) request.get("range");
         String beginDateStr = (String) rangeMap.get("from");
@@ -61,6 +63,10 @@ public class HistroyTylController {
         Date beginDated = format.parse(beginDateStr);
         Date endDated = format.parse(endDateStr);
 
+        Map<String,Object> rangeRawMap = (Map<String, Object>) request.get("rangeRaw");
+        String fromType = (String) rangeRawMap.get("from");
+        String toType = (String) rangeRawMap.get("to");
+
         String beginDate = format.format(beginDated);
         String endDate = format.format(endDated);
 
@@ -81,7 +87,18 @@ public class HistroyTylController {
 
         ArrayList<ResultD> list = new ArrayList<>();
 
-        List<InterlockTyl> tylList = dashboardService.getTylBySysNameTime(deviceName,sysName,beginDate,endDate);
+        List<InterlockTyl> tylList = new ArrayList<>();
+
+        if ("now/y".equals(fromType)){
+            beginDate = formatMonth.format(beginDated);
+            endDate = formatMonth.format(endDated);
+            tylList = dashboardService.getTylBySysNameTimeMonth(deviceName,sysName,beginDate,endDate);
+
+        }else {
+            tylList = dashboardService.getTylBySysNameTime(deviceName,sysName,beginDate,endDate);
+        }
+
+
 
         ResultD<String[]> d = new ResultD<>();
         d.setTarget("投用率");
@@ -90,7 +107,12 @@ public class HistroyTylController {
 
         for (InterlockTyl item : tylList) {
             String time = item.getTime();
-            Date dateTime = format.parse(time);
+            Date dateTime = new Date();
+            if ("now/y".equals(fromType)){
+                dateTime = formatMonth.parse(time);
+            }else {
+                dateTime = format.parse(time);
+            }
             String[] v = new String[]{item.getTyl(),String.valueOf(dateTime.getTime())};
             strings.add(v);
         }

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

@@ -104,4 +104,19 @@ public interface IDashboardINterfaceService {
     */
     String getSystemStatus(String deviceName,String systemName);
 
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁投用率 按年统计(显示每个月的)
+    *   date: 2024/7/11
+    */
+    List<InterlockTyl> getTylBySysNameTimeMonth(String deviceName, String sysName, String beginDate, String endDate);
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁健康等级 按年统计(显示每个月的)
+    *   date: 2024/7/11
+    */
+    Map<String, List<LoopHealthLevel>> getLoopHealthLevelsMonth(String deviceName, String sysName, String beginDate, String endDate);
 }

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

@@ -8,6 +8,7 @@ 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.interlockCountMonth.service.IInterlockCountMonthService;
 import org.jeecg.modules.summary.service.IInterlockSummaryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,6 +33,10 @@ public class IDashboardINterfaceServiceImpl implements IDashboardINterfaceServic
 
     @Autowired
     @SuppressWarnings("all")
+    private IInterlockCountMonthService countMonthService;
+
+    @Autowired
+    @SuppressWarnings("all")
     private IInterlockBaseService baseService;
 
     /**
@@ -185,6 +190,30 @@ public class IDashboardINterfaceServiceImpl implements IDashboardINterfaceServic
     /**
     *   author: dzc
     *   version: 1.0
+    *   des: 联锁投用率按年统计 (显示每个月的)
+    *   date: 2024/7/11
+    */
+    @Override
+    public List<InterlockTyl> getTylBySysNameTimeMonth(String deviceName, String sysName, String beginDate, String endDate) {
+        InterlockBase base = getBaseInfo(deviceName);
+        return countMonthService.getTylBySysNameTimeMonth(base.getId(),sysName,beginDate,endDate);
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 联锁健康等级按年统计(显示每个月的)
+    *   date: 2024/7/11
+    */
+    @Override
+    public Map<String, List<LoopHealthLevel>> getLoopHealthLevelsMonth(String deviceName, String sysName, String beginDate, String endDate) {
+        InterlockBase base = getBaseInfo(deviceName);
+        return countMonthService.getLoopHealthLevelsMonth(base.getId(),sysName,beginDate,endDate);
+    }
+
+    /**
+    *   author: dzc
+    *   version: 1.0
     *   des: 根据 装置/系统 名称查询配置信息 (获取 装置/系统的id)
     *   date: 2024/7/4
     */

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

@@ -161,13 +161,15 @@ public class InterlockCountDayServiceImpl extends ServiceImpl<InterlockCountDayM
             for (InterlockDetail detail : detailList) {
                 if (ybStatusAnNormalValue.equals(detail.getInstrumentStatus())){
                     ybAnNormalNumber++;
-                    break;
+                }
+                if (ybStatusNormalValue.equals(detail.getInstrumentStatus())){
+                    ybNormalNumber++;
                 }
             }
         }
-        if (summaryList.size() > 0){
-            ybNormalNumber = summaryList.size() - ybAnNormalNumber;
-        }
+        //if (summaryList.size() > 0){
+        //    ybNormalNumber = summaryList.size() - ybAnNormalNumber;
+        //}
         InterlockAndYbStatus interlockAndYbStatus1 = new InterlockAndYbStatus();
         interlockAndYbStatus1.setStatusName("正常");
         interlockAndYbStatus1.setNumber(String.valueOf(ybNormalNumber));

+ 5 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountMonth/mapper/InterlockCountMonthMapper.java

@@ -3,6 +3,8 @@ package org.jeecg.modules.interlockCountMonth.mapper;
 import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
 import org.jeecg.modules.interlockCountMonth.entity.InterlockCountMonth;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -14,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface InterlockCountMonthMapper extends BaseMapper<InterlockCountMonth> {
 
+    List<InterlockTyl> getTylBySysNameTimeMonth(@Param("deviceId") String deviceId,@Param("sysName") String sysName,@Param("beginDate") String beginDate,@Param("endDate") String endDate);
+
+    List<LoopHealthLevel> getLoopHealthLevelsMonth(@Param("deviceId") String deviceId,@Param("sysName") String sysName,@Param("beginDate") String beginDate,@Param("endDate") String endDate);
 }

+ 13 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountMonth/mapper/xml/InterlockCountMonthMapper.xml

@@ -2,4 +2,17 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.interlockCountMonth.mapper.InterlockCountMonthMapper">
 
+    <select id="getTylBySysNameTimeMonth" resultType="org.jeecg.modules.dashboardInterface.entity.InterlockTyl">
+        select count_num as tyl,time
+        from interlock_count_month
+        where count_type = '2' and device_id = #{deviceId} and interlock_name = #{sysName} and time > #{beginDate} and time <![CDATA[ <= ]]> #{endDate}
+        order by time
+    </select>
+
+    <select id="getLoopHealthLevelsMonth" resultType="org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel">
+        select count_name as level ,count_num as number,time
+        from interlock_count_month
+        where count_type = '0' and device_id = #{deviceId} and interlock_name = #{sysName} and  time > #{beginDate} and time <![CDATA[ <= ]]> #{endDate}
+        order by time
+    </select>
 </mapper>

+ 8 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountMonth/service/IInterlockCountMonthService.java

@@ -1,8 +1,13 @@
 package org.jeecg.modules.interlockCountMonth.service;
 
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
 import org.jeecg.modules.interlockCountMonth.entity.InterlockCountMonth;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: interlock_count_month
  * @Author: jeecg-boot
@@ -11,4 +16,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IInterlockCountMonthService extends IService<InterlockCountMonth> {
 
+    List<InterlockTyl> getTylBySysNameTimeMonth(String deviceId, String sysName, String beginDate, String endDate);
+
+    Map<String, List<LoopHealthLevel>> getLoopHealthLevelsMonth(String deviceId, String sysName, String beginDate, String endDate);
 }

+ 33 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountMonth/service/impl/InterlockCountMonthServiceImpl.java

@@ -1,12 +1,21 @@
 package org.jeecg.modules.interlockCountMonth.service.impl;
 
+import net.bytebuddy.asm.Advice;
+import org.jeecg.modules.dashboardInterface.entity.InterlockTyl;
+import org.jeecg.modules.dashboardInterface.entity.LoopHealthLevel;
 import org.jeecg.modules.interlockCountMonth.entity.InterlockCountMonth;
 import org.jeecg.modules.interlockCountMonth.mapper.InterlockCountMonthMapper;
 import org.jeecg.modules.interlockCountMonth.service.IInterlockCountMonthService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: interlock_count_month
  * @Author: jeecg-boot
@@ -16,4 +25,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class InterlockCountMonthServiceImpl extends ServiceImpl<InterlockCountMonthMapper, InterlockCountMonth> implements IInterlockCountMonthService {
 
+    @Autowired
+    @SuppressWarnings("all")
+    private InterlockCountMonthMapper mapper;
+
+    @Override
+    public List<InterlockTyl> getTylBySysNameTimeMonth(String deviceId, String sysName, String beginDate, String endDate) {
+        return mapper.getTylBySysNameTimeMonth(deviceId,sysName,beginDate,endDate);
+    }
+
+    @Override
+    public Map<String, List<LoopHealthLevel>> getLoopHealthLevelsMonth(String deviceId, String sysName, String beginDate, String endDate) {
+        HashMap<String, List<LoopHealthLevel>> map = new HashMap<>();
+        List<LoopHealthLevel> list = mapper.getLoopHealthLevelsMonth(deviceId,sysName,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;
+    }
 }