Преглед изворни кода

运维概览:概览数据

zhj пре 2 година
родитељ
комит
55f274c961
28 измењених фајлова са 563 додато и 0 уклоњено
  1. 224 0
      src/main/java/com/welampiot/controller/WorkManageController.java
  2. 3 0
      src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java
  3. 5 0
      src/main/java/com/welampiot/dao/DefectManageDao.java
  4. 5 0
      src/main/java/com/welampiot/dao/PatrolManageDao.java
  5. 5 0
      src/main/java/com/welampiot/dao/RepairProjectDao.java
  6. 5 0
      src/main/java/com/welampiot/dao/WorkManageDao.java
  7. 1 0
      src/main/java/com/welampiot/dto/AllAlarmInfoLogDTO.java
  8. 2 0
      src/main/java/com/welampiot/dto/DefectManageDTO.java
  9. 33 0
      src/main/java/com/welampiot/dto/OperationDataDTO.java
  10. 2 0
      src/main/java/com/welampiot/dto/PatrolManageDTO.java
  11. 2 0
      src/main/java/com/welampiot/dto/RepairProjectDTO.java
  12. 2 0
      src/main/java/com/welampiot/dto/WorkManageDTO.java
  13. 3 0
      src/main/java/com/welampiot/service/AllAlarmInfoLogService.java
  14. 5 0
      src/main/java/com/welampiot/service/DefectManageService.java
  15. 5 0
      src/main/java/com/welampiot/service/PatrolManageService.java
  16. 5 0
      src/main/java/com/welampiot/service/RepairProjectService.java
  17. 5 0
      src/main/java/com/welampiot/service/WorkManageService.java
  18. 11 0
      src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java
  19. 11 0
      src/main/java/com/welampiot/service/impl/DefectManageServiceImpl.java
  20. 11 0
      src/main/java/com/welampiot/service/impl/PatrolManageServiceImpl.java
  21. 11 0
      src/main/java/com/welampiot/service/impl/RepairProjectServiceImpl.java
  22. 11 0
      src/main/java/com/welampiot/service/impl/WorkManageServiceImpl.java
  23. 36 0
      src/main/java/com/welampiot/vo/OperationVO.java
  24. 32 0
      src/main/resources/mapper/AllAlarmInfoLogMapper.xml
  25. 32 0
      src/main/resources/mapper/DefectManageMapper.xml
  26. 32 0
      src/main/resources/mapper/PatrolManageMapper.xml
  27. 32 0
      src/main/resources/mapper/RepairProjectMapper.xml
  28. 32 0
      src/main/resources/mapper/WorkManageMapper.xml

+ 224 - 0
src/main/java/com/welampiot/controller/WorkManageController.java

@@ -14,7 +14,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.YearMonth;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -56,6 +58,12 @@ public class WorkManageController {
     @Autowired
     private RepairProjectService repairProjectService;
 
+    @Autowired
+    private DefectManageService defectManageService;
+
+    @Autowired
+    private PatrolManageService patrolManageService;
+
     /**
      * 故障列表
      * @param request 分页、区域路段筛选、故障类型、设备类型
@@ -493,4 +501,220 @@ public class WorkManageController {
         repairProjectService.updateRepairProjectStatus(repairProjectDTO);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
     }
+
+    /**
+     * 概览数据
+     * @param request 时间筛选
+     * @return 概览数据
+     */
+    @RequestMapping(value = "/operationData", method = RequestMethod.POST)
+    public BaseResult<?> operationData(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer dateType = (Integer) toolUtils.getRequestContent(request, "dateType", 1);
+
+        long l = System.currentTimeMillis();
+        Date date1 = new Date(l);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date1);
+        int year = calendar.get(Calendar.YEAR); // 获取年份
+        int month = calendar.get(Calendar.MONTH) + 1; // 获取月份
+        long startTime,endTime;
+        String startDate = "";
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String endDate = simpleDateFormat.format(l);
+        if (dateType == 0) { // 当月
+            if (month < 10) {
+                startDate = year + "-0" + month + "-01";
+            } else {
+                startDate = year + "-" + month + "-01";
+            }
+        } else if (dateType == 1) { // 当年
+            month = 1;
+            startDate = year + "-0" + month + "-01";
+            endDate = simpleDateFormat.format(l);
+        } else if (dateType == 2) { // 全部
+            endDate = simpleDateFormat.format(l);
+        } else if (dateType == 3) { // 具体月份
+            String date = (String) toolUtils.getRequestContent(request, "date", 2);
+            if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR, version);
+            List<String> list = Arrays.asList(date.split("-"));
+            int yearNum = Integer.parseInt(list.get(0));
+            int monthNum = Integer.parseInt(list.get(1));
+            int daysInMonth = YearMonth.of(yearNum, monthNum).lengthOfMonth();
+            if (yearNum == year && monthNum == month) {
+                if (month < 10) {
+                    startDate = year + "-" + "0" + month + "-01";
+                } else {
+                    startDate = year + "-" + month + "-01";
+                }
+            } else if ((yearNum == year && monthNum > month) || (yearNum > year)) {
+                return toolUtils.response(InterfaceResultEnum.DATE_CHOOSE_ERROR, version);
+            } else {
+                startTime = simpleDateFormat.parse(date + "-01").getTime();
+                endTime = simpleDateFormat.parse(date + "-" + daysInMonth).getTime();
+                startDate = simpleDateFormat.format(startTime);
+                endDate = simpleDateFormat.format(endTime);
+            }
+        }
+
+        OperationVO operationVO = new OperationVO();
+        operationVO.setStartDate(startDate);
+        operationVO.setEndDate(endDate);
+        operationVO.setSectionList(toolUtils.getSectionList(request));
+        List<Object> dateList = new ArrayList<>();
+        List<Object> alarmList = new ArrayList<>();
+        List<Object> workList = new ArrayList<>();
+        List<Object> defectList = new ArrayList<>();
+        List<Object> patrolList = new ArrayList<>();
+        List<Object> projectList = new ArrayList<>();
+        List<OperationDataDTO> dataList = new ArrayList<>();
+        HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
+        long timeT = l - 29L * 3600 * 1000 * 24;
+        int i = 0;
+
+        while (timeT <= l) {
+            objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)),i);
+            dateList.add(simpleDateFormat.format(new Date(timeT)));
+            alarmList.add(0);
+            workList.add(0);
+            defectList.add(0);
+            patrolList.add(0);
+            projectList.add(0);
+            dataList.add(new OperationDataDTO(0,0,0,0,0,simpleDateFormat.format(new Date(timeT))));
+            timeT += 3600 * 1000 * 24;
+            i ++;
+        }
+
+        // 故障列表
+        List<AllAlarmInfoLogDTO> alarmCountList = allAlarmInfoLogService.getAllAlarmCountOnMonth(operationVO);
+        for (AllAlarmInfoLogDTO dto : alarmCountList) {
+            Date date = new Date(simpleDateFormat.parse(dto.getUpdateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto.getDayCount() != null && dto.getDayCount() != 0 && integer != null) {
+                alarmList.set(integer, dto.getDayCount());
+            }
+        }
+
+        // 工单列表
+        List<WorkManageDTO> workCountList = workManageService.getWorkManageCountOnMonth(operationVO);
+        for (WorkManageDTO dto : workCountList) {
+            Date date = new Date(simpleDateFormat.parse(dto.getCreateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto.getDayCount() != null && dto.getDayCount() != 0 && integer != null) {
+                workList.set(integer, dto.getDayCount());
+            }
+        }
+
+        // 缺陷列表
+        List<DefectManageDTO> defectCountList = defectManageService.getDefectManageCountOnMonth(operationVO);
+        for (DefectManageDTO dto : defectCountList) {
+            Date date = new Date(simpleDateFormat.parse(dto.getCreateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto.getDayCount() != null && dto.getDayCount() != 0 && integer != null) {
+                defectList.set(integer, dto.getDayCount());
+            }
+        }
+
+        // 巡视列表
+        List<PatrolManageDTO> patrolCountList = patrolManageService.getPatrolManageCountOnMonth(operationVO);
+        for (PatrolManageDTO dto : patrolCountList) {
+            Date date = new Date(simpleDateFormat.parse(dto.getCreateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto.getDayCount() != null && dto.getDayCount() != 0 && integer != null) {
+                patrolList.set(integer, dto.getDayCount());
+            }
+        }
+
+        // 维修项目列表
+        List<RepairProjectDTO> repairCountList = repairProjectService.getRepairProjectCountOnMonth(operationVO);
+        for (RepairProjectDTO dto : repairCountList) {
+            Date date = new Date(simpleDateFormat.parse(dto.getCreateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto.getDayCount() != null && dto.getDayCount() != 0 && integer != null) {
+                projectList.set(integer, dto.getDayCount());
+            }
+        }
+
+        // 列表数据
+        for (OperationDataDTO dto : dataList) {
+            alarmCountList.forEach(dto1 -> {
+                if (dto1.getUpdateTime().equals(dto.getDate())) {
+                    dto.setAlarmCount(dto1.getDayCount());
+                }
+            });
+        }
+        for (OperationDataDTO dto : dataList) {
+            workCountList.forEach(dto1 -> {
+                if (dto1.getCreateTime().equals(dto.getDate())) {
+                    dto.setWorkCount(dto1.getDayCount());
+                }
+            });
+        }
+        for (OperationDataDTO dto : dataList) {
+            defectCountList.forEach(dto1 -> {
+                if (dto1.getCreateTime().equals(dto.getDate())) {
+                    dto.setDefectCount(dto1.getDayCount());
+                }
+            });
+        }
+        for (OperationDataDTO dto : dataList) {
+            patrolCountList.forEach(dto1 -> {
+                if (dto1.getCreateTime().equals(dto.getDate())) {
+                    dto.setPatrolCount(dto1.getDayCount());
+                }
+            });
+        }
+        for (OperationDataDTO dto : dataList) {
+            repairCountList.forEach(dto1 -> {
+                if (dto1.getCreateTime().equals(dto.getDate())) {
+                    dto.setProjectCount(dto1.getDayCount());
+                }
+            });
+        }
+
+        Integer allAlarmInfoLogCount = allAlarmInfoLogService.getAllAlarmInfoLogCount(operationVO);
+        Integer workManageCount = workManageService.getWorkManageCount(operationVO);
+        Integer defectManageCount = defectManageService.getDefectManageCount(operationVO);
+        Integer patrolManageCount = patrolManageService.getPatrolManageCount1(operationVO);
+        Integer repairProjectCount = repairProjectService.getRepairProjectCount(operationVO);
+        OperationVO vo = new OperationVO();
+        vo.setAlarmCount(allAlarmInfoLogCount);
+        vo.setWorkCount(workManageCount);
+        vo.setDefectCount(defectManageCount);
+        vo.setPatrolCount(patrolManageCount);
+        vo.setProjectCount(repairProjectCount);
+        vo.setAlarmList(alarmList);
+        vo.setWorkList(workList);
+        vo.setDefectList(defectList);
+        vo.setPatrolList(patrolList);
+        vo.setProjectList(projectList);
+        vo.setDateList(dateList);
+        vo.setDataList(dataList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
+    }
 }

+ 3 - 0
src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java

@@ -2,6 +2,7 @@ package com.welampiot.dao;
 
 import com.welampiot.dto.AllAlarmInfoLogDTO;
 import com.welampiot.vo.AllAlarmInfoLogVO;
+import com.welampiot.vo.OperationVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -20,4 +21,6 @@ public interface AllAlarmInfoLogDao {
     List<AllAlarmInfoLogDTO> getWaterImmersionAlarmListByVO(AllAlarmInfoLogVO vo);
     List<AllAlarmInfoLogDTO> getElectricBoxAlarmListByVO(AllAlarmInfoLogVO vo);
     void updateAlarmStatus(AllAlarmInfoLogDTO dto);
+    Integer getAllAlarmInfoLogCount(OperationVO vo);
+    List<AllAlarmInfoLogDTO> getAllAlarmCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/dao/DefectManageDao.java

@@ -2,6 +2,7 @@ package com.welampiot.dao;
 
 import com.welampiot.dto.DefectManageDTO;
 import com.welampiot.vo.DefectManageVO;
+import com.welampiot.vo.OperationVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -39,4 +40,8 @@ public interface DefectManageDao {
     Integer getDefectManageTotal6(DefectManageVO vo);
 
     DefectManageDTO getDefectManageInfoById(@Param("id") Integer id);
+
+    Integer getDefectManageCount(OperationVO vo);
+
+    List<DefectManageDTO> getDefectManageCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/dao/PatrolManageDao.java

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.PatrolManageVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,4 +26,8 @@ public interface PatrolManageDao {
     void addPatrolManageData(PatrolManageDTO dto);
 
     void updatePatrolManageData(PatrolManageDTO dto);
+
+    Integer getPatrolManageCount1(OperationVO vo);
+
+    List<PatrolManageDTO> getPatrolManageCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/dao/RepairProjectDao.java

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.RepairProjectDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.RepairProjectVO;
 
 import java.util.List;
@@ -30,4 +31,8 @@ public interface RepairProjectDao {
     Integer getRepairProjectTotal4(RepairProjectVO vo);
 
     void updateRepairProjectStatus(RepairProjectDTO dto);
+
+    Integer getRepairProjectCount(OperationVO vo);
+
+    List<RepairProjectDTO> getRepairProjectCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/dao/WorkManageDao.java

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.WorkManageDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.WorkManageVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -39,4 +40,8 @@ public interface WorkManageDao {
     void updateWorkStatus(WorkManageDTO dto);
 
     WorkManageDTO getAlarmIdAndUseridById(@Param("id") Integer id);
+
+    Integer getWorkManageCount(OperationVO vo);
+
+    List<WorkManageDTO> getWorkManageCountOnMonth(OperationVO vo);
 }

+ 1 - 0
src/main/java/com/welampiot/dto/AllAlarmInfoLogDTO.java

@@ -26,4 +26,5 @@ public class AllAlarmInfoLogDTO {
     private String addr;
     private String city;
     private String province;
+    private Integer dayCount;
 }

+ 2 - 0
src/main/java/com/welampiot/dto/DefectManageDTO.java

@@ -50,5 +50,7 @@ public class DefectManageDTO implements Serializable {
 
     private Integer sectionId;
 
+    private Integer dayCount;
+
     private List<DefectManageFileDTO> fileList;
 }

+ 33 - 0
src/main/java/com/welampiot/dto/OperationDataDTO.java

@@ -0,0 +1,33 @@
+package com.welampiot.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: OperationDataDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/4 - 14:20
+ * @Version: v1.0
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class OperationDataDTO implements Serializable {
+    private Integer alarmCount; // 故障数
+
+    private Integer workCount;  // 工单数
+
+    private Integer defectCount; // 缺陷数
+
+    private Integer patrolCount; // 巡视数
+
+    private Integer projectCount; // 维修项目数
+
+    private String date; // 对应日期
+}

+ 2 - 0
src/main/java/com/welampiot/dto/PatrolManageDTO.java

@@ -38,5 +38,7 @@ public class PatrolManageDTO implements Serializable {
 
     private List<PatrolSpotDTO> spotList;
 
+    private Integer dayCount;
+
     private static final long serialVersionUID = 1L;
 }

+ 2 - 0
src/main/java/com/welampiot/dto/RepairProjectDTO.java

@@ -37,5 +37,7 @@ public class RepairProjectDTO implements Serializable {
 
     private Integer sectionId; // 路段id
 
+    private Integer dayCount;
+
     private static final long serialVersionUID = 1L;
 }

+ 2 - 0
src/main/java/com/welampiot/dto/WorkManageDTO.java

@@ -64,5 +64,7 @@ public class WorkManageDTO implements Serializable {
 
     private String progressTime; // 维修进度时间
 
+    private Integer dayCount;
+
     private List<WorkManageFileDTO> fileList;
 }

+ 3 - 0
src/main/java/com/welampiot/service/AllAlarmInfoLogService.java

@@ -2,6 +2,7 @@ package com.welampiot.service;
 
 import com.welampiot.dto.AllAlarmInfoLogDTO;
 import com.welampiot.vo.AllAlarmInfoLogVO;
+import com.welampiot.vo.OperationVO;
 
 import java.util.List;
 
@@ -19,4 +20,6 @@ public interface AllAlarmInfoLogService {
     List<AllAlarmInfoLogDTO> getWaterImmersionAlarmListByVO(AllAlarmInfoLogVO vo);
     List<AllAlarmInfoLogDTO> getElectricBoxAlarmListByVO(AllAlarmInfoLogVO vo);
     void updateAlarmStatus(AllAlarmInfoLogDTO dto);
+    Integer getAllAlarmInfoLogCount(OperationVO vo);
+    List<AllAlarmInfoLogDTO> getAllAlarmCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/service/DefectManageService.java

@@ -2,6 +2,7 @@ package com.welampiot.service;
 
 import com.welampiot.dto.DefectManageDTO;
 import com.welampiot.vo.DefectManageVO;
+import com.welampiot.vo.OperationVO;
 
 import java.util.List;
 
@@ -38,4 +39,8 @@ public interface DefectManageService {
     Integer getDefectManageTotal6(DefectManageVO vo);
 
     DefectManageDTO getDefectManageInfoById(Integer id);
+
+    Integer getDefectManageCount(OperationVO vo);
+
+    List<DefectManageDTO> getDefectManageCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/service/PatrolManageService.java

@@ -1,6 +1,7 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.PatrolManageVO;
 
 import java.util.List;
@@ -24,4 +25,8 @@ public interface PatrolManageService {
     void addPatrolManageData(PatrolManageDTO dto);
 
     void updatePatrolManageData(PatrolManageDTO dto);
+
+    Integer getPatrolManageCount1(OperationVO vo);
+
+    List<PatrolManageDTO> getPatrolManageCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/service/RepairProjectService.java

@@ -1,6 +1,7 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.RepairProjectDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.RepairProjectVO;
 
 import java.util.List;
@@ -30,4 +31,8 @@ public interface RepairProjectService {
     Integer getRepairProjectTotal4(RepairProjectVO vo);
 
     void updateRepairProjectStatus(RepairProjectDTO dto);
+
+    Integer getRepairProjectCount(OperationVO vo);
+
+    List<RepairProjectDTO> getRepairProjectCountOnMonth(OperationVO vo);
 }

+ 5 - 0
src/main/java/com/welampiot/service/WorkManageService.java

@@ -1,6 +1,7 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.WorkManageDTO;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.WorkManageVO;
 
 import java.util.List;
@@ -38,4 +39,8 @@ public interface WorkManageService {
     void updateWorkStatus(WorkManageDTO dto);
 
     WorkManageDTO getAlarmIdAndUseridById(Integer id);
+
+    Integer getWorkManageCount(OperationVO vo);
+
+    List<WorkManageDTO> getWorkManageCountOnMonth(OperationVO vo);
 }

+ 11 - 0
src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java

@@ -4,6 +4,7 @@ import com.welampiot.dao.AllAlarmInfoLogDao;
 import com.welampiot.dto.AllAlarmInfoLogDTO;
 import com.welampiot.service.AllAlarmInfoLogService;
 import com.welampiot.vo.AllAlarmInfoLogVO;
+import com.welampiot.vo.OperationVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -121,4 +122,14 @@ public class AllAlarmInfoLogServiceImpl implements AllAlarmInfoLogService {
     public void updateAlarmStatus(AllAlarmInfoLogDTO dto) {
         allAlarmInfoLogDao.updateAlarmStatus(dto);
     }
+
+    @Override
+    public Integer getAllAlarmInfoLogCount(OperationVO vo) {
+        return allAlarmInfoLogDao.getAllAlarmInfoLogCount(vo);
+    }
+
+    @Override
+    public List<AllAlarmInfoLogDTO> getAllAlarmCountOnMonth(OperationVO vo) {
+        return allAlarmInfoLogDao.getAllAlarmCountOnMonth(vo);
+    }
 }

+ 11 - 0
src/main/java/com/welampiot/service/impl/DefectManageServiceImpl.java

@@ -4,6 +4,7 @@ import com.welampiot.dao.DefectManageDao;
 import com.welampiot.dto.DefectManageDTO;
 import com.welampiot.service.DefectManageService;
 import com.welampiot.vo.DefectManageVO;
+import com.welampiot.vo.OperationVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -82,4 +83,14 @@ public class DefectManageServiceImpl implements DefectManageService {
     public DefectManageDTO getDefectManageInfoById(Integer id) {
         return defectManageDao.getDefectManageInfoById(id);
     }
+
+    @Override
+    public Integer getDefectManageCount(OperationVO vo) {
+        return defectManageDao.getDefectManageCount(vo);
+    }
+
+    @Override
+    public List<DefectManageDTO> getDefectManageCountOnMonth(OperationVO vo) {
+        return defectManageDao.getDefectManageCountOnMonth(vo);
+    }
 }

+ 11 - 0
src/main/java/com/welampiot/service/impl/PatrolManageServiceImpl.java

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.dao.PatrolManageDao;
 import com.welampiot.dto.PatrolManageDTO;
 import com.welampiot.service.PatrolManageService;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.PatrolManageVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -47,4 +48,14 @@ public class PatrolManageServiceImpl implements PatrolManageService {
     public void updatePatrolManageData(PatrolManageDTO dto) {
         patrolManageDao.updatePatrolManageData(dto);
     }
+
+    @Override
+    public Integer getPatrolManageCount1(OperationVO vo) {
+        return patrolManageDao.getPatrolManageCount1(vo);
+    }
+
+    @Override
+    public List<PatrolManageDTO> getPatrolManageCountOnMonth(OperationVO vo) {
+        return patrolManageDao.getPatrolManageCountOnMonth(vo);
+    }
 }

+ 11 - 0
src/main/java/com/welampiot/service/impl/RepairProjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.dao.RepairProjectDao;
 import com.welampiot.dto.RepairProjectDTO;
 import com.welampiot.service.RepairProjectService;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.RepairProjectVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -62,4 +63,14 @@ public class RepairProjectServiceImpl implements RepairProjectService {
     public void updateRepairProjectStatus(RepairProjectDTO dto) {
         repairProjectDao.updateRepairProjectStatus(dto);
     }
+
+    @Override
+    public Integer getRepairProjectCount(OperationVO vo) {
+        return repairProjectDao.getRepairProjectCount(vo);
+    }
+
+    @Override
+    public List<RepairProjectDTO> getRepairProjectCountOnMonth(OperationVO vo) {
+        return repairProjectDao.getRepairProjectCountOnMonth(vo);
+    }
 }

+ 11 - 0
src/main/java/com/welampiot/service/impl/WorkManageServiceImpl.java

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.dao.WorkManageDao;
 import com.welampiot.dto.WorkManageDTO;
 import com.welampiot.service.WorkManageService;
+import com.welampiot.vo.OperationVO;
 import com.welampiot.vo.WorkManageVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -82,4 +83,14 @@ public class WorkManageServiceImpl implements WorkManageService {
     public WorkManageDTO getAlarmIdAndUseridById(Integer id) {
         return workManageDao.getAlarmIdAndUseridById(id);
     }
+
+    @Override
+    public Integer getWorkManageCount(OperationVO vo) {
+        return workManageDao.getWorkManageCount(vo);
+    }
+
+    @Override
+    public List<WorkManageDTO> getWorkManageCountOnMonth(OperationVO vo) {
+        return workManageDao.getWorkManageCountOnMonth(vo);
+    }
 }

+ 36 - 0
src/main/java/com/welampiot/vo/OperationVO.java

@@ -0,0 +1,36 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.OperationDataDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: OperationVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/4 - 13:47
+ * @Version: v1.0
+ */
+@Data
+public class OperationVO implements Serializable {
+    private String startDate;
+    private String endDate;
+    private List<Integer> sectionList;
+
+    private Integer alarmCount; // 故障数
+    private Integer workCount; // 工单数
+    private Integer defectCount; // 缺陷数
+    private Integer patrolCount; // 巡视数
+    private Integer projectCount; // 维修项目数
+    private List<OperationDataDTO> dataList; // 列表数据
+    private List<Object> dateList; // 日期列表
+    private List<Object> alarmList; // 故障列表
+    private List<Object> workList; // 工单列表
+    private List<Object> defectList; // 缺陷列表
+    private List<Object> patrolList; // 巡视列表
+    private List<Object> projectList; // 维修项目列表
+}

+ 32 - 0
src/main/resources/mapper/AllAlarmInfoLogMapper.xml

@@ -457,4 +457,36 @@
         where a.id = #{id}
     </update>
 
+    <!-- 运维概览故障数 -->
+    <select id="getAllAlarmInfoLogCount" resultType="Integer">
+        select count(a.id)
+        from all_alarm_info_log a
+        where date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <!-- 运维概览故障数,前30天内的数据数量 -->
+    <select id="getAllAlarmCountOnMonth" resultType="AllAlarmInfoLogDTO">
+        select count(*) as dayCount,date(a.updatetime) as updateTime
+        from all_alarm_info_log a
+        where a.updatetime <![CDATA[ >= ]]> curdate() - interval 30 day
+        and a.updatetime <![CDATA[ <= ]]> now()
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by date(a.updatetime)
+        order by date(a.updatetime) desc
+    </select>
+
 </mapper>

+ 32 - 0
src/main/resources/mapper/DefectManageMapper.xml

@@ -200,4 +200,36 @@
         where d.id = #{id}
     </select>
 
+    <!-- 运维概览缺陷数 -->
+    <select id="getDefectManageCount" resultType="Integer">
+        select count(d.id)
+        from defect_manage d
+        where date(d.create_time) <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            and date(d.create_time) <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and d.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <!-- 运维概览缺陷数,前30天内的数据数量 -->
+    <select id="getDefectManageCountOnMonth" resultType="RepairProjectDTO">
+        select count(*) as dayCount,date(d.create_time) as createTime
+        from defect_manage d
+        where d.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
+        and d.create_time <![CDATA[ <= ]]> now()
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and d.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by date(d.create_time)
+        order by date(d.create_time) desc
+    </select>
+
 </mapper>

+ 32 - 0
src/main/resources/mapper/PatrolManageMapper.xml

@@ -67,4 +67,36 @@
         where p.id = #{id}
     </update>
 
+    <!-- 运维概览巡视数 -->
+    <select id="getPatrolManageCount1" resultType="Integer">
+        select count(p.id)
+        from patrol_manage p
+        where date(p.create_time) <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            and date(p.create_time) <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <!-- 运维概览巡视数,前30天内的数据数量 -->
+    <select id="getPatrolManageCountOnMonth" resultType="PatrolManageDTO">
+        select count(*) as dayCount,date(p.create_time) as createTime
+        from patrol_manage p
+        where p.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
+        and p.create_time <![CDATA[ <= ]]> now()
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by date(p.create_time)
+        order by date(p.create_time) desc
+    </select>
+
 </mapper>

+ 32 - 0
src/main/resources/mapper/RepairProjectMapper.xml

@@ -117,4 +117,36 @@
         where r.id = #{id}
     </update>
 
+    <!-- 运维概览项目维修数 -->
+    <select id="getRepairProjectCount" resultType="Integer">
+        select count(r.id)
+        from repair_project r
+        where date(r.create_time) <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            and date(r.create_time) <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and r.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <!-- 运维概览维修项目数,前30天内的数据数量 -->
+    <select id="getRepairProjectCountOnMonth" resultType="RepairProjectDTO">
+        select count(*) as dayCount,date(r.create_time) as createTime
+        from repair_project r
+        where r.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
+        and r.create_time <![CDATA[ <= ]]> now()
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and r.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by date(r.create_time)
+        order by date(r.create_time) desc
+    </select>
+
 </mapper>

+ 32 - 0
src/main/resources/mapper/WorkManageMapper.xml

@@ -203,4 +203,36 @@
         where w.id = #{id}
     </select>
 
+    <!-- 运维概览工单数 -->
+    <select id="getWorkManageCount" resultType="Integer">
+        select count(w.id)
+        from work_manage w
+        where date(w.create_time) <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and w.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <!-- 运维概览工单数,前30天内的数据数量 -->
+    <select id="getWorkManageCountOnMonth" resultType="WorkManageDTO">
+        select count(*) as dayCount,date(w.create_time) as createTime
+        from work_manage w
+        where w.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
+        and w.create_time <![CDATA[ <= ]]> now()
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and w.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by date(w.create_time)
+        order by date(w.create_time) desc
+    </select>
+
 </mapper>