Sfoglia il codice sorgente

巡检异常记录接口及签到状态人数统计

fuyuhchuan 10 mesi fa
parent
commit
219c469729
43 ha cambiato i file con 1398 aggiunte e 334 eliminazioni
  1. 60 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalController.java
  2. 21 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalOptionController.java
  3. 21 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalPictureController.java
  4. 6 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAttendanceController.java
  5. 3 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRecordController.java
  6. 34 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRouteController.java
  7. 141 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormal.java
  8. 55 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormalOption.java
  9. 40 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormalPicture.java
  10. 4 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionPlan.java
  11. 5 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionRecord.java
  12. 71 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionRoute.java
  13. 18 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAbnormalMapper.java
  14. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAbnormalOptionMapper.java
  15. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAbnormalPictureMapper.java
  16. 5 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAttendanceMapper.java
  17. 2 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionPlanSonMapper.java
  18. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionRouteMapper.java
  19. 2 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionSiteMapper.java
  20. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAbnormalOptionService.java
  21. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAbnormalPictureService.java
  22. 51 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAbnormalService.java
  23. 26 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAttendanceService.java
  24. 1 2
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRecordService.java
  25. 22 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRouteService.java
  26. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAbnormalOptionServiceImpl.java
  27. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAbnormalPictureServiceImpl.java
  28. 292 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAbnormalServiceImpl.java
  29. 43 17
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java
  30. 3 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanServiceImpl.java
  31. 15 6
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java
  32. 20 294
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java
  33. 33 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRouteServiceImpl.java
  34. 153 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionAbnormalVo.java
  35. 5 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanDataVo.java
  36. 5 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanVo.java
  37. 32 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalMapper.xml
  38. 15 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalOptionMapper.xml
  39. 12 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalPictureMapper.xml
  40. 42 14
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAttendanceMapper.xml
  41. 1 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionPlanMapper.xml
  42. 1 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionRecordMapper.xml
  43. 18 0
      service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionRouteMapper.xml

+ 60 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalController.java

@@ -0,0 +1,60 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionAbnormal;
+import com.usky.fire.domain.PatrolInspectionRecord;
+import com.usky.fire.domain.PatrolInspectionRoute;
+import com.usky.fire.service.PatrolInspectionAbnormalService;
+import com.usky.fire.service.vo.PatrolInspectionAbnormalVo;
+import com.usky.fire.service.vo.PatrolInspectionRecordVo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import org.springframework.stereotype.Controller;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 巡检异常记录表 前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@RestController
+@RequestMapping("/patrolInspectionAbnormal")
+public class PatrolInspectionAbnormalController {
+
+    @Autowired
+    private PatrolInspectionAbnormalService patrolInspectionAbnormalService;
+
+
+    @PostMapping("/addAbnormal")
+    public ApiResult<Void> add(@RequestBody PatrolInspectionAbnormal patrolInspectionAbnormal) {
+        patrolInspectionAbnormalService.addAbnormal(patrolInspectionAbnormal);
+        return ApiResult.success();
+    }
+
+    @GetMapping("/abnormalList")
+    public ApiResult<CommonPage<PatrolInspectionAbnormal>> recordList(@RequestParam(value = "areaName", required = false) String areaName,
+                                                                                    @RequestParam(value = "siteName", required = false) String siteName,
+                                                                                    @RequestParam(value = "name", required = false) String name,
+                                                                                    @RequestParam(value = "planType", required = false) Integer planType,
+                                                                                    @RequestParam(value = "routeId", required = false) Integer routeId,
+                                                                                    @RequestParam(value = "startDateTime", required = false) String startDateTime,
+                                                                                    @RequestParam(value = "endDateTime", required = false) String endDateTime,
+                                                                                    @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+                                                                                    @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(patrolInspectionAbnormalService.recordList(areaName, siteName, name, planType, routeId, startDateTime, endDateTime, pageNum, pageSize));
+    }
+
+    @GetMapping("/addAbnormalRecordDetails")
+    public ApiResult<List<PatrolInspectionAbnormalVo>> recordDetails(@RequestParam(value = "id") Integer id) {
+        return ApiResult.success(patrolInspectionAbnormalService.recordDetails(id));
+    }
+}
+

+ 21 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalOptionController.java

@@ -0,0 +1,21 @@
+package com.usky.fire.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 巡检异常记录内容选项关联表 前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Controller
+@RequestMapping("/patrolInspectionAbnormalOption")
+public class PatrolInspectionAbnormalOptionController {
+
+}
+

+ 21 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAbnormalPictureController.java

@@ -0,0 +1,21 @@
+package com.usky.fire.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 异常记录上传图片关联表 前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Controller
+@RequestMapping("/patrolInspectionAbnormalPicture")
+public class PatrolInspectionAbnormalPictureController {
+
+}
+

+ 6 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAttendanceController.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.List;
 import java.util.Map;
 
 
@@ -56,6 +57,11 @@ public class PatrolInspectionAttendanceController {
         patrolInspectionAttendanceService.add(patrolInspectionAttendance);
         return ApiResult.success();
     }
+
+    @GetMapping("/bodyCount")
+    public ApiResult<List<Map<String, Integer>>> bodyCount() {
+        return ApiResult.success(patrolInspectionAttendanceService.bodyCount());
+    }
 }
 
 

+ 3 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRecordController.java

@@ -46,6 +46,7 @@ public class PatrolInspectionRecordController {
      * @param siteName      地点名称
      * @param name          人员名称
      * @param planType      计划类型
+     * @param routeId       路线id
      * @param startDateTime 开始时间
      * @param endDateTime   结束时间
      * @param pageNum       当前页
@@ -57,11 +58,12 @@ public class PatrolInspectionRecordController {
                                                                                     @RequestParam(value = "siteName", required = false) String siteName,
                                                                                     @RequestParam(value = "name", required = false) String name,
                                                                                     @RequestParam(value = "planType", required = false) Integer planType,
+                                                                                    @RequestParam(value = "routeId", required = false) Integer routeId,
                                                                                     @RequestParam(value = "startDateTime", required = false) String startDateTime,
                                                                                     @RequestParam(value = "endDateTime", required = false) String endDateTime,
                                                                                     @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
-        return ApiResult.success(patrolInspectionRecordService.patrolInspectionRecordLsit(areaName, siteName, name, planType, startDateTime, endDateTime, pageNum, pageSize));
+        return ApiResult.success(patrolInspectionRecordService.patrolInspectionRecordLsit(areaName, siteName, name, planType, routeId, startDateTime, endDateTime, pageNum, pageSize));
     }
 
     /**

+ 34 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRouteController.java

@@ -0,0 +1,34 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.fire.domain.PatrolInspectionRoute;
+import com.usky.fire.service.PatrolInspectionRouteService;
+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.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@RestController
+@RequestMapping("/patrolInspectionRoute")
+public class PatrolInspectionRouteController {
+    @Autowired
+    private PatrolInspectionRouteService patrolInspectionRouteService;
+
+    @GetMapping("/routeList")
+    public ApiResult<List<PatrolInspectionRoute>> routeTreeList() {
+        return ApiResult.success(patrolInspectionRouteService.routeList());
+    }
+
+}
+

+ 141 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormal.java

@@ -0,0 +1,141 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 巡检异常记录表
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionAbnormal implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 巡检记录表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 地点号码
+     */
+    private String siteNubmber;
+
+    /**
+     * 地点类型 (1二维码 2NFC)
+     */
+    private Integer siteType;
+
+    /**
+     * 区域名称
+     */
+    private String areaName;
+
+    /**
+     * 地点名称
+     */
+    private String siteName;
+
+    /**
+     * 巡检人员
+     */
+    private String name;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 定位 (0:未定位 1:已定位)
+     */
+    private Integer siteStatus;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 开始时间
+     */
+    private LocalDateTime startDate;
+
+    /**
+     * 结束时间
+     */
+    private LocalDateTime endDate;
+
+    /**
+     * 创建时间/巡检时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 巡检计划主表ID
+     */
+    private Integer planId;
+
+    /**
+     * 巡检计划子表ID
+     */
+    private Integer planSonId;
+
+    /**
+     * 巡检地点ID
+     */
+    private Integer siteId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 用户名称
+     */
+    private String creator;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 路线表主键id
+     */
+    private Integer routeId;
+
+    /**
+     * 异常状态
+     */
+    private Integer abnormalStatus;
+
+
+}

+ 55 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormalOption.java

@@ -0,0 +1,55 @@
+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;
+
+/**
+ * <p>
+ * 巡检异常记录内容选项关联表
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionAbnormalOption implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 巡检异常记录内容选项关联表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 记录ID
+     */
+    private Integer recordId;
+
+    /**
+     * 内容选项ID
+     */
+    private Integer contentOptionId;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 检查项ID
+     */
+    private Integer contentId;
+
+
+}

+ 40 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAbnormalPicture.java

@@ -0,0 +1,40 @@
+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;
+
+/**
+ * <p>
+ * 异常记录上传图片关联表
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionAbnormalPicture implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 异常记录上传图片关联表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 巡检异常记录ID
+     */
+    private Integer recordId;
+
+    /**
+     * 图片路径
+     */
+    private String pictureUrl;
+
+
+}

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

@@ -115,5 +115,9 @@ public class PatrolInspectionPlan implements Serializable {
      */
     private Integer weekCount;
 
+    /**
+     * 路线表主键id
+     */
+    private Integer routeId;
 
 }

+ 5 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionRecord.java

@@ -129,4 +129,9 @@ public class PatrolInspectionRecord implements Serializable {
      */
     private String remarks;
 
+    /**
+     * 路线表主键id
+     */
+    private Integer routeId;
+
 }

+ 71 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionRoute.java

@@ -0,0 +1,71 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionRoute implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 路线名称
+     */
+    private String routeName;
+
+    /**
+     * 关联巡检地点ID集合
+     */
+    private String siteIds;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+
+}

+ 18 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAbnormalMapper.java

@@ -0,0 +1,18 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionAbnormal;
+import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 巡检异常记录表 Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@Repository
+public interface PatrolInspectionAbnormalMapper extends CrudMapper<PatrolInspectionAbnormal> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalOption;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 巡检异常记录内容选项关联表 Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+public interface PatrolInspectionAbnormalOptionMapper extends CrudMapper<PatrolInspectionAbnormalOption> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalPicture;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 异常记录上传图片关联表 Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+public interface PatrolInspectionAbnormalPictureMapper extends CrudMapper<PatrolInspectionAbnormalPicture> {
+
+}

+ 5 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAttendanceMapper.java

@@ -2,6 +2,8 @@ package com.usky.fire.mapper;
 
 import com.usky.fire.domain.PatrolInspectionAttendance;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +13,9 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author fu
  * @since 2024-02-05
  */
+@Repository
 public interface PatrolInspectionAttendanceMapper extends CrudMapper<PatrolInspectionAttendance> {
+    Integer signIn(Integer tenantId);
 
+    Integer signOut(Integer tenantId);
 }

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

@@ -2,6 +2,7 @@ package com.usky.fire.mapper;
 
 import com.usky.fire.domain.PatrolInspectionPlanSon;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author JCB
  * @since 2022-07-18
  */
+@Repository
 public interface PatrolInspectionPlanSonMapper extends CrudMapper<PatrolInspectionPlanSon> {
 
 }

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

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionRoute;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+public interface PatrolInspectionRouteMapper extends CrudMapper<PatrolInspectionRoute> {
+
+}

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionSiteMapper.java

@@ -2,6 +2,7 @@ package com.usky.fire.mapper;
 
 import com.usky.common.mybatis.core.CrudMapper;
 import com.usky.fire.domain.PatrolInspectionSite;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.fire.domain.PatrolInspectionSite;
  * @author JCB
  * @since 2022-07-13
  */
+@Repository
 public interface PatrolInspectionSiteMapper extends CrudMapper<PatrolInspectionSite> {
 
 }

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

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalOption;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 巡检异常记录内容选项关联表 服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+public interface PatrolInspectionAbnormalOptionService extends CrudService<PatrolInspectionAbnormalOption> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalPicture;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 异常记录上传图片关联表 服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+public interface PatrolInspectionAbnormalPictureService extends CrudService<PatrolInspectionAbnormalPicture> {
+
+}

+ 51 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAbnormalService.java

@@ -0,0 +1,51 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionAbnormal;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.domain.PatrolInspectionRecord;
+import com.usky.fire.service.vo.PatrolInspectionAbnormalVo;
+import com.usky.fire.service.vo.PatrolInspectionRecordVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 巡检异常记录表 服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+public interface PatrolInspectionAbnormalService extends CrudService<PatrolInspectionAbnormal> {
+    /**
+     * 新增巡检异常记录
+     * @param patrolInspectionAbnormal 异常记录表实体
+     */
+    void addAbnormal(PatrolInspectionAbnormal patrolInspectionAbnormal);
+
+    /**
+     * 异常记录分页接口
+     * @param areaName      区域名称
+     * @param siteName      地点名称
+     * @param name          人员名称
+     * @param planType      计划类型
+     * @param routeId       路线id
+     * @param startDateTime 开始时间
+     * @param endDateTime   结束时间
+     * @param pageNum       当前页
+     * @param pageSize      每页条数
+     * @return
+     */
+    CommonPage<PatrolInspectionAbnormal> recordList(String areaName, String siteName, String name,
+                                                  Integer planType, Integer routeId,
+                                                  String startDateTime, String endDateTime,
+                                                  Integer pageNum, Integer pageSize);
+
+    /**
+     * 异常巡检记录详情
+     * @param id
+     * @return
+     */
+    List<PatrolInspectionAbnormalVo> recordDetails(Integer id);
+}

+ 26 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAttendanceService.java

@@ -5,6 +5,7 @@ import com.usky.fire.domain.PatrolInspectionAttendance;
 import com.usky.common.mybatis.core.CrudService;
 
 import java.time.LocalDateTime;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -17,9 +18,34 @@ import java.util.Map;
  */
 public interface PatrolInspectionAttendanceService extends CrudService<PatrolInspectionAttendance> {
 
+    /**
+     * 签到记录分页查询
+     * @param pageNum
+     * @param pageSize
+     * @param operateCode
+     * @param operator
+     * @param startTime
+     * @param endTime
+     * @return
+     */
     IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, String operateCode, String operator, LocalDateTime startTime, LocalDateTime endTime);
 
+    /**
+     * 新增签到记录
+     * @param patrolInspectionAttendance
+     */
     void add(PatrolInspectionAttendance patrolInspectionAttendance);
 
+    /**
+     * 查询部门名
+     * @param id
+     * @return
+     */
     String getDeptName(Integer id);
+
+    /**
+     * 签到、签退状态人数统计
+     * @return
+     */
+    List<Map<String, Integer>> bodyCount();
 }

+ 1 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRecordService.java

@@ -26,6 +26,7 @@ public interface PatrolInspectionRecordService extends CrudService<PatrolInspect
                                                                   String siteName,
                                                                   String name,
                                                                   Integer planType,
+                                                                  Integer routeId,
                                                                   String startDateTime,
                                                                   String endDateTime,
                                                                   Integer pageNum,
@@ -48,6 +49,4 @@ public interface PatrolInspectionRecordService extends CrudService<PatrolInspect
                                                      Integer planType, String startDateTime,
                                                      String endDateTime, String idList);
 
-/*    void exportImage(HttpServletResponse response, String areaName, String siteName, String name, Integer planType,
-                            String startDateTime, String endDateTime, String idList) throws IOException;*/
 }

+ 22 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRouteService.java

@@ -0,0 +1,22 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.PatrolInspectionRoute;
+import com.usky.common.mybatis.core.CrudService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+public interface PatrolInspectionRouteService extends CrudService<PatrolInspectionRoute> {
+    /**
+     * 路线下拉列表
+     * @return
+     */
+    List<PatrolInspectionRoute> routeList();
+}

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

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalOption;
+import com.usky.fire.mapper.PatrolInspectionAbnormalOptionMapper;
+import com.usky.fire.service.PatrolInspectionAbnormalOptionService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 巡检异常记录内容选项关联表 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Service
+public class PatrolInspectionAbnormalOptionServiceImpl extends AbstractCrudService<PatrolInspectionAbnormalOptionMapper, PatrolInspectionAbnormalOption> implements PatrolInspectionAbnormalOptionService {
+
+}

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

@@ -0,0 +1,20 @@
+package com.usky.fire.service.impl;
+
+import com.usky.fire.domain.PatrolInspectionAbnormalPicture;
+import com.usky.fire.mapper.PatrolInspectionAbnormalPictureMapper;
+import com.usky.fire.service.PatrolInspectionAbnormalPictureService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 异常记录上传图片关联表 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-14
+ */
+@Service
+public class PatrolInspectionAbnormalPictureServiceImpl extends AbstractCrudService<PatrolInspectionAbnormalPictureMapper, PatrolInspectionAbnormalPicture> implements PatrolInspectionAbnormalPictureService {
+
+}

+ 292 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAbnormalServiceImpl.java

@@ -0,0 +1,292 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.core.exception.BusinessException;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.*;
+import com.usky.fire.mapper.PatrolInspectionAbnormalMapper;
+import com.usky.fire.mapper.PatrolInspectionPlanMapper;
+import com.usky.fire.mapper.PatrolInspectionPlanSonMapper;
+import com.usky.fire.service.*;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.service.vo.ContentOptionVo;
+import com.usky.fire.service.vo.PatrolInspectionAbnormalVo;
+import com.usky.fire.service.vo.PatrolInspectionContentVo;
+import com.usky.fire.service.vo.PatrolInspectionRecordVo;
+import com.usky.system.model.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 巡检异常记录表 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@Service
+public class PatrolInspectionAbnormalServiceImpl extends AbstractCrudService<PatrolInspectionAbnormalMapper, PatrolInspectionAbnormal> implements PatrolInspectionAbnormalService {
+
+    @Autowired
+    private PatrolInspectionPlanSonMapper patrolInspectionPlanSonMapper;
+
+    @Autowired
+    private PatrolInspectionPlanMapper patrolInspectionPlanMapper;
+
+    @Autowired
+    private PatrolInspectionAreaService patrolInspectionAreaService;
+
+    @Autowired
+    private PatrolInspectionAbnormalPictureService patrolInspectionAbnormalPictureService;
+
+    @Autowired
+    private PatrolInspectionAbnormalOptionService patrolInspectionAbnormalOptionService;
+
+    @Autowired
+    private PatrolInspectionSiteContentService siteContentService;
+
+    @Autowired
+    private PatrolInspectionContentService patrolInspectionContentService;
+
+    @Autowired
+    private PatrolInspectionContentOptionService contentOptionService;
+
+    @Override
+    public void addAbnormal(PatrolInspectionAbnormal patrolInspectionAbnormal) {
+        DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LambdaQueryWrapper<PatrolInspectionPlanSon> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionPlanSon::getId, patrolInspectionAbnormal.getPlanSonId());
+        List<PatrolInspectionPlanSon> planSonList = patrolInspectionPlanSonMapper.selectList(queryWrapper);
+
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.select(PatrolInspectionArea::getId, PatrolInspectionArea::getAreaName)
+                .eq(PatrolInspectionArea::getId, planSonList.get(0).getAreaId());
+        List<PatrolInspectionArea> areaList = patrolInspectionAreaService.list(queryWrapperOne);
+
+        PatrolInspectionAbnormal insertAbnormal = new PatrolInspectionAbnormal();
+        insertAbnormal.setSiteNubmber(patrolInspectionAbnormal.getSiteNubmber());
+        insertAbnormal.setSiteType(patrolInspectionAbnormal.getSiteType());
+        insertAbnormal.setAreaName(areaList.get(0).getAreaName());
+        insertAbnormal.setSiteName(patrolInspectionAbnormal.getSiteName());
+        insertAbnormal.setName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+        insertAbnormal.setPhone(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
+        insertAbnormal.setPlanType(planSonList.get(0).getPlanType());
+        insertAbnormal.setSiteStatus(patrolInspectionAbnormal.getSiteStatus());
+        insertAbnormal.setLongitude(patrolInspectionAbnormal.getLongitude());
+        insertAbnormal.setLatitude(patrolInspectionAbnormal.getLatitude());
+
+        String startDate = null;
+        String endDate = null;
+        if (planSonList.get(0).getPlanType() == 1) {
+            startDate = df1.format(planSonList.get(0).getInspectionDate()) + "T" + planSonList.get(0).getStartTime();
+            endDate = df1.format(planSonList.get(0).getInspectionDate()) + "T" + planSonList.get(0).getEndTime();
+        } else {
+            startDate = df1.format(planSonList.get(0).getStartDate()) + "T" + planSonList.get(0).getStartTime();
+            endDate = df1.format(planSonList.get(0).getEndDate()) + "T" + planSonList.get(0).getEndTime();
+        }
+
+        insertAbnormal.setStartDate(LocalDateTime.parse(startDate));
+        insertAbnormal.setEndDate(LocalDateTime.parse(endDate));
+        insertAbnormal.setCreateTime(LocalDateTime.now());
+        insertAbnormal.setPlanId(planSonList.get(0).getPlanId());
+        insertAbnormal.setPlanSonId(patrolInspectionAbnormal.getPlanSonId());
+        insertAbnormal.setSiteId(patrolInspectionAbnormal.getSiteId());
+        insertAbnormal.setTenantId(SecurityUtils.getTenantId());
+        insertAbnormal.setCompanyId(patrolInspectionAbnormal.getCompanyId());
+        insertAbnormal.setCreator(SecurityUtils.getUsername());
+        insertAbnormal.setRemarks(patrolInspectionAbnormal.getRemarks());
+        insertAbnormal.setAbnormalStatus(patrolInspectionAbnormal.getAbnormalStatus());
+        //从主计划表中查找路线id放入表中
+        LambdaQueryWrapper<PatrolInspectionPlan> planLambdaQueryWrapper = Wrappers.lambdaQuery();
+        planLambdaQueryWrapper.select(PatrolInspectionPlan::getRouteId)
+                .eq(PatrolInspectionPlan::getId, patrolInspectionAbnormal.getPlanId());
+        Integer routeId = patrolInspectionPlanMapper.selectOne(planLambdaQueryWrapper).getRouteId();
+        insertAbnormal.setRouteId(routeId);
+        this.save(insertAbnormal);
+    }
+
+    @Override
+    public CommonPage<PatrolInspectionAbnormal> recordList(String areaName, String siteName, String name,
+                                                                         Integer planType, Integer routeId,
+                                                                         String startDateTime, String endDateTime,
+                                                                         Integer pageNum, Integer pageSize) {
+        IPage<PatrolInspectionAbnormal> page = new Page<>(pageNum, pageSize);
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        String userType = null;
+        if (loginUser != null && !"".equals(loginUser)) {
+            userType = loginUser.getUserType();
+        }
+        LambdaQueryWrapper<PatrolInspectionAbnormal> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionAbnormal::getTenantId, SecurityUtils.getTenantId())
+                .like(StringUtils.isNotBlank(areaName), PatrolInspectionAbnormal::getAreaName, areaName)
+                .like(StringUtils.isNotBlank(siteName), PatrolInspectionAbnormal::getSiteName, siteName)
+                .like(StringUtils.isNotBlank(name), PatrolInspectionAbnormal::getName, name)
+                .eq(planType != null && planType != 0, PatrolInspectionAbnormal::getPlanType, planType)
+                .eq(routeId != null, PatrolInspectionAbnormal::getRouteId, routeId)
+                .between(StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime), PatrolInspectionAbnormal::getCreateTime, startDateTime, endDateTime)
+                .eq("00".equals(userType), PatrolInspectionAbnormal::getCreator, SecurityUtils.getUsername());
+        queryWrapper.orderByDesc(PatrolInspectionAbnormal::getId);
+        page = this.page(page, queryWrapper);
+        return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
+    }
+
+    @Override
+    public List<PatrolInspectionAbnormalVo> recordDetails(Integer id) {
+        //记录查询
+        LambdaQueryWrapper<PatrolInspectionAbnormal> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionAbnormal::getTenantId, SecurityUtils.getTenantId())
+                .eq(PatrolInspectionAbnormal::getId, id);
+        List<PatrolInspectionAbnormal> patrolInspectionRecordList = this.list(queryWrapper);
+        if (patrolInspectionRecordList.isEmpty()) {
+            throw new BusinessException("巡检记录不存在");
+        }
+        //上传图片查询
+        LambdaQueryWrapper<PatrolInspectionAbnormalPicture> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PatrolInspectionAbnormalPicture::getRecordId, id);
+        List<PatrolInspectionAbnormalPicture> patrolInspectionRecordPictureList = patrolInspectionAbnormalPictureService.list(queryWrapperOne);
+
+        //内容选中项查询
+        List<Integer> contentOptionIdList = new ArrayList<>();
+        LambdaQueryWrapper<PatrolInspectionAbnormalOption> queryWrapperTwo = Wrappers.lambdaQuery();
+        queryWrapperTwo.eq(PatrolInspectionAbnormalOption::getRecordId, id);
+        List<PatrolInspectionAbnormalOption> patrolInspectionRecordOptionList = patrolInspectionAbnormalOptionService.list(queryWrapperTwo);
+        for (int i = 0; i < patrolInspectionRecordOptionList.size(); i++) {
+            if (patrolInspectionRecordOptionList.get(i).getContentOptionId() != null) {
+                contentOptionIdList.add(patrolInspectionRecordOptionList.get(i).getContentOptionId());
+            }
+        }
+
+        //地点内容ID查询
+        LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperThree = Wrappers.lambdaQuery();
+        queryWrapperThree.in(PatrolInspectionSiteContent::getSiteId, patrolInspectionRecordList.get(0).getSiteId());
+        List<PatrolInspectionSiteContent> siteContentList = siteContentService.list(queryWrapperThree);
+
+        //内容ID重组
+        List<Integer> contentIdList = new ArrayList<>();
+        for (int i = 0; i < siteContentList.size(); i++) {
+            contentIdList.add(siteContentList.get(i).getContentId());
+        }
+
+        //内容查询
+        LambdaQueryWrapper<PatrolInspectionContent> queryWrapperFour = Wrappers.lambdaQuery();
+        queryWrapperFour.in(PatrolInspectionContent::getId, contentIdList)
+                .eq(PatrolInspectionContent::getEnable, 1);
+        List<PatrolInspectionContent> patrolInspectionContentList = patrolInspectionContentService.list(queryWrapperFour);
+
+        //内容选择项查询
+        LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapperFive = Wrappers.lambdaQuery();
+        queryWrapperFive.in(PatrolInspectionContentOption::getContentId, contentIdList)
+                .eq(PatrolInspectionContentOption::getEnable, 1);
+        List<PatrolInspectionContentOption> contentOptionList = contentOptionService.list(queryWrapperFive);
+
+        //重组内容选项
+        List<ContentOptionVo> contentOptionVoList = new ArrayList<>();
+        for (int i = 0; i < contentOptionList.size(); i++) {
+            ContentOptionVo contentOptionVo = new ContentOptionVo();
+            contentOptionVo.setId(contentOptionList.get(i).getId());
+            contentOptionVo.setContentId(contentOptionList.get(i).getContentId());
+            contentOptionVo.setOptionName(contentOptionList.get(i).getOptionName());
+            contentOptionVo.setEnable(contentOptionList.get(i).getEnable());
+            contentOptionVo.setCreator(contentOptionList.get(i).getCreator());
+            contentOptionVo.setCreateTime(contentOptionList.get(i).getCreateTime());
+            contentOptionVo.setSelectStatus(false);
+            for (int j = 0; j < patrolInspectionRecordOptionList.size(); j++) {
+                if (contentOptionList.get(i).getContentId() == patrolInspectionContentList.get(j).getId()) {
+                    contentOptionVo.setRemarks(patrolInspectionRecordOptionList.get(j).getRemarks());
+                }
+                if (contentOptionList.get(i).getId() == patrolInspectionRecordOptionList.get(j).getContentOptionId()) {
+                    contentOptionVo.setSelectStatus(true);
+                }
+            }
+            contentOptionVoList.add(contentOptionVo);
+        }
+
+        //重组内容
+        List<PatrolInspectionContentVo> patrolInspectionContentVoList = new ArrayList<>();
+        for (int i = 0; i < patrolInspectionContentList.size(); i++) {
+            PatrolInspectionContentVo patrolInspectionContentVo = new PatrolInspectionContentVo();
+            patrolInspectionContentVo.setId(patrolInspectionContentList.get(i).getId());
+            patrolInspectionContentVo.setContentTitle(patrolInspectionContentList.get(i).getContentTitle());
+            patrolInspectionContentVo.setContentDescribe(patrolInspectionContentList.get(i).getContentDescribe());
+            patrolInspectionContentVo.setSubmissionMethod(patrolInspectionContentList.get(i).getSubmissionMethod());
+            patrolInspectionContentVo.setTenantId(patrolInspectionContentList.get(i).getTenantId());
+            patrolInspectionContentVo.setCreateTime(patrolInspectionContentList.get(i).getCreateTime());
+            patrolInspectionContentVo.setCreator(patrolInspectionContentList.get(i).getCreator());
+            patrolInspectionContentVo.setEnable(patrolInspectionContentList.get(i).getEnable());
+            patrolInspectionContentVo.setCompanyId(patrolInspectionContentList.get(i).getCompanyId());
+            List<ContentOptionVo> contentOptionVoListOne = new ArrayList<>();
+
+            if (patrolInspectionContentList.get(i).getSubmissionMethod() == 3) {
+                for (int j = 0; j < patrolInspectionRecordOptionList.size(); j++) {
+                    if (patrolInspectionRecordOptionList.get(j).getContentOptionId() == null || patrolInspectionRecordOptionList.get(j).getContentOptionId() == 0) {
+                        int id11 = patrolInspectionContentList.get(i).getId();
+                        int id22 = patrolInspectionRecordOptionList.get(j).getContentId();
+                        if (id11 == id22) {
+                            if (patrolInspectionRecordOptionList.get(j).getRemarks() != null && !"".equals(patrolInspectionRecordOptionList.get(j).getRemarks())) {
+                                patrolInspectionContentVo.setRemarks(patrolInspectionRecordOptionList.get(j).getRemarks());
+                            }
+                            patrolInspectionContentVo.setContent(patrolInspectionRecordOptionList.get(j).getContent());
+                        }
+                    }
+                }
+            } else {
+                for (int j = 0; j < contentOptionVoList.size(); j++) {
+                    int id1 = patrolInspectionContentList.get(i).getId();
+                    int id2 = contentOptionVoList.get(j).getContentId();
+                    if (id1 == id2) {
+                        if (contentOptionVoList.get(j).getRemarks() != null && !"".equals(contentOptionVoList.get(j).getRemarks())) {
+                            patrolInspectionContentVo.setRemarks(contentOptionVoList.get(j).getRemarks());
+                        }
+                        contentOptionVoListOne.add(contentOptionVoList.get(j));
+                        patrolInspectionContentVo.setContentOptionVoList(contentOptionVoListOne);
+                    }
+                }
+            }
+
+            patrolInspectionContentVo.setContentOptionValue(contentOptionIdList);
+            patrolInspectionContentVoList.add(patrolInspectionContentVo);
+        }
+
+        //重组巡检记录
+        List<PatrolInspectionAbnormalVo> list = new ArrayList<>();
+        for (int i = 0; i < patrolInspectionRecordList.size(); i++) {
+            PatrolInspectionAbnormalVo patrolInspectionAbnormalVo = new PatrolInspectionAbnormalVo();
+            patrolInspectionAbnormalVo.setId(patrolInspectionRecordList.get(i).getId());
+            patrolInspectionAbnormalVo.setSiteNubmber(patrolInspectionRecordList.get(i).getSiteNubmber());
+            patrolInspectionAbnormalVo.setSiteType(patrolInspectionRecordList.get(i).getSiteType());
+            patrolInspectionAbnormalVo.setAreaName(patrolInspectionRecordList.get(i).getAreaName());
+            patrolInspectionAbnormalVo.setSiteName(patrolInspectionRecordList.get(i).getSiteName());
+            patrolInspectionAbnormalVo.setName(patrolInspectionRecordList.get(i).getName());
+            patrolInspectionAbnormalVo.setPhone(patrolInspectionRecordList.get(i).getPhone());
+            patrolInspectionAbnormalVo.setPlanType(patrolInspectionRecordList.get(i).getPlanType());
+            patrolInspectionAbnormalVo.setSiteStatus(patrolInspectionRecordList.get(i).getSiteStatus());
+            patrolInspectionAbnormalVo.setLongitude(patrolInspectionRecordList.get(i).getLongitude());
+            patrolInspectionAbnormalVo.setLatitude(patrolInspectionRecordList.get(i).getLatitude());
+            patrolInspectionAbnormalVo.setStartDate(patrolInspectionRecordList.get(i).getStartDate());
+            patrolInspectionAbnormalVo.setEndDate(patrolInspectionRecordList.get(i).getEndDate());
+            patrolInspectionAbnormalVo.setCreateTime(patrolInspectionRecordList.get(i).getCreateTime());
+            patrolInspectionAbnormalVo.setPlanId(patrolInspectionRecordList.get(i).getPlanId());
+            patrolInspectionAbnormalVo.setPlanSonId(patrolInspectionRecordList.get(i).getPlanSonId());
+            patrolInspectionAbnormalVo.setSiteId(patrolInspectionRecordList.get(i).getSiteId());
+            patrolInspectionAbnormalVo.setTenantId(patrolInspectionRecordList.get(i).getTenantId());
+            patrolInspectionAbnormalVo.setCompanyId(patrolInspectionRecordList.get(i).getCompanyId());
+            patrolInspectionAbnormalVo.setCreator(patrolInspectionRecordList.get(i).getCreator());
+            patrolInspectionAbnormalVo.setRemarks(patrolInspectionRecordList.get(i).getRemarks());
+            patrolInspectionAbnormalVo.setRecordPictureList(patrolInspectionRecordPictureList);
+            patrolInspectionAbnormalVo.setContentVoList(patrolInspectionContentVoList);
+            list.add(patrolInspectionAbnormalVo);
+        }
+        return list;
+    }
+}

+ 43 - 17
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -83,9 +83,9 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         }
 
         if (startTime != null) {
-            queryWrapper.between(endTime!=null,PatrolInspectionAttendance::getOperateDate, startTime, endTime);
-        }else {
-            queryWrapper.le(endTime!=null,PatrolInspectionAttendance::getOperateDate, endTime);
+            queryWrapper.between(endTime != null, PatrolInspectionAttendance::getOperateDate, startTime, endTime);
+        } else {
+            queryWrapper.le(endTime != null, PatrolInspectionAttendance::getOperateDate, endTime);
         }
 
         queryWrapper.orderByDesc(PatrolInspectionAttendance::getId);
@@ -125,7 +125,7 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
     @Override
     public void add(PatrolInspectionAttendance patrolInspectionAttendance) {
         LambdaQueryWrapper<PatrolInspectionPersonnel> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(PatrolInspectionPersonnel::getUserId,SecurityUtils.getUserId());
+        wrapper.eq(PatrolInspectionPersonnel::getUserId, SecurityUtils.getUserId());
         List<PatrolInspectionPersonnel> personnelList = patrolInspectionPersonnelMapper.selectList(wrapper);
         if (personnelList.isEmpty()) {
             throw new BusinessException("您不是巡检人员,不可进行此操作");
@@ -152,16 +152,16 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         String formattedTime = now.format(formatter);
         jsonObj.put("triggerTime", formattedTime);
         Integer eventCode = 17;
-        if(patrolInspectionAttendance.getSignInType().equals(0)){
-            eventCode=31;
-        }else {
-            eventCode=32;
+        if (patrolInspectionAttendance.getSignInType().equals(0)) {
+            eventCode = 31;
+        } else {
+            eventCode = 32;
         }
         jsonObj.put("eventType", eventCode);
         jsonObj.put("name", SecurityUtils.getUsername());
         jsonObj.put("certifiedNo", patrolInspectionAttendance.getIdentificationNumber());
 
-        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange,"",jsonObj.toJSONString());
+        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange, "", jsonObj.toJSONString());
 //        if (pushFlag.equals(1)){
 //            JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
 //        }
@@ -169,20 +169,46 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
 
     /**
      * 获取部门名
+     *
      * @param id
      * @return
      */
     @Override
-        public String getDeptName(Integer id) {
-            String name = "";
-            List<Map<String, Object>> deptList = remoteDeptService.getDeptList(SecurityUtils.getTenantId());
-            for (int i = 0; i < deptList.size(); i++) {
-                if (id.equals(deptList.get(i).get("dept_id"))){
-                    name = deptList.get(i).get("dept_name").toString();
-                }
+    public String getDeptName(Integer id) {
+        String name = "";
+        List<Map<String, Object>> deptList = remoteDeptService.getDeptList(SecurityUtils.getTenantId());
+        for (int i = 0; i < deptList.size(); i++) {
+            if (id.equals(deptList.get(i).get("dept_id"))) {
+                name = deptList.get(i).get("dept_name").toString();
             }
-            return name;
         }
+        return name;
+    }
+
+    public List<Map<String, Integer>> bodyCount() {
+        List<Map<String, Integer>> returnList = new ArrayList<>();
+        Map<String, Integer> signIn = new HashMap<>();
+        Map<String, Integer> signOut = new HashMap<>();
+        int countOut, countIn;
+        countOut = baseMapper.signOut(SecurityUtils.getTenantId());
+        countIn = baseMapper.signIn(SecurityUtils.getTenantId());
+        if (countOut != 0 && countIn == 0) {
+            signIn.put("signIn", 0);
+            signOut.put("signOut", countOut);
+        } else if (countOut == 0 && countIn != 0) {
+            signIn.put("signIn", countIn);
+            signOut.put("signOut", 0);
+        } else if (countOut == 0 && countIn == 0) {
+            signIn.put("signIn", 0);
+            signOut.put("signOut", 0);
+        }else {
+            signIn.put("signIn", countIn);
+            signOut.put("signOut", countOut);
+        }
+        returnList.add(signIn);
+        returnList.add(signOut);
+        return returnList;
+    }
 
 }
 

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

@@ -166,6 +166,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
         patrolInspectionPlan.setCompanyId(patrolInspectionPlanVo.getCompanyId());
         patrolInspectionPlan.setRestDay(patrolInspectionPlanVo.getRestDay());
         patrolInspectionPlan.setWeekCount(patrolInspectionPlanVo.getWeekCount());
+        patrolInspectionPlan.setRouteId(patrolInspectionPlanVo.getRouteId());//增加路线表主键id
         this.save(patrolInspectionPlan);
         Integer fid = patrolInspectionPlan.getId();
         //巡检日程添加
@@ -333,6 +334,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
         patrolInspectionPlan.setCompanyId(patrolInspectionPlanVo.getCompanyId());
         patrolInspectionPlan.setRestDay(patrolInspectionPlanVo.getRestDay());
         patrolInspectionPlan.setWeekCount(patrolInspectionPlanVo.getWeekCount());
+        patrolInspectionPlan.setRouteId((patrolInspectionPlanVo.getRouteId()));
         this.updateById(patrolInspectionPlan);
         //巡检日程更新
         LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
@@ -690,6 +692,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
             patrolInspectionPlanDataVo.setCompanyId(patrolInspectionPlanSonList.get(i).getCompanyId());
             patrolInspectionPlanDataVo.setRestDay(patrolInspectionPlanSonList.get(i).getRestDay());
             patrolInspectionPlanDataVo.setWeekCount(patrolInspectionPlanSonList.get(i).getWeekCount());
+            patrolInspectionPlanDataVo.setRouteId(patrolInspectionPlanSonList.get(i).getRouteId());
             if (planType == 1) {
                 List<PlanScheduleVo> list2 = new ArrayList<>();
                 for (int j = 0; j < list.size(); j++) {

+ 15 - 6
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -12,6 +12,7 @@ import com.usky.fire.domain.*;
 import com.usky.fire.mapper.PatrolInspectionPlanMapper;
 import com.usky.fire.mapper.PatrolInspectionPlanSonMapper;
 import com.usky.fire.mapper.PatrolInspectionRecordMapper;
+import com.usky.fire.mapper.PatrolInspectionSiteMapper;
 import com.usky.fire.service.*;
 import com.usky.fire.service.util.OnlineMethod;
 import com.usky.fire.service.vo.*;
@@ -73,6 +74,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     @Autowired
     private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
 
+    @Autowired
+    private PatrolInspectionSiteMapper patrolInspectionSiteMapper;
+
     @Override
     public Map<String, Object> appPlanStatistics(String currentDate) {
         Integer planSonCount = 0;
@@ -240,18 +244,17 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             throw new BusinessException("计划不存在,可能已被删除,请联系管理人员");
         }
         /*
-        * 巡检时间判断
-        * */
+         * 巡检时间判断
+         * */
         LocalDateTime now = LocalDateTime.now();
-        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         if (inspectionDateTime.isAfter(now)) {
             throw new BusinessException("计划未开始,不可巡检");
-        } else if (now.isAfter(inspectionDateTime1)){
+        } else if (now.isAfter(inspectionDateTime1)) {
             throw new BusinessException("巡检时间已过,请联系管理员");
         }
 
-
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
         queryWrapperOne.select(PatrolInspectionArea::getId, PatrolInspectionArea::getAreaName)
                 .eq(PatrolInspectionArea::getId, planSonList.get(0).getAreaId());
@@ -290,6 +293,12 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         patrolInspectionRecord.setCompanyId(planRecordVo.getCompanyId());
         patrolInspectionRecord.setCreator(SecurityUtils.getUsername());
         patrolInspectionRecord.setRemarks(planRecordVo.getRemarks());
+        //从主计划表中查找路线id放入记录表中
+        LambdaQueryWrapper<PatrolInspectionPlan> planLambdaQueryWrapper = Wrappers.lambdaQuery();
+        planLambdaQueryWrapper.select(PatrolInspectionPlan::getRouteId)
+                .eq(PatrolInspectionPlan::getId, planRecordVo.getPlanId());
+        Integer routeId = patrolInspectionPlanMapper.selectOne(planLambdaQueryWrapper).getRouteId();
+        patrolInspectionRecord.setRouteId(routeId);
         patrolInspectionRecordMapper.insert(patrolInspectionRecord);
         Integer recordId = patrolInspectionRecord.getId();
         List<PatrolInspectionRecordPicture> recordPictureList = planRecordVo.getRecordPictureList();

+ 20 - 294
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java

@@ -86,7 +86,8 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
 
     @Override
     public CommonPage<PatrolInspectionRecord> patrolInspectionRecordLsit(String areaName, String siteName, String name,
-                                                                         Integer planType, String startDateTime, String endDateTime,
+                                                                         Integer planType, Integer routeId,
+                                                                         String startDateTime, String endDateTime,
                                                                          Integer pageNum, Integer pageSize) {
         IPage<PatrolInspectionRecord> page = new Page<>(pageNum, pageSize);
         LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -100,6 +101,7 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
                 .like(StringUtils.isNotBlank(siteName), PatrolInspectionRecord::getSiteName, siteName)
                 .like(StringUtils.isNotBlank(name), PatrolInspectionRecord::getName, name)
                 .eq(planType != null && planType != 0, PatrolInspectionRecord::getPlanType, planType)
+                .eq(routeId != null, PatrolInspectionRecord::getRouteId, routeId)
                 .between(StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime), PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime)
                 .eq("00".equals(userType), PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
         queryWrapper.orderByDesc(PatrolInspectionRecord::getId);
@@ -108,11 +110,6 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     }
 
 
-//    public List<PatrolInspectionPlan> getPatrolInspectionPlan(){
-//        LambdaQueryWrapper<PatrolInspectionRecord> queryWrapper = Wrappers.lambdaQuery();
-//        queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId());
-//    }
-
     @Override
     public List<PatrolInspectionRecordVo> patrolInspectionRecordDetails(Integer id) {
         //记录查询
@@ -428,6 +425,17 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
         return list;
     }
 
+    /**
+     * 导出巡检记录
+     * @param areaName
+     * @param siteName
+     * @param name
+     * @param planType
+     * @param startDateTime
+     * @param endDateTime
+     * @param idList
+     * @return
+     */
     @Override
     public List<PatrolInspectionRecordExportVo> exportImage(String areaName, String siteName, String name,
                                                             Integer planType, String startDateTime,
@@ -452,7 +460,7 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
             for (int i = 0; i < idArray.length; i++) {
                 listId.add(Integer.parseInt(idArray[i]));
             }
-            if (!listId.isEmpty()){
+            if (!listId.isEmpty()) {
                 queryWrapper.in(PatrolInspectionRecord::getId, listId);
             }
         }
@@ -515,287 +523,6 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     }
 
 
-    /*public void exportImage(HttpServletResponse response, String areaName, String siteName, String name, Integer planType,
-                            String startDateTime, String endDateTime, String idList) throws IOException {
-        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        LoginUser loginUser = SecurityUtils.getLoginUser();
-        String userType = null;
-        if (loginUser != null && !"".equals(loginUser)) {
-            userType = loginUser.getUserType();
-        }
-        LambdaQueryWrapper<PatrolInspectionRecord> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId())
-                .like(StringUtils.isNotBlank(areaName), PatrolInspectionRecord::getAreaName, areaName)
-                .like(StringUtils.isNotBlank(siteName), PatrolInspectionRecord::getSiteName, siteName)
-                .like(StringUtils.isNotBlank(name), PatrolInspectionRecord::getName, name)
-                .eq(planType != null && planType != 0, PatrolInspectionRecord::getPlanType, planType)
-                .between(StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime), PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime)
-                .eq("00".equals(userType), PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
-        if (StringUtils.isNotBlank(idList)) {
-            List<Integer> listId = new ArrayList<>();
-            String[] idArray = idList.split(",");
-            for (int i = 0; i < idArray.length; i++) {
-                listId.add(Integer.parseInt(idArray[i]));
-            }
-            queryWrapper.in(PatrolInspectionRecord::getId, listId);
-        }
-        queryWrapper.orderByDesc(PatrolInspectionRecord::getId);
-        List<PatrolInspectionRecord> patrolInspectionRecordList = this.list(queryWrapper);
-        List<PatrolInspectionRecordExportVo> list = new ArrayList<>();
-        for (int i = 0; i < patrolInspectionRecordList.size(); i++) {
-            PatrolInspectionRecordExportVo patrolInspectionRecordExportVo = new PatrolInspectionRecordExportVo();
-            patrolInspectionRecordExportVo.setXh(i + 1);
-            patrolInspectionRecordExportVo.setId(patrolInspectionRecordList.get(i).getId());
-            patrolInspectionRecordExportVo.setSiteNubmber(patrolInspectionRecordList.get(i).getSiteNubmber());
-            patrolInspectionRecordExportVo.setSiteType(patrolInspectionRecordList.get(i).getSiteType());
-            patrolInspectionRecordExportVo.setAreaName(patrolInspectionRecordList.get(i).getAreaName());
-            patrolInspectionRecordExportVo.setSiteName(patrolInspectionRecordList.get(i).getSiteName());
-            patrolInspectionRecordExportVo.setName(patrolInspectionRecordList.get(i).getName());
-            patrolInspectionRecordExportVo.setPhone(patrolInspectionRecordList.get(i).getPhone());
-            patrolInspectionRecordExportVo.setPlanType(patrolInspectionRecordList.get(i).getPlanType());
-            patrolInspectionRecordExportVo.setLongitude(patrolInspectionRecordList.get(i).getLongitude());
-            patrolInspectionRecordExportVo.setLatitude(patrolInspectionRecordList.get(i).getLatitude());
-            patrolInspectionRecordExportVo.setStartDate(patrolInspectionRecordList.get(i).getStartDate().format(df));
-            patrolInspectionRecordExportVo.setEndDate(patrolInspectionRecordList.get(i).getEndDate().format(df));
-            patrolInspectionRecordExportVo.setCreateTime(patrolInspectionRecordList.get(i).getCreateTime().format(df));
-            LambdaQueryWrapper<PatrolInspectionRecordPicture> queryWrapperJpg = Wrappers.lambdaQuery();//导出图片
-            queryWrapperJpg.select(PatrolInspectionRecordPicture::getPictureUrl)
-                    .eq(PatrolInspectionRecordPicture::getRecordId, patrolInspectionRecordList.get(i).getId());
-            List<PatrolInspectionRecordPicture> pictures = orphansInspectionRecordPictureMapper.selectList(queryWrapperJpg);
-            if (pictures.size() > 0) {
-                for (int j = 0; j < pictures.size() && j < 5; j++) {
-                    String pictureUrl = pictures.get(j).getPictureUrl();
-                    switch (j) {
-                        case 0:
-                            patrolInspectionRecordExportVo.setImagePath1(pictureUrl);
-                            break;
-                        case 1:
-                            patrolInspectionRecordExportVo.setImagePath2(pictureUrl);
-                            break;
-                        case 2:
-                            patrolInspectionRecordExportVo.setImagePath3(pictureUrl);
-                            break;
-                        case 3:
-                            patrolInspectionRecordExportVo.setImagePath4(pictureUrl);
-                            break;
-                        case 4:
-                            patrolInspectionRecordExportVo.setImagePath5(pictureUrl);
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            }
-            list.add(patrolInspectionRecordExportVo);
-        }
-        XSSFWorkbook workbook = new XSSFWorkbook();
-        XSSFSheet sheet = workbook.createSheet("巡检记录");
-        // 添加列标题行
-        Row headerRow = sheet.createRow(1);
-        String[] headers = {
-                "序号", "地点号码", "地点类型", "区域名称", "地点名称", "巡检人员", "联系电话",
-                "计划类型", "经度", "纬度", "开始时间", "结束时间", "巡检时间", "巡检照片1",
-                "巡检照片2", "巡检照片3", "巡检照片4", "巡检照片5"
-        };
-        // 添加总标题行
-        Row titleRow = sheet.createRow(0);
-        Cell titleCell = titleRow.createCell(0);
-        titleCell.setCellValue("巡检记录");
-        CellStyle titleCellStyle = workbook.createCellStyle();
-        // 设置字体为黑色加粗
-        Font titleFont = workbook.createFont();
-        titleFont.setFontName("宋体");
-        titleFont.setFontHeightInPoints((short) 16);
-        titleFont.setColor(IndexedColors.BLACK.getIndex());
-        titleFont.setBold(true);
-        titleCellStyle.setFont(titleFont);
-        // 设置水平居中和垂直居中
-        titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        titleCell.setCellStyle(titleCellStyle);
-        titleRow.setHeightInPoints(30);
-        // 合并标题单元格以横跨所有列
-        int totalColumns = headers.length;
-        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, totalColumns - 1));
-        //设置列标题
-        for (int i = 0; i < headers.length; i++) {
-            Cell cell = headerRow.createCell(i);
-            cell.setCellValue(headers[i]);
-            CellStyle headerCellStyle = workbook.createCellStyle();
-            headerCellStyle.setAlignment(HorizontalAlignment.CENTER);
-            headerCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-            headerCellStyle.setBorderBottom(BorderStyle.THIN);
-            headerCellStyle.setBorderTop(BorderStyle.THIN);
-            headerCellStyle.setBorderLeft(BorderStyle.THIN);
-            headerCellStyle.setBorderRight(BorderStyle.THIN);
-            // 设置背景颜色为灰色
-            headerCellStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
-            headerCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-            // 设置字体为白色
-            Font headerFont = workbook.createFont();
-            headerFont.setFontName("宋体");
-            headerFont.setFontHeightInPoints((short) 10);
-            headerFont.setColor(IndexedColors.WHITE.getIndex());
-            headerFont.setBold(true);
-            headerRow.setHeightInPoints(13.5f);
-            headerCellStyle.setFont(headerFont);
-            cell.setCellStyle(headerCellStyle);
-        }
-
-        Row fixedRow = sheet.createRow(list.size() + 3); // 数据行数 + 标题行数(1) + 固定行(1) + 空一行
-        CellStyle fixedCellStyle = workbook.createCellStyle();
-
-        // 创建字体样式
-        Font fixedFont = workbook.createFont();
-        fixedFont.setFontName("宋体");
-        fixedFont.setBold(true);
-        fixedFont.setFontHeightInPoints((short) 12);
-        fixedCellStyle.setFont(fixedFont);
-
-        // 创建“负责人签名”单元格
-        Cell cellSign = fixedRow.createCell(0);
-        cellSign.setCellValue("负责人签名:");
-        cellSign.setCellStyle(fixedCellStyle);
-
-        // 创建“日期”单元格
-        Cell cellDate = fixedRow.createCell(4); // 假设日期单元格在第五列
-        cellDate.setCellValue("日期:");
-        cellDate.setCellStyle(fixedCellStyle);
-
-        // 合并单元格
-//        sheet.addMergedRegion(new CellRangeAddress(list.size() + 2, list.size() + 2, 0, 0)); // 负责人签名
-//        sheet.addMergedRegion(new CellRangeAddress(list.size() + 2, list.size() + 2, 4, 4)); // 日期
-
-        // 设置固定行的高度
-        fixedRow.setHeightInPoints(20);
-
-        // 设置数据行样式
-        CellStyle dataCellStyle = workbook.createCellStyle();
-        Font dataFont = workbook.createFont();
-        dataFont.setFontName("Arial");
-        dataFont.setFontHeightInPoints((short) 10);
-        dataCellStyle.setFont(dataFont);
-        dataCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        dataCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        dataCellStyle.setBorderBottom(BorderStyle.THIN);
-        dataCellStyle.setBorderTop(BorderStyle.THIN);
-        dataCellStyle.setBorderLeft(BorderStyle.THIN);
-        dataCellStyle.setBorderRight(BorderStyle.THIN);
-        // 添加数据
-        for (int i = 0; i < list.size(); i++) {
-            PatrolInspectionRecordExportVo record = list.get(i);
-            Row row = sheet.createRow(i + 2);
-
-            for (int j = 0; j < headers.length; j++) {
-                Cell cell = row.createCell(j);
-                cell.setCellStyle(dataCellStyle);
-
-                // 根据 j 变量来确定应该填充数据的单元格索引
-                switch (j) {
-                    case 0:
-                        cell.setCellValue(record.getXh());
-                        break;
-                    case 1:
-                        cell.setCellValue(record.getSiteNubmber());
-                        break;
-                    case 2:
-                        cell.setCellValue(record.getSiteType() == 1 ? "二维码" : "NFC");
-                        break;
-                    case 3:
-                        cell.setCellValue(record.getAreaName());
-                        break;
-                    case 4:
-                        cell.setCellValue(record.getSiteName());
-                        break;
-                    case 5:
-                        cell.setCellValue(record.getName());
-                        break;
-                    case 6:
-                        cell.setCellValue(record.getPhone());
-                        break;
-                    case 7:
-                        cell.setCellValue(record.getPlanType() == 1 ? "普通计划" : "按次计划");
-                        break;
-                    case 8:
-                        cell.setCellValue(record.getLongitude());
-                        break;
-                    case 9:
-                        cell.setCellValue(record.getLatitude());
-                        break;
-                    case 10:
-                        cell.setCellValue(record.getStartDate());
-                        break;
-                    case 11:
-                        cell.setCellValue(record.getEndDate());
-                        break;
-                    case 12:
-                        cell.setCellValue(record.getCreateTime());
-                        break;
-                    default:
-                        break;
-                }
-                CreationHelper helper = workbook.getCreationHelper();
-                Drawing<?> drawing = sheet.createDrawingPatriarch();
-                ClientAnchor anchor;
-                if (record.getImagePath1() != null || record.getImagePath2() != null
-                        || record.getImagePath3() != null || record.getImagePath4() != null || record.getImagePath5() != null) {
-                    for (int k = 0; k < 5; k++) {
-                        String imagePath = null;
-                        switch (k) {
-                            case 0:
-                                imagePath = record.getImagePath1();
-                                break;
-                            case 1:
-                                imagePath = record.getImagePath2();
-                                break;
-                            case 2:
-                                imagePath = record.getImagePath3();
-                                break;
-                            case 3:
-                                imagePath = record.getImagePath4();
-                                break;
-                            case 4:
-                                imagePath = record.getImagePath5();
-                                break;
-                        }
-
-                        if (imagePath != null) {
-                            byte[] imageBytes = getImageBytes(imagePath);
-                            int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_JPEG);
-
-                            anchor = helper.createClientAnchor();
-                            anchor.setCol1(headers.length - 5 + k);
-                            anchor.setRow1(i + 2);
-
-                            Picture pict = drawing.createPicture(anchor, pictureIdx);
-                            pict.resize(1, 1);
-                        }
-                    }
-                }
-            }
-
-        }
-
-        for (int i = 0; i < headers.length; i++) {
-            sheet.setColumnWidth(i, (int) (16.09 * 256));
-        }
-
-        // 输出Excel文件
-        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
-        response.setHeader("Content-Disposition", "attachment; filename=巡检记录.xlsx");
-        workbook.write(response.getOutputStream());
-        workbook.close();
-    }
-
-    //处理图片
-    public byte[] getImageBytes(String imageUrl) throws IOException {
-        URL url = new URL(imageUrl);
-        BufferedImage image = ImageIO.read(url);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ImageIO.write(image, "jpg", baos);
-        return baos.toByteArray();
-    }*/
-
     /**
      * 获取内容选项备注
      *
@@ -914,18 +641,18 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
         List<Integer> list = getContentOptionId(recordId);
         System.out.println(list);
         LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper1 = Wrappers.lambdaQuery();
-        queryWrapper1.eq(PatrolInspectionRecordOption::getRecordId,recordId)
-                .in(PatrolInspectionRecordOption::getContentId,list)
+        queryWrapper1.eq(PatrolInspectionRecordOption::getRecordId, recordId)
+                .in(PatrolInspectionRecordOption::getContentId, list)
                 .orderByAsc(PatrolInspectionRecordOption::getId);
         List<PatrolInspectionRecordOption> list2 = patrolInspectionRecordOptionMapper.selectList(queryWrapper1);
         List<String> optionNameList = new ArrayList<>();
         for (int i = 0; i < list2.size(); i++) {
-            if (list2.get(i).getContentOptionId() == null || " ".equals(list2.get(i).getContentOptionId())){
+            if (list2.get(i).getContentOptionId() == null || " ".equals(list2.get(i).getContentOptionId())) {
                 optionNameList.add(list2.get(i).getContent());
-            }else {
+            } else {
                 LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapper2 = Wrappers.lambdaQuery();
                 queryWrapper2.select(PatrolInspectionContentOption::getOptionName)
-                        .eq(PatrolInspectionContentOption::getId,list2.get(i).getContentOptionId())
+                        .eq(PatrolInspectionContentOption::getId, list2.get(i).getContentOptionId())
                         .orderByAsc(PatrolInspectionContentOption::getId);
                 PatrolInspectionContentOption optionName1 = patrolInspectionContentOptionMapper.selectOne(queryWrapper2);
                 optionNameList.add(optionName1.getOptionName());
@@ -935,5 +662,4 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     }
 
 
-
 }

+ 33 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRouteServiceImpl.java

@@ -0,0 +1,33 @@
+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.security.utils.SecurityUtils;
+import com.usky.fire.domain.PatrolInspectionRoute;
+import com.usky.fire.mapper.PatrolInspectionRouteMapper;
+import com.usky.fire.service.PatrolInspectionRouteService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-06-13
+ */
+@Service
+public class PatrolInspectionRouteServiceImpl extends AbstractCrudService<PatrolInspectionRouteMapper, PatrolInspectionRoute> implements PatrolInspectionRouteService {
+
+    @Override
+    public List<PatrolInspectionRoute> routeList() {
+        LambdaQueryWrapper<PatrolInspectionRoute> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(PatrolInspectionRoute::getId, PatrolInspectionRoute::getRouteName)
+                .eq(PatrolInspectionRoute::getTenantId, SecurityUtils.getTenantId());
+        List<PatrolInspectionRoute> routeList = this.list(queryWrapper);
+        return routeList;
+    }
+}

+ 153 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionAbnormalVo.java

@@ -0,0 +1,153 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.usky.fire.domain.PatrolInspectionAbnormal;
+import com.usky.fire.domain.PatrolInspectionAbnormalPicture;
+import com.usky.fire.domain.PatrolInspectionRecordPicture;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @description:TODO
+ * @author: fu
+ * @create: 2024-06-14 16:59
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionAbnormalVo implements Serializable {
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检记录表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 地点号码
+     */
+    private String siteNubmber;
+
+    /**
+     * 地点类型
+     */
+    private Integer siteType;
+
+    /**
+     * 区域名称
+     */
+    private String areaName;
+
+    /**
+     * 地点名称
+     */
+    private String siteName;
+
+    /**
+     * 巡检人员
+     */
+    private String name;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 计划类型(1 普通计划,2 按次计划)
+     */
+    private Integer planType;
+
+    /**
+     * 定位 (0:未定位 1:已定位)
+     */
+    private Integer siteStatus;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 开始时间
+     */
+    private LocalDateTime startDate;
+
+    /**
+     * 结束时间
+     */
+    private LocalDateTime endDate;
+
+    /**
+     * 创建时间/巡检时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 巡检计划主表ID
+     */
+    private Integer planId;
+
+    /**
+     * 巡检计划子表ID
+     */
+    private Integer planSonId;
+
+    /**
+     * 巡检地点ID
+     */
+    private Integer siteId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 用户名
+     */
+    private String creator;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 图片路径
+     */
+    private List<PatrolInspectionAbnormalPicture> recordPictureList;
+
+    /**
+     * 内容数据
+     */
+    private List<PatrolInspectionContentVo> contentVoList;
+
+    /**
+     * 检查项数量
+     */
+    private Integer contentCount;
+
+    /**
+     * 图片地址
+     */
+    private String pictureUrl;
+}
+

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

@@ -132,5 +132,10 @@ public class PatrolInspectionPlanDataVo implements Serializable {
      */
     private Integer personneId;
 
+    /**
+     * 路线表主键id
+     */
+    private Integer routeId;
+
 
 }

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

@@ -128,5 +128,10 @@ public class PatrolInspectionPlanVo implements Serializable {
      */
     private List<PatrolInspectionPlanSchedule> planScheduleList;
 
+    /**
+     * 路线表主键id
+     */
+    private Integer routeId;
+
 
 }

+ 32 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalMapper.xml

@@ -0,0 +1,32 @@
+<?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.PatrolInspectionAbnormalMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionAbnormal">
+        <id column="id" property="id" />
+        <result column="site_nubmber" property="siteNubmber" />
+        <result column="site_type" property="siteType" />
+        <result column="area_name" property="areaName" />
+        <result column="site_name" property="siteName" />
+        <result column="name" property="name" />
+        <result column="phone" property="phone" />
+        <result column="plan_type" property="planType" />
+        <result column="site_status" property="siteStatus" />
+        <result column="longitude" property="longitude" />
+        <result column="latitude" property="latitude" />
+        <result column="start_date" property="startDate" />
+        <result column="end_date" property="endDate" />
+        <result column="create_time" property="createTime" />
+        <result column="plan_id" property="planId" />
+        <result column="plan_son_id" property="planSonId" />
+        <result column="site_id" property="siteId" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="company_id" property="companyId" />
+        <result column="creator" property="creator" />
+        <result column="remarks" property="remarks" />
+        <result column="route_id" property="routeId" />
+        <result column="abnormal_status" property="abnormalStatus" />
+    </resultMap>
+
+</mapper>

+ 15 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalOptionMapper.xml

@@ -0,0 +1,15 @@
+<?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.PatrolInspectionAbnormalOptionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionAbnormalOption">
+        <id column="id" property="id" />
+        <result column="record_id" property="recordId" />
+        <result column="content_option_id" property="contentOptionId" />
+        <result column="remarks" property="remarks" />
+        <result column="content" property="content" />
+        <result column="content_id" property="contentId" />
+    </resultMap>
+
+</mapper>

+ 12 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAbnormalPictureMapper.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.PatrolInspectionAbnormalPictureMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionAbnormalPicture">
+        <id column="id" property="id" />
+        <result column="record_id" property="recordId" />
+        <result column="picture_url" property="pictureUrl" />
+    </resultMap>
+
+</mapper>

+ 42 - 14
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAttendanceMapper.xml

@@ -4,20 +4,48 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionAttendance">
-        <id column="id" property="id" />
-        <result column="dept_id" property="deptId" />
-        <result column="tenant_id" property="tenantId" />
-        <result column="operator" property="operator" />
-        <result column="operator_id" property="operatorId" />
-        <result column="operate_date" property="operateDate" />
-        <result column="operate_type" property="operateType" />
-        <result column="type_id" property="typeId" />
-        <result column="device_code" property="deviceCode" />
-        <result column="image_path" property="imagePath" />
-        <result column="longitude" property="longitude" />
-        <result column="latitude" property="latitude" />
-        <result column="remarks" property="remarks" />
-        <result column="identification_number" property="identificationNumber" />
+        <id column="id" property="id"/>
+        <result column="dept_id" property="deptId"/>
+        <result column="tenant_id" property="tenantId"/>
+        <result column="operator" property="operator"/>
+        <result column="operator_id" property="operatorId"/>
+        <result column="operate_date" property="operateDate"/>
+        <result column="sign_in_type" property="signInType"/>
+        <result column="operate_code" property="operateCode"/>
+        <result column="device_code" property="deviceCode"/>
+        <result column="image_path" property="imagePath"/>
+        <result column="longitude" property="longitude"/>
+        <result column="latitude" property="latitude"/>
+        <result column="remarks" property="remarks"/>
+        <result column="identification_number" property="identificationNumber"/>
     </resultMap>
 
+    <select id="signIn" resultType="java.lang.Integer">
+    SELECT COUNT(*) AS total_sign_outs
+    FROM (
+        SELECT a.operator_id
+        FROM patrol_inspection_attendance a
+        INNER JOIN (
+            SELECT operator_id, MAX(operate_date) AS latest_date
+            FROM patrol_inspection_attendance
+            GROUP BY operator_id
+        ) b ON a.operator_id = b.operator_id AND a.operate_date = b.latest_date
+        WHERE a.sign_in_type = 0 AND tenant_id = #{tenantId}
+    ) c;
+</select>
+
+    <select id="signOut" resultType="java.lang.Integer">
+    SELECT COUNT(*) AS total_sign_outs
+    FROM (
+        SELECT a.operator_id
+        FROM patrol_inspection_attendance a
+        INNER JOIN (
+            SELECT operator_id, MAX(operate_date) AS latest_date
+            FROM patrol_inspection_attendance
+            GROUP BY operator_id
+        ) b ON a.operator_id = b.operator_id AND a.operate_date = b.latest_date
+        WHERE a.sign_in_type = 1 AND tenant_id = #{tenantId}
+    ) c;
+</select>
+
 </mapper>

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

@@ -22,6 +22,7 @@
         <result column="company_id" property="companyId"/>
         <result column="rest_day" property="restDay"/>
         <result column="week_count" property="weekCount"/>
+        <result column="route_id" property="routeId" />
     </resultMap>
     <select id="planSiteCount" resultType="int">
         SELECT

+ 1 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionRecordMapper.xml

@@ -24,6 +24,7 @@
         <result column="tenant_id" property="tenantId" />
         <result column="company_id" property="companyId" />
         <result column="remarks" property="remarks" />
+        <result column="route_id" property="routeId" />
     </resultMap>
 
 </mapper>

+ 18 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionRouteMapper.xml

@@ -0,0 +1,18 @@
+<?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.PatrolInspectionRouteMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionRoute">
+        <id column="id" property="id" />
+        <result column="route_name" property="routeName" />
+        <result column="site_ids" property="siteIds" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="create_by" property="createBy" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+    </resultMap>
+
+</mapper>