Jelajahi Sumber

巡检内容模块相关接口开发

jichaobo 2 tahun lalu
induk
melakukan
63a3248369
24 mengubah file dengan 855 tambahan dan 16 penghapusan
  1. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java
  2. 22 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/ContentOptionController.java
  3. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAreaController.java
  4. 78 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionContentController.java
  5. 45 7
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionSiteController.java
  6. 22 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/SiteContentController.java
  7. 58 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/ContentOption.java
  8. 73 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionContent.java
  9. 42 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/SiteContent.java
  10. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/ContentOptionMapper.java
  11. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionContentMapper.java
  12. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/SiteContentMapper.java
  13. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/ContentOptionService.java
  14. 25 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionContentService.java
  15. 5 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionSiteService.java
  16. 16 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/SiteContentService.java
  17. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/ContentOptionServiceImpl.java
  18. 188 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionContentServiceImpl.java
  19. 49 7
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionSiteServiceImpl.java
  20. 20 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/SiteContentServiceImpl.java
  21. 81 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionContentVo.java
  22. 15 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/ContentOptionMapper.xml
  23. 18 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionContentMapper.xml
  24. 12 0
      service-fire/service-fire-biz/src/main/resources/mapper.fire/SiteContentMapper.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("patrol_inspection_site");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("site_content");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

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

@@ -0,0 +1,22 @@
+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 {
+
+}
+

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

@@ -72,7 +72,7 @@ public class PatrolInspectionAreaController {
      */
     @GetMapping("patrolInspectionAreaList")
     public ApiResult<List<PatrolInspectionArea>> patrolInspectionAreaList(@RequestParam(value = "areaName", required = false) String areaName,
-                                                             @RequestParam(value = "pageNum", required = false, defaultValue = "0") Integer pageNum,
+                                                             @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(patrolInspectionAreaService.patrolInspectionAreaList(id, areaName, pageNum, pageSize));

+ 78 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionContentController.java

@@ -0,0 +1,78 @@
+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.PatrolInspectionContentService;
+import com.usky.fire.service.vo.PatrolInspectionContentVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 巡查自检-巡检内容
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@RestController
+@RequestMapping("/patrolInspectionContent")
+public class PatrolInspectionContentController {
+
+    @Autowired
+    private PatrolInspectionContentService patrolInspectionContentService;
+
+    /**
+     * 巡查自检-巡检内容-列表查询
+     *
+     * @param contentTitle 内容标题
+     * @param pageNum      当前页
+     * @param pageSize     每页条数
+     * @param id           巡检内容ID
+     * @return
+     */
+    @GetMapping("patrolInspectionContentList")
+    public ApiResult<CommonPage<PatrolInspectionContentVo>> patrolInspectionContentList(@RequestParam(value = "contentTitle", required = false) String contentTitle,
+                                                                                        @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(patrolInspectionContentService.patrolInspectionContentList(contentTitle, pageNum, pageSize, id));
+    }
+
+    /**
+     * 巡查自检-巡检内容-新增
+     *
+     * @param patrolInspectionContentVo
+     * @return
+     */
+    @PostMapping("addPatrolInspectionContent")
+    public ApiResult<Void> addPatrolInspectionContent(@RequestBody PatrolInspectionContentVo patrolInspectionContentVo) {
+        patrolInspectionContentService.addPatrolInspectionContent(patrolInspectionContentVo);
+        return ApiResult.success();
+    }
+
+    /**
+     * 巡查自检-巡检内容-修改
+     *
+     * @param patrolInspectionContentVo
+     * @return
+     */
+    @PostMapping("updatePatrolInspectionContent")
+    public ApiResult<Void> updatePatrolInspectionContent(@RequestBody PatrolInspectionContentVo patrolInspectionContentVo) {
+        patrolInspectionContentService.updatePatrolInspectionContent(patrolInspectionContentVo);
+        return ApiResult.success();
+    }
+
+    /**
+     * 巡查自检-巡检内容-删除
+     *
+     * @param id 巡检内容ID
+     * @return
+     */
+    @GetMapping("delPatrolInspectionContent")
+    public ApiResult<Void> delPatrolInspectionContent(@RequestParam(value = "id") Integer id) {
+        patrolInspectionContentService.delPatrolInspectionContent(id);
+        return ApiResult.success();
+    }
+
+}
+

+ 45 - 7
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionSiteController.java

@@ -3,17 +3,20 @@ 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.PatrolInspectionArea;
 import com.usky.fire.domain.PatrolInspectionSite;
+import com.usky.fire.domain.SiteContent;
+import com.usky.fire.service.PatrolInspectionContentService;
 import com.usky.fire.service.PatrolInspectionSiteService;
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
- *巡查自检-巡检地点
+ * 巡查自检-巡检地点
  *
  * @author JCB
  * @since 2022-07-13
@@ -24,6 +27,8 @@ public class PatrolInspectionSiteController {
 
     @Autowired
     private PatrolInspectionSiteService patrolInspectionSiteService;
+    @Autowired
+    private PatrolInspectionContentService patrolInspectionContentService;
 
 
     /**
@@ -39,17 +44,18 @@ public class PatrolInspectionSiteController {
 
     /**
      * 巡查自检-巡检地点-巡检列表
-     * @param areaId 区域id
+     *
+     * @param areaId   区域id
      * @param siteName 地点名称
-     * @param pageNum 当前页
+     * @param pageNum  当前页
      * @param pageSize 每页条数
-     * @param id 巡检地点ID
+     * @param id       巡检地点ID
      * @return
      */
     @GetMapping("patrolInspectionSiteList")
     public ApiResult<CommonPage<PatrolInspectionSite>> patrolInspectionSiteList(@RequestParam(value = "areaId", required = false) Integer areaId,
                                                                                 @RequestParam(value = "siteName", required = false) String siteName,
-                                                                                @RequestParam(value = "pageNum", required = false, defaultValue = "0") Integer pageNum,
+                                                                                @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(patrolInspectionSiteService.patrolInspectionSiteList(areaId, siteName, pageNum, pageSize, id));
@@ -57,6 +63,7 @@ public class PatrolInspectionSiteController {
 
     /**
      * 巡查自检-巡检地点-添加地点-保存
+     *
      * @param PatrolInspectionSiteList
      * @return
      */
@@ -67,7 +74,8 @@ public class PatrolInspectionSiteController {
     }
 
     /**
-     *  巡查自检-巡检地点-编辑
+     * 巡查自检-巡检地点-编辑
+     *
      * @param PatrolInspectionSite
      * @return
      */
@@ -79,6 +87,7 @@ public class PatrolInspectionSiteController {
 
     /**
      * 巡查自检-巡检地点-删除
+     *
      * @param id 巡检地点ID
      * @return
      */
@@ -88,5 +97,34 @@ public class PatrolInspectionSiteController {
         return ApiResult.success();
     }
 
+
+    /**
+     * 巡查自检-巡检地点-分配内容-列表查询
+     * @param pageNum 当前页
+     * @param pageSize 每页条数
+     * @param siteId 巡检地点ID
+     * @return
+     */
+    @GetMapping("siteContentList")
+    public ApiResult<Map<String, Object>> siteContentList(@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+                                                          @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
+                                                          @RequestParam(value = "siteId") Integer siteId) {
+        Map<String, Object> ajax = new HashMap<>();
+        ajax.put("checkedKeys", patrolInspectionSiteService.siteContentList(siteId));
+        ajax.put("InspectionContent", patrolInspectionContentService.patrolInspectionContentList(null, pageNum, pageSize, 0));
+        return ApiResult.success(ajax);
+    }
+
+    /**
+     * 巡查自检-巡检地点-分配内容-保存
+     * @param siteContentList
+     * @return
+     */
+    @PostMapping("addSiteContent")
+    public ApiResult<Void> addSiteContent(@RequestBody List<SiteContent> siteContentList) {
+        patrolInspectionSiteService.addSiteContent(siteContentList);
+        return ApiResult.success();
+    }
+
 }
 

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

@@ -0,0 +1,22 @@
+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 {
+
+}
+

+ 58 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/ContentOption.java

@@ -0,0 +1,58 @@
+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;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ContentOption implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 内容选项信息表ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 内容标题
+     */
+    private String optionName;
+
+    /**
+     * 内容ID
+     */
+    private Integer contentId;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+
+}

+ 73 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionContent.java

@@ -0,0 +1,73 @@
+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;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionContent implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检内容信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 内容标题
+     */
+    private String contentTitle;
+
+    /**
+     * 内容描述
+     */
+    private String contentDescribe;
+
+    /**
+     * 提交方式
+     */
+    private Integer submissionMethod;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+
+}

+ 42 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/SiteContent.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-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SiteContent implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 地点内容关联信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 内容标题
+     */
+    private Integer siteId;
+
+    /**
+     * 内容ID
+     */
+    private Integer contentId;
+
+
+}

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

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

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

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

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

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

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

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

+ 25 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionContentService.java

@@ -0,0 +1,25 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionContent;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.service.vo.PatrolInspectionContentVo;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+public interface PatrolInspectionContentService extends CrudService<PatrolInspectionContent> {
+
+    void addPatrolInspectionContent(PatrolInspectionContentVo patrolInspectionContentVo);
+
+    void updatePatrolInspectionContent(PatrolInspectionContentVo patrolInspectionContentVo);
+
+    void delPatrolInspectionContent(Integer id);
+
+    CommonPage<PatrolInspectionContentVo> patrolInspectionContentList(String contentTitle, Integer pageNum, Integer pageSize, Integer id);
+}

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

@@ -3,6 +3,7 @@ package com.usky.fire.service;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.CrudService;
 import com.usky.fire.domain.PatrolInspectionSite;
+import com.usky.fire.domain.SiteContent;
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
 
 import java.util.List;
@@ -26,4 +27,8 @@ public interface PatrolInspectionSiteService extends CrudService<PatrolInspectio
     void updatePatrolInspectionSite(PatrolInspectionSite patrolInspectionSite);
 
     void delPatrolInspectionSite(Integer id);
+
+    void addSiteContent(List<SiteContent> siteContentList);
+
+    Integer[] siteContentList(Integer siteId);
 }

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

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

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

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

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

@@ -0,0 +1,188 @@
+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.core.exception.BusinessException;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.ContentOption;
+import com.usky.fire.domain.PatrolInspectionContent;
+import com.usky.fire.domain.SiteContent;
+import com.usky.fire.mapper.PatrolInspectionContentMapper;
+import com.usky.fire.service.ContentOptionService;
+import com.usky.fire.service.PatrolInspectionContentService;
+import com.usky.fire.service.SiteContentService;
+import com.usky.fire.service.vo.PatrolInspectionContentVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@Service
+public class PatrolInspectionContentServiceImpl extends AbstractCrudService<PatrolInspectionContentMapper, PatrolInspectionContent> implements PatrolInspectionContentService {
+
+    @Autowired
+    private ContentOptionService contentOptionService;
+    @Autowired
+    private SiteContentService siteContentService;
+
+    @Override
+    @Transactional
+    public void addPatrolInspectionContent(PatrolInspectionContentVo patrolInspectionContentVo) {
+        PatrolInspectionContent patrolInspectionContent = new PatrolInspectionContent();
+        patrolInspectionContent.setContentTitle(patrolInspectionContentVo.getContentTitle());
+        patrolInspectionContent.setContentDescribe(patrolInspectionContentVo.getContentDescribe());
+        patrolInspectionContent.setSubmissionMethod(patrolInspectionContentVo.getSubmissionMethod());
+        patrolInspectionContent.setTenantId(SecurityUtils.getTenantId());
+        patrolInspectionContent.setCompanyId(patrolInspectionContentVo.getCompanyId());
+        patrolInspectionContent.setCreateTime(LocalDateTime.now());
+        patrolInspectionContent.setCreator(SecurityUtils.getUsername());
+        patrolInspectionContent.setEnable(1);
+        this.save(patrolInspectionContent);
+        if (patrolInspectionContentVo.getContentOptionList().size() > 0) {
+            Integer fid = patrolInspectionContent.getId();
+            for (int i = 0; i < patrolInspectionContentVo.getContentOptionList().size(); i++) {
+                ContentOption contentOption = new ContentOption();
+                contentOption.setOptionName(patrolInspectionContentVo.getContentOptionList().get(i).getOptionName());
+                contentOption.setContentId(fid);
+                contentOption.setEnable(1);
+                contentOption.setCreator(SecurityUtils.getUsername());
+                contentOption.setCreateTime(LocalDateTime.now());
+                contentOptionService.save(contentOption);
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public void updatePatrolInspectionContent(PatrolInspectionContentVo patrolInspectionContentVo) {
+        PatrolInspectionContent patrolInspectionContent = new PatrolInspectionContent();
+        patrolInspectionContent.setId(patrolInspectionContentVo.getId());
+        patrolInspectionContent.setContentTitle(patrolInspectionContentVo.getContentTitle());
+        patrolInspectionContent.setContentDescribe(patrolInspectionContentVo.getContentDescribe());
+        patrolInspectionContent.setSubmissionMethod(patrolInspectionContentVo.getSubmissionMethod());
+        patrolInspectionContent.setCompanyId(patrolInspectionContentVo.getCompanyId());
+        this.updateById(patrolInspectionContent);
+        LambdaQueryWrapper<ContentOption> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(ContentOption::getEnable, 1)
+        .eq(ContentOption::getContentId,patrolInspectionContentVo.getId());
+        List<ContentOption> ContentOptionList = contentOptionService.list(queryWrapper);
+        if (ContentOptionList.size() > 0) {
+            for (int i = 0; i < ContentOptionList.size(); i++) {
+                ContentOptionList.get(i).setEnable(0);
+                contentOptionService.updateById(ContentOptionList.get(i));
+            }
+        }
+        if (patrolInspectionContentVo.getContentOptionList().size() > 0) {
+            for (int i = 0; i < patrolInspectionContentVo.getContentOptionList().size(); i++) {
+                ContentOption contentOption = new ContentOption();
+                contentOption.setOptionName(patrolInspectionContentVo.getContentOptionList().get(i).getOptionName());
+                contentOption.setContentId(patrolInspectionContentVo.getId());
+                if (patrolInspectionContentVo.getContentOptionList().get(i).getId() != 0 &&
+                        patrolInspectionContentVo.getContentOptionList().get(i).getId() != null) {
+                    contentOption.setId(patrolInspectionContentVo.getContentOptionList().get(i).getId());
+                    contentOption.setEnable(1);
+                    contentOptionService.updateById(contentOption);
+                } else {
+                    contentOption.setEnable(1);
+                    contentOption.setCreator(SecurityUtils.getUsername());
+                    contentOption.setCreateTime(LocalDateTime.now());
+                    contentOptionService.save(contentOption);
+                }
+
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public void delPatrolInspectionContent(Integer id) {
+        LambdaQueryWrapper<SiteContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(SiteContent::getContentId, id);
+        List<SiteContent> siteContentList = siteContentService.list(queryWrapper);
+        if (siteContentList.size() > 0) {
+            throw new BusinessException("巡检内容正在使用中不可删除");
+        }
+        PatrolInspectionContent patrolInspectionContent = new PatrolInspectionContent();
+        patrolInspectionContent.setId(id);
+        patrolInspectionContent.setEnable(0);
+        this.updateById(patrolInspectionContent);
+        LambdaQueryWrapper<ContentOption> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(ContentOption::getContentId, id)
+                .eq(ContentOption::getEnable, 1);
+        List<ContentOption> contentOptionList = contentOptionService.list(queryWrapperOne);
+        if (contentOptionList.size() > 0) {
+            for (int i = 0; i < contentOptionList.size(); i++) {
+                ContentOption contentOption = new ContentOption();
+                contentOption.setId(contentOptionList.get(i).getId());
+                contentOption.setEnable(0);
+                contentOptionService.updateById(contentOption);
+            }
+        }
+    }
+
+    @Override
+    public CommonPage<PatrolInspectionContentVo> patrolInspectionContentList(String contentTitle, Integer pageNum, Integer pageSize, Integer id) {
+        LambdaQueryWrapper<PatrolInspectionContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionContent::getTenantId, SecurityUtils.getTenantId())
+                .eq(PatrolInspectionContent::getEnable, 1);
+        if (contentTitle != null && !"".equals(contentTitle)) {
+            queryWrapper.like(PatrolInspectionContent::getContentTitle, contentTitle);
+        }
+        if (id != 0 && id != null) {
+            queryWrapper.eq(PatrolInspectionContent::getId, id);
+        }
+        List<PatrolInspectionContent> patrolInspectionContentList = this.list(queryWrapper);
+        List<PatrolInspectionContentVo> list = new ArrayList<>();
+        List<PatrolInspectionContentVo> patrolInspectionContentVoList = new ArrayList<>();
+        if (patrolInspectionContentList.size() > 0) {
+            List<Integer> idList = new ArrayList<>();
+            for (int i = 0; i < patrolInspectionContentList.size(); i++) {
+                idList.add(patrolInspectionContentList.get(i).getId());
+
+            }
+            LambdaQueryWrapper<ContentOption> queryWrapperOne = Wrappers.lambdaQuery();
+            queryWrapperOne.eq(ContentOption::getEnable, 1)
+                    .in(ContentOption::getContentId, idList);
+            List<ContentOption> contentOptionList = contentOptionService.list(queryWrapperOne);
+            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.setCompanyId(patrolInspectionContentList.get(i).getCompanyId());
+                patrolInspectionContentVo.setCreator(patrolInspectionContentList.get(i).getCreator());
+                patrolInspectionContentVo.setCreateTime(patrolInspectionContentList.get(i).getCreateTime());
+                patrolInspectionContentVo.setEnable(patrolInspectionContentList.get(i).getEnable());
+                List<ContentOption> contentOptionListOne = new ArrayList<>();
+                for (int j = 0; j < contentOptionList.size(); j++) {
+                    if (patrolInspectionContentList.get(i).getId() == contentOptionList.get(j).getContentId()) {
+                        contentOptionListOne.add(contentOptionList.get(j));
+                    }
+                }
+                patrolInspectionContentVo.setContentOptionList(contentOptionListOne);
+                patrolInspectionContentVoList.add(patrolInspectionContentVo);
+            }
+            list = patrolInspectionContentVoList.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+
+        }
+        return new CommonPage<>(list, patrolInspectionContentVoList.size(), pageNum, pageSize);
+    }
+
+
+}

+ 49 - 7
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionSiteServiceImpl.java

@@ -7,9 +7,11 @@ import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.PatrolInspectionArea;
 import com.usky.fire.domain.PatrolInspectionSite;
+import com.usky.fire.domain.SiteContent;
 import com.usky.fire.mapper.PatrolInspectionSiteMapper;
 import com.usky.fire.service.PatrolInspectionAreaService;
 import com.usky.fire.service.PatrolInspectionSiteService;
+import com.usky.fire.service.SiteContentService;
 import com.usky.fire.service.util.OnlineMethod;
 import com.usky.fire.service.vo.DataCountVo;
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
@@ -36,6 +38,10 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
     @Autowired
     private PatrolInspectionAreaService patrolInspectionAreaService;
 
+    @Autowired
+    private SiteContentService siteContentService;
+
+    @Override
     public List<PatrolInspectionAreaVo> areaLeftList() {
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionArea::getTenantId, SecurityUtils.getTenantId())
@@ -82,15 +88,15 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
         return patrolInspectionAreaVoListOne;
     }
 
-
-    public CommonPage<PatrolInspectionSite> patrolInspectionSiteList(Integer areaId, String siteName, Integer pageNum, Integer pageSize,Integer id) {
+    @Override
+    public CommonPage<PatrolInspectionSite> patrolInspectionSiteList(Integer areaId, String siteName, Integer pageNum, Integer pageSize, Integer id) {
         LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
                 .eq(PatrolInspectionSite::getEnable, 1);
         if (areaId != null) {
             queryWrapper.eq(PatrolInspectionSite::getAreaId, areaId);
         }
-        if (id != null&&id !=0) {
+        if (id != null && id != 0) {
             queryWrapper.eq(PatrolInspectionSite::getId, id);
         }
         if (siteName != null && !"".equals(siteName)) {
@@ -104,8 +110,8 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
 
     @Override
     @Transactional
-    public void updatePatrolInspectionSiteList(List<PatrolInspectionSite> patrolInspectionSiteList){
-        for (int i=0;i<patrolInspectionSiteList.size();i++){
+    public void updatePatrolInspectionSiteList(List<PatrolInspectionSite> patrolInspectionSiteList) {
+        for (int i = 0; i < patrolInspectionSiteList.size(); i++) {
             PatrolInspectionSite patrolInspectionSite = new PatrolInspectionSite();
             patrolInspectionSite.setId(patrolInspectionSiteList.get(i).getId());
             patrolInspectionSite.setAreaId(patrolInspectionSiteList.get(i).getAreaId());
@@ -116,16 +122,52 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
     }
 
     @Override
-    public void updatePatrolInspectionSite(PatrolInspectionSite patrolInspectionSite){
+    public void updatePatrolInspectionSite(PatrolInspectionSite patrolInspectionSite) {
         this.updateById(patrolInspectionSite);
     }
 
     @Override
-    public void delPatrolInspectionSite(Integer id){
+    public void delPatrolInspectionSite(Integer id) {
         PatrolInspectionSite patrolInspectionSite = new PatrolInspectionSite();
         patrolInspectionSite.setId(id);
         patrolInspectionSite.setEnable(0);
         this.updateById(patrolInspectionSite);
     }
 
+
+    @Override
+    @Transactional
+    public void addSiteContent(List<SiteContent> siteContentList) {
+        LambdaQueryWrapper<SiteContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(SiteContent::getSiteId, siteContentList.get(0).getSiteId());
+        List<SiteContent> siteContenListOne = siteContentService.list(queryWrapper);
+        if (siteContenListOne.size() > 0) {
+            for (int i = 0; i < siteContenListOne.size(); i++) {
+                siteContentService.removeById(siteContenListOne.get(i).getId());
+            }
+        }
+        for (int i = 0; i < siteContentList.size(); i++) {
+            siteContentService.save(siteContentList.get(i));
+        }
+    }
+
+    /**
+     * 根据巡检地点ID查询巡检内容ID
+     * @param siteId 巡检地点ID
+     * @return
+     */
+    public Integer[] siteContentList(Integer siteId){
+        LambdaQueryWrapper<SiteContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(SiteContent::getSiteId, siteId);
+        List<SiteContent> siteContenList = siteContentService.list(queryWrapper);
+        Integer[] contenIdList = new Integer[siteContenList.size()];
+        if (siteContenList.size()>0){
+            for (int i = 0; i < siteContenList.size(); i++) {
+                contenIdList[i] = siteContenList.get(i).getContentId();
+            }
+        }
+        return contenIdList;
+    }
+
+
 }

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

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

+ 81 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionContentVo.java

@@ -0,0 +1,81 @@
+package com.usky.fire.service.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.usky.fire.domain.ContentOption;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionContentVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检内容信息表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 内容标题
+     */
+    private String contentTitle;
+
+    /**
+     * 内容描述
+     */
+    private String contentDescribe;
+
+    /**
+     * 提交方式
+     */
+    private Integer submissionMethod;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1 生效)
+     */
+    private Integer enable;
+
+    /**
+     * 单位ID
+     */
+    private Integer companyId;
+
+    /**
+     * 选项内容
+     */
+    private List<ContentOption> contentOptionList;
+
+
+}

+ 15 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/ContentOptionMapper.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.ContentOptionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.ContentOption">
+        <id column="id" property="id" />
+        <result column="option_name" property="optionName" />
+        <result column="content_id" property="contentId" />
+        <result column="create_time" property="createTime" />
+        <result column="creator" property="creator" />
+        <result column="enable" property="enable" />
+    </resultMap>
+
+</mapper>

+ 18 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/PatrolInspectionContentMapper.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.PatrolInspectionContentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionContent">
+        <id column="id" property="id" />
+        <result column="content_title" property="contentTitle" />
+        <result column="content_describe" property="contentDescribe" />
+        <result column="submission_method" property="submissionMethod" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="create_time" property="createTime" />
+        <result column="creator" property="creator" />
+        <result column="enable" property="enable" />
+        <result column="company_id" property="companyId" />
+    </resultMap>
+
+</mapper>

+ 12 - 0
service-fire/service-fire-biz/src/main/resources/mapper.fire/SiteContentMapper.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.SiteContentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.SiteContent">
+        <id column="id" property="id" />
+        <result column="site_id" property="siteId" />
+        <result column="content_id" property="contentId" />
+    </resultMap>
+
+</mapper>