Browse Source

巡检计划模块相关接口开发

jichaobo 2 years ago
parent
commit
20b37b4cf9
43 changed files with 2123 additions and 71 deletions
  1. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java
  2. 0 22
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/ContentOptionController.java
  3. 0 22
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPersonnelController.java
  4. 111 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPlanController.java
  5. 0 22
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/SiteContentController.java
  6. 119 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionPlan.java
  7. 134 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionPlanSon.java
  8. 52 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSchedule.java
  9. 42 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSite.java
  10. 47 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSiteSon.java
  11. 43 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/SpecialRestDay.java
  12. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionPlanMapper.java
  13. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionPlanSonMapper.java
  14. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanScheduleMapper.java
  15. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanSiteMapper.java
  16. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanSiteSonMapper.java
  17. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/SpecialRestDayMapper.java
  18. 34 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionPlanService.java
  19. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionPlanSonService.java
  20. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanScheduleService.java
  21. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanSiteService.java
  22. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanSiteSonService.java
  23. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/SpecialRestDayService.java
  24. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionContentServiceImpl.java
  25. 570 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanServiceImpl.java
  26. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java
  27. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanScheduleServiceImpl.java
  28. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanSiteServiceImpl.java
  29. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanSiteSonServiceImpl.java
  30. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/SpecialRestDayServiceImpl.java
  31. 65 3
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/util/OnlineMethod.java
  32. 4 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionAreaVo.java
  33. 126 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanDataVo.java
  34. 132 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanVo.java
  35. 125 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionSiteVo.java
  36. 43 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PlanDataVo.java
  37. 90 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PlanScheduleVo.java
  38. 27 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionPlanMapper.xml
  39. 30 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionPlanSonMapper.xml
  40. 14 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanScheduleMapper.xml
  41. 12 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanSiteMapper.xml
  42. 13 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanSiteSonMapper.xml
  43. 12 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/SpecialRestDayMapper.xml

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java

@@ -71,7 +71,7 @@ public class MybatisGeneratorUtils {
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表
-        strategy.setInclude("site_content");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("special_rest_day");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 0 - 22
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/ContentOptionController.java

@@ -1,22 +0,0 @@
-package com.usky.fire.controller.web;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author JCB
- * @since 2022-07-15
- */
-@RestController
-@RequestMapping("/contentOption")
-public class ContentOptionController {
-
-}
-

+ 0 - 22
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPersonnelController.java

@@ -1,22 +0,0 @@
-package com.usky.fire.controller.web;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author JCB
- * @since 2022-07-12
- */
-@RestController
-@RequestMapping("/patrolInspectionPersonnel")
-public class PatrolInspectionPersonnelController {
-
-}
-

+ 111 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPlanController.java

@@ -0,0 +1,111 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.service.PatrolInspectionPlanService;
+import com.usky.fire.service.vo.PatrolInspectionAreaVo;
+import com.usky.fire.service.vo.PatrolInspectionPlanDataVo;
+import com.usky.fire.service.vo.PatrolInspectionPlanVo;
+import com.usky.fire.service.vo.PatrolInspectionSiteVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 巡查自检-巡检计划
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@RestController
+@RequestMapping("/patrolInspectionPlan")
+public class PatrolInspectionPlanController {
+
+    @Autowired
+    private PatrolInspectionPlanService patrolInspectionPlanService;
+
+    /**
+     * 巡查自检-巡检计划-新增
+     *
+     * @param patrolInspectionPlanVo
+     * @return
+     */
+    @PostMapping("addPatrolInspectionPlan")
+    public ApiResult<Void> addPatrolInspectionPlan(@RequestBody PatrolInspectionPlanVo patrolInspectionPlanVo) {
+        patrolInspectionPlanService.addPatrolInspectionPlan(patrolInspectionPlanVo);
+        return ApiResult.success();
+    }
+
+    /**
+     * 巡查自检-巡检计划-修改
+     *
+     * @param patrolInspectionPlanVo
+     * @return
+     */
+    @PostMapping("updatePatrolInspectionPlan")
+    public ApiResult<Void> updatePatrolInspectionPlan(@RequestBody PatrolInspectionPlanVo patrolInspectionPlanVo) {
+        patrolInspectionPlanService.updatePatrolInspectionPlan(patrolInspectionPlanVo);
+        return ApiResult.success();
+    }
+
+    /**
+     * 巡查自检-巡检计划-删除
+     *
+     * @param id 计划ID
+     * @return
+     */
+    @GetMapping("delPatrolInspectionPlan")
+    public ApiResult<Void> delPatrolInspectionPlan(@RequestParam(value = "id") Integer id) {
+        patrolInspectionPlanService.delPatrolInspectionPlan(id);
+        return ApiResult.success();
+    }
+
+    /**
+     * 巡查自检-巡检计划-列表查询
+     *
+     * @param planName 计划名称
+     * @param planType 计划类型(1 普通计划,2 按次计划)
+     * @param areaId   区域ID
+     * @param pageNum  当前页
+     * @param pageSize 每页条数
+     * @param id       计划ID
+     * @return
+     */
+    @GetMapping("patrolInspectionPlanList")
+    public ApiResult<CommonPage<PatrolInspectionPlanDataVo>> patrolInspectionPlanList(@RequestParam(value = "planName", required = false) String planName,
+                                                                                      @RequestParam(value = "planType", required = false, defaultValue = "0") Integer planType,
+                                                                                      @RequestParam(value = "areaId", required = false, defaultValue = "0") Integer areaId,
+                                                                                      @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+                                                                                      @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
+                                                                                      @RequestParam(value = "id", required = false, defaultValue = "0") Integer id) {
+        return ApiResult.success(patrolInspectionPlanService.patrolInspectionPlanList(planName, planType, areaId, pageNum, pageSize, id));
+    }
+
+    /**
+     * 巡查自检-巡检计划-左侧区域树形
+     *
+     * @return
+     */
+    @GetMapping("planLeftList")
+    public ApiResult<List<PatrolInspectionAreaVo>> planLeftList() {
+        return ApiResult.success(patrolInspectionPlanService.planLeftList());
+    }
+
+
+    /**
+     * 巡查自检-巡检计划-新增/修改弹窗的地点数据查询
+     *
+     * @param planId 计划ID
+     * @param areaId 区域ID
+     * @return
+     */
+    @GetMapping("patrolInspectionSiteVoList")
+    public ApiResult<List<PatrolInspectionSiteVo>> patrolInspectionSiteVoList(@RequestParam(value = "planId") Integer planId,
+                                                                              @RequestParam(value = "areaId") Integer areaId) {
+        return ApiResult.success(patrolInspectionPlanService.patrolInspectionSiteVoList(planId, areaId));
+    }
+
+}
+

+ 0 - 22
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/SiteContentController.java

@@ -1,22 +0,0 @@
-package com.usky.fire.controller.web;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author JCB
- * @since 2022-07-15
- */
-@RestController
-@RequestMapping("/siteContent")
-public class SiteContentController {
-
-}
-

+ 119 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionPlan.java

@@ -0,0 +1,119 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionPlan implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检计划主信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划名称
+     */
+    private String planName;
+
+    /**
+     * 开始日期
+     */
+    private LocalDate startDate;
+
+    /**
+     * 结束日期
+     */
+    private LocalDate endDate;
+
+    /**
+     * 巡检区域ID
+     */
+    private Integer areaId;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 巡检周期(1 日,2 周,3 月,4 年)
+     */
+    private Integer planCycle;
+
+    /**
+     * 计划次数
+     */
+    private Integer planFrequency;
+
+    /**
+     * 每圈用时(分钟)
+     */
+    private Integer lapTime;
+
+    /**
+     * 两圈间隔时间(分钟)
+     */
+    private Integer intervalTime;
+
+    /**
+     * 计划描述
+     */
+    private String planDescribe;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 休息日:星期一、星期二、星期三、星期四、星期五、星期六、星期日
+     */
+    private String restDay;
+
+    /**
+     * 周数
+     */
+    private String weekCount;
+
+
+}

+ 134 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionPlanSon.java

@@ -0,0 +1,134 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionPlanSon implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检计划子信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划主表id
+     */
+    private Integer planId;
+
+    /**
+     * 巡检日期
+     */
+    private LocalDate inspectionDate;
+
+    /**
+     * 开始日期
+     */
+    private LocalDate startDate;
+
+    /**
+     * 结束日期
+     */
+    private LocalDate endDate;
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+    /**
+     * 巡检人员ID
+     */
+    private Integer personnelId;
+
+    /**
+     * 巡检区域ID
+     */
+    private Integer areaId;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 巡检周期(1 日,2 周,3 月,4 年)
+     */
+    private Integer planCycle;
+
+    /**
+     * 计划次数
+     */
+    private Integer planFrequency;
+
+    /**
+     * 每圈用时(分钟)
+     */
+    private Integer lapTime;
+
+    /**
+     * 两圈间隔时间(分钟)
+     */
+    private Integer intervalTime;
+
+    /**
+     * 计划描述
+     */
+    private String planDescribe;
+
+    /**
+     * 完成情况(百分比)
+     */
+    private Integer completion;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 备用字段
+     */
+    private String alternateField;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+
+}

+ 52 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSchedule.java

@@ -0,0 +1,52 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PlanSchedule implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检日程关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 主计划ID
+     */
+    private Integer planId;
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+    /**
+     * 巡检人员ID
+     */
+    private Integer personnelId;
+
+
+}

+ 42 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSite.java

@@ -0,0 +1,42 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PlanSite implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主计划地点关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划主表ID
+     */
+    private Integer planId;
+
+    /**
+     * 地点ID
+     */
+    private Integer siteId;
+
+
+}

+ 47 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PlanSiteSon.java

@@ -0,0 +1,47 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PlanSiteSon implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 子计划地点关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划子表ID
+     */
+    private Integer planId;
+
+    /**
+     * 地点ID
+     */
+    private Integer siteId;
+
+    /**
+     * 巡检状态(1 未巡检,2 已巡检)
+     */
+    private Integer inspectionStatus;
+
+
+}

+ 43 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/SpecialRestDay.java

@@ -0,0 +1,43 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SpecialRestDay implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 特殊休息日关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 主计划ID
+     */
+    private Integer planId;
+
+    /**
+     * 休息日期日期
+     */
+    private LocalDate restDate;
+
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionPlanMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionPlan;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PatrolInspectionPlanMapper extends CrudMapper<PatrolInspectionPlan> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionPlanSonMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionPlanSon;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PatrolInspectionPlanSonMapper extends CrudMapper<PatrolInspectionPlanSon> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanScheduleMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PlanSchedule;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-19
+ */
+public interface PlanScheduleMapper extends CrudMapper<PlanSchedule> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanSiteMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PlanSite;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PlanSiteMapper extends CrudMapper<PlanSite> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PlanSiteSonMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PlanSiteSon;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PlanSiteSonMapper extends CrudMapper<PlanSiteSon> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/SpecialRestDayMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.SpecialRestDay;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-20
+ */
+public interface SpecialRestDayMapper extends CrudMapper<SpecialRestDay> {
+
+}

+ 34 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionPlanService.java

@@ -0,0 +1,34 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionPlan;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.service.vo.PatrolInspectionAreaVo;
+import com.usky.fire.service.vo.PatrolInspectionPlanDataVo;
+import com.usky.fire.service.vo.PatrolInspectionPlanVo;
+import com.usky.fire.service.vo.PatrolInspectionSiteVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PatrolInspectionPlanService extends CrudService<PatrolInspectionPlan> {
+
+    List<PatrolInspectionAreaVo> planLeftList();
+
+    void addPatrolInspectionPlan(PatrolInspectionPlanVo patrolInspectionPlanVo);
+
+    void updatePatrolInspectionPlan(PatrolInspectionPlanVo patrolInspectionPlanVo);
+
+    void delPatrolInspectionPlan(Integer id);
+
+    CommonPage<PatrolInspectionPlanDataVo> patrolInspectionPlanList(String planName,Integer planType, Integer areaId,Integer pageNum, Integer pageSize, Integer id);
+
+    List<PatrolInspectionSiteVo> patrolInspectionSiteVoList(Integer planId, Integer areaId);
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionPlanSonService.java

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PatrolInspectionPlanSon;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PatrolInspectionPlanSonService extends CrudService<PatrolInspectionPlanSon> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanScheduleService.java

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PlanSchedule;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-19
+ */
+public interface PlanScheduleService extends CrudService<PlanSchedule> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanSiteService.java

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PlanSite;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PlanSiteService extends CrudService<PlanSite> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PlanSiteSonService.java

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PlanSiteSon;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+public interface PlanSiteSonService extends CrudService<PlanSiteSon> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/SpecialRestDayService.java

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.SpecialRestDay;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-20
+ */
+public interface SpecialRestDayService extends CrudService<SpecialRestDay> {
+
+}

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionContentServiceImpl.java

@@ -181,7 +181,7 @@ public class PatrolInspectionContentServiceImpl extends AbstractCrudService<Patr
             list = patrolInspectionContentVoList.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
 
         }
-        return new CommonPage<>(list, patrolInspectionContentVoList.size(), pageNum, pageSize);
+        return new CommonPage<>(list, patrolInspectionContentVoList.size(), pageSize,pageNum);
     }
 
 

+ 570 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanServiceImpl.java

@@ -0,0 +1,570 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.*;
+import com.usky.fire.mapper.PatrolInspectionPlanMapper;
+import com.usky.fire.service.*;
+import com.usky.fire.service.util.OnlineMethod;
+import com.usky.fire.service.vo.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Service
+public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolInspectionPlanMapper, PatrolInspectionPlan> implements PatrolInspectionPlanService {
+
+    @Autowired
+    private PatrolInspectionAreaService patrolInspectionAreaService;
+
+    @Autowired
+    private PlanSiteService planSiteService;
+
+    @Autowired
+    private PatrolInspectionPlanSonService patrolInspectionPlanSonService;
+
+    @Autowired
+    private PlanScheduleService planScheduleService;
+
+    @Autowired
+    private PlanSiteSonService planSiteSonService;
+
+    @Autowired
+    private SpecialRestDayService specialRestDayService;
+
+    @Autowired
+    private PatrolInspectionSiteService patrolInspectionSiteService;
+
+    @Override
+    public List<PatrolInspectionAreaVo> planLeftList() {
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionArea::getTenantId, SecurityUtils.getTenantId())
+                .eq(PatrolInspectionArea::getEnable, 1);
+        List<PatrolInspectionArea> patrolInspectionAreaList = patrolInspectionAreaService.list(queryWrapper);
+        LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1).eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
+        List<PatrolInspectionPlan> list = this.list(queryWrapperOne);
+        Map<Integer, List<PatrolInspectionPlan>> grouypByAreaId = list.stream().collect(
+                Collectors.groupingBy(o -> o.getAreaId())
+        );
+        List<DataCountVo> dataCountVoList = new ArrayList<>();
+        grouypByAreaId.forEach((k, v) -> {
+            DataCountVo dataCountVo = new DataCountVo();
+            dataCountVo.setListCount(v.size());
+            dataCountVo.setId(k);
+            dataCountVoList.add(dataCountVo);
+        });
+        List<PatrolInspectionAreaVo> patrolInspectionAreaVoList = new ArrayList<>();
+        if (patrolInspectionAreaList.size() > 0) {
+            for (int i = 0; i < patrolInspectionAreaList.size(); i++) {
+                PatrolInspectionAreaVo patrolInspectionAreaVo = new PatrolInspectionAreaVo();
+                patrolInspectionAreaVo.setId(patrolInspectionAreaList.get(i).getId());
+                patrolInspectionAreaVo.setAreaName(patrolInspectionAreaList.get(i).getAreaName());
+                patrolInspectionAreaVo.setAreaFid(patrolInspectionAreaList.get(i).getAreaFid());
+                patrolInspectionAreaVo.setCompanyId(patrolInspectionAreaList.get(i).getCompanyId());
+                patrolInspectionAreaVo.setTenantId(patrolInspectionAreaList.get(i).getTenantId());
+                patrolInspectionAreaVo.setCreator(patrolInspectionAreaList.get(i).getCreator());
+                patrolInspectionAreaVo.setCreateTime(patrolInspectionAreaList.get(i).getCreateTime());
+                patrolInspectionAreaVo.setEnable(patrolInspectionAreaList.get(i).getEnable());
+                patrolInspectionAreaVo.setSiteCount(0);
+                for (int j = 0; j < dataCountVoList.size(); j++) {
+                    if (patrolInspectionAreaList.get(i).getId() == dataCountVoList.get(j).getId()) {
+                        patrolInspectionAreaVo.setPlanCount(dataCountVoList.get(j).getListCount());
+                    }
+                }
+                patrolInspectionAreaVoList.add(patrolInspectionAreaVo);
+            }
+        }
+        List<PatrolInspectionAreaVo> patrolInspectionAreaVoListOne = new ArrayList<>();
+        if (patrolInspectionAreaVoList.size() > 0) {
+            patrolInspectionAreaVoListOne = OnlineMethod.getChildPerms(patrolInspectionAreaVoList, 0);
+        }
+        return patrolInspectionAreaVoListOne;
+    }
+
+    @Override
+    @Transactional
+    public void addPatrolInspectionPlan(PatrolInspectionPlanVo patrolInspectionPlanVo) {
+        //主表数据添加
+        PatrolInspectionPlan patrolInspectionPlan = new PatrolInspectionPlan();
+        patrolInspectionPlan.setPlanName(patrolInspectionPlanVo.getPlanName());
+        patrolInspectionPlan.setStartDate(patrolInspectionPlanVo.getStartDate());
+        if (patrolInspectionPlanVo.getPlanType() == 1) {
+            patrolInspectionPlan.setEndDate(patrolInspectionPlanVo.getEndDate());
+        } else {
+            String timeStr = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            LocalDate ss = OnlineMethod.getDate(timeStr, "yyyy-MM-dd", true, 7 * patrolInspectionPlanVo.getWeekCount());
+            patrolInspectionPlan.setEndDate(ss);
+        }
+        patrolInspectionPlan.setAreaId(patrolInspectionPlanVo.getAreaId());
+        patrolInspectionPlan.setPlanType(patrolInspectionPlanVo.getPlanType());
+        patrolInspectionPlan.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+        patrolInspectionPlan.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+        patrolInspectionPlan.setLapTime(patrolInspectionPlanVo.getLapTime());
+        patrolInspectionPlan.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+        patrolInspectionPlan.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+        patrolInspectionPlan.setCreateTime(LocalDateTime.now());
+        patrolInspectionPlan.setCreator(SecurityUtils.getUsername());
+        patrolInspectionPlan.setEnable(1);
+        patrolInspectionPlan.setTenantId(SecurityUtils.getTenantId());
+        patrolInspectionPlan.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+        this.save(patrolInspectionPlan);
+        Integer fid = patrolInspectionPlan.getId();
+        //巡检日程添加
+        for (int i = 0; i < patrolInspectionPlanVo.getPlanScheduleList().size(); i++) {
+            patrolInspectionPlanVo.getPlanScheduleList().get(i).setPlanId(fid);
+            planScheduleService.save(patrolInspectionPlanVo.getPlanScheduleList().get(i));
+        }
+        //主计划地点添加
+        for (int i = 0; i < patrolInspectionPlanVo.getSiteArray().length; i++) {
+            PlanSite planSite = new PlanSite();
+            planSite.setPlanId(fid);
+            planSite.setSiteId(patrolInspectionPlanVo.getSiteArray()[i]);
+            planSiteService.save(planSite);
+        }
+
+        //特殊休息日关联信息添加
+        String timeStr3 = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        int days = 0;
+        if (patrolInspectionPlanVo.getPlanType() == 1) {
+            days = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), patrolInspectionPlanVo.getEndDate());
+        } else {
+            LocalDate date = OnlineMethod.getDate(timeStr3, "yyyy-MM-dd", true, 7 * (patrolInspectionPlanVo.getWeekCount() + 1));
+            days = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), date);
+        }
+        for (int i = 0; i < days; i++) {
+            LocalDate date1 = OnlineMethod.getDate(timeStr3, "yyyy-MM-dd", true, i);
+            Date date = Date.from(date1.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
+            String week1 = OnlineMethod.getWeekOfDate(date);
+            if (patrolInspectionPlanVo.getRestDay().contains(week1)) {
+                SpecialRestDay specialRestDay = new SpecialRestDay();
+                specialRestDay.setPlanId(fid);
+                specialRestDay.setRestDate(date1);
+                specialRestDayService.save(specialRestDay);
+            }
+        }
+        //子表数据添加
+        if (patrolInspectionPlanVo.getPlanType() == 1) {//普通计划
+            //计算两时间天数
+            int day = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), patrolInspectionPlanVo.getEndDate());
+            String timeStr1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            for (int i = 0; i < day; i++) {
+                for (int j = 0; j < patrolInspectionPlanVo.getPlanScheduleList().size(); j++) {
+                    LocalDate s = OnlineMethod.getDate(timeStr1, "yyyy-MM-dd", true, i);
+                    Date date = Date.from(s.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
+                    String week = OnlineMethod.getWeekOfDate(date);
+                    if (!patrolInspectionPlanVo.getRestDay().contains(week)) {
+                        PatrolInspectionPlanSon patrolInspectionPlanSon = new PatrolInspectionPlanSon();
+                        patrolInspectionPlanSon.setPlanId(fid);
+                        patrolInspectionPlanSon.setInspectionDate(s);
+                        patrolInspectionPlanSon.setStartTime(patrolInspectionPlanVo.getPlanScheduleList().get(j).getStartTime());
+                        patrolInspectionPlanSon.setEndTime(patrolInspectionPlanVo.getPlanScheduleList().get(j).getEndTime());
+                        patrolInspectionPlanSon.setPersonnelId(patrolInspectionPlanVo.getPlanScheduleList().get(j).getPersonnelId());
+                        patrolInspectionPlanSon.setAreaId(patrolInspectionPlanVo.getAreaId());
+                        patrolInspectionPlanSon.setPlanType(patrolInspectionPlanVo.getPlanType());
+                        patrolInspectionPlanSon.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+                        patrolInspectionPlanSon.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+                        patrolInspectionPlanSon.setLapTime(patrolInspectionPlanVo.getLapTime());
+                        patrolInspectionPlanSon.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+                        patrolInspectionPlanSon.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+                        patrolInspectionPlanSon.setCompletion(0);
+                        patrolInspectionPlanSon.setCreateTime(LocalDateTime.now());
+                        patrolInspectionPlanSon.setCreator(SecurityUtils.getUsername());
+                        patrolInspectionPlanSon.setAlternateField("0");
+                        patrolInspectionPlanSon.setTenantId(SecurityUtils.getTenantId());
+                        patrolInspectionPlanSon.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+                        patrolInspectionPlanSonService.save(patrolInspectionPlanSon);
+                        Integer zfid = patrolInspectionPlanSon.getId();
+                        for (int k = 0; k < patrolInspectionPlanVo.getSiteArray().length; k++) {
+                            PlanSiteSon planSiteSon = new PlanSiteSon();
+                            planSiteSon.setPlanId(zfid);
+                            planSiteSon.setSiteId(patrolInspectionPlanVo.getSiteArray()[k]);
+                            planSiteSon.setInspectionStatus(1);
+                            planSiteSonService.save(planSiteSon);
+                        }
+                    }
+                }
+            }
+        } else {//按次计划
+            for (int i = 0; i < patrolInspectionPlanVo.getWeekCount(); i++) {
+                String timeStr2 = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                LocalDate sss = OnlineMethod.getDate(timeStr2, "yyyy-MM-dd", true, 7 * (i + 1));
+                PatrolInspectionPlanSon patrolInspectionPlanSon = new PatrolInspectionPlanSon();
+                patrolInspectionPlanSon.setPlanId(fid);
+                if (i == 0) {
+                    patrolInspectionPlanSon.setStartDate(patrolInspectionPlanVo.getStartDate());
+                } else {
+                    LocalDate ssss = OnlineMethod.getDate(timeStr2, "yyyy-MM-dd", true, 7 * i + 1);
+                    patrolInspectionPlanSon.setStartDate(ssss);
+                }
+                patrolInspectionPlanSon.setEndDate(sss);
+                patrolInspectionPlanSon.setPersonnelId(patrolInspectionPlanVo.getPlanScheduleList().get(0).getPersonnelId());
+                patrolInspectionPlanSon.setAreaId(patrolInspectionPlanVo.getAreaId());
+                patrolInspectionPlanSon.setPlanType(patrolInspectionPlanVo.getPlanType());
+                patrolInspectionPlanSon.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+                patrolInspectionPlanSon.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+                patrolInspectionPlanSon.setLapTime(patrolInspectionPlanVo.getLapTime());
+                patrolInspectionPlanSon.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+                patrolInspectionPlanSon.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+                patrolInspectionPlanSon.setCompletion(0);
+                patrolInspectionPlanSon.setCreateTime(LocalDateTime.now());
+                patrolInspectionPlanSon.setCreator(SecurityUtils.getUsername());
+                patrolInspectionPlanSon.setAlternateField("0");
+                patrolInspectionPlanSon.setTenantId(SecurityUtils.getTenantId());
+                patrolInspectionPlanSon.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+                patrolInspectionPlanSonService.save(patrolInspectionPlanSon);
+                Integer zfid = patrolInspectionPlanSon.getId();
+                for (int k = 0; k < patrolInspectionPlanVo.getSiteArray().length; k++) {
+                    PlanSiteSon planSiteSon = new PlanSiteSon();
+                    planSiteSon.setPlanId(zfid);
+                    planSiteSon.setSiteId(patrolInspectionPlanVo.getSiteArray()[k]);
+                    planSiteSon.setInspectionStatus(1);
+                    planSiteSonService.save(planSiteSon);
+                }
+            }
+
+        }
+
+    }
+
+    @Override
+    @Transactional
+    public void updatePatrolInspectionPlan(PatrolInspectionPlanVo patrolInspectionPlanVo) {
+        //主表数据修改
+        PatrolInspectionPlan patrolInspectionPlan = new PatrolInspectionPlan();
+        patrolInspectionPlan.setId(patrolInspectionPlanVo.getId());
+        patrolInspectionPlan.setPlanName(patrolInspectionPlanVo.getPlanName());
+        patrolInspectionPlan.setStartDate(patrolInspectionPlanVo.getStartDate());
+        if (patrolInspectionPlanVo.getPlanType() == 1) {
+            patrolInspectionPlan.setEndDate(patrolInspectionPlanVo.getEndDate());
+        } else {
+            String timeStr = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            LocalDate ss = OnlineMethod.getDate(timeStr, "yyyy-MM-dd", true, 7 * patrolInspectionPlanVo.getWeekCount());
+            patrolInspectionPlan.setEndDate(ss);
+        }
+        patrolInspectionPlan.setAreaId(patrolInspectionPlanVo.getAreaId());
+        patrolInspectionPlan.setPlanType(patrolInspectionPlanVo.getPlanType());
+        patrolInspectionPlan.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+        patrolInspectionPlan.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+        patrolInspectionPlan.setLapTime(patrolInspectionPlanVo.getLapTime());
+        patrolInspectionPlan.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+        patrolInspectionPlan.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+        patrolInspectionPlan.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+        this.updateById(patrolInspectionPlan);
+        //巡检日程更新
+        LambdaQueryWrapper<PlanSchedule> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PlanSchedule::getPlanId, patrolInspectionPlanVo.getId());
+        List<PlanSchedule> planScheduleList = planScheduleService.list(queryWrapper);
+        for (int i = 0; i < planScheduleList.size(); i++) {
+            planScheduleService.removeById(planScheduleList.get(i).getId());
+        }
+        for (int i = 0; i < patrolInspectionPlanVo.getPlanScheduleList().size(); i++) {
+            patrolInspectionPlanVo.getPlanScheduleList().get(i).setPlanId(patrolInspectionPlanVo.getId());
+            planScheduleService.save(patrolInspectionPlanVo.getPlanScheduleList().get(i));
+        }
+        //主计划地点更新
+        LambdaQueryWrapper<PlanSite> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PlanSite::getPlanId, patrolInspectionPlanVo.getId());
+        List<PlanSite> planSiteList = planSiteService.list(queryWrapperOne);
+        for (int i = 0; i < planSiteList.size(); i++) {
+            planSiteService.removeById(planSiteList.get(i).getId());
+        }
+        for (int i = 0; i < patrolInspectionPlanVo.getSiteArray().length; i++) {
+            PlanSite planSite = new PlanSite();
+            planSite.setPlanId(patrolInspectionPlanVo.getId());
+            planSite.setSiteId(patrolInspectionPlanVo.getSiteArray()[i]);
+            planSiteService.save(planSite);
+        }
+
+        //特殊休息日关联信息更改
+        LambdaQueryWrapper<SpecialRestDay> queryWrapperFour = Wrappers.lambdaQuery();
+        queryWrapperFour.eq(SpecialRestDay::getPlanId, patrolInspectionPlanVo.getId());
+        List<SpecialRestDay> specialRestDayList = specialRestDayService.list(queryWrapperFour);
+        for (int i = 0; i < specialRestDayList.size(); i++) {
+            specialRestDayService.removeById(specialRestDayList.get(i).getId());
+        }
+        String timeStr3 = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        int days = 0;
+        if (patrolInspectionPlanVo.getPlanType() == 1) {
+            days = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), patrolInspectionPlanVo.getEndDate());
+        } else {
+            LocalDate date = OnlineMethod.getDate(timeStr3, "yyyy-MM-dd", true, 7 * (patrolInspectionPlanVo.getWeekCount() + 1));
+            days = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), date);
+        }
+        for (int i = 0; i < days; i++) {
+            LocalDate date1 = OnlineMethod.getDate(timeStr3, "yyyy-MM-dd", true, i);
+            Date date = Date.from(date1.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
+            String week1 = OnlineMethod.getWeekOfDate(date);
+            if (patrolInspectionPlanVo.getRestDay().contains(week1)) {
+                SpecialRestDay specialRestDay = new SpecialRestDay();
+                specialRestDay.setPlanId(patrolInspectionPlanVo.getId());
+                specialRestDay.setRestDate(date1);
+                specialRestDayService.save(specialRestDay);
+            }
+        }
+        //子表数据更新
+        LambdaQueryWrapper<PatrolInspectionPlanSon> queryWrapperTwo = Wrappers.lambdaQuery();
+        queryWrapperTwo.eq(PatrolInspectionPlanSon::getPlanId, patrolInspectionPlanVo.getId());
+        List<PatrolInspectionPlanSon> patrolInspectionPlanSonList = patrolInspectionPlanSonService.list(queryWrapperTwo);
+        for (int i = 0; i < patrolInspectionPlanSonList.size(); i++) {
+            LambdaQueryWrapper<PlanSiteSon> queryWrapperThree = Wrappers.lambdaQuery();
+            queryWrapperThree.eq(PlanSiteSon::getPlanId, patrolInspectionPlanSonList.get(i).getId());
+            List<PlanSiteSon> planSiteSonList = planSiteSonService.list(queryWrapperThree);
+            for (int j = 0; j < planSiteSonList.size(); j++) {
+                planSiteSonService.removeById(planSiteSonList.get(j).getId());
+            }
+            patrolInspectionPlanSonService.removeById(patrolInspectionPlanSonList.get(i).getId());
+        }
+
+        if (patrolInspectionPlanVo.getPlanType() == 1) {//普通计划
+            //计算两时间天数
+            int day = OnlineMethod.fun(patrolInspectionPlanVo.getStartDate(), patrolInspectionPlanVo.getEndDate());
+            String timeStr1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            for (int i = 0; i < day; i++) {
+                for (int j = 0; j < patrolInspectionPlanVo.getPlanScheduleList().size(); j++) {
+                    LocalDate s = OnlineMethod.getDate(timeStr1, "yyyy-MM-dd", true, i);
+                    Date date = Date.from(s.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
+                    String week = OnlineMethod.getWeekOfDate(date);
+                    if (!patrolInspectionPlanVo.getRestDay().contains(week)) {
+                        PatrolInspectionPlanSon patrolInspectionPlanSon = new PatrolInspectionPlanSon();
+                        patrolInspectionPlanSon.setPlanId(patrolInspectionPlanVo.getId());
+                        patrolInspectionPlanSon.setInspectionDate(s);
+                        patrolInspectionPlanSon.setStartTime(patrolInspectionPlanVo.getPlanScheduleList().get(j).getStartTime());
+                        patrolInspectionPlanSon.setEndTime(patrolInspectionPlanVo.getPlanScheduleList().get(j).getEndTime());
+                        patrolInspectionPlanSon.setPersonnelId(patrolInspectionPlanVo.getPlanScheduleList().get(j).getPersonnelId());
+                        patrolInspectionPlanSon.setAreaId(patrolInspectionPlanVo.getAreaId());
+                        patrolInspectionPlanSon.setPlanType(patrolInspectionPlanVo.getPlanType());
+                        patrolInspectionPlanSon.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+                        patrolInspectionPlanSon.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+                        patrolInspectionPlanSon.setLapTime(patrolInspectionPlanVo.getLapTime());
+                        patrolInspectionPlanSon.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+                        patrolInspectionPlanSon.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+                        patrolInspectionPlanSon.setCompletion(0);
+                        patrolInspectionPlanSon.setCreateTime(LocalDateTime.now());
+                        patrolInspectionPlanSon.setCreator(SecurityUtils.getUsername());
+                        patrolInspectionPlanSon.setAlternateField("0");
+                        patrolInspectionPlanSon.setTenantId(SecurityUtils.getTenantId());
+                        patrolInspectionPlanSon.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+                        patrolInspectionPlanSonService.save(patrolInspectionPlanSon);
+                        Integer zfid = patrolInspectionPlanSon.getId();
+                        for (int k = 0; k < patrolInspectionPlanVo.getSiteArray().length; k++) {
+                            PlanSiteSon planSiteSon = new PlanSiteSon();
+                            planSiteSon.setPlanId(zfid);
+                            planSiteSon.setSiteId(patrolInspectionPlanVo.getSiteArray()[k]);
+                            planSiteSon.setInspectionStatus(1);
+                            planSiteSonService.save(planSiteSon);
+                        }
+                    }
+                }
+            }
+        } else {//按次计划
+            for (int i = 0; i < patrolInspectionPlanVo.getWeekCount(); i++) {
+                String timeStr2 = patrolInspectionPlanVo.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                LocalDate sss = OnlineMethod.getDate(timeStr2, "yyyy-MM-dd", true, 7 * (i + 1));
+                PatrolInspectionPlanSon patrolInspectionPlanSon = new PatrolInspectionPlanSon();
+                patrolInspectionPlanSon.setPlanId(patrolInspectionPlanVo.getId());
+                if (i == 0) {
+                    patrolInspectionPlanSon.setStartDate(patrolInspectionPlanVo.getStartDate());
+                } else {
+                    LocalDate ssss = OnlineMethod.getDate(timeStr2, "yyyy-MM-dd", true, 7 * i + 1);
+                    patrolInspectionPlanSon.setStartDate(ssss);
+                }
+                patrolInspectionPlanSon.setEndDate(sss);
+                patrolInspectionPlanSon.setPersonnelId(patrolInspectionPlanVo.getPlanScheduleList().get(0).getPersonnelId());
+                patrolInspectionPlanSon.setAreaId(patrolInspectionPlanVo.getAreaId());
+                patrolInspectionPlanSon.setPlanType(patrolInspectionPlanVo.getPlanType());
+                patrolInspectionPlanSon.setPlanCycle(patrolInspectionPlanVo.getPlanCycle());
+                patrolInspectionPlanSon.setPlanFrequency(patrolInspectionPlanVo.getPlanFrequency());
+                patrolInspectionPlanSon.setLapTime(patrolInspectionPlanVo.getLapTime());
+                patrolInspectionPlanSon.setIntervalTime(patrolInspectionPlanVo.getIntervalTime());
+                patrolInspectionPlanSon.setPlanDescribe(patrolInspectionPlanVo.getPlanDescribe());
+                patrolInspectionPlanSon.setCompletion(0);
+                patrolInspectionPlanSon.setCreateTime(LocalDateTime.now());
+                patrolInspectionPlanSon.setCreator(SecurityUtils.getUsername());
+                patrolInspectionPlanSon.setAlternateField("0");
+                patrolInspectionPlanSon.setTenantId(SecurityUtils.getTenantId());
+                patrolInspectionPlanSon.setCompanyId(patrolInspectionPlanVo.getCompanyId());
+                patrolInspectionPlanSonService.save(patrolInspectionPlanSon);
+                Integer zfid = patrolInspectionPlanSon.getId();
+                for (int k = 0; k < patrolInspectionPlanVo.getSiteArray().length; k++) {
+                    PlanSiteSon planSiteSon = new PlanSiteSon();
+                    planSiteSon.setPlanId(zfid);
+                    planSiteSon.setSiteId(patrolInspectionPlanVo.getSiteArray()[k]);
+                    planSiteSon.setInspectionStatus(1);
+                    planSiteSonService.save(planSiteSon);
+                }
+            }
+        }
+    }
+
+
+    @Override
+    @Transactional
+    public void delPatrolInspectionPlan(Integer id) {
+        PatrolInspectionPlan patrolInspectionPlan = new PatrolInspectionPlan();
+        patrolInspectionPlan.setId(id);
+        patrolInspectionPlan.setEnable(0);
+        this.updateById(patrolInspectionPlan);
+//        //特殊休息日关联信息更改
+//        LambdaQueryWrapper<SpecialRestDay> queryWrapperFour= Wrappers.lambdaQuery();
+//        queryWrapperFour.eq(SpecialRestDay::getPlanId, id);
+//        List<SpecialRestDay> specialRestDayList = specialRestDayService.list(queryWrapperFour);
+//        for (int i = 0; i < specialRestDayList.size(); i++) {
+//            specialRestDayService.removeById(specialRestDayList.get(i).getId());
+//        }
+//        //巡检日程删除
+//        LambdaQueryWrapper<PlanSchedule> queryWrapper = Wrappers.lambdaQuery();
+//        queryWrapper.eq(PlanSchedule::getPlanId, id);
+//        List<PlanSchedule> planScheduleList = planScheduleService.list(queryWrapper);
+//        for (int i = 0; i < planScheduleList.size(); i++) {
+//            planScheduleService.removeById(planScheduleList.get(i).getId());
+//        }
+//        //主计划地点删除
+//        LambdaQueryWrapper<PlanSite> queryWrapperOne = Wrappers.lambdaQuery();
+//        queryWrapperOne.eq(PlanSite::getPlanId, id);
+//        List<PlanSite> planSiteList = planSiteService.list(queryWrapperOne);
+//        for (int i = 0; i < planSiteList.size(); i++) {
+//            planSiteService.removeById(planSiteList.get(i).getId());
+//        }
+//        //子表数据删除
+//        LambdaQueryWrapper<PatrolInspectionPlanSon> queryWrapperTwo = Wrappers.lambdaQuery();
+//        queryWrapperTwo.eq(PatrolInspectionPlanSon::getPlanId,id);
+//        List<PatrolInspectionPlanSon> patrolInspectionPlanSonList = patrolInspectionPlanSonService.list(queryWrapperTwo);
+//        for (int i = 0; i < patrolInspectionPlanSonList.size(); i++) {
+//            LambdaQueryWrapper<PlanSiteSon> queryWrapperThree = Wrappers.lambdaQuery();
+//            queryWrapperThree.eq(PlanSiteSon::getPlanId, patrolInspectionPlanSonList.get(i).getId());
+//            List<PlanSiteSon> planSiteSonList = planSiteSonService.list(queryWrapperThree);
+//            for (int j = 0; j < planSiteSonList.size(); j++) {
+//                planSiteSonService.removeById(planSiteSonList.get(j).getId());
+//            }
+//            patrolInspectionPlanSonService.removeById(patrolInspectionPlanSonList.get(i).getId());
+//        }
+    }
+
+
+    public CommonPage<PatrolInspectionPlanDataVo> patrolInspectionPlanList(String planName, Integer planType, Integer areaId, Integer pageNum, Integer pageSize, Integer id) {
+        LambdaQueryWrapper<PatrolInspectionPlan> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionPlan::getEnable, 1)
+                .eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
+        if (planName != null && "".equals(planName)) {
+            queryWrapper.like(PatrolInspectionPlan::getPlanName, planName);
+        }
+        if (id != null && id != 0) {
+            queryWrapper.eq(PatrolInspectionPlan::getId, id);
+        }
+        if (planType != null && planType != 0) {
+            queryWrapper.eq(PatrolInspectionPlan::getPlanType, planType);
+        }
+        if (areaId != null && areaId != 0) {
+            queryWrapper.eq(PatrolInspectionPlan::getAreaId, areaId);
+        }
+        List<PatrolInspectionPlan> patrolInspectionPlanSonList = this.list(queryWrapper);
+        List<PlanSchedule> planScheduleList = planScheduleService.list();
+
+        List<PlanScheduleVo> list = new ArrayList<>();
+        for (int i = 0; i < planScheduleList.size(); i++) {
+            PlanScheduleVo planScheduleVo = new PlanScheduleVo();
+            planScheduleVo.setTime(planScheduleList.get(i).getStartTime() + "~" + planScheduleList.get(i).getEndTime());
+            planScheduleVo.setPersonnelId(planScheduleList.get(i).getPersonnelId());
+            planScheduleVo.setPersonnelName("未定义");
+            planScheduleVo.setPlanId(planScheduleList.get(i).getPlanId());
+            list.add(planScheduleVo);
+        }
+        List<PatrolInspectionPlanDataVo> list1 = new ArrayList<>();
+        for (int i = 0; i < patrolInspectionPlanSonList.size(); i++) {
+            PatrolInspectionPlanDataVo patrolInspectionPlanDataVo = new PatrolInspectionPlanDataVo();
+            patrolInspectionPlanDataVo.setId(patrolInspectionPlanSonList.get(i).getId());
+            patrolInspectionPlanDataVo.setPlanName(patrolInspectionPlanSonList.get(i).getPlanName());
+            patrolInspectionPlanDataVo.setStartDate(patrolInspectionPlanSonList.get(i).getStartDate());
+            patrolInspectionPlanDataVo.setEndDate(patrolInspectionPlanSonList.get(i).getEndDate());
+            patrolInspectionPlanDataVo.setAreaId(patrolInspectionPlanSonList.get(i).getAreaId());
+            patrolInspectionPlanDataVo.setPlanType(patrolInspectionPlanSonList.get(i).getPlanType());
+            patrolInspectionPlanDataVo.setPlanCycle(patrolInspectionPlanSonList.get(i).getPlanCycle());
+            patrolInspectionPlanDataVo.setPlanFrequency(patrolInspectionPlanSonList.get(i).getPlanFrequency());
+            patrolInspectionPlanDataVo.setLapTime(patrolInspectionPlanSonList.get(i).getLapTime());
+            patrolInspectionPlanDataVo.setIntervalTime(patrolInspectionPlanSonList.get(i).getIntervalTime());
+            patrolInspectionPlanDataVo.setPlanDescribe(patrolInspectionPlanSonList.get(i).getPlanDescribe());
+            patrolInspectionPlanDataVo.setCreateTime(patrolInspectionPlanSonList.get(i).getCreateTime());
+            patrolInspectionPlanDataVo.setCreator(patrolInspectionPlanSonList.get(i).getCreator());
+            patrolInspectionPlanDataVo.setEnable(patrolInspectionPlanSonList.get(i).getEnable());
+            patrolInspectionPlanDataVo.setTenantId(patrolInspectionPlanSonList.get(i).getTenantId());
+            patrolInspectionPlanDataVo.setCompanyId(patrolInspectionPlanSonList.get(i).getCompanyId());
+            patrolInspectionPlanDataVo.setRestDay(patrolInspectionPlanSonList.get(i).getRestDay());
+            patrolInspectionPlanDataVo.setWeekCount(patrolInspectionPlanSonList.get(i).getWeekCount());
+            List<PlanScheduleVo> list2 = new ArrayList<>();
+            for (int j = 0; j < list.size(); j++) {
+                if (patrolInspectionPlanSonList.get(i).getId() == list.get(j).getPlanId()) {
+                    list.get(j).setWeekOne(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期一") ? true : false);
+                    list.get(j).setWeekTwo(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期二") ? true : false);
+                    list.get(j).setWeekThree(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期三") ? true : false);
+                    list.get(j).setWeekFour(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期四") ? true : false);
+                    list.get(j).setWeekFive(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期五") ? true : false);
+                    list.get(j).setWeekSix(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期六") ? true : false);
+                    list.get(j).setWeekSeven(patrolInspectionPlanSonList.get(i).getRestDay().contains("星期日") ? true : false);
+                    list2.add(list.get(j));
+                }
+            }
+            patrolInspectionPlanDataVo.setChildrenList(list2);
+            list1.add(patrolInspectionPlanDataVo);
+        }
+        List<PatrolInspectionPlanDataVo> list3 = list1.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+        return new CommonPage<>(list3, list1.size(), pageNum, pageSize);
+    }
+
+
+    public List<PatrolInspectionSiteVo> patrolInspectionSiteVoList(Integer planId, Integer areaId) {
+        LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionSite::getEnable, 1)
+                .eq(PatrolInspectionSite::getAreaId, areaId)
+                .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
+        List<PatrolInspectionSite> patrolInspectionSiteList = patrolInspectionSiteService.list();
+        LambdaQueryWrapper<PlanSite> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PlanSite::getPlanId, planId);
+        List<PlanSite> planSiteList = planSiteService.list(queryWrapperOne);
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapperTwo = Wrappers.lambdaQuery();
+        queryWrapperTwo.eq(PatrolInspectionArea::getEnable, 1)
+                .eq(PatrolInspectionArea::getTenantId, SecurityUtils.getTenantId());
+        List<PatrolInspectionArea> PatrolInspectionAreaList = patrolInspectionAreaService.list(queryWrapperTwo);
+        List<PatrolInspectionSiteVo> list = new ArrayList<>();
+        for (int i = 0; i < patrolInspectionSiteList.size(); i++) {
+            PatrolInspectionSiteVo patrolInspectionSiteVo = new PatrolInspectionSiteVo();
+            patrolInspectionSiteVo.setSiteName(patrolInspectionSiteList.get(i).getSiteName());
+            patrolInspectionSiteVo.setAreaId(patrolInspectionSiteList.get(i).getAreaId());
+            for (int j = 0; j < PatrolInspectionAreaList.size(); j++) {
+                if (patrolInspectionSiteList.get(i).getAreaId() == PatrolInspectionAreaList.get(j).getId()) {
+                    patrolInspectionSiteVo.setAreaName(PatrolInspectionAreaList.get(j).getAreaName());
+                }
+            }
+            patrolInspectionSiteVo.setId(patrolInspectionSiteList.get(i).getId());
+            patrolInspectionSiteVo.setSiteStatus(false);
+            for (int j = 0; j < planSiteList.size(); j++) {
+                if (patrolInspectionSiteList.get(i).getId() == planSiteList.get(j).getSiteId()) {
+                    patrolInspectionSiteVo.setSiteStatus(true);
+                }
+            }
+            list.add(patrolInspectionSiteVo);
+        }
+        return list;
+    }
+}

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PatrolInspectionPlanSon;
+import com.usky.fire.mapper.PatrolInspectionPlanSonMapper;
+import com.usky.fire.service.PatrolInspectionPlanSonService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Service
+public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<PatrolInspectionPlanSonMapper, PatrolInspectionPlanSon> implements PatrolInspectionPlanSonService {
+
+}

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanScheduleServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PlanSchedule;
+import com.usky.fire.mapper.PlanScheduleMapper;
+import com.usky.fire.service.PlanScheduleService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-19
+ */
+@Service
+public class PlanScheduleServiceImpl extends AbstractCrudService<PlanScheduleMapper, PlanSchedule> implements PlanScheduleService {
+
+}

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanSiteServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PlanSite;
+import com.usky.fire.mapper.PlanSiteMapper;
+import com.usky.fire.service.PlanSiteService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Service
+public class PlanSiteServiceImpl extends AbstractCrudService<PlanSiteMapper, PlanSite> implements PlanSiteService {
+
+}

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PlanSiteSonServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PlanSiteSon;
+import com.usky.fire.mapper.PlanSiteSonMapper;
+import com.usky.fire.service.PlanSiteSonService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Service
+public class PlanSiteSonServiceImpl extends AbstractCrudService<PlanSiteSonMapper, PlanSiteSon> implements PlanSiteSonService {
+
+}

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/SpecialRestDayServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.SpecialRestDay;
+import com.usky.fire.mapper.SpecialRestDayMapper;
+import com.usky.fire.service.SpecialRestDayService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-20
+ */
+@Service
+public class SpecialRestDayServiceImpl extends AbstractCrudService<SpecialRestDayMapper, SpecialRestDay> implements SpecialRestDayService {
+
+}

+ 65 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/util/OnlineMethod.java

@@ -2,9 +2,12 @@ package com.usky.fire.service.util;
 
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
 
 public class OnlineMethod {
 
@@ -69,4 +72,63 @@ public class OnlineMethod {
         return getChildList(list, t).size() > 0 ? true : false;
     }
 
+    /**
+     * 计算两个日期相隔天数
+     * @param s1 日期1
+     * @param s2 日期2
+     * @return
+     */
+    public static int fun(LocalDate s1, LocalDate s2) {
+        long between = ChronoUnit.DAYS.between(s1, s2);
+        return (int) between;
+    }
+
+    /*java获取指定日期的前几天或后几天
+      @param datestr指定日期
+      * @param format 日期格式
+      * * @param flag true为获取后几天, false:为获取前几天
+      * *@param day指定需要获取的天数
+      * *
+      *  @returr
+      * */
+    public static LocalDate getDate(String dateStr, String format, boolean flag, int day)
+    {
+        Calendar c = Calendar.getInstance();
+        Date date = null;
+        try {
+            date = new SimpleDateFormat(format).parse(dateStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        c.setTime (date);
+        int day1 = c.get(Calendar.DATE);
+        if (flag) {
+            c.set(Calendar.DATE, day1 + day);
+        }else {
+            c.set(Calendar.DATE, day1- day);
+        }
+        String m = new SimpleDateFormat(format).format(c.getTime());
+        LocalDate beginDateTime = LocalDate.parse(m, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        return  beginDateTime;
+    }
+
+
+
+    /**
+     * 获取当前日期是星期几<br>
+     *
+     * @param date
+     * @return 当前日期是星期几
+     */
+
+    public static String getWeekOfDate(Date date) {
+        String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if (w < 0)
+            w = 0;
+        return weekDays[w];
+    }
+
 }

+ 4 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionAreaVo.java

@@ -79,6 +79,10 @@ public class PatrolInspectionAreaVo implements Serializable {
      */
     private Integer siteCount;
 
+    /**
+     * 计划数量
+     */
+    private Integer planCount;
 
     /** 子菜单 */
     @TableField(exist = false)

+ 126 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanDataVo.java

@@ -0,0 +1,126 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionPlanDataVo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 巡检计划主信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划名称
+     */
+    private String planName;
+
+    /**
+     * 开始日期
+     */
+    private LocalDate startDate;
+
+    /**
+     * 结束日期
+     */
+    private LocalDate endDate;
+
+    /**
+     * 巡检区域ID
+     */
+    private Integer areaId;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 巡检周期(1 日,2 周,3 月,4 年)
+     */
+    private Integer planCycle;
+
+    /**
+     * 计划次数
+     */
+    private Integer planFrequency;
+
+    /**
+     * 每圈用时(分钟)
+     */
+    private Integer lapTime;
+
+    /**
+     * 两圈间隔时间(分钟)
+     */
+    private Integer intervalTime;
+
+    /**
+     * 计划描述
+     */
+    private String planDescribe;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 休息日:星期一、星期二、星期三、星期四、星期五、星期六、星期日
+     */
+    private String restDay;
+
+    /**
+     * 周数
+     */
+    private String weekCount;
+
+    /**
+     * 子级列表
+     */
+    private List<PlanScheduleVo> childrenList;
+
+
+}

+ 132 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanVo.java

@@ -0,0 +1,132 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.usky.fire.domain.PlanSchedule;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionPlanVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检计划主信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 计划名称
+     */
+    private String planName;
+
+    /**
+     * 开始日期
+     */
+    private LocalDate startDate;
+
+    /**
+     * 结束日期
+     */
+    private LocalDate endDate;
+
+    /**
+     * 巡检区域ID
+     */
+    private Integer areaId;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 巡检周期(1 日,2 周,3 月,4 年)
+     */
+    private Integer planCycle;
+
+    /**
+     * 计划次数
+     */
+    private Integer planFrequency;
+
+    /**
+     * 每圈用时(分钟)
+     */
+    private Integer lapTime;
+
+    /**
+     * 两圈间隔时间(分钟)
+     */
+    private Integer intervalTime;
+
+    /**
+     * 计划描述
+     */
+    private String planDescribe;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 休息日:星期一、星期二、星期三、星期四、星期五、星期六、星期日
+     */
+    private String restDay;
+
+    /**
+     * 周数
+     */
+    private Integer weekCount;
+
+    /**
+     * 选中的地点ID
+     */
+    private Integer[] siteArray;
+
+    /**
+     * 巡检日程
+     */
+    private List<PlanSchedule> planScheduleList;
+
+
+}

+ 125 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionSiteVo.java

@@ -0,0 +1,125 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionSiteVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检地点信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 地点名称
+     */
+    private String siteName;
+
+    /**
+     * 地点号码
+     */
+    private String siteNubmber;
+
+    /**
+     * 地点描述
+     */
+    private String siteDescribe;
+
+    /**
+     * 地点类型
+     */
+    private Integer siteType;
+
+    /**
+     * 采集人员
+     */
+    private String collector;
+
+    /**
+     * 采集时间
+     */
+    private LocalDateTime collectTime;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 区域id
+     */
+    private Integer areaId;
+
+    /**
+     * 图片地址
+     */
+    private String pictureUrl;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 误差范围
+     */
+    private Double distanceRange;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 站点状态:true 选中 false未选中
+     */
+    private Boolean siteStatus;
+
+    /**
+     * 区域名称
+     */
+    private String areaName;
+
+
+
+}

+ 43 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PlanDataVo.java

@@ -0,0 +1,43 @@
+package com.usky.fire.service.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PlanDataVo implements Serializable {
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+    /**
+     * 巡检人员ID
+     */
+    private Integer personnelId;
+
+
+    /**
+     * 巡检人名称
+     */
+    private String personnelName;
+
+}

+ 90 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PlanScheduleVo.java

@@ -0,0 +1,90 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PlanScheduleVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 地点内容关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 巡检时间
+     */
+    private String time;
+
+    /**
+     * 巡检人ID
+     */
+    private Integer personnelId;
+
+    /**
+     * 巡检人名称
+     */
+    private String personnelName;
+
+    /**
+     * 主计划ID
+     */
+    private Integer planId;
+
+    /**
+     * 周一
+     */
+    private Boolean weekOne;
+
+    /**
+     * 周二
+     */
+    private Boolean weekTwo;
+
+    /**
+     * 周三
+     */
+    private Boolean weekThree;
+
+    /**
+     * 周四
+     */
+    private Boolean weekFour;
+
+    /**
+     * 周五
+     */
+    private Boolean weekFive;
+
+    /**
+     * 周六
+     */
+    private Boolean weekSix;
+
+    /**
+     * 周日
+     */
+    private Boolean weekSeven;
+
+
+
+
+}

+ 27 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionPlanMapper.xml

@@ -0,0 +1,27 @@
+<?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.usky.fire.mapper.PatrolInspectionPlanMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionPlan">
+        <id column="id" property="id" />
+        <result column="plan_name" property="planName" />
+        <result column="start_date" property="startDate" />
+        <result column="end_date" property="endDate" />
+        <result column="area_id" property="areaId" />
+        <result column="plan_type" property="planType" />
+        <result column="plan_cycle" property="planCycle" />
+        <result column="plan_frequency" property="planFrequency" />
+        <result column="lap_time" property="lapTime" />
+        <result column="interval_time" property="intervalTime" />
+        <result column="plan_describe" property="planDescribe" />
+        <result column="create_time" property="createTime" />
+        <result column="creator" property="creator" />
+        <result column="enable" property="enable" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="company_id" property="companyId" />
+        <result column="rest_day" property="restDay" />
+        <result column="week_count" property="weekCount" />
+    </resultMap>
+
+</mapper>

+ 30 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionPlanSonMapper.xml

@@ -0,0 +1,30 @@
+<?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.usky.fire.mapper.PatrolInspectionPlanSonMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionPlanSon">
+        <id column="id" property="id" />
+        <result column="plan_id" property="planId" />
+        <result column="inspection_date" property="inspectionDate" />
+        <result column="start_date" property="startDate" />
+        <result column="end_date" property="endDate" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="personnel_id" property="personnelId" />
+        <result column="area_id" property="areaId" />
+        <result column="plan_type" property="planType" />
+        <result column="plan_cycle" property="planCycle" />
+        <result column="plan_frequency" property="planFrequency" />
+        <result column="lap_time" property="lapTime" />
+        <result column="interval_time" property="intervalTime" />
+        <result column="plan_describe" property="planDescribe" />
+        <result column="completion" property="completion" />
+        <result column="create_time" property="createTime" />
+        <result column="creator" property="creator" />
+        <result column="alternate_field" property="alternateField" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="company_id" property="companyId" />
+    </resultMap>
+
+</mapper>

+ 14 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanScheduleMapper.xml

@@ -0,0 +1,14 @@
+<?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.usky.fire.mapper.PlanScheduleMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PlanSchedule">
+        <id column="id" property="id" />
+        <result column="plan_id" property="planId" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="personnel_id" property="personnelId" />
+    </resultMap>
+
+</mapper>

+ 12 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanSiteMapper.xml

@@ -0,0 +1,12 @@
+<?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.usky.fire.mapper.PlanSiteMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PlanSite">
+        <id column="id" property="id" />
+        <result column="plan_id" property="planId" />
+        <result column="site_id" property="siteId" />
+    </resultMap>
+
+</mapper>

+ 13 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PlanSiteSonMapper.xml

@@ -0,0 +1,13 @@
+<?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.usky.fire.mapper.PlanSiteSonMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PlanSiteSon">
+        <id column="id" property="id" />
+        <result column="plan_id" property="planId" />
+        <result column="site_id" property="siteId" />
+        <result column="inspection_status" property="inspectionStatus" />
+    </resultMap>
+
+</mapper>

+ 12 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/SpecialRestDayMapper.xml

@@ -0,0 +1,12 @@
+<?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.usky.fire.mapper.SpecialRestDayMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.SpecialRestDay">
+        <id column="id" property="id" />
+        <result column="plan_id" property="planId" />
+        <result column="rest_date" property="restDate" />
+    </resultMap>
+
+</mapper>