Browse Source

refactor(mapper): 移除数据权限注解并优化导入引用

- 移除了多个 mapper 接口中不必要的 @DataScope 注解
- 优化了 TPsInspectionAppController 中 ServletUtils 的导入方式
- 为多个巡检记录 mapper 添加了根据计划 ID 删除记录的方法
- 简化了 TPsPatrolPlanController 中设备服务的注入逻辑
- 清理了未使用的日期工具类和相关代码块
jiangbiao 2 weeks ago
parent
commit
5c8fa2b05c
75 changed files with 1735 additions and 338 deletions
  1. 260 0
      master/src/main/java/com/ruoyi/framework/task/PsPatrolTask.java
  2. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevAlarmMapper.java
  3. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCabinetMapper.java
  4. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCallsystemMapper.java
  5. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCofferMapper.java
  6. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCurtainMapper.java
  7. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevExtinguisherMapper.java
  8. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevEyewashMapper.java
  9. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevFgsMapper.java
  10. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevFiredoorMapper.java
  11. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevHydrantMapper.java
  12. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevLiftMapper.java
  13. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevMonitorMapper.java
  14. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevPitMapper.java
  15. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevRainvalveMapper.java
  16. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevSteamMapper.java
  17. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevSumpMapper.java
  18. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevUtilitystationMapper.java
  19. 1 1
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevVentvalveMapper.java
  20. 4 3
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionAppController.java
  21. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionAlarmMapper.java
  22. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCabinetMapper.java
  23. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCallsystemMapper.java
  24. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCofferMapper.java
  25. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCurtainMapper.java
  26. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionExtinguisherMapper.java
  27. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionEyewashMapper.java
  28. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionFgsMapper.java
  29. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionFiredoorMapper.java
  30. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionHydrantMapper.java
  31. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionLiftMapper.java
  32. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionMonitorMapper.java
  33. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionPitMapper.java
  34. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionRainvalveMapper.java
  35. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionSteamMapper.java
  36. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionSumpMapper.java
  37. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionUtilitystationMapper.java
  38. 9 1
      master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionVentvalveMapper.java
  39. 49 0
      master/src/main/java/com/ruoyi/project/ps/patrol/controller/TPsIndexController.java
  40. 7 279
      master/src/main/java/com/ruoyi/project/ps/patrol/controller/TPsPatrolPlanController.java
  41. 52 0
      master/src/main/java/com/ruoyi/project/ps/patrol/domain/TPsIndex.java
  42. 43 0
      master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsIndexMapper.java
  43. 1 1
      master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolIssuesMapper.java
  44. 1 2
      master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolMainMapper.java
  45. 1 1
      master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolPlanMapper.java
  46. 43 0
      master/src/main/java/com/ruoyi/project/ps/patrol/service/ITPsIndexService.java
  47. 9 0
      master/src/main/java/com/ruoyi/project/ps/patrol/service/ITPsPatrolPlanService.java
  48. 67 0
      master/src/main/java/com/ruoyi/project/ps/patrol/service/impl/TPsIndexServiceImpl.java
  49. 360 0
      master/src/main/java/com/ruoyi/project/ps/patrol/service/impl/TPsPatrolPlanServiceImpl.java
  50. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionAlarmMapper.xml
  51. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCabinetMapper.xml
  52. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCallsystemMapper.xml
  53. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCofferMapper.xml
  54. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCurtainMapper.xml
  55. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionExtinguisherMapper.xml
  56. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionEyewashMapper.xml
  57. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionFgsMapper.xml
  58. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionFiredoorMapper.xml
  59. 9 5
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionHydrantMapper.xml
  60. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionLiftMapper.xml
  61. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionMonitorMapper.xml
  62. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionPitMapper.xml
  63. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionRainvalveMapper.xml
  64. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionSteamMapper.xml
  65. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionSumpMapper.xml
  66. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionUtilitystationMapper.xml
  67. 4 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionVentvalveMapper.xml
  68. 55 0
      master/src/main/resources/mybatis/ps/patrol/TPsIndexMapper.xml
  69. 7 0
      ui/src/api/ps/patrol/home.js
  70. 3 0
      ui/src/views/index.vue
  71. 155 0
      ui/src/views/ps/home/dashboard/NoticeChart.vue
  72. 193 0
      ui/src/views/ps/home/dashboard/PanelGroup.vue
  73. 98 0
      ui/src/views/ps/home/dashboard/PieChart.vue
  74. 59 0
      ui/src/views/ps/home/index.vue
  75. 11 11
      ui/src/views/ps/patrol/plan/index.vue

+ 260 - 0
master/src/main/java/com/ruoyi/framework/task/PsPatrolTask.java

@@ -0,0 +1,260 @@
+package com.ruoyi.framework.task;
+
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SpringContextUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.ps.patrol.domain.TPsPatrolMain;
+import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
+import com.ruoyi.project.ps.patrol.service.ITPsPatrolMainService;
+import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+@Component("psPatrolTask")
+public class PsPatrolTask extends BaseController {
+
+
+    @Autowired
+    private ITPsPatrolMainService tPsPatrolMainService;
+
+    @Autowired
+    private ITPsPatrolPlanService tPsPatrolPlanService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+
+    public void generatePlan() {
+        logger.info("=============================开始生成计划===============================");
+        TPsPatrolPlan tPsPatrolPlan = new TPsPatrolPlan();
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        tPsPatrolPlan.setPlanMonth((long) (calendar.get(Calendar.MONTH) + 1));
+        tPsPatrolPlan.setPlanYear((long) (calendar.get(Calendar.YEAR)));
+        TPsPatrolMain tPsPatrolMain = new TPsPatrolMain();
+        tPsPatrolMain.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+        if (calendar.get(Calendar.DATE) > 15) {
+            // 每三个月一次的
+            if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) {
+                // 每三个月一次巡检的设备,中间月创建巡检计划
+                tPsPatrolMain.setCheckCycle("3");
+                List<TPsPatrolMain> tPsPatrolMains = tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain);
+                for (TPsPatrolMain patrolMain : tPsPatrolMains) {
+                    tPsPatrolPlan.setPatrolType(patrolMain.getPatrolType());
+                    tPsPatrolPlan.setPlanName(calendar.get(Calendar.YEAR) + "年-" + (calendar.get(Calendar.MONTH) + 1) + "月" + "-固定计划-" + patrolMain.getDevName());
+                    tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, "1");
+                }
+            }
+            //每半年一次的
+            if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.JULY) {
+                // 每半年一次巡检的设备,1、7月创建巡检计划
+                tPsPatrolMain.setCheckCycle("4");
+                List<TPsPatrolMain> tPsPatrolMains = tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain);
+                String val = "";
+                if (calendar.get(Calendar.MONTH) == Calendar.JANUARY)
+                    val = "-上半年-";
+                else
+                    val = "-下半年-";
+                for (TPsPatrolMain patrolMain : tPsPatrolMains) {
+                    tPsPatrolPlan.setPatrolType(patrolMain.getPatrolType());
+                    tPsPatrolPlan.setPlanName(calendar.get(Calendar.YEAR) + "年-" + val + "-固定计划-" + patrolMain.getDevName());
+                    tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, "1");
+                }
+            }
+            //每年一次的
+            if (calendar.get(Calendar.MONTH) == Calendar.JANUARY) {
+                // 每年一次巡检的设备,1月创建巡检计划
+                tPsPatrolMain.setCheckCycle("5");
+                List<TPsPatrolMain> tPsPatrolMains = tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain);
+                for (TPsPatrolMain patrolMain : tPsPatrolMains) {
+                    tPsPatrolPlan.setPatrolType(patrolMain.getPatrolType());
+                    tPsPatrolPlan.setPlanName(calendar.get(Calendar.YEAR) + "年-" + "-固定计划-" + patrolMain.getDevName());
+                    tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, "1");
+                }
+            }
+            tPsPatrolMain.setCheckCycle("2");
+            List<TPsPatrolMain> tPsPatrolMains = tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain);
+            for (TPsPatrolMain patrolMain : tPsPatrolMains) {
+                tPsPatrolPlan.setPatrolType(patrolMain.getPatrolType());
+                tPsPatrolPlan.setPlanName(calendar.get(Calendar.YEAR) + "年-" + (calendar.get(Calendar.MONTH) + 1) + "月" + "-固定计划-" + patrolMain.getDevName());
+                tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, "1");
+            }
+        }
+        tPsPatrolMain.setCheckCycle("1");
+        List<TPsPatrolMain> tPsPatrolMains = tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain);
+        for (TPsPatrolMain patrolMain : tPsPatrolMains) {
+            String val = "";
+            if (calendar.get(Calendar.DATE) <= 15) {
+                val = "-上半月-";
+                tPsPatrolPlan.setDetectionFrequency("1");
+            } else {
+                tPsPatrolPlan.setDetectionFrequency("2");
+                val = "-下半月-";
+            }
+
+            tPsPatrolPlan.setPatrolType(patrolMain.getPatrolType());
+            tPsPatrolPlan.setPlanName(calendar.get(Calendar.YEAR) + "年-" + (calendar.get(Calendar.MONTH) + 1) + "月" + val + "-固定计划-" + patrolMain.getDevName());
+            tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, "1");
+        }
+        logger.info("=============================结束生成计划===============================");
+    }
+
+    public void generateMain() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        TPsPatrolMain tPsPatrolMain = new TPsPatrolMain();
+        tPsPatrolMain.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+        for (TPsPatrolMain patrolMain : tPsPatrolMainService.selectTPsPatrolMainList(tPsPatrolMain)) {
+            TPsPatrolMain main = new TPsPatrolMain();
+            main.setPatrolType(patrolMain.getPatrolType());
+            main.setYear(String.valueOf(calendar.get(Calendar.YEAR) + 1));
+            if (CollectionUtils.isNotEmpty(tPsPatrolMainService.selectTPsPatrolMainList(main))) {
+                continue;
+            }
+            main.setCheckCycle(patrolMain.getCheckCycle());
+            main.setDevLink(patrolMain.getDevLink());
+            main.setDevName(patrolMain.getDevName());
+            main.setDevNum(patrolMain.getDevNum());
+            if ("1".equals((patrolMain.getCheckCycle()))) {
+                main.setJan("0,0");
+                main.setFeb("0,0");
+                main.setMar("0,0");
+                main.setApr("0,0");
+                main.setMay("0,0");
+                main.setJun("0,0");
+                main.setJul("0,0");
+                main.setAug("0,0");
+                main.setSep("0,0");
+                main.setOct("0,0");
+                main.setNov("0,0");
+                main.setDec("0,0");
+            } else if ("2".equals((patrolMain.getCheckCycle()))) {
+                main.setJan("0");
+                main.setFeb("0");
+                main.setMar("0");
+                main.setApr("0");
+                main.setMay("0");
+                main.setJun("0");
+                main.setJul("0");
+                main.setAug("0");
+                main.setSep("0");
+                main.setOct("0");
+                main.setNov("0");
+                main.setDec("0");
+            } else if ("3".equals((patrolMain.getCheckCycle()))) {
+                main.setJan("-");
+                main.setFeb("0");
+                main.setMar("-");
+                main.setApr("-");
+                main.setMay("0");
+                main.setJun("-");
+                main.setJul("-");
+                main.setAug("0");
+                main.setSep("-");
+                main.setOct("-");
+                main.setNov("0");
+                main.setDec("-");
+            } else if ("4".equals((patrolMain.getCheckCycle()))) {
+                main.setJan("0");
+                main.setFeb("-");
+                main.setMar("-");
+                main.setApr("-");
+                main.setMay("-");
+                main.setJun("-");
+                main.setJul("0");
+                main.setAug("-");
+                main.setSep("-");
+                main.setOct("-");
+                main.setNov("-");
+                main.setDec("-");
+            } else if ("5".equals((patrolMain.getCheckCycle()))) {
+                main.setJan("0");
+                main.setFeb("-");
+                main.setMar("-");
+                main.setApr("-");
+                main.setMay("-");
+                main.setJun("-");
+                main.setJul("-");
+                main.setAug("-");
+                main.setSep("-");
+                main.setOct("-");
+                main.setNov("-");
+                main.setDec("-");
+            }
+            main.setPersonLiable(patrolMain.getPersonLiable());
+            main.setCreaterCode("1");
+            main.setCreatedate(new Date());
+            tPsPatrolMainService.insertTPsPatrolMain(main);
+        }
+
+    }
+
+    public void emailReminder() {
+        IMailService mailService = (IMailService) SpringContextUtils.getBean("mailService");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        TPsPatrolPlan tPsPatrolPlan = new TPsPatrolPlan();
+        tPsPatrolPlan.setStatus(0L);
+        tPsPatrolPlan.setPlanYear((long) calendar.get(Calendar.YEAR));
+        tPsPatrolPlan.setPlanMonth((long) calendar.get(Calendar.MONTH) + 1);
+        if (calendar.get(Calendar.DATE) < 15) {
+            tPsPatrolPlan.setDetectionFrequency("1");
+        }
+        List<TPsPatrolPlan> tPsPatrolPlans = tPsPatrolPlanService.selectTPsPatrolPlanList(tPsPatrolPlan);
+        if (CollectionUtils.isEmpty(tPsPatrolPlans)) {
+            return;
+        }
+        Set<String> names = new HashSet<>();
+        for (TPsPatrolPlan patrolPlan : tPsPatrolPlans) {
+            TPsPatrolMain main = new TPsPatrolMain();
+            main.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+            main.setPatrolType(patrolPlan.getPatrolType());
+            for (TPsPatrolMain tPsPatrolMain : tPsPatrolMainService.selectTPsPatrolMainList(main)) {
+                if (StringUtils.isNotEmpty(tPsPatrolMain.getPersonLiable())) {
+                    names.addAll(Arrays.asList(tPsPatrolMain.getPersonLiable().split("、")));
+                }
+            }
+        }
+        List<SysUser> users = new ArrayList<>();
+        for (String name : names) {
+            SysUser sysUser = new SysUser();
+            sysUser.setNickName(name);
+//            users.addAll(sysUserService.selectAllUser(sysUser));
+        }
+        String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                "<table cellpadding=\"0\" align=\"center\"" +
+                "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">EHS管理助手</font></th></tr>";
+        //表html中间内容
+        String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
+                "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
+                "<p>您有" + tPsPatrolPlans.size() + "条巡检计划将于三天后截止:<br>" +
+                "请登录<a href=\"http://43.143.92.79:93/plan\">检查计划</a>或EHS管理助手APP查看。<br>" +
+                "<p align=\"right\">date</p>" +
+                "<div style=\"width:700px;margin:0 auto;\">" +
+                "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
+                "<p>此为系统邮件,请勿回复</p>" +
+                "</div></div></div></td></tr>";
+        for (SysUser user : users) {
+            String one = center.replaceFirst("username", user.getNickName());
+            String two = one.replace("loginName", user.getUserName());
+            String result = two.replaceFirst("date", DateUtils.getDate());
+            String end = "</tbody></table></div></body></html>";
+            //拼接html
+            String html = start + result + end;
+            logger.info("html:" + html);
+            if (StringUtils.isNotEmpty(user.getEmail()))
+                mailService.sendHtmlMail(user.getEmail(), "您有巡检任务尚未完成", html);
+        }
+
+    }
+}

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevAlarmMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevAlarmMapper {
      * @param tPsDevAlarm 手动启动火灾报警器基础信息
      * @return 手动启动火灾报警器基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevAlarm> selectTPsDevAlarmList(TPsDevAlarm tPsDevAlarm);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCabinetMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevCabinetMapper {
      * @param tPsDevCabinet 玻璃门消火栓箱和泡沫栓箱基础信息
      * @return 玻璃门消火栓箱和泡沫栓箱基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevCabinet> selectTPsDevCabinetList(TPsDevCabinet tPsDevCabinet);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCallsystemMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevCallsystemMapper {
      * @param tPsDevCallsystem 现场呼叫系统基础信息
      * @return 现场呼叫系统基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevCallsystem> selectTPsDevCallsystemList(TPsDevCallsystem tPsDevCallsystem);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCofferMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevCofferMapper {
      * @param tPsDevCoffer 围堰基础信息
      * @return 围堰基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevCoffer> selectTPsDevCofferList(TPsDevCoffer tPsDevCoffer);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevCurtainMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevCurtainMapper {
      * @param tPsDevCurtain 现场消防水幕检测记录
      * @return 现场消防水幕检测记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevCurtain> selectTPsDevCurtainList(TPsDevCurtain tPsDevCurtain);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevExtinguisherMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevExtinguisherMapper {
      * @param tPsDevExtinguisher 现场灭火器基础信息
      * @return 现场灭火器基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevExtinguisher> selectTPsDevExtinguisherList(TPsDevExtinguisher tPsDevExtinguisher);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevEyewashMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevEyewashMapper {
      * @param tPsDevEyewash 洗眼器巡检记录
      * @return 洗眼器巡检记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevEyewash> selectTPsDevEyewashList(TPsDevEyewash tPsDevEyewash);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevFgsMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevFgsMapper {
      * @param tPsDevFgs FGS Mini板基础信息
      * @return FGS Mini板基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevFgs> selectTPsDevFgsList(TPsDevFgs tPsDevFgs);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevFiredoorMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevFiredoorMapper {
      * @param tPsDevFiredoor 安全防火门防爆门基础信息
      * @return 安全防火门防爆门基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevFiredoor> selectTPsDevFiredoorList(TPsDevFiredoor tPsDevFiredoor);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevHydrantMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevHydrantMapper {
      * @param tPsDevHydrant 地上消火栓和消防水带箱基础信息
      * @return 地上消火栓和消防水带箱基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevHydrant> selectTPsDevHydrantList(TPsDevHydrant tPsDevHydrant);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevLiftMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevLiftMapper {
      * @param tPsDevLift 电梯基础信息
      * @return 电梯基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevLift> selectTPsDevLiftList(TPsDevLift tPsDevLift);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevMonitorMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevMonitorMapper {
      * @param tPsDevMonitor 现场消防炮基础信息
      * @return 现场消防炮基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevMonitor> selectTPsDevMonitorList(TPsDevMonitor tPsDevMonitor);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevPitMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevPitMapper {
      * @param tPsDevPit 现场地井基础信息
      * @return 现场地井基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevPit> selectTPsDevPitList(TPsDevPit tPsDevPit);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevRainvalveMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevRainvalveMapper {
      * @param tPsDevRainvalve 污水/雨排切换阀门检查
      * @return 污水/雨排切换阀门检查集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevRainvalve> selectTPsDevRainvalveList(TPsDevRainvalve tPsDevRainvalve);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevSteamMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevSteamMapper {
      * @param tPsDevSteam 消防蒸汽系统基础信息
      * @return 消防蒸汽系统基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevSteam> selectTPsDevSteamList(TPsDevSteam tPsDevSteam);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevSumpMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevSumpMapper {
      * @param tPsDevSump 雨排井基础信息
      * @return 雨排井基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevSump> selectTPsDevSumpList(TPsDevSump tPsDevSump);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevUtilitystationMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevUtilitystationMapper {
      * @param tPsDevUtilitystation 公用站基础信息
      * @return 公用站基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevUtilitystation> selectTPsDevUtilitystationList(TPsDevUtilitystation tPsDevUtilitystation);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevVentvalveMapper.java

@@ -26,7 +26,7 @@ public interface TPsDevVentvalveMapper {
      * @param tPsDevVentvalve 余压阀基础信息
      * @return 余压阀基础信息集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsDevVentvalve> selectTPsDevVentvalveList(TPsDevVentvalve tPsDevVentvalve);
 
     /**

+ 4 - 3
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionAppController.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.ps.inspection.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
+import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
@@ -104,15 +105,15 @@ public class TPsInspectionAppController extends BaseController {
             // 如果 data 中没有分页参数,尝试从请求参数中获取
             if (pageNum == null || pageSize == null) {
                 try {
-                    com.ruoyi.common.utils.ServletUtils.getRequest();
+                    ServletUtils.getRequest();
                     if (pageNum == null) {
-                        Integer paramPageNum = com.ruoyi.common.utils.ServletUtils.getParameterToInt("pageNum");
+                        Integer paramPageNum = ServletUtils.getParameterToInt("pageNum");
                         if (paramPageNum != null) {
                             pageNum = paramPageNum;
                         }
                     }
                     if (pageSize == null) {
-                        Integer paramPageSize = com.ruoyi.common.utils.ServletUtils.getParameterToInt("pageSize");
+                        Integer paramPageSize = ServletUtils.getParameterToInt("pageSize");
                         if (paramPageSize != null) {
                             pageSize = paramPageSize;
                         }

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionAlarmMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionAlarmMapper {
      * @param tPsInspectionAlarm 手动启动火灾报警器检查记录
      * @return 手动启动火灾报警器检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionAlarm> selectTPsInspectionAlarmList(TPsInspectionAlarm tPsInspectionAlarm);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionAlarmMapper {
      * @return 结果
      */
     public int deleteTPsInspectionAlarmByIds(Long[] ids);
+
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionAlarmByPlanId(Long planId);
 }

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCabinetMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionCabinetMapper {
      * @param tPsInspectionCabinet 玻璃门消火栓箱和泡沫栓箱检查记录
      * @return 玻璃门消火栓箱和泡沫栓箱检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionCabinet> selectTPsInspectionCabinetList(TPsInspectionCabinet tPsInspectionCabinet);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionCabinetMapper {
      * @return 结果
      */
     public int deleteTPsInspectionCabinetByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionCabinetByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCallsystemMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionCallsystemMapper {
      * @param tPsInspectionCallsystem 现场呼叫系统检查记录
      * @return 现场呼叫系统检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionCallsystem> selectTPsInspectionCallsystemList(TPsInspectionCallsystem tPsInspectionCallsystem);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionCallsystemMapper {
      * @return 结果
      */
     public int deleteTPsInspectionCallsystemByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionCallsystemByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCofferMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionCofferMapper {
      * @param tPsInspectionCoffer 围堰检查记录
      * @return 围堰检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionCoffer> selectTPsInspectionCofferList(TPsInspectionCoffer tPsInspectionCoffer);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionCofferMapper {
      * @return 结果
      */
     public int deleteTPsInspectionCofferByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionCofferByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionCurtainMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionCurtainMapper {
      * @param tPsInspectionCurtain 现场消防水幕检测记录
      * @return 现场消防水幕检测记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionCurtain> selectTPsInspectionCurtainList(TPsInspectionCurtain tPsInspectionCurtain);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionCurtainMapper {
      * @return 结果
      */
     public int deleteTPsInspectionCurtainByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionCurtainByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionExtinguisherMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionExtinguisherMapper {
      * @param tPsInspectionExtinguisher 现场灭火器检查记录
      * @return 现场灭火器检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionExtinguisher> selectTPsInspectionExtinguisherList(TPsInspectionExtinguisher tPsInspectionExtinguisher);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionExtinguisherMapper {
      * @return 结果
      */
     public int deleteTPsInspectionExtinguisherByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionExtinguisherByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionEyewashMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionEyewashMapper {
      * @param tPsInspectionEyewash 洗眼器巡检记录
      * @return 洗眼器巡检记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionEyewash> selectTPsInspectionEyewashList(TPsInspectionEyewash tPsInspectionEyewash);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionEyewashMapper {
      * @return 结果
      */
     public int deleteTPsInspectionEyewashByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionEyewashByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionFgsMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionFgsMapper {
      * @param tPsInspectionFgs FGS Mini板检查记录
      * @return FGS Mini板检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionFgs> selectTPsInspectionFgsList(TPsInspectionFgs tPsInspectionFgs);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionFgsMapper {
      * @return 结果
      */
     public int deleteTPsInspectionFgsByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionFgsByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionFiredoorMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionFiredoorMapper {
      * @param tPsInspectionFiredoor 安全防火门防爆门检查记录
      * @return 安全防火门防爆门检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionFiredoor> selectTPsInspectionFiredoorList(TPsInspectionFiredoor tPsInspectionFiredoor);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionFiredoorMapper {
      * @return 结果
      */
     public int deleteTPsInspectionFiredoorByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionFiredoorByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionHydrantMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionHydrantMapper {
      * @param tPsInspectionHydrant 地上消火栓和消防水带箱检查记录
      * @return 地上消火栓和消防水带箱检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionHydrant> selectTPsInspectionHydrantList(TPsInspectionHydrant tPsInspectionHydrant);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionHydrantMapper {
      * @return 结果
      */
     public int deleteTPsInspectionHydrantByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionHydrantByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionLiftMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionLiftMapper {
      * @param tPsInspectionLift 电梯检查记录
      * @return 电梯检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionLift> selectTPsInspectionLiftList(TPsInspectionLift tPsInspectionLift);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionLiftMapper {
      * @return 结果
      */
     public int deleteTPsInspectionLiftByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionLiftByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionMonitorMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionMonitorMapper {
      * @param tPsInspectionMonitor 现场消防炮检查记录
      * @return 现场消防炮检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionMonitor> selectTPsInspectionMonitorList(TPsInspectionMonitor tPsInspectionMonitor);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionMonitorMapper {
      * @return 结果
      */
     public int deleteTPsInspectionMonitorByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionMonitorByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionPitMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionPitMapper {
      * @param tPsInspectionPit 现场地井检查记录
      * @return 现场地井检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionPit> selectTPsInspectionPitList(TPsInspectionPit tPsInspectionPit);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionPitMapper {
      * @return 结果
      */
     public int deleteTPsInspectionPitByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionPitByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionRainvalveMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionRainvalveMapper {
      * @param tPsInspectionRainvalve 污水/雨排切换阀门检查
      * @return 污水/雨排切换阀门检查集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionRainvalve> selectTPsInspectionRainvalveList(TPsInspectionRainvalve tPsInspectionRainvalve);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionRainvalveMapper {
      * @return 结果
      */
     public int deleteTPsInspectionRainvalveByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionRainvalveByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionSteamMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionSteamMapper {
      * @param tPsInspectionSteam 消防蒸汽系统检查记录
      * @return 消防蒸汽系统检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionSteam> selectTPsInspectionSteamList(TPsInspectionSteam tPsInspectionSteam);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionSteamMapper {
      * @return 结果
      */
     public int deleteTPsInspectionSteamByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionSteamByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionSumpMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionSumpMapper {
      * @param tPsInspectionSump 雨排井检查记录
      * @return 雨排井检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionSump> selectTPsInspectionSumpList(TPsInspectionSump tPsInspectionSump);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionSumpMapper {
      * @return 结果
      */
     public int deleteTPsInspectionSumpByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionSumpByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionUtilitystationMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionUtilitystationMapper {
      * @param tPsInspectionUtilitystation 公用站检查记录
      * @return 公用站检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionUtilitystation> selectTPsInspectionUtilitystationList(TPsInspectionUtilitystation tPsInspectionUtilitystation);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionUtilitystationMapper {
      * @return 结果
      */
     public int deleteTPsInspectionUtilitystationByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionUtilitystationByPlanId(Long planId);
 }
+

+ 9 - 1
master/src/main/java/com/ruoyi/project/ps/inspection/mapper/TPsInspectionVentvalveMapper.java

@@ -26,7 +26,7 @@ public interface TPsInspectionVentvalveMapper {
      * @param tPsInspectionVentvalve 余压阀检查记录
      * @return 余压阀检查记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsInspectionVentvalve> selectTPsInspectionVentvalveList(TPsInspectionVentvalve tPsInspectionVentvalve);
 
     /**
@@ -60,4 +60,12 @@ public interface TPsInspectionVentvalveMapper {
      * @return 结果
      */
     public int deleteTPsInspectionVentvalveByIds(Long[] ids);
+    /**
+     * 根据计划ID删除巡检记录
+     *
+     * @param planId 计划ID
+     * @return 结果
+     */
+    public int deleteTPsInspectionVentvalveByPlanId(Long planId);
 }
+

+ 49 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/controller/TPsIndexController.java

@@ -0,0 +1,49 @@
+package com.ruoyi.project.ps.patrol.controller;
+
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.ps.patrol.domain.TPsIndex;
+import com.ruoyi.project.ps.patrol.service.ITPsIndexService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 首页统计Controller
+ * 
+ * @author ssy
+ * @date 2025-11-27
+ */
+@RestController
+@RequestMapping("/ps/patrol/index")
+public class TPsIndexController extends BaseController
+{
+    @Autowired
+    private ITPsIndexService tPsIndexService;
+
+    /**
+     * 获取首页统计数量
+     */
+    @GetMapping("/countNums")
+    public AjaxResult getCountNums()
+    {
+        TPsIndex tIndex = new TPsIndex();
+        tIndex.setCreateDate(new Date());
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        tIndex.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+        tIndex.setMonth(String.valueOf(calendar.get(Calendar.MONTH) + 1));
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("devNum", tPsIndexService.getDevNumber());
+        resultMap.put("uncheckPlanNum", tPsIndexService.getUncheckNumber(tIndex));
+        resultMap.put("checkedPlanNum", tPsIndexService.getCheckNumber(tIndex));
+        resultMap.put("issueNum", tPsIndexService.getIssueNumber(tIndex));
+        return AjaxResult.success(resultMap);
+    }
+}

+ 7 - 279
master/src/main/java/com/ruoyi/project/ps/patrol/controller/TPsPatrolPlanController.java

@@ -1,13 +1,11 @@
 package com.ruoyi.project.ps.patrol.controller;
 
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.ps.dev.domain.*;
 import com.ruoyi.project.ps.dev.service.*;
 import com.ruoyi.project.ps.inspection.domain.*;
 import com.ruoyi.project.ps.inspection.service.*;
@@ -19,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -93,61 +90,6 @@ public class TPsPatrolPlanController extends BaseController {
 
     @Autowired
     private ITPsInspectionVentvalveService tPsInspectionVentvalveService;
-
-
-    @Autowired
-    private ITPsDevAlarmService tPsDevAlarmService;
-
-    @Autowired
-    private ITPsDevCabinetService tPsDevCabinetService;
-
-    @Autowired
-    private ITPsDevCallsystemService tPsDevCallsystemService;
-
-    @Autowired
-    private ITPsDevCofferService tPsDevCofferService;
-
-    @Autowired
-    private ITPsDevCurtainService tPsDevCurtainService;
-
-    @Autowired
-    private ITPsDevExtinguisherService tPsDevExtinguisherService;
-
-    @Autowired
-    private ITPsDevEyewashService tPsDevEyewashService;
-
-    @Autowired
-    private ITPsDevFgsService tPsDevFgsService;
-
-    @Autowired
-    private ITPsDevFiredoorService tPsDevFiredoorService;
-
-    @Autowired
-    private ITPsDevHydrantService tPsDevHydrantService;
-
-    @Autowired
-    private ITPsDevLiftService tPsDevLiftService;
-
-    @Autowired
-    private ITPsDevMonitorService tPsDevMonitorService;
-
-    @Autowired
-    private ITPsDevPitService tPsDevPitService;
-
-    @Autowired
-    private ITPsDevRainvalveService tPsDevRainvalveService;
-
-    @Autowired
-    private ITPsDevSteamService tPsDevSteamService;
-
-    @Autowired
-    private ITPsDevSumpService tPsDevSumpService;
-
-    @Autowired
-    private ITPsDevUtilitystationService tPsDevUtilitystationService;
-
-    @Autowired
-    private ITPsDevVentvalveService tPsDevVentvalveService;
     // endregion
 
     /**
@@ -195,230 +137,16 @@ public class TPsPatrolPlanController extends BaseController {
         // 设置创建人ID、状态和创建时间
         String userId = getUserId().toString();
         tPsPatrolPlan.setStatus(0L);
-        tPsPatrolPlan.setCreaterCode(getUserId().toString());
+        tPsPatrolPlan.setCreaterCode(userId);
         tPsPatrolPlan.setCreatedate(new Date());
 
-        // 插入检查计划并获取插入结果
-        if (tPsPatrolPlanService.insertTPsPatrolPlan(tPsPatrolPlan) > 0) {
-            // 根据计划年月,设置为每月15号,计算截止日期,默认为当月最后一天
-            Calendar cd = Calendar.getInstance();
-            cd.set(Math.toIntExact(tPsPatrolPlan.getPlanYear()), Math.toIntExact(tPsPatrolPlan.getPlanMonth() - 1), 15);
-            Date deadline = DateUtils.getLastMonthDay(cd.getTime());
-            // 统计设备数量
-            int devNum = 0;
-
-            // 根据不同的巡检类型(1-19)查询对应设备列表,并生成相应的巡检任务记录
-            switch (tPsPatrolPlan.getPatrolType()) {
-                case "1":
-                    TPsDevAlarm tPsDevAlarm = new TPsDevAlarm();
-                    tPsDevAlarm.setStatus("1");
-                    List<TPsDevAlarm> tPsDevAlarms = tPsDevAlarmService.selectTPsDevAlarmList(tPsDevAlarm);
-                    devNum = tPsDevAlarms.size();
-                    for (TPsDevAlarm dev : tPsDevAlarms) {
-                        TPsInspectionAlarm alarm = new TPsInspectionAlarm(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), tPsPatrolPlan.getId(), userId);
-                        tPsInspectionAlarmService.insertTPsInspectionAlarm(alarm);
-                    }
-                    break;
-                case "2":
-                    TPsDevCabinet tPsDevCabinet = new TPsDevCabinet();
-                    tPsDevCabinet.setStatus("1");
-                    List<TPsDevCabinet> tPsDevCabinets = tPsDevCabinetService.selectTPsDevCabinetList(tPsDevCabinet);
-                    devNum = tPsDevCabinets.size();
-                    for (TPsDevCabinet dev : tPsDevCabinets) {
-                        TPsInspectionCabinet inspectionCabinet = new TPsInspectionCabinet(dev.getPosition(), dev.getModelNo(), dev.getBoxNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), tPsPatrolPlan.getId(), userId, dev.getValveType(), dev.getValveSpecification(), dev.getValveLength(), dev.getBoltPointDistance(), dev.getBoltHoleCount());
-                        tPsInspectionCabinetService.insertTPsInspectionCabinet(inspectionCabinet);
-                    }
-                    break;
-                case "3":
-                    TPsDevCallsystem tPsDevCallsystem = new TPsDevCallsystem();
-                    tPsDevCallsystem.setStatus("1");
-                    List<TPsDevCallsystem> tPsDevCallsystems = tPsDevCallsystemService.selectTPsDevCallsystemList(tPsDevCallsystem);
-                    devNum = tPsDevCallsystems.size();
-                    for (TPsDevCallsystem dev : tPsDevCallsystems) {
-                        TPsInspectionCallsystem inspectionCallsystem = new TPsInspectionCallsystem(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionCallsystemService.insertTPsInspectionCallsystem(inspectionCallsystem);
-                    }
-                    break;
-                case "4":
-                    TPsDevCoffer tPsDevCoffer = new TPsDevCoffer();
-                    tPsDevCoffer.setStatus("1");
-                    List<TPsDevCoffer> tPsDevCoffers = tPsDevCofferService.selectTPsDevCofferList(tPsDevCoffer);
-                    devNum = tPsDevCoffers.size();
-                    for (TPsDevCoffer dev : tPsDevCoffers) {
-                        TPsInspectionCoffer inspectionCoffer = new TPsInspectionCoffer(dev.getCofferNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionCofferService.insertTPsInspectionCoffer(inspectionCoffer);
-                    }
-                    break;
-                case "5":
-                    TPsDevCurtain tPsDevCurtain = new TPsDevCurtain();
-                    tPsDevCurtain.setStatus("1");
-                    List<TPsDevCurtain> tPsDevCurtains = tPsDevCurtainService.selectTPsDevCurtainList(tPsDevCurtain);
-                    devNum = tPsDevCurtains.size();
-                    for (TPsDevCurtain dev : tPsDevCurtains) {
-                        TPsInspectionCurtain inspectionCurtain = new TPsInspectionCurtain(dev.getPosition(), dev.getCurtainName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionCurtainService.insertTPsInspectionCurtain(inspectionCurtain);
-                    }
-                    break;
-                case "6":
-                    TPsDevExtinguisher tPsDevExtinguisher = new TPsDevExtinguisher();
-                    tPsDevExtinguisher.setStatus("1");
-                    List<TPsDevExtinguisher> tPsDevExtinguishers = tPsDevExtinguisherService.selectTPsDevExtinguisherList(tPsDevExtinguisher);
-                    devNum = tPsDevExtinguishers.size();
-                    for (TPsDevExtinguisher dev : tPsDevExtinguishers) {
-                        TPsInspectionExtinguisher inspectionExtinguisher = new TPsInspectionExtinguisher(dev.getFireExtinguisherNo(), dev.getPosition(), dev.getFireExtinguisherModel(), tPsPatrolPlan.getDetectionFrequency(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId(), dev.getDevType());
-                        tPsInspectionExtinguisherService.insertTPsInspectionExtinguisher(inspectionExtinguisher);
-                    }
-                    // 若检测频率为“每半个月一次”,且为上半月的,则截止时间为当前月 15号
-                    if ("1".equals(tPsPatrolPlan.getDetectionFrequency())) {
-                        deadline = cd.getTime();
-                    }
-                    break;
-                case "7":
-                    TPsDevEyewash tPsDevEyewash = new TPsDevEyewash();
-                    tPsDevEyewash.setStatus("1");
-                    List<TPsDevEyewash> tPsDevEyewashs = tPsDevEyewashService.selectTPsDevEyewashList(tPsDevEyewash);
-                    devNum = tPsDevEyewashs.size();
-                    for (TPsDevEyewash dev : tPsDevEyewashs) {
-                        TPsInspectionEyewash inspectionEyewash = new TPsInspectionEyewash(dev.getDevNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionEyewashService.insertTPsInspectionEyewash(inspectionEyewash);
-                    }
-                    break;
-                case "8":
-                    TPsDevFgs tPsDevFgs = new TPsDevFgs();
-                    tPsDevFgs.setStatus("1");
-                    List<TPsDevFgs> tPsDevFgss = tPsDevFgsService.selectTPsDevFgsList(tPsDevFgs);
-                    devNum = tPsDevFgss.size();
-                    for (TPsDevFgs dev : tPsDevFgss) {
-                        TPsInspectionFgs inspectionFgs = new TPsInspectionFgs(dev.getFgsNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionFgsService.insertTPsInspectionFgs(inspectionFgs);
-                    }
-                    break;
-                case "9":
-                    TPsDevFiredoor tPsDevFiredoor = new TPsDevFiredoor();
-                    tPsDevFiredoor.setStatus("1");
-                    List<TPsDevFiredoor> tPsDevFiredoors = tPsDevFiredoorService.selectTPsDevFiredoorList(tPsDevFiredoor);
-                    devNum = tPsDevFiredoors.size();
-                    for (TPsDevFiredoor dev : tPsDevFiredoors) {
-                        TPsInspectionFiredoor inspectionFiredoor = new TPsInspectionFiredoor(dev.getDoorNo(), dev.getDoorName(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionFiredoorService.insertTPsInspectionFiredoor(inspectionFiredoor);
-                    }
-                    break;
-                case "10":
-                    TPsDevHydrant tPsDevHydrant = new TPsDevHydrant();
-                    tPsDevHydrant.setStatus("1");
-                    List<TPsDevHydrant> tPsDevHydrants = tPsDevHydrantService.selectTPsDevHydrantList(tPsDevHydrant);
-                    devNum = tPsDevHydrants.size();
-                    for (TPsDevHydrant dev : tPsDevHydrants) {
-                        TPsInspectionHydrant inspectionHydrant = new TPsInspectionHydrant(
-                                dev.getPosition(),
-                                dev.getEquipId(),
-                                dev.getHydrantQty(),
-                                dev.getHoseQty(),
-                                dev.getWrenchQty(),
-                                tPsPatrolPlan.getPlanMonth(),
-                                tPsPatrolPlan.getPlanYear(),
-                                userId,
-                                tPsPatrolPlan.getId()
-                        );
-                        inspectionHydrant.setGroupNo(dev.getGroupNo());
-                        tPsInspectionHydrantService.insertTPsInspectionHydrant(inspectionHydrant);
-                    }
-                    break;
-                case "11":
-                    TPsDevLift tPsDevLift = new TPsDevLift();
-                    tPsDevLift.setStatus("1");
-                    List<TPsDevLift> tPsDevLifts = tPsDevLiftService.selectTPsDevLiftList(tPsDevLift);
-                    devNum = tPsDevLifts.size();
-                    for (TPsDevLift dev : tPsDevLifts) {
-                        TPsInspectionLift inspectionLift = new TPsInspectionLift(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionLiftService.insertTPsInspectionLift(inspectionLift);
-                    }
-                    break;
-                case "12":
-                    TPsDevMonitor tPsDevMonitor = new TPsDevMonitor();
-                    tPsDevMonitor.setStatus("1");
-                    List<TPsDevMonitor> tPsDevMonitors = tPsDevMonitorService.selectTPsDevMonitorList(tPsDevMonitor);
-                    devNum = tPsDevMonitors.size();
-                    for (TPsDevMonitor dev : tPsDevMonitors) {
-                        TPsInspectionMonitor inspectionMonitor = new TPsInspectionMonitor(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionMonitorService.insertTPsInspectionMonitor(inspectionMonitor);
-                    }
-                    break;
-                case "13":
-                    TPsDevPit tPsDevPit = new TPsDevPit();
-                    tPsDevPit.setStatus("1");
-                    List<TPsDevPit> tPsDevPits = tPsDevPitService.selectTPsDevPitList(tPsDevPit);
-                    devNum = tPsDevPits.size();
-                    for (TPsDevPit dev : tPsDevPits) {
-                        TPsInspectionPit inspectionPit = new TPsInspectionPit(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionPitService.insertTPsInspectionPit(inspectionPit);
-                    }
-                    break;
-                case "14":
-                    TPsDevRainvalve tPsDevRainvalve = new TPsDevRainvalve();
-                    tPsDevRainvalve.setStatus("1");
-                    List<TPsDevRainvalve> tPsDevRainvalves = tPsDevRainvalveService.selectTPsDevRainvalveList(tPsDevRainvalve);
-                    devNum = tPsDevRainvalves.size();
-                    for (TPsDevRainvalve dev : tPsDevRainvalves) {
-                        TPsInspectionRainvalve inspectionRainvalve = new TPsInspectionRainvalve(dev.getPosition(), dev.getValveName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionRainvalveService.insertTPsInspectionRainvalve(inspectionRainvalve);
-                    }
-                    break;
-                case "15":
-                    TPsDevSteam tPsDevSteam = new TPsDevSteam();
-                    tPsDevSteam.setStatus("1");
-                    List<TPsDevSteam> tPsDevSteams = tPsDevSteamService.selectTPsDevSteamList(tPsDevSteam);
-                    devNum = tPsDevSteams.size();
-                    for (TPsDevSteam dev : tPsDevSteams) {
-                        TPsInspectionSteam inspectionSteam = new TPsInspectionSteam(dev.getPosition(), dev.getSteamName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionSteamService.insertTPsInspectionSteam(inspectionSteam);
-                    }
-                    break;
-                case "16":
-                    TPsDevSump tPsDevSump = new TPsDevSump();
-                    tPsDevSump.setStatus("1");
-                    List<TPsDevSump> tPsDevSumps = tPsDevSumpService.selectTPsDevSumpList(tPsDevSump);
-                    devNum = tPsDevSumps.size();
-                    for (TPsDevSump dev : tPsDevSumps) {
-                        TPsInspectionSump inspectionSump = new TPsInspectionSump(dev.getSumpNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionSumpService.insertTPsInspectionSump(inspectionSump);
-                    }
-                    break;
-                case "17":
-                    TPsDevUtilitystation tPsDevUtilitystation = new TPsDevUtilitystation();
-                    tPsDevUtilitystation.setStatus("1");
-                    List<TPsDevUtilitystation> tPsDevUtilitystations = tPsDevUtilitystationService.selectTPsDevUtilitystationList(tPsDevUtilitystation);
-                    devNum = tPsDevUtilitystations.size();
-                    for (TPsDevUtilitystation dev : tPsDevUtilitystations) {
-                        TPsInspectionUtilitystation inspectionUtilitystation = new TPsInspectionUtilitystation(dev.getPosition(), dev.getUtilityStationName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionUtilitystationService.insertTPsInspectionUtilitystation(inspectionUtilitystation);
-                    }
-                    break;
-                case "18":
-                    TPsDevVentvalve tPsDevVentvalve = new TPsDevVentvalve();
-                    tPsDevVentvalve.setStatus("1");
-                    List<TPsDevVentvalve> tPsDevVentvalves = tPsDevVentvalveService.selectTPsDevVentvalveList(tPsDevVentvalve);
-                    devNum = tPsDevVentvalves.size();
-                    for (TPsDevVentvalve dev : tPsDevVentvalves) {
-                        TPsInspectionVentvalve inspectionVentvalve = new TPsInspectionVentvalve(dev.getPosition(), dev.getVentvalveNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
-                        tPsInspectionVentvalveService.insertTPsInspectionVentvalve(inspectionVentvalve);
-                    }
-                    break;
-                case "19":
-                    break;
-            }
-
-            // 更新计划中的设备数量、未完成数、已完成数及截止时间
-            tPsPatrolPlan.setDevNum((long) devNum);
-            tPsPatrolPlan.setUncheckedNum((long) devNum);
-            tPsPatrolPlan.setCheckedNum(0L);
-            tPsPatrolPlan.setDeadline(deadline);
-
-            // 成功后返回成功信息
-            return toAjax(tPsPatrolPlanService.updateTPsPatrolPlan(tPsPatrolPlan));
+        // 调用 service 创建巡检计划并生成巡检记录
+        int result = tPsPatrolPlanService.createPatrolPlanWithInspections(tPsPatrolPlan, userId);
+        
+        if (result > 0) {
+            return AjaxResult.success("计划生成成功!");
         }
-
-        // 默认返回错误信息
+        
         return AjaxResult.error("计划生成失败!请联系管理员!");
     }
 

+ 52 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/domain/TPsIndex.java

@@ -0,0 +1,52 @@
+package com.ruoyi.project.ps.patrol.domain;
+
+import com.ruoyi.framework.web.domain.BaseEntity;
+import java.util.Date;
+
+/**
+ * 首页统计对象
+ * 
+ * @author ssy
+ * @date 2025-11-27
+ */
+public class TPsIndex extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 年份 */
+    private String year;
+
+    /** 月份 */
+    private String month;
+
+    /** 创建时间 */
+    private Date createDate;
+
+    public void setYear(String year) 
+    {
+        this.year = year;
+    }
+
+    public String getYear() 
+    {
+        return year;
+    }
+    public void setMonth(String month) 
+    {
+        this.month = month;
+    }
+
+    public String getMonth() 
+    {
+        return month;
+    }
+    public void setCreateDate(Date createDate) 
+    {
+        this.createDate = createDate;
+    }
+
+    public Date getCreateDate() 
+    {
+        return createDate;
+    }
+}

+ 43 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsIndexMapper.java

@@ -0,0 +1,43 @@
+package com.ruoyi.project.ps.patrol.mapper;
+
+import com.ruoyi.project.ps.patrol.domain.TPsIndex;
+
+/**
+ * 首页统计Mapper接口
+ * 
+ * @author ssy
+ * @date 2025-11-27
+ */
+public interface TPsIndexMapper 
+{
+    /**
+     * 查询设备数量
+     * 
+     * @return 设备数量
+     */
+    public int getDevNumber();
+
+    /**
+     * 查询未检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 未检查计划数量
+     */
+    public int getUncheckNumber(TPsIndex tIndex);
+
+    /**
+     * 查询已检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 已检查计划数量
+     */
+    public int getCheckNumber(TPsIndex tIndex);
+
+    /**
+     * 查询隐患数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 隐患数量
+     */
+    public int getIssueNumber(TPsIndex tIndex);
+}

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolIssuesMapper.java

@@ -26,7 +26,7 @@ public interface TPsPatrolIssuesMapper {
      * @param tPsPatrolIssues 检查问题记录
      * @return 检查问题记录集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsPatrolIssues> selectTPsPatrolIssuesList(TPsPatrolIssues tPsPatrolIssues);
 
     /**

+ 1 - 2
master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolMainMapper.java

@@ -1,6 +1,5 @@
 package com.ruoyi.project.ps.patrol.mapper;
 
-import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolMain;
 
 import java.util.List;
@@ -26,7 +25,7 @@ public interface TPsPatrolMainMapper {
      * @param tPsPatrolMain 检查策略
      * @return 检查策略集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsPatrolMain> selectTPsPatrolMainList(TPsPatrolMain tPsPatrolMain);
 
     /**

+ 1 - 1
master/src/main/java/com/ruoyi/project/ps/patrol/mapper/TPsPatrolPlanMapper.java

@@ -26,7 +26,7 @@ public interface TPsPatrolPlanMapper {
      * @param tPsPatrolPlan 检查计划
      * @return 检查计划集合
      */
-    @DataScope(deptAlias = "d")
+    
     public List<TPsPatrolPlan> selectTPsPatrolPlanList(TPsPatrolPlan tPsPatrolPlan);
 
     /**

+ 43 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/service/ITPsIndexService.java

@@ -0,0 +1,43 @@
+package com.ruoyi.project.ps.patrol.service;
+
+import com.ruoyi.project.ps.patrol.domain.TPsIndex;
+
+/**
+ * 首页统计Service接口
+ * 
+ * @author ssy
+ * @date 2025-11-27
+ */
+public interface ITPsIndexService 
+{
+    /**
+     * 查询设备数量
+     * 
+     * @return 设备数量
+     */
+    public int getDevNumber();
+
+    /**
+     * 查询未检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 未检查计划数量
+     */
+    public int getUncheckNumber(TPsIndex tIndex);
+
+    /**
+     * 查询已检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 已检查计划数量
+     */
+    public int getCheckNumber(TPsIndex tIndex);
+
+    /**
+     * 查询隐患数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 隐患数量
+     */
+    public int getIssueNumber(TPsIndex tIndex);
+}

+ 9 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/service/ITPsPatrolPlanService.java

@@ -58,4 +58,13 @@ public interface ITPsPatrolPlanService {
      * @return 结果
      */
     public int deleteTPsPatrolPlanById(Long id);
+
+    /**
+     * 创建巡检计划并生成巡检记录
+     *
+     * @param tPsPatrolPlan 巡检计划
+     * @param userId 用户ID
+     * @return 结果
+     */
+    public int createPatrolPlanWithInspections(TPsPatrolPlan tPsPatrolPlan, String userId);
 }

+ 67 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/service/impl/TPsIndexServiceImpl.java

@@ -0,0 +1,67 @@
+package com.ruoyi.project.ps.patrol.service.impl;
+
+import com.ruoyi.project.ps.patrol.domain.TPsIndex;
+import com.ruoyi.project.ps.patrol.mapper.TPsIndexMapper;
+import com.ruoyi.project.ps.patrol.service.ITPsIndexService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 首页统计Service业务层处理
+ * 
+ * @author ssy
+ * @date 2025-11-27
+ */
+@Service
+public class TPsIndexServiceImpl implements ITPsIndexService 
+{
+    @Autowired
+    private TPsIndexMapper tPsIndexMapper;
+
+    /**
+     * 查询设备数量
+     * 
+     * @return 设备数量
+     */
+    @Override
+    public int getDevNumber()
+    {
+        return tPsIndexMapper.getDevNumber();
+    }
+
+    /**
+     * 查询未检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 未检查计划数量
+     */
+    @Override
+    public int getUncheckNumber(TPsIndex tIndex)
+    {
+        return tPsIndexMapper.getUncheckNumber(tIndex);
+    }
+
+    /**
+     * 查询已检查计划数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 已检查计划数量
+     */
+    @Override
+    public int getCheckNumber(TPsIndex tIndex)
+    {
+        return tPsIndexMapper.getCheckNumber(tIndex);
+    }
+
+    /**
+     * 查询隐患数量
+     * 
+     * @param tIndex 首页统计信息
+     * @return 隐患数量
+     */
+    @Override
+    public int getIssueNumber(TPsIndex tIndex)
+    {
+        return tPsIndexMapper.getIssueNumber(tIndex);
+    }
+}

+ 360 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/service/impl/TPsPatrolPlanServiceImpl.java

@@ -1,11 +1,18 @@
 package com.ruoyi.project.ps.patrol.service.impl;
 
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.project.ps.dev.domain.*;
+import com.ruoyi.project.ps.dev.mapper.*;
+import com.ruoyi.project.ps.inspection.domain.*;
+import com.ruoyi.project.ps.inspection.mapper.*;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.mapper.TPsPatrolPlanMapper;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -19,6 +26,82 @@ public class TPsPatrolPlanServiceImpl implements ITPsPatrolPlanService {
     @Autowired
     private TPsPatrolPlanMapper tPsPatrolPlanMapper;
 
+    // 设备 Mapper 注入
+    @Autowired
+    private TPsDevAlarmMapper tPsDevAlarmMapper;
+    @Autowired
+    private TPsDevCabinetMapper tPsDevCabinetMapper;
+    @Autowired
+    private TPsDevCallsystemMapper tPsDevCallsystemMapper;
+    @Autowired
+    private TPsDevCofferMapper tPsDevCofferMapper;
+    @Autowired
+    private TPsDevCurtainMapper tPsDevCurtainMapper;
+    @Autowired
+    private TPsDevExtinguisherMapper tPsDevExtinguisherMapper;
+    @Autowired
+    private TPsDevEyewashMapper tPsDevEyewashMapper;
+    @Autowired
+    private TPsDevFgsMapper tPsDevFgsMapper;
+    @Autowired
+    private TPsDevFiredoorMapper tPsDevFiredoorMapper;
+    @Autowired
+    private TPsDevHydrantMapper tPsDevHydrantMapper;
+    @Autowired
+    private TPsDevLiftMapper tPsDevLiftMapper;
+    @Autowired
+    private TPsDevMonitorMapper tPsDevMonitorMapper;
+    @Autowired
+    private TPsDevPitMapper tPsDevPitMapper;
+    @Autowired
+    private TPsDevRainvalveMapper tPsDevRainvalveMapper;
+    @Autowired
+    private TPsDevSteamMapper tPsDevSteamMapper;
+    @Autowired
+    private TPsDevSumpMapper tPsDevSumpMapper;
+    @Autowired
+    private TPsDevUtilitystationMapper tPsDevUtilitystationMapper;
+    @Autowired
+    private TPsDevVentvalveMapper tPsDevVentvalveMapper;
+
+    // 巡检 Mapper 注入
+    @Autowired
+    private TPsInspectionAlarmMapper tPsInspectionAlarmMapper;
+    @Autowired
+    private TPsInspectionCabinetMapper tPsInspectionCabinetMapper;
+    @Autowired
+    private TPsInspectionCallsystemMapper tPsInspectionCallsystemMapper;
+    @Autowired
+    private TPsInspectionCofferMapper tPsInspectionCofferMapper;
+    @Autowired
+    private TPsInspectionCurtainMapper tPsInspectionCurtainMapper;
+    @Autowired
+    private TPsInspectionExtinguisherMapper tPsInspectionExtinguisherMapper;
+    @Autowired
+    private TPsInspectionEyewashMapper tPsInspectionEyewashMapper;
+    @Autowired
+    private TPsInspectionFgsMapper tPsInspectionFgsMapper;
+    @Autowired
+    private TPsInspectionFiredoorMapper tPsInspectionFiredoorMapper;
+    @Autowired
+    private TPsInspectionHydrantMapper tPsInspectionHydrantMapper;
+    @Autowired
+    private TPsInspectionLiftMapper tPsInspectionLiftMapper;
+    @Autowired
+    private TPsInspectionMonitorMapper tPsInspectionMonitorMapper;
+    @Autowired
+    private TPsInspectionPitMapper tPsInspectionPitMapper;
+    @Autowired
+    private TPsInspectionRainvalveMapper tPsInspectionRainvalveMapper;
+    @Autowired
+    private TPsInspectionSteamMapper tPsInspectionSteamMapper;
+    @Autowired
+    private TPsInspectionSumpMapper tPsInspectionSumpMapper;
+    @Autowired
+    private TPsInspectionUtilitystationMapper tPsInspectionUtilitystationMapper;
+    @Autowired
+    private TPsInspectionVentvalveMapper tPsInspectionVentvalveMapper;
+
     /**
      * 查询检查计划
      *
@@ -71,6 +154,29 @@ public class TPsPatrolPlanServiceImpl implements ITPsPatrolPlanService {
      */
     @Override
     public int deleteTPsPatrolPlanByIds(Long[] ids) {
+        // 批量删除计划前,先删除所有关联的巡检记录
+        for (Long id : ids) {
+            tPsInspectionAlarmMapper.deleteTPsInspectionAlarmByPlanId(id);
+            tPsInspectionCabinetMapper.deleteTPsInspectionCabinetByPlanId(id);
+            tPsInspectionCallsystemMapper.deleteTPsInspectionCallsystemByPlanId(id);
+            tPsInspectionCofferMapper.deleteTPsInspectionCofferByPlanId(id);
+            tPsInspectionCurtainMapper.deleteTPsInspectionCurtainByPlanId(id);
+            tPsInspectionExtinguisherMapper.deleteTPsInspectionExtinguisherByPlanId(id);
+            tPsInspectionEyewashMapper.deleteTPsInspectionEyewashByPlanId(id);
+            tPsInspectionFgsMapper.deleteTPsInspectionFgsByPlanId(id);
+            tPsInspectionFiredoorMapper.deleteTPsInspectionFiredoorByPlanId(id);
+            tPsInspectionHydrantMapper.deleteTPsInspectionHydrantByPlanId(id);
+            tPsInspectionLiftMapper.deleteTPsInspectionLiftByPlanId(id);
+            tPsInspectionMonitorMapper.deleteTPsInspectionMonitorByPlanId(id);
+            tPsInspectionPitMapper.deleteTPsInspectionPitByPlanId(id);
+            tPsInspectionRainvalveMapper.deleteTPsInspectionRainvalveByPlanId(id);
+            tPsInspectionSteamMapper.deleteTPsInspectionSteamByPlanId(id);
+            tPsInspectionSumpMapper.deleteTPsInspectionSumpByPlanId(id);
+            tPsInspectionUtilitystationMapper.deleteTPsInspectionUtilitystationByPlanId(id);
+            tPsInspectionVentvalveMapper.deleteTPsInspectionVentvalveByPlanId(id);
+        }
+        
+        // 批量删除巡检计划
         return tPsPatrolPlanMapper.deleteTPsPatrolPlanByIds(ids);
     }
 
@@ -82,6 +188,260 @@ public class TPsPatrolPlanServiceImpl implements ITPsPatrolPlanService {
      */
     @Override
     public int deleteTPsPatrolPlanById(Long id) {
+        // 删除计划前,先删除所有关联的巡检记录
+        tPsInspectionAlarmMapper.deleteTPsInspectionAlarmByPlanId(id);
+        tPsInspectionCabinetMapper.deleteTPsInspectionCabinetByPlanId(id);
+        tPsInspectionCallsystemMapper.deleteTPsInspectionCallsystemByPlanId(id);
+        tPsInspectionCofferMapper.deleteTPsInspectionCofferByPlanId(id);
+        tPsInspectionCurtainMapper.deleteTPsInspectionCurtainByPlanId(id);
+        tPsInspectionExtinguisherMapper.deleteTPsInspectionExtinguisherByPlanId(id);
+        tPsInspectionEyewashMapper.deleteTPsInspectionEyewashByPlanId(id);
+        tPsInspectionFgsMapper.deleteTPsInspectionFgsByPlanId(id);
+        tPsInspectionFiredoorMapper.deleteTPsInspectionFiredoorByPlanId(id);
+        tPsInspectionHydrantMapper.deleteTPsInspectionHydrantByPlanId(id);
+        tPsInspectionLiftMapper.deleteTPsInspectionLiftByPlanId(id);
+        tPsInspectionMonitorMapper.deleteTPsInspectionMonitorByPlanId(id);
+        tPsInspectionPitMapper.deleteTPsInspectionPitByPlanId(id);
+        tPsInspectionRainvalveMapper.deleteTPsInspectionRainvalveByPlanId(id);
+        tPsInspectionSteamMapper.deleteTPsInspectionSteamByPlanId(id);
+        tPsInspectionSumpMapper.deleteTPsInspectionSumpByPlanId(id);
+        tPsInspectionUtilitystationMapper.deleteTPsInspectionUtilitystationByPlanId(id);
+        tPsInspectionVentvalveMapper.deleteTPsInspectionVentvalveByPlanId(id);
+        
+        // 删除巡检计划
         return tPsPatrolPlanMapper.deleteTPsPatrolPlanById(id);
     }
+
+    /**
+     * 创建巡检计划并生成巡检记录
+     *
+     * @param tPsPatrolPlan 巡检计划
+     * @param userId 用户ID
+     * @return 结果
+     */
+    @Override
+    public int createPatrolPlanWithInspections(TPsPatrolPlan tPsPatrolPlan, String userId) {
+        // 插入检查计划并获取插入结果
+        if (tPsPatrolPlanMapper.insertTPsPatrolPlan(tPsPatrolPlan) <= 0) {
+            return 0;
+        }
+
+        // 根据计划年月,设置为每月15号,计算截止日期,默认为当月最后一天
+        Calendar cd = Calendar.getInstance();
+        cd.set(Math.toIntExact(tPsPatrolPlan.getPlanYear()), Math.toIntExact(tPsPatrolPlan.getPlanMonth() - 1), 15);
+        Date deadline = DateUtils.getLastMonthDay(cd.getTime());
+        
+        // 统计设备数量
+        int devNum = 0;
+
+        // 根据不同的巡检类型(1-19)查询对应设备列表,并生成相应的巡检任务记录
+        switch (tPsPatrolPlan.getPatrolType()) {
+            case "1":
+                TPsDevAlarm tPsDevAlarm = new TPsDevAlarm();
+                tPsDevAlarm.setStatus("1");
+                List<TPsDevAlarm> tPsDevAlarms = tPsDevAlarmMapper.selectTPsDevAlarmList(tPsDevAlarm);
+                devNum = tPsDevAlarms.size();
+                for (TPsDevAlarm dev : tPsDevAlarms) {
+                    TPsInspectionAlarm alarm = new TPsInspectionAlarm(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), tPsPatrolPlan.getId(), userId);
+                    tPsInspectionAlarmMapper.insertTPsInspectionAlarm(alarm);
+                }
+                break;
+            case "2":
+                TPsDevCabinet tPsDevCabinet = new TPsDevCabinet();
+                tPsDevCabinet.setStatus("1");
+                List<TPsDevCabinet> tPsDevCabinets = tPsDevCabinetMapper.selectTPsDevCabinetList(tPsDevCabinet);
+                devNum = tPsDevCabinets.size();
+                for (TPsDevCabinet dev : tPsDevCabinets) {
+                    TPsInspectionCabinet inspectionCabinet = new TPsInspectionCabinet(dev.getPosition(), dev.getModelNo(), dev.getBoxNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), tPsPatrolPlan.getId(), userId, dev.getValveType(), dev.getValveSpecification(), dev.getValveLength(), dev.getBoltPointDistance(), dev.getBoltHoleCount());
+                    tPsInspectionCabinetMapper.insertTPsInspectionCabinet(inspectionCabinet);
+                }
+                break;
+            case "3":
+                TPsDevCallsystem tPsDevCallsystem = new TPsDevCallsystem();
+                tPsDevCallsystem.setStatus("1");
+                List<TPsDevCallsystem> tPsDevCallsystems = tPsDevCallsystemMapper.selectTPsDevCallsystemList(tPsDevCallsystem);
+                devNum = tPsDevCallsystems.size();
+                for (TPsDevCallsystem dev : tPsDevCallsystems) {
+                    TPsInspectionCallsystem inspectionCallsystem = new TPsInspectionCallsystem(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionCallsystemMapper.insertTPsInspectionCallsystem(inspectionCallsystem);
+                }
+                break;
+            case "4":
+                TPsDevCoffer tPsDevCoffer = new TPsDevCoffer();
+                tPsDevCoffer.setStatus("1");
+                List<TPsDevCoffer> tPsDevCoffers = tPsDevCofferMapper.selectTPsDevCofferList(tPsDevCoffer);
+                devNum = tPsDevCoffers.size();
+                for (TPsDevCoffer dev : tPsDevCoffers) {
+                    TPsInspectionCoffer inspectionCoffer = new TPsInspectionCoffer(dev.getCofferNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionCofferMapper.insertTPsInspectionCoffer(inspectionCoffer);
+                }
+                break;
+            case "5":
+                TPsDevCurtain tPsDevCurtain = new TPsDevCurtain();
+                tPsDevCurtain.setStatus("1");
+                List<TPsDevCurtain> tPsDevCurtains = tPsDevCurtainMapper.selectTPsDevCurtainList(tPsDevCurtain);
+                devNum = tPsDevCurtains.size();
+                for (TPsDevCurtain dev : tPsDevCurtains) {
+                    TPsInspectionCurtain inspectionCurtain = new TPsInspectionCurtain(dev.getPosition(), dev.getCurtainName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionCurtainMapper.insertTPsInspectionCurtain(inspectionCurtain);
+                }
+                break;
+            case "6":
+                TPsDevExtinguisher tPsDevExtinguisher = new TPsDevExtinguisher();
+                tPsDevExtinguisher.setStatus("1");
+                List<TPsDevExtinguisher> tPsDevExtinguishers = tPsDevExtinguisherMapper.selectTPsDevExtinguisherList(tPsDevExtinguisher);
+                devNum = tPsDevExtinguishers.size();
+                for (TPsDevExtinguisher dev : tPsDevExtinguishers) {
+                    TPsInspectionExtinguisher inspectionExtinguisher = new TPsInspectionExtinguisher(dev.getFireExtinguisherNo(), dev.getPosition(), dev.getFireExtinguisherModel(), tPsPatrolPlan.getDetectionFrequency(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId(), dev.getDevType());
+                    tPsInspectionExtinguisherMapper.insertTPsInspectionExtinguisher(inspectionExtinguisher);
+                }
+                // 若检测频率为"每半个月一次",且为上半月的,则截止时间为当前月 15号
+                if ("1".equals(tPsPatrolPlan.getDetectionFrequency())) {
+                    deadline = cd.getTime();
+                }
+                break;
+            case "7":
+                TPsDevEyewash tPsDevEyewash = new TPsDevEyewash();
+                tPsDevEyewash.setStatus("1");
+                List<TPsDevEyewash> tPsDevEyewashs = tPsDevEyewashMapper.selectTPsDevEyewashList(tPsDevEyewash);
+                devNum = tPsDevEyewashs.size();
+                for (TPsDevEyewash dev : tPsDevEyewashs) {
+                    TPsInspectionEyewash inspectionEyewash = new TPsInspectionEyewash(dev.getDevNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionEyewashMapper.insertTPsInspectionEyewash(inspectionEyewash);
+                }
+                break;
+            case "8":
+                TPsDevFgs tPsDevFgs = new TPsDevFgs();
+                tPsDevFgs.setStatus("1");
+                List<TPsDevFgs> tPsDevFgss = tPsDevFgsMapper.selectTPsDevFgsList(tPsDevFgs);
+                devNum = tPsDevFgss.size();
+                for (TPsDevFgs dev : tPsDevFgss) {
+                    TPsInspectionFgs inspectionFgs = new TPsInspectionFgs(dev.getFgsNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionFgsMapper.insertTPsInspectionFgs(inspectionFgs);
+                }
+                break;
+            case "9":
+                TPsDevFiredoor tPsDevFiredoor = new TPsDevFiredoor();
+                tPsDevFiredoor.setStatus("1");
+                List<TPsDevFiredoor> tPsDevFiredoors = tPsDevFiredoorMapper.selectTPsDevFiredoorList(tPsDevFiredoor);
+                devNum = tPsDevFiredoors.size();
+                for (TPsDevFiredoor dev : tPsDevFiredoors) {
+                    TPsInspectionFiredoor inspectionFiredoor = new TPsInspectionFiredoor(dev.getDoorNo(), dev.getDoorName(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionFiredoorMapper.insertTPsInspectionFiredoor(inspectionFiredoor);
+                }
+                break;
+            case "10":
+                TPsDevHydrant tPsDevHydrant = new TPsDevHydrant();
+                tPsDevHydrant.setStatus("1");
+                List<TPsDevHydrant> tPsDevHydrants = tPsDevHydrantMapper.selectTPsDevHydrantList(tPsDevHydrant);
+                devNum = tPsDevHydrants.size();
+                for (TPsDevHydrant dev : tPsDevHydrants) {
+                    TPsInspectionHydrant inspectionHydrant = new TPsInspectionHydrant(
+                            dev.getPosition(),
+                            dev.getEquipId(),
+                            dev.getHydrantQty(),
+                            dev.getHoseQty(),
+                            dev.getWrenchQty(),
+                            tPsPatrolPlan.getPlanMonth(),
+                            tPsPatrolPlan.getPlanYear(),
+                            userId,
+                            tPsPatrolPlan.getId()
+                    );
+                    inspectionHydrant.setGroupNo(dev.getGroupNo());
+                    tPsInspectionHydrantMapper.insertTPsInspectionHydrant(inspectionHydrant);
+                }
+                break;
+            case "11":
+                TPsDevLift tPsDevLift = new TPsDevLift();
+                tPsDevLift.setStatus("1");
+                List<TPsDevLift> tPsDevLifts = tPsDevLiftMapper.selectTPsDevLiftList(tPsDevLift);
+                devNum = tPsDevLifts.size();
+                for (TPsDevLift dev : tPsDevLifts) {
+                    TPsInspectionLift inspectionLift = new TPsInspectionLift(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionLiftMapper.insertTPsInspectionLift(inspectionLift);
+                }
+                break;
+            case "12":
+                TPsDevMonitor tPsDevMonitor = new TPsDevMonitor();
+                tPsDevMonitor.setStatus("1");
+                List<TPsDevMonitor> tPsDevMonitors = tPsDevMonitorMapper.selectTPsDevMonitorList(tPsDevMonitor);
+                devNum = tPsDevMonitors.size();
+                for (TPsDevMonitor dev : tPsDevMonitors) {
+                    TPsInspectionMonitor inspectionMonitor = new TPsInspectionMonitor(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionMonitorMapper.insertTPsInspectionMonitor(inspectionMonitor);
+                }
+                break;
+            case "13":
+                TPsDevPit tPsDevPit = new TPsDevPit();
+                tPsDevPit.setStatus("1");
+                List<TPsDevPit> tPsDevPits = tPsDevPitMapper.selectTPsDevPitList(tPsDevPit);
+                devNum = tPsDevPits.size();
+                for (TPsDevPit dev : tPsDevPits) {
+                    TPsInspectionPit inspectionPit = new TPsInspectionPit(dev.getDevNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionPitMapper.insertTPsInspectionPit(inspectionPit);
+                }
+                break;
+            case "14":
+                TPsDevRainvalve tPsDevRainvalve = new TPsDevRainvalve();
+                tPsDevRainvalve.setStatus("1");
+                List<TPsDevRainvalve> tPsDevRainvalves = tPsDevRainvalveMapper.selectTPsDevRainvalveList(tPsDevRainvalve);
+                devNum = tPsDevRainvalves.size();
+                for (TPsDevRainvalve dev : tPsDevRainvalves) {
+                    TPsInspectionRainvalve inspectionRainvalve = new TPsInspectionRainvalve(dev.getPosition(), dev.getValveName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionRainvalveMapper.insertTPsInspectionRainvalve(inspectionRainvalve);
+                }
+                break;
+            case "15":
+                TPsDevSteam tPsDevSteam = new TPsDevSteam();
+                tPsDevSteam.setStatus("1");
+                List<TPsDevSteam> tPsDevSteams = tPsDevSteamMapper.selectTPsDevSteamList(tPsDevSteam);
+                devNum = tPsDevSteams.size();
+                for (TPsDevSteam dev : tPsDevSteams) {
+                    TPsInspectionSteam inspectionSteam = new TPsInspectionSteam(dev.getPosition(), dev.getSteamName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionSteamMapper.insertTPsInspectionSteam(inspectionSteam);
+                }
+                break;
+            case "16":
+                TPsDevSump tPsDevSump = new TPsDevSump();
+                tPsDevSump.setStatus("1");
+                List<TPsDevSump> tPsDevSumps = tPsDevSumpMapper.selectTPsDevSumpList(tPsDevSump);
+                devNum = tPsDevSumps.size();
+                for (TPsDevSump dev : tPsDevSumps) {
+                    TPsInspectionSump inspectionSump = new TPsInspectionSump(dev.getSumpNo(), dev.getPosition(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionSumpMapper.insertTPsInspectionSump(inspectionSump);
+                }
+                break;
+            case "17":
+                TPsDevUtilitystation tPsDevUtilitystation = new TPsDevUtilitystation();
+                tPsDevUtilitystation.setStatus("1");
+                List<TPsDevUtilitystation> tPsDevUtilitystations = tPsDevUtilitystationMapper.selectTPsDevUtilitystationList(tPsDevUtilitystation);
+                devNum = tPsDevUtilitystations.size();
+                for (TPsDevUtilitystation dev : tPsDevUtilitystations) {
+                    TPsInspectionUtilitystation inspectionUtilitystation = new TPsInspectionUtilitystation(dev.getPosition(), dev.getUtilityStationName(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionUtilitystationMapper.insertTPsInspectionUtilitystation(inspectionUtilitystation);
+                }
+                break;
+            case "18":
+                TPsDevVentvalve tPsDevVentvalve = new TPsDevVentvalve();
+                tPsDevVentvalve.setStatus("1");
+                List<TPsDevVentvalve> tPsDevVentvalves = tPsDevVentvalveMapper.selectTPsDevVentvalveList(tPsDevVentvalve);
+                devNum = tPsDevVentvalves.size();
+                for (TPsDevVentvalve dev : tPsDevVentvalves) {
+                    TPsInspectionVentvalve inspectionVentvalve = new TPsInspectionVentvalve(dev.getPosition(), dev.getVentvalveNo(), tPsPatrolPlan.getPlanMonth(), tPsPatrolPlan.getPlanYear(), userId, tPsPatrolPlan.getId());
+                    tPsInspectionVentvalveMapper.insertTPsInspectionVentvalve(inspectionVentvalve);
+                }
+                break;
+            case "19":
+                break;
+        }
+
+        // 更新计划中的设备数量、未完成数、已完成数及截止时间
+        tPsPatrolPlan.setDevNum((long) devNum);
+        tPsPatrolPlan.setUncheckedNum((long) devNum);
+        tPsPatrolPlan.setCheckedNum(0L);
+        tPsPatrolPlan.setDeadline(deadline);
+
+        // 成功后返回成功信息
+        return tPsPatrolPlanMapper.updateTPsPatrolPlan(tPsPatrolPlan);
+    }
 }

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionAlarmMapper.xml

@@ -159,4 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionAlarmByPlanId" parameterType="Long">
+        update t_ps_inspection_alarm set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCabinetMapper.xml

@@ -194,4 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionCabinetByPlanId" parameterType="Long">
+        update t_ps_inspection_cabinet set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCallsystemMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionCallsystemByPlanId" parameterType="Long">
+        update t_ps_inspection_callsystem set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCofferMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionCofferByPlanId" parameterType="Long">
+        update t_ps_inspection_coffer set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCurtainMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionCurtainByPlanId" parameterType="Long">
+        update t_ps_inspection_curtain set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionExtinguisherMapper.xml

@@ -199,4 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionExtinguisherByPlanId" parameterType="Long">
+        update t_ps_inspection_extinguisher set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionEyewashMapper.xml

@@ -199,4 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionEyewashByPlanId" parameterType="Long">
+        update t_ps_inspection_eyewash set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionFgsMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionFgsByPlanId" parameterType="Long">
+        update t_ps_inspection_fgs set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionFiredoorMapper.xml

@@ -169,4 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionFiredoorByPlanId" parameterType="Long">
+        update t_ps_inspection_firedoor set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 9 - 5
master/src/main/resources/mybatis/ps/inspection/TPsInspectionHydrantMapper.xml

@@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="position"    column="position"    />
         <result property="equipId"    column="equip_id"    />
         <result property="groupNo"    column="group_no"    />
-        <result property="hydrantQty"    column="hydrant_status"    />
+        <result property="hydrantQty"    column="hydrant_qty"    />
         <result property="hoseQty"    column="hose_qty"    />
         <result property="wrenchQty"    column="wrench_qty"    />
         <result property="appearance"    column="appearance"    />
@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectTPsInspectionHydrantVo">
         select d.id, d.position, d.equip_id, d.group_no,
-               d.hydrant_status, d.hose_qty, d.wrench_qty,
+               d.hydrant_qty, d.hose_qty, d.wrench_qty,
                d.appearance, d.leak_status, d.item_status, d.access_status,
                d.dev_type, d.confirmer, d.check_status, d.check_date,
                d.month, d.year, d.del_flag, d.creater_code, d.createdate,
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="position != null  and position != ''"> and position like concat(concat('%', #{position}), '%')</if>
             <if test="equipId != null  and equipId != ''"> and equip_id like concat(concat('%', #{equipId}), '%')</if>
             <if test="groupNo != null  and groupNo != ''"> and group_no = #{groupNo}</if>
-            <if test="hydrantQty != null  and hydrantQty != ''"> and hydrant_status = #{hydrantQty}</if>
+            <if test="hydrantQty != null  and hydrantQty != ''"> and hydrant_qty = #{hydrantQty}</if>
             <if test="hoseQty != null  and hoseQty != ''"> and hose_qty = #{hoseQty}</if>
             <if test="wrenchQty != null  and wrenchQty != ''"> and wrench_qty = #{wrenchQty}</if>
             <if test="appearance != null  and appearance != ''"> and appearance = #{appearance}</if>
@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="position != null">position,</if>
             <if test="equipId != null">equip_id,</if>
             <if test="groupNo != null">group_no,</if>
-            <if test="hydrantQty != null">hydrant_status,</if>
+            <if test="hydrantQty != null">hydrant_qty,</if>
             <if test="hoseQty != null">hose_qty,</if>
             <if test="wrenchQty != null">wrench_qty,</if>
             <if test="appearance != null">appearance,</if>
@@ -160,7 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="position != null">position = #{position},</if>
             <if test="equipId != null">equip_id = #{equipId},</if>
             <if test="groupNo != null">group_no = #{groupNo},</if>
-            <if test="hydrantQty != null">hydrant_status = #{hydrantQty},</if>
+            <if test="hydrantQty != null">hydrant_qty = #{hydrantQty},</if>
             <if test="hoseQty != null">hose_qty = #{hoseQty},</if>
             <if test="wrenchQty != null">wrench_qty = #{wrenchQty},</if>
             <if test="appearance != null">appearance = #{appearance},</if>
@@ -198,4 +198,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionHydrantByPlanId" parameterType="Long">
+        update t_ps_inspection_hydrant set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionLiftMapper.xml

@@ -174,4 +174,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionLiftByPlanId" parameterType="Long">
+        update t_ps_inspection_lift set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionMonitorMapper.xml

@@ -169,4 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionMonitorByPlanId" parameterType="Long">
+        update t_ps_inspection_monitor set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionPitMapper.xml

@@ -159,4 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionPitByPlanId" parameterType="Long">
+        update t_ps_inspection_pit set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionRainvalveMapper.xml

@@ -159,4 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionRainvalveByPlanId" parameterType="Long">
+        update t_ps_inspection_rainvalve set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionSteamMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionSteamByPlanId" parameterType="Long">
+        update t_ps_inspection_steam set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionSumpMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionSumpByPlanId" parameterType="Long">
+        update t_ps_inspection_sump set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionUtilitystationMapper.xml

@@ -169,4 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionUtilitystationByPlanId" parameterType="Long">
+        update t_ps_inspection_utilitystation set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 4 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionVentvalveMapper.xml

@@ -164,4 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
     
+    <update id="deleteTPsInspectionVentvalveByPlanId" parameterType="Long">
+        update t_ps_inspection_ventvalve set del_flag = 2 where plan_id = #{planId}
+    </update>
+    
 </mapper>

+ 55 - 0
master/src/main/resources/mybatis/ps/patrol/TPsIndexMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.project.ps.patrol.mapper.TPsIndexMapper">
+
+    <select id="getDevNumber" resultType="java.lang.Integer">
+        select sum(a.num + b.num + c.num + d.num + e.num + f.num + g.num + h.num + i.num + j.num + k.num + l.num +
+                   m.num +
+                   n.num + o.num + p.num + q.num + r.num) num
+        from (select count(*) num from T_PS_DEV_ALARM where STATUS = 1 and DEL_FLAG = 0) a,
+             (select count(*) num from T_PS_DEV_CABINET where STATUS = 1 and DEL_FLAG = 0) b,
+             (select count(*) num from T_PS_DEV_CALLSYSTEM where STATUS = 1 and DEL_FLAG = 0) c,
+             (select count(*) num from T_PS_DEV_COFFER where STATUS = 1 and DEL_FLAG = 0) d,
+             (select count(*) num from T_PS_DEV_CURTAIN where STATUS = 1 and DEL_FLAG = 0) e,
+             (select count(*) num from T_PS_DEV_EXTINGUISHER where STATUS = 1 and DEL_FLAG = 0) f,
+             (select count(*) num from T_PS_DEV_EYEWASH where STATUS = 1 and DEL_FLAG = 0) g,
+             (select count(*) num from T_PS_DEV_FGS where STATUS = 1 and DEL_FLAG = 0) h,
+             (select count(*) num from T_PS_DEV_FIREDOOR where STATUS = 1 and DEL_FLAG = 0) i,
+             (select count(*) num from T_PS_DEV_HYDRANT where STATUS = 1 and DEL_FLAG = 0) j,
+             (select count(*) num from T_PS_DEV_LIFT where STATUS = 1 and DEL_FLAG = 0) k,
+             (select count(*) num from T_PS_DEV_MONITOR where STATUS = 1 and DEL_FLAG = 0) l,
+             (select count(*) num from T_PS_DEV_PIT where STATUS = 1 and DEL_FLAG = 0) m,
+             (select count(*) num from T_PS_DEV_RAINVALVE where STATUS = 1 and DEL_FLAG = 0) n,
+             (select count(*) num from T_PS_DEV_STEAM where STATUS = 1 and DEL_FLAG = 0) o,
+             (select count(*) num from T_PS_DEV_SUMP where STATUS = 1 and DEL_FLAG = 0) p,
+             (select count(*) num from T_PS_DEV_UTILITYSTATION where STATUS = 1 and DEL_FLAG = 0) q,
+             (select count(*) num from T_PS_DEV_VENTVALVE where STATUS = 1 and DEL_FLAG = 0) r
+    </select>
+    <select id="getUncheckNumber" parameterType="TPsIndex" resultType="java.lang.Integer">
+        select count(*) num
+        from T_PS_PATROL_PLAN
+        where PLAN_YEAR = #{year}
+          and PLAN_MONTH = #{month}
+          and STATUS = 0
+          and DEL_FLAG = 0
+    </select>
+    <select id="getCheckNumber" parameterType="TPsIndex" resultType="java.lang.Integer">
+        select count(*) num
+        from T_PS_PATROL_PLAN
+        where PLAN_YEAR = #{year}
+          and PLAN_MONTH = #{month}
+          and STATUS = 1
+          and DEL_FLAG = 0
+    </select>
+    <select id="getIssueNumber" parameterType="TPsIndex" resultType="java.lang.Integer">
+        select count(*) num
+        from T_PS_PATROL_ISSUES
+        where to_char(createdate, 'yyyy-MM') = to_char(#{createDate}, 'yyyy-MM')
+          and STATUS = 0
+          and DEL_FLAG = 0
+    </select>
+
+
+</mapper>

+ 7 - 0
ui/src/api/ps/patrol/home.js

@@ -0,0 +1,7 @@
+import request from '@/utils/request'
+export function getCountNums() {
+  return request({
+    url: '/ps/patrol/index/countNums',
+    method: 'get'
+  })
+}

+ 3 - 0
ui/src/views/index.vue

@@ -6,6 +6,7 @@
   <hcqhome v-else-if="homeType== 5"></hcqhome>
   <ldpehome v-else-if="homeType== 6"></ldpehome>
   <EoegHome v-else-if="homeType== 7"></EoegHome>
+  <ps_home v-else-if="homeType== 8"></ps_home>
 <!--  <semshome v-show="homeType == 2"></semshome>-->
 </template>
 
@@ -22,6 +23,7 @@
   import '@/common/flexible.js';
   import EoegHome from "@/views/eoeg/home/index.vue";
   import Ldpehome from "@/views/ldpehome.vue";
+  import Ps_home from "@/views/ps/home/index.vue";
 
   export default {
     data() {
@@ -30,6 +32,7 @@
       };
     },
     components: {
+      Ps_home,
       Ldpehome,
       EoegHome,
       homepage,

+ 155 - 0
ui/src/views/ps/home/dashboard/NoticeChart.vue

@@ -0,0 +1,155 @@
+<template>
+  <div>
+    <div :style="{height:height,width:width}" class="text-container">
+      <ul class="allNotice" @mouseleave="handleMouseLeave" @mouseover="handleMouseOver">
+        <!-- 原始列表 -->
+        <li v-for="(item,index) in noticeList" :key="'original-' + index" class="notice-item">
+          <span>截止日期:{{ parseTime(item.deadline, '{yyyy}-{mm}-{dd}') }}
+            <el-tag size="medium" effect="plain">{{ item.planName }}</el-tag>
+          </span>
+          <span>
+            <el-tag effect="dark" size="mini" type="success" v-if="item.status == 1">已完成</el-tag>
+            <el-tag effect="dark" size="mini" type="danger" v-if="item.status == 0">未完成</el-tag>
+          </span>
+        </li>
+        <!-- 复制一份列表实现无缝滚动 -->
+        <li v-for="(item,index) in noticeList" :key="'copy-' + index" class="notice-item">
+          <span>截止日期:{{ parseTime(item.deadline, '{yyyy}-{mm}-{dd}') }}
+            <el-tag size="medium" effect="plain">{{ item.planName }}</el-tag>
+          </span>
+          <span>
+            <el-tag effect="dark" size="mini" type="success" v-if="item.status == 1">已完成</el-tag>
+            <el-tag effect="dark" size="mini" type="danger" v-if="item.status == 0">未完成</el-tag>
+          </span>
+        </li>
+      </ul>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import {listPlan} from "@/api/ps/patrol/plan";
+
+export default {
+  name: "NoticeChart",
+  props: {
+    width: {
+      type: String,
+      default: '100%'
+    },
+    height: {
+      type: String,
+      default: '570px'
+    }
+  },
+  data() {
+    return {
+      // 查询参数
+      queryParams: {
+        planQuarter: new Date().getMonth() + 1, planYear: new Date().getFullYear()
+      },
+      // 公示公告列表
+      noticeList: [],
+      styleElement: null,
+    }
+  },
+  created() {
+    this.listNoticeNoPage();
+  },
+  beforeDestroy() {
+    // 清理动态添加的 style 元素
+    if (this.styleElement && this.styleElement.parentNode) {
+      this.styleElement.parentNode.removeChild(this.styleElement);
+    }
+  },
+  methods: {
+    handleMouseOver() {
+      let elem = document.querySelector('.allNotice');
+      if (elem) {
+        elem.style['animation-play-state'] = 'paused';
+      }
+    },
+    handleMouseLeave() {
+      let elem = document.querySelector('.allNotice');
+      if (elem) {
+        elem.style['animation-play-state'] = 'running';
+      }
+    },
+    listNoticeNoPage() {
+      listPlan(this.queryParams).then(response => {
+        this.noticeList = response.rows || [];
+        
+        // 判断是否需要滚动
+        if (this.noticeList.length > 0) {
+          this.$nextTick(() => {
+            // 清理之前的 style
+            if (this.styleElement && this.styleElement.parentNode) {
+              this.styleElement.parentNode.removeChild(this.styleElement);
+            }
+            
+            let elem = document.querySelector('.allNotice');
+            if (!elem) return;
+            
+            // 每个 li 的高度约为 50px(包括margin)
+            const itemHeight = 50;
+            const listHeight = this.noticeList.length * itemHeight;
+            
+            // 设置滚动时间(可根据列表长度调整)
+            const scrollTime = this.noticeList.length * 2;
+            
+            // 创建无缝滚动的 keyframes
+            // 从 0 滚动到 -listHeight,然后重新开始
+            const keyframeName = 'seamlessScroll-' + Date.now();
+            const myFirstkeyframes = `@keyframes ${keyframeName} {
+              0% {
+                transform: translateY(0);
+              }
+              100% {
+                transform: translateY(-${listHeight}px);
+              }
+            }`;
+            
+            // 动态插入 keyframes
+            this.styleElement = document.createElement("style");
+            this.styleElement.setAttribute("type", "text/css");
+            this.styleElement.textContent = myFirstkeyframes;
+            document.head.appendChild(this.styleElement);
+            
+            // 应用动画
+            elem.style['animation'] = `${keyframeName} ${scrollTime}s linear infinite`;
+          });
+        }
+      });
+    },
+  }
+}
+</script>
+
+<style scoped>
+.text-container {
+  line-height: 40px;
+  overflow: hidden;
+  background-color: #fff;
+  padding: 10px;
+}
+
+.notice-item {
+  border-radius: 3px;
+  margin-bottom: 10px;
+  font-size: 14px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding-right: 10px;
+  padding-left: 10px;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  height: 40px; /* 固定高度便于计算 */
+}
+
+.allNotice {
+  list-style: none;
+  padding: 0;
+  margin: 0;
+}
+</style>

+ 193 - 0
ui/src/views/ps/home/dashboard/PanelGroup.vue

@@ -0,0 +1,193 @@
+<template>
+  <el-row :gutter="40" class="panel-group">
+    <el-col :lg="6" :sm="12" :xs="12" class="card-panel-col">
+      <div class="card-panel">
+        <div class="card-panel-icon-wrapper icon-people">
+          <svg-icon class-name="card-panel-icon" icon-class="dev"/>
+        </div>
+        <div class="card-panel-description">
+          <div class="card-panel-text">
+            总设备数
+          </div>
+          <count-to :duration="3000" :end-val="devNum" :start-val="0" class="card-panel-num"/>
+        </div>
+      </div>
+    </el-col>
+    <el-col :lg="6" :sm="12" :xs="12" class="card-panel-col">
+      <div class="card-panel">
+        <div class="card-panel-icon-wrapper icon-message">
+          <svg-icon class-name="card-panel-icon" icon-class="uncheck"/>
+        </div>
+        <div class="card-panel-description">
+          <div class="card-panel-text">
+            本月未完成计划
+          </div>
+          <count-to :duration="3000" :end-val="uncheckPlanNum" :start-val="0" class="card-panel-num"/>
+        </div>
+      </div>
+    </el-col>
+    <el-col :lg="6" :sm="12" :xs="12" class="card-panel-col">
+      <div class="card-panel">
+        <div class="card-panel-icon-wrapper icon-money">
+          <svg-icon class-name="card-panel-icon" icon-class="checked"/>
+        </div>
+        <div class="card-panel-description">
+          <div class="card-panel-text">
+            本月已完成计划
+          </div>
+          <count-to :duration="3000" :end-val="checkedPlanNum" :start-val="0" class="card-panel-num"/>
+        </div>
+      </div>
+    </el-col>
+    <el-col :lg="6" :sm="12" :xs="12" class="card-panel-col">
+      <div class="card-panel">
+        <div class="card-panel-icon-wrapper icon-shopping">
+          <svg-icon class-name="card-panel-icon" icon-class="issue"/>
+        </div>
+        <div class="card-panel-description">
+          <div class="card-panel-text">
+            未处理问题数量
+          </div>
+          <count-to :duration="3000" :end-val="issueNum" :start-val="0" class="card-panel-num"/>
+        </div>
+      </div>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+import CountTo from 'vue-count-to'
+import {getCountNums} from "@/api/ps/patrol/home";
+
+export default {
+  components: {
+    CountTo
+  },
+  data() {
+    return {
+      devNum: 0,
+      uncheckPlanNum: 0,
+      checkedPlanNum: 0,
+      issueNum: 0,
+    }
+  },
+  created() {
+    getCountNums().then(res => {
+      this.devNum = res.data.devNum;
+      this.uncheckPlanNum = res.data.uncheckPlanNum;
+      this.checkedPlanNum = res.data.checkedPlanNum;
+      this.issueNum = res.data.issueNum;
+    })
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.panel-group {
+  margin-top: 18px;
+
+  .card-panel-col {
+    margin-bottom: 32px;
+  }
+
+  .card-panel {
+    height: 108px;
+    cursor: pointer;
+    font-size: 12px;
+    position: relative;
+    overflow: hidden;
+    color: #666;
+    background: #fff;
+    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
+    border-color: rgba(0, 0, 0, .05);
+
+    &:hover {
+      .card-panel-icon-wrapper {
+        color: #fff;
+      }
+
+      .icon-people {
+        background: #40c9c6;
+      }
+
+      .icon-message {
+        background: #36a3f7;
+      }
+
+      .icon-money {
+        background: #f4516c;
+      }
+
+      .icon-shopping {
+        background: #34bfa3
+      }
+    }
+
+    .icon-people {
+      color: #40c9c6;
+    }
+
+    .icon-message {
+      color: #36a3f7;
+    }
+
+    .icon-money {
+      color: #f4516c;
+    }
+
+    .icon-shopping {
+      color: #34bfa3
+    }
+
+    .card-panel-icon-wrapper {
+      float: left;
+      margin: 14px 0 0 14px;
+      padding: 16px;
+      transition: all 0.38s ease-out;
+      border-radius: 6px;
+    }
+
+    .card-panel-icon {
+      float: left;
+      font-size: 48px;
+    }
+
+    .card-panel-description {
+      float: right;
+      font-weight: bold;
+      margin: 26px;
+      margin-left: 0px;
+
+      .card-panel-text {
+        line-height: 18px;
+        color: rgba(0, 0, 0, 0.45);
+        font-size: 16px;
+        margin-bottom: 12px;
+      }
+
+      .card-panel-num {
+        font-size: 20px;
+      }
+    }
+  }
+}
+
+@media (max-width: 550px) {
+  .card-panel-description {
+    display: none;
+  }
+
+  .card-panel-icon-wrapper {
+    float: none !important;
+    width: 100%;
+    height: 100%;
+    margin: 0 !important;
+
+    .svg-icon {
+      display: block;
+      margin: 14px auto !important;
+      float: none !important;
+    }
+  }
+}
+</style>

+ 98 - 0
ui/src/views/ps/home/dashboard/PieChart.vue

@@ -0,0 +1,98 @@
+<template>
+  <div :class="className" :style="{height:height,width:width}"/>
+</template>
+
+<script>
+import * as echarts from 'echarts';
+import resize from '@/views/dashboard/mixins/resize'
+import {listPlan} from "@/api/ps/patrol/plan";
+
+require('echarts/theme/macarons') // echarts theme
+
+export default {
+  mixins: [resize],
+  props: {
+    className: {
+      type: String,
+      default: 'chart'
+    },
+    width: {
+      type: String,
+      default: '100%'
+    },
+    height: {
+      type: String,
+      default: '570px'
+    }
+  },
+  data() {
+    return {
+      chart: null,
+      planList: [],
+      // 查询参数
+      queryParams: {
+        planQuarter: new Date().getMonth() + 1, planYear: new Date().getFullYear()
+      },
+    }
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.getList()
+    })
+  },
+  beforeDestroy() {
+    if (!this.chart) {
+      return
+    }
+    this.chart.dispose()
+    this.chart = null
+  },
+  methods: {
+    getList() {
+      listPlan(this.queryParams).then(response => {
+        response.rows.forEach(item => {
+          this.planList.push({name: item.planName, value: item.uncheckedNum})
+        })
+        this.initChart();
+      })
+    },
+    initChart() {
+      this.chart = echarts.init(this.$el, 'macarons')
+
+      this.chart.setOption({
+        tooltip: {
+          trigger: 'item',
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
+        },
+        legend: {
+          type: 'scroll',
+          orient: 'horizontalAndVertical',
+          top: '70%',
+          data: this.planList,
+        },
+        series: [
+          {
+            name: '计划中未检测的设备数量',
+            type: 'pie',
+            radius: ['30%', '50%'],
+            center: ['50%', '30%'],
+            itemStyle:{
+              borderRadius: 15,
+            },
+            emphasis: {
+              itemStyle: {
+                shadowBlur: 10,
+                shadowOffsetX: 0,
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
+              }
+            },
+            data: this.planList,
+            animationEasing: 'cubicInOut',
+            animationDuration: 2600
+          }
+        ]
+      })
+    }
+  }
+}
+</script>

+ 59 - 0
ui/src/views/ps/home/index.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="dashboard-editor-container">
+    <panel-group/>
+
+    <el-row :gutter="32">
+      <el-col :xs="24" :sm="24" :lg="12">
+        <div class="chart-wrapper">
+          <pie-chart/>
+        </div>
+      </el-col>
+      <el-col  :xs="24" :sm="24" :lg="12">
+        <div class="chart-wrapper">
+          <notice-chart/>
+        </div>
+      </el-col>
+    </el-row>
+
+  </div>
+</template>
+
+<script>
+import PanelGroup from './dashboard/PanelGroup'
+import PieChart from './dashboard/PieChart'
+import NoticeChart from "./dashboard/NoticeChart.vue";
+
+export default {
+  name: 'ps_home',
+  components: {
+    NoticeChart,
+    PanelGroup,
+    PieChart,
+  },
+  data() {
+    return {}
+  },
+  methods: {}
+}
+</script>
+
+<style lang="scss" scoped>
+.dashboard-editor-container {
+  padding: 32px;
+  background-color: rgb(240, 242, 245);
+  position: relative;
+
+  .chart-wrapper {
+    background: #fff;
+    padding: 16px 16px 0;
+    margin-bottom: 15px;
+  }
+}
+
+/*
+@media (max-width: 1024px) {
+  .chart-wrapper {
+    padding: 8px;
+  }
+}*/
+</style>

+ 11 - 11
ui/src/views/ps/patrol/plan/index.vue

@@ -507,19 +507,19 @@ export default {
       this.mainList.forEach(item => {
         if (item.id === this.form.mainId) {
           this.form.mainObj = item
+          if (item.checkCycle == "1") {
+            this.dfFlag = true;
+          } else {
+            this.dfFlag = false;
+          }
+          let s = '';
+          if (item.detectionFrequency != '') {
+            s = item.detectionFrequency == 1 ? '-上半月' : '-下半月';
+          }
+          this.form.planName = this.form.planYear + '年-' + this.form.planMonth + '月' + s + "-临时计划-" + this.form.mainObj.devName;
+          this.form.patrolType = this.form.mainObj.patrolType;
         }
       });
-      if (this.form.mainObj.checkCycle == "1") {
-        this.dfFlag = true;
-      } else {
-        this.dfFlag = false;
-      }
-      let s = '';
-      if (this.form.detectionFrequency != '') {
-        s = this.form.detectionFrequency == 1 ? '-上半月-' : '-下半月-';
-      }
-      this.form.planName = this.form.planYear + '年-' + this.form.planMonth + '月' + s + "-临时计划-" + this.form.mainObj.devName;
-      this.form.patrolType = this.form.mainObj.patrolType;
     },
     /** 提交按钮 */
     submitForm() {