kangwei: 风险点---移动端---风险点巡检--开始巡检
正在显示
20 个修改的文件
包含
590 行增加
和
4 行删除
... | @@ -76,7 +76,7 @@ public class DangerInspectInfoController { | ... | @@ -76,7 +76,7 @@ public class DangerInspectInfoController { |
76 | Result<IPage<DangerInspectInfo>> result = new Result<IPage<DangerInspectInfo>>(); | 76 | Result<IPage<DangerInspectInfo>> result = new Result<IPage<DangerInspectInfo>>(); |
77 | QueryWrapper<DangerInspectInfo> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectInfo, req.getParameterMap()); | 77 | QueryWrapper<DangerInspectInfo> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectInfo, req.getParameterMap()); |
78 | Page<DangerInspectInfo> page = new Page<DangerInspectInfo>(pageNo, pageSize); | 78 | Page<DangerInspectInfo> page = new Page<DangerInspectInfo>(pageNo, pageSize); |
79 | queryWrapper.eq("danger_level_id",dangerInspectInfo.getDangerLevelId()); | 79 | queryWrapper.eq("danger_id",dangerInspectInfo.getDangerId()); |
80 | queryWrapper.orderByDesc("create_time"); | 80 | queryWrapper.orderByDesc("create_time"); |
81 | 81 | ||
82 | IPage<DangerInspectInfo> pageList = dangerInspectInfoService.page(page, queryWrapper); | 82 | IPage<DangerInspectInfo> pageList = dangerInspectInfoService.page(page, queryWrapper); | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerInspectionInfoController.java
0 → 100644
此文件的差异被折叠,
点击展开。
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerInspectionRecordController.java
0 → 100644
此文件的差异被折叠,
点击展开。
sk-module-biz/src/main/java/com/skua/modules/safe/controller/app/APPDangerInspectionController.java
0 → 100644
1 | package com.skua.modules.safe.controller.app; | ||
2 | import java.util.List; | ||
3 | |||
4 | import com.skua.core.api.vo.Result; | ||
5 | import com.skua.core.aspect.annotation.AutoLog; | ||
6 | import com.skua.core.context.BaseContextHandler; | ||
7 | import com.skua.modules.safe.entity.*; | ||
8 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; | ||
9 | import com.skua.modules.safe.service.*; | ||
10 | import lombok.extern.slf4j.Slf4j; | ||
11 | |||
12 | import org.springframework.beans.factory.annotation.Autowired; | ||
13 | import org.springframework.web.bind.annotation.*; | ||
14 | import io.swagger.annotations.Api; | ||
15 | import io.swagger.annotations.ApiOperation; | ||
16 | |||
17 | /** | ||
18 | * <pre> | ||
19 | * 风险巡检 | ||
20 | * </pre> | ||
21 | * @author 开发者姓名 | ||
22 | * @version V0.1, 开发时间 | ||
23 | */ | ||
24 | @Slf4j | ||
25 | @Api(tags="风险巡检") | ||
26 | @RestController("APPDangerInspectionController") | ||
27 | @RequestMapping("/app/safe/dangerInspection") | ||
28 | public class APPDangerInspectionController { | ||
29 | |||
30 | @Autowired | ||
31 | private IDangerLevelManageService dangerLevelManageService;//风险点Service | ||
32 | |||
33 | @Autowired | ||
34 | private IDangerInspectionRecordService inspectionRecordService ;//巡检对象 | ||
35 | |||
36 | @Autowired | ||
37 | private IDangerInspectionInfoService inspectionInfoService ;//巡检对象 | ||
38 | |||
39 | @Autowired | ||
40 | private IDangerInspectionItemService inspectionItemService ;//巡检对象,检查项 | ||
41 | |||
42 | |||
43 | /** | ||
44 | * <pre> | ||
45 | * 扫描二维码进入:风险点详情 | ||
46 | * </pre> | ||
47 | * @param id | ||
48 | * @return | ||
49 | * @author 开发者姓名, 开发时间 | ||
50 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
51 | */ | ||
52 | @AutoLog(value = "扫描二维码进入:风险点详情") | ||
53 | @ApiOperation(value="扫描二维码进入:风险点详情", notes="扫描二维码进入:风险点详情") | ||
54 | @GetMapping(value = "/queryDangerById") | ||
55 | public Result<DangerLevelManage> queryById(@RequestParam(name="id",required=true) String id) { | ||
56 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); | ||
57 | DangerLevelManage dangerInspection = dangerLevelManageService.getById(id); | ||
58 | //查询:上次巡检时间 | ||
59 | DangerInspectionRecord inspection = inspectionRecordService.queryOneByDangerId( id,"2" ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录 | ||
60 | if(inspection != null ){ | ||
61 | dangerInspection.setLastInspectionTime( inspection.getReportDate() ); | ||
62 | }else{ | ||
63 | dangerInspection.setLastInspectionTime(""); | ||
64 | } | ||
65 | if(dangerInspection==null) { | ||
66 | result.error500("未找到对应实体"); | ||
67 | }else { | ||
68 | result.setResult(dangerInspection); | ||
69 | result.setSuccess(true); | ||
70 | } | ||
71 | return result; | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * <pre> | ||
76 | * 开始巡检-->获取风险点,检查对象集合 | ||
77 | * </pre> | ||
78 | * @param dangerId | ||
79 | * @return | ||
80 | * @author 开发者姓名, 开发时间 | ||
81 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
82 | */ | ||
83 | @AutoLog(value = "开始巡检-->开始巡检") | ||
84 | @ApiOperation(value="开始巡检-->开始巡检", notes="开始巡检-->开始巡检") | ||
85 | @GetMapping(value = "/startInspection") | ||
86 | public Result< DangerInspectionRecord > startInspection(@RequestParam(name="dangerId",required=true) String dangerId) { | ||
87 | Result< DangerInspectionRecord > result = new Result< DangerInspectionRecord >(); | ||
88 | |||
89 | //开始巡检,将风险点下的检查内容(检查项目)插入到巡检、巡检项目,并创建巡检记录 | ||
90 | DangerInspectionRecord dangerInspection = inspectionRecordService.startInspection(dangerId,"1",BaseContextHandler.getUserId()); | ||
91 | if(dangerInspection==null) { | ||
92 | result.error500("未找到对应实体"); | ||
93 | }else { | ||
94 | result.setResult(dangerInspection); | ||
95 | result.setSuccess(true); | ||
96 | } | ||
97 | return result; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * <pre> | ||
102 | * 开始巡检-->根据id获取检查内容对象 | ||
103 | * </pre> | ||
104 | * @param id | ||
105 | * @return | ||
106 | * @author 开发者姓名, 开发时间 | ||
107 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
108 | */ | ||
109 | @AutoLog(value = "开始巡检-->根据id获取检查内容对象") | ||
110 | @ApiOperation(value="开始巡检-->根据id获取检查内容对象", notes="开始巡检-->根据id获取检查内容对象") | ||
111 | @GetMapping(value = "/queryInspectInfoById") | ||
112 | public Result< DangerInspectionInfo> queryInspectInfoById(@RequestParam(name="id",required=true) String id) { | ||
113 | Result< DangerInspectionInfo> result = new Result< DangerInspectionInfo >(); | ||
114 | |||
115 | DangerInspectionInfo inspectionInfo = inspectionInfoService.getById( id ) ; | ||
116 | if(inspectionInfo != null ){ | ||
117 | List<DangerInspectionItem> inspectionItemList = inspectionItemService.queryListByInfoId(inspectionInfo.getId()); | ||
118 | inspectionInfo.setInspectionItemList( inspectionItemList ) ; | ||
119 | } | ||
120 | |||
121 | if(inspectionInfo==null) { | ||
122 | result.error500("未找到对应实体"); | ||
123 | }else { | ||
124 | result.setResult(inspectionInfo); | ||
125 | result.setSuccess(true); | ||
126 | } | ||
127 | return result; | ||
128 | } | ||
129 | |||
130 | @AutoLog(value = "巡查内容对象-保存") | ||
131 | @ApiOperation(value="巡查内容对象-保存", notes="巡查内容对象-保存") | ||
132 | @PostMapping(value = "/saveInspectionInf") | ||
133 | public Result<DangerInspectInfo> updateDangerInspectionInfo(@RequestBody DangerInspectionInfo dangerInspectionInfo) { | ||
134 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); | ||
135 | try { | ||
136 | inspectionInfoService.updateDangerInspectionInfo(dangerInspectionInfo); | ||
137 | result.success("添加成功!"); | ||
138 | } catch (Exception e) { | ||
139 | log.error(e.getMessage(),e); | ||
140 | result.error500("操作失败"); | ||
141 | } | ||
142 | return result; | ||
143 | } | ||
144 | @AutoLog(value = "结束巡检") | ||
145 | @ApiOperation(value="结束巡检", notes="结束巡检") | ||
146 | @PostMapping(value = "/endInspection") | ||
147 | public Result<DangerInspectInfo> endInspection(@RequestParam(name="id",required=true) String id) { | ||
148 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); | ||
149 | try { | ||
150 | |||
151 | //inspectionRecordService.(id); | ||
152 | result.success("添加成功!"); | ||
153 | } catch (Exception e) { | ||
154 | log.error(e.getMessage(),e); | ||
155 | result.error500("操作失败"); | ||
156 | } | ||
157 | return result; | ||
158 | } | ||
159 | |||
160 | |||
161 | } |
... | @@ -34,7 +34,7 @@ public class DangerInspectInfo { | ... | @@ -34,7 +34,7 @@ public class DangerInspectInfo { |
34 | /**风险点编号*/ | 34 | /**风险点编号*/ |
35 | @Excel(name = "风险点编号", width = 15) | 35 | @Excel(name = "风险点编号", width = 15) |
36 | @ApiModelProperty(value = "风险点编号") | 36 | @ApiModelProperty(value = "风险点编号") |
37 | private String dangerLevelId; | 37 | private String dangerId; |
38 | /**检查内容*/ | 38 | /**检查内容*/ |
39 | @Excel(name = "检查内容", width = 15) | 39 | @Excel(name = "检查内容", width = 15) |
40 | @ApiModelProperty(value = "检查内容") | 40 | @ApiModelProperty(value = "检查内容") | ... | ... |
... | @@ -29,6 +29,12 @@ public class DangerInspectItem { | ... | @@ -29,6 +29,12 @@ public class DangerInspectItem { |
29 | @TableId(type = IdType.ID_WORKER_STR) | 29 | @TableId(type = IdType.ID_WORKER_STR) |
30 | @ApiModelProperty(value = "id") | 30 | @ApiModelProperty(value = "id") |
31 | private String id; | 31 | private String id; |
32 | |||
33 | /**风险点编号*/ | ||
34 | @Excel(name = "风险点编号", width = 15) | ||
35 | @ApiModelProperty(value = "风险点编号") | ||
36 | private String dangerId; | ||
37 | |||
32 | /**检查内容对象编号*/ | 38 | /**检查内容对象编号*/ |
33 | @Excel(name = "检查内容对象编号", width = 15) | 39 | @Excel(name = "检查内容对象编号", width = 15) |
34 | @ApiModelProperty(value = "检查内容对象编号") | 40 | @ApiModelProperty(value = "检查内容对象编号") | ... | ... |
1 | package com.skua.modules.safe.entity; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import java.util.Date; | ||
5 | import java.util.List; | ||
6 | |||
7 | import com.baomidou.mybatisplus.annotation.IdType; | ||
8 | import com.baomidou.mybatisplus.annotation.TableId; | ||
9 | import com.baomidou.mybatisplus.annotation.TableName; | ||
10 | import com.baomidou.mybatisplus.annotation.TableField; | ||
11 | import io.swagger.annotations.ApiModel; | ||
12 | import io.swagger.annotations.ApiModelProperty; | ||
13 | import lombok.Data; | ||
14 | import lombok.EqualsAndHashCode; | ||
15 | import lombok.experimental.Accessors; | ||
16 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
17 | import org.springframework.format.annotation.DateTimeFormat; | ||
18 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
19 | |||
20 | /** | ||
21 | * 巡检对象 | ||
22 | */ | ||
23 | @Data | ||
24 | @TableName("danger_inspection_info") | ||
25 | @EqualsAndHashCode(callSuper = false) | ||
26 | @Accessors(chain = true) | ||
27 | @ApiModel(value="danger_inspection_info对象", description="巡检对象") | ||
28 | public class DangerInspectionInfo { | ||
29 | |||
30 | /**id*/ | ||
31 | @TableId(type = IdType.ID_WORKER_STR) | ||
32 | @ApiModelProperty(value = "id") | ||
33 | private String id; | ||
34 | /**厂id*/ | ||
35 | @Excel(name = "厂id", width = 15) | ||
36 | @ApiModelProperty(value = "厂id") | ||
37 | private String departId; | ||
38 | /**记录人用户编号*/ | ||
39 | @Excel(name = "巡检记录编号", width = 15) | ||
40 | @ApiModelProperty(value = "巡检记录编号") | ||
41 | private String inspectionRecordId; | ||
42 | /**风险等级对象*/ | ||
43 | @Excel(name = "风险等级对象", width = 15) | ||
44 | @ApiModelProperty(value = "风险等级对象") | ||
45 | private String dangerId; | ||
46 | /**检查内容对象编号*/ | ||
47 | @Excel(name = "检查内容对象编号", width = 15) | ||
48 | @ApiModelProperty(value = "检查内容对象编号") | ||
49 | private String inspectObjId; | ||
50 | |||
51 | /**检查内容*/ | ||
52 | @Excel(name = "检查内容", width = 15) | ||
53 | @ApiModelProperty(value = "检查内容") | ||
54 | private String inspectName; | ||
55 | /**检查标准*/ | ||
56 | @Excel(name = "检查标准", width = 15) | ||
57 | @ApiModelProperty(value = "检查标准") | ||
58 | private String inspectStandard; | ||
59 | /**检查方法*/ | ||
60 | @Excel(name = "检查方法", width = 15) | ||
61 | @ApiModelProperty(value = "检查方法") | ||
62 | private String inspectMethod; | ||
63 | |||
64 | |||
65 | /**检查图片*/ | ||
66 | @Excel(name = "检查图片", width = 15) | ||
67 | @ApiModelProperty(value = "检查图片") | ||
68 | private String inspectImg; | ||
69 | /**上报人(用户id)*/ | ||
70 | @Excel(name = "上报人(用户id)", width = 15) | ||
71 | @ApiModelProperty(value = "上报人(用户id)") | ||
72 | private String reportUser; | ||
73 | /**巡检状态(0:未开始,1:开始,2:结束,3:作废)*/ | ||
74 | @Excel(name = "巡检状态(0:未开始,1:开始,2:结束,3:作废)", width = 15) | ||
75 | @ApiModelProperty(value = "巡检状态(0:未开始,1:开始,2:结束,3:作废)") | ||
76 | private String status; | ||
77 | /**备注*/ | ||
78 | @Excel(name = "备注", width = 15) | ||
79 | @ApiModelProperty(value = "备注") | ||
80 | private String remark; | ||
81 | /**创建人Id*/ | ||
82 | @Excel(name = "创建人Id", width = 15) | ||
83 | @ApiModelProperty(value = "创建人Id") | ||
84 | private String createBy; | ||
85 | /**上报时间*/ | ||
86 | @Excel(name = "上报时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
87 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
88 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
89 | @ApiModelProperty(value = "上报时间") | ||
90 | private Date createTime; | ||
91 | /**修改人Id*/ | ||
92 | @Excel(name = "修改人Id", width = 15) | ||
93 | @ApiModelProperty(value = "修改人Id") | ||
94 | private String updateBy; | ||
95 | /**修改时间*/ | ||
96 | @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
97 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
98 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
99 | @ApiModelProperty(value = "修改时间") | ||
100 | private Date updateTime; | ||
101 | /**删除标识,1有效,0删除*/ | ||
102 | @Excel(name = "删除标识,1有效,0删除", width = 15) | ||
103 | @ApiModelProperty(value = "删除标识,1有效,0删除") | ||
104 | private Integer delFlag; | ||
105 | |||
106 | @TableField(exist=false) | ||
107 | @ApiModelProperty(value = "检查项集合") | ||
108 | private List<DangerInspectionItem> inspectionItemList; | ||
109 | } |
... | @@ -29,6 +29,11 @@ public class DangerInspectionItem { | ... | @@ -29,6 +29,11 @@ public class DangerInspectionItem { |
29 | @TableId(type = IdType.ID_WORKER_STR) | 29 | @TableId(type = IdType.ID_WORKER_STR) |
30 | @ApiModelProperty(value = "id") | 30 | @ApiModelProperty(value = "id") |
31 | private String id; | 31 | private String id; |
32 | |||
33 | @Excel(name = "巡检检查内容对象编号", width = 15) | ||
34 | @ApiModelProperty(value = "巡检检查内容对象编号") | ||
35 | private String inspectionInfoId; | ||
36 | |||
32 | /**检查内容对象编号*/ | 37 | /**检查内容对象编号*/ |
33 | @Excel(name = "检查内容对象编号", width = 15) | 38 | @Excel(name = "检查内容对象编号", width = 15) |
34 | @ApiModelProperty(value = "检查内容对象编号") | 39 | @ApiModelProperty(value = "检查内容对象编号") | ... | ... |
... | @@ -102,7 +102,6 @@ public class DangerLevelManage { | ... | @@ -102,7 +102,6 @@ public class DangerLevelManage { |
102 | private String qrCode; | 102 | private String qrCode; |
103 | 103 | ||
104 | 104 | ||
105 | |||
106 | /**创建人Id*/ | 105 | /**创建人Id*/ |
107 | @ApiModelProperty(value = "创建人Id") | 106 | @ApiModelProperty(value = "创建人Id") |
108 | private String createBy; | 107 | private String createBy; | ... | ... |
1 | package com.skua.modules.safe.mapper; | ||
2 | |||
3 | import java.util.List; | ||
4 | |||
5 | import org.apache.ibatis.annotations.Param; | ||
6 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
8 | |||
9 | /** | ||
10 | * 巡检对象 | ||
11 | */ | ||
12 | public interface DangerInspectionInfoMapper extends BaseMapper<DangerInspectionInfo> { | ||
13 | |||
14 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/DangerInspectionRecordMapper.java
0 → 100644
1 | package com.skua.modules.safe.mapper; | ||
2 | |||
3 | import java.util.List; | ||
4 | |||
5 | import org.apache.ibatis.annotations.Param; | ||
6 | import com.skua.modules.safe.entity.DangerInspectionRecord; | ||
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
8 | |||
9 | /** | ||
10 | * 巡检记录 | ||
11 | */ | ||
12 | public interface DangerInspectionRecordMapper extends BaseMapper<DangerInspectionRecord> { | ||
13 | |||
14 | /*** | ||
15 | * 批量插入检查内容对象 | ||
16 | * @param dangerInspection | ||
17 | */ | ||
18 | public void batchSaveInspectionInfo(DangerInspectionRecord dangerInspection); | ||
19 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/xml/DangerInspectionInfoMapper.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | <mapper namespace="com.skua.modules.safe.mapper.DangerInspectionInfoMapper"> | ||
4 | |||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/xml/DangerInspectionRecordMapper.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | <mapper namespace="com.skua.modules.safe.mapper.DangerInspectionRecordMapper"> | ||
4 | |||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
sk-module-biz/src/main/java/com/skua/modules/safe/service/IDangerInspectionInfoService.java
0 → 100644
1 | package com.skua.modules.safe.service; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
4 | import com.baomidou.mybatisplus.extension.service.IService; | ||
5 | |||
6 | /** | ||
7 | * 巡检对象 | ||
8 | */ | ||
9 | public interface IDangerInspectionInfoService extends IService<DangerInspectionInfo> { | ||
10 | |||
11 | /*** | ||
12 | * 保存巡检对象 | ||
13 | * @param dangerInspectionInfo | ||
14 | */ | ||
15 | public void updateDangerInspectionInfo(DangerInspectionInfo dangerInspectionInfo); | ||
16 | } |
... | @@ -3,9 +3,17 @@ package com.skua.modules.safe.service; | ... | @@ -3,9 +3,17 @@ package com.skua.modules.safe.service; |
3 | import com.skua.modules.safe.entity.DangerInspectionItem; | 3 | import com.skua.modules.safe.entity.DangerInspectionItem; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | 5 | ||
6 | import java.util.List; | ||
7 | |||
6 | /** | 8 | /** |
7 | * 风险检查项记录 | 9 | * 风险检查项记录 |
8 | */ | 10 | */ |
9 | public interface IDangerInspectionItemService extends IService<DangerInspectionItem> { | 11 | public interface IDangerInspectionItemService extends IService<DangerInspectionItem> { |
10 | 12 | ||
13 | /*** | ||
14 | * 根据infoId查询检查项目集合 | ||
15 | * @param infoId | ||
16 | * @return | ||
17 | */ | ||
18 | public List<DangerInspectionItem> queryListByInfoId(String infoId); | ||
11 | } | 19 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/safe/service/IDangerInspectionRecordService.java
0 → 100644
1 | package com.skua.modules.safe.service; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
4 | import com.skua.modules.safe.entity.DangerInspectionRecord; | ||
5 | import com.baomidou.mybatisplus.extension.service.IService; | ||
6 | |||
7 | import java.util.List; | ||
8 | |||
9 | /** | ||
10 | * 巡检记录 | ||
11 | */ | ||
12 | public interface IDangerInspectionRecordService extends IService<DangerInspectionRecord> { | ||
13 | |||
14 | /** | ||
15 | * 根据分线点编号dangerId,获取最新的巡检记录 | ||
16 | * @param dangerId | ||
17 | * @return | ||
18 | */ | ||
19 | public DangerInspectionRecord queryOneByDangerId(String dangerId,String status,String userId); | ||
20 | |||
21 | /*** | ||
22 | * 开始i巡检,如果用户已经开始巡检,返回巡检对象,如果未巡检,那就创建新的巡检对象 | ||
23 | * @param dangerId 风险点编号 | ||
24 | * @param status 状态 | ||
25 | * @param userId 用户编号 | ||
26 | * @return | ||
27 | */ | ||
28 | public DangerInspectionRecord startInspection(String dangerId, String status , String userId); | ||
29 | } |
... | @@ -54,7 +54,7 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM | ... | @@ -54,7 +54,7 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM |
54 | */ | 54 | */ |
55 | public List<DangerInspectInfo> queryListByDangerId(String dangerId){ | 55 | public List<DangerInspectInfo> queryListByDangerId(String dangerId){ |
56 | LambdaQueryWrapper<DangerInspectInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectInfo>(); | 56 | LambdaQueryWrapper<DangerInspectInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectInfo>(); |
57 | queryWrapper.eq(DangerInspectInfo::getDangerLevelId, dangerId); | 57 | queryWrapper.eq(DangerInspectInfo::getDangerId, dangerId); |
58 | queryWrapper.orderByDesc(DangerInspectInfo::getCreateTime);//添加排序 | 58 | queryWrapper.orderByDesc(DangerInspectInfo::getCreateTime);//添加排序 |
59 | return this.baseMapper.selectList(queryWrapper); | 59 | return this.baseMapper.selectList(queryWrapper); |
60 | } | 60 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/safe/service/impl/DangerInspectionInfoServiceImpl.java
0 → 100644
1 | package com.skua.modules.safe.service.impl; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
4 | import com.skua.modules.safe.entity.DangerInspectionItem; | ||
5 | import com.skua.modules.safe.mapper.DangerInspectionInfoMapper; | ||
6 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; | ||
7 | import com.skua.modules.safe.service.IDangerInspectionInfoService; | ||
8 | import org.springframework.stereotype.Service; | ||
9 | |||
10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
11 | import org.springframework.transaction.annotation.Transactional; | ||
12 | |||
13 | import javax.annotation.Resource; | ||
14 | |||
15 | /** | ||
16 | * 巡检对象 | ||
17 | */ | ||
18 | @Service | ||
19 | public class DangerInspectionInfoServiceImpl extends ServiceImpl<DangerInspectionInfoMapper, DangerInspectionInfo> implements IDangerInspectionInfoService { | ||
20 | |||
21 | @Resource | ||
22 | private DangerInspectionItemMapper inspectionItemMapper ; | ||
23 | /*** | ||
24 | * 保存巡检对象 | ||
25 | * @param dangerInspectionInfo | ||
26 | */ | ||
27 | @Transactional | ||
28 | public void updateDangerInspectionInfo(DangerInspectionInfo dangerInspectionInfo){ | ||
29 | |||
30 | this.baseMapper.updateById(dangerInspectionInfo ) ; | ||
31 | |||
32 | if(dangerInspectionInfo.getInspectionItemList() != null && !dangerInspectionInfo.getInspectionItemList().isEmpty()){ | ||
33 | for( DangerInspectionItem item : dangerInspectionInfo.getInspectionItemList()){ | ||
34 | inspectionItemMapper.updateById( item) ; | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | } |
1 | package com.skua.modules.safe.service.impl; | 1 | package com.skua.modules.safe.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | import com.skua.modules.safe.entity.DangerInspectInfo; | ||
3 | import com.skua.modules.safe.entity.DangerInspectionItem; | 5 | import com.skua.modules.safe.entity.DangerInspectionItem; |
4 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; | 6 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; |
5 | import com.skua.modules.safe.service.IDangerInspectionItemService; | 7 | import com.skua.modules.safe.service.IDangerInspectionItemService; |
... | @@ -7,10 +9,24 @@ import org.springframework.stereotype.Service; | ... | @@ -7,10 +9,24 @@ import org.springframework.stereotype.Service; |
7 | 9 | ||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 11 | ||
12 | import java.util.List; | ||
13 | |||
10 | /** | 14 | /** |
11 | * 风险检查项记录 | 15 | * 风险检查项记录 |
12 | */ | 16 | */ |
13 | @Service | 17 | @Service |
14 | public class DangerInspectionItemServiceImpl extends ServiceImpl<DangerInspectionItemMapper, DangerInspectionItem> implements IDangerInspectionItemService { | 18 | public class DangerInspectionItemServiceImpl extends ServiceImpl<DangerInspectionItemMapper, DangerInspectionItem> implements IDangerInspectionItemService { |
15 | 19 | ||
20 | /*** | ||
21 | * 根据infoId查询检查项目集合 | ||
22 | * @param infoId | ||
23 | * @return | ||
24 | */ | ||
25 | public List<DangerInspectionItem> queryListByInfoId(String infoId){ | ||
26 | LambdaQueryWrapper<DangerInspectionItem> queryWrapper = new LambdaQueryWrapper<DangerInspectionItem>(); | ||
27 | queryWrapper.eq(DangerInspectionItem::getInspectionInfoId, infoId); | ||
28 | queryWrapper.orderByDesc(DangerInspectionItem::getCreateTime);//添加排序 | ||
29 | |||
30 | return this.baseMapper.selectList(queryWrapper ); | ||
31 | } | ||
16 | } | 32 | } | ... | ... |
1 | package com.skua.modules.safe.service.impl; | ||
2 | |||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | import com.skua.core.context.BaseContextHandler; | ||
5 | import com.skua.modules.safe.entity.*; | ||
6 | import com.skua.modules.safe.mapper.*; | ||
7 | import com.skua.modules.safe.service.IDangerInspectionRecordService; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | ||
9 | import org.springframework.stereotype.Service; | ||
10 | |||
11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
12 | import org.springframework.transaction.annotation.Transactional; | ||
13 | |||
14 | import javax.annotation.Resource; | ||
15 | import java.util.List; | ||
16 | |||
17 | /** | ||
18 | * 巡检记录 | ||
19 | */ | ||
20 | @Service | ||
21 | public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspectionRecordMapper, DangerInspectionRecord> implements IDangerInspectionRecordService { | ||
22 | |||
23 | @Resource | ||
24 | private DangerLevelManageMapper dangerLevelManageMapper; | ||
25 | @Resource | ||
26 | private DangerInspectionInfoMapper dangerInspectionInfoMapper ;//巡检对象 | ||
27 | @Resource | ||
28 | private DangerInspectionItemMapper dangerInspectionItemMapper ;//巡检对象,检查项 | ||
29 | @Resource | ||
30 | private DangerInspectInfoMapper inspectInfoMapper;//检查对象 | ||
31 | @Resource | ||
32 | private DangerInspectItemMapper inspectItemMapper;//检查选项 | ||
33 | |||
34 | |||
35 | /** | ||
36 | * 根据分线点编号dangerId,获取最新的巡检记录 | ||
37 | * @param dangerId | ||
38 | * @return | ||
39 | */ | ||
40 | public DangerInspectionRecord queryOneByDangerId(String dangerId,String status,String userId){ | ||
41 | LambdaQueryWrapper<DangerInspectionRecord> queryWrapper = new LambdaQueryWrapper<DangerInspectionRecord>(); | ||
42 | queryWrapper.eq(DangerInspectionRecord::getDangerId, dangerId); | ||
43 | queryWrapper.eq(DangerInspectionRecord::getStatus , status); | ||
44 | queryWrapper.eq(DangerInspectionRecord::getReportUser , userId); | ||
45 | queryWrapper.orderByDesc(DangerInspectionRecord::getCreateTime);//添加排序 | ||
46 | return this.baseMapper.selectOne(queryWrapper); | ||
47 | } | ||
48 | |||
49 | /*** | ||
50 | * 开始i巡检,如果用户已经开始巡检,返回巡检对象,如果未巡检,那就创建新的巡检对象 | ||
51 | * @param dangerId 风险点编号 | ||
52 | * @param status 状态 | ||
53 | * @param userId 用户编号 | ||
54 | * @return | ||
55 | */ | ||
56 | @Transactional | ||
57 | public DangerInspectionRecord startInspection(String dangerId,String status , String userId){ | ||
58 | |||
59 | DangerInspectionRecord dangerInspection = queryOneByDangerId(dangerId ,status ,userId ); | ||
60 | if(dangerInspection == null ){ | ||
61 | DangerLevelManage dangerLevelManage = dangerLevelManageMapper.selectById(dangerId ); | ||
62 | dangerInspection = new DangerInspectionRecord(); | ||
63 | dangerInspection.setDepartId(dangerLevelManage.getDepartId()); | ||
64 | dangerInspection.setDangerId( dangerId ); | ||
65 | dangerInspection.setStatus( status); | ||
66 | dangerInspection.setReportUser( userId ); | ||
67 | |||
68 | this.baseMapper.insert( dangerInspection ) ; | ||
69 | |||
70 | //添加检查对象 | ||
71 | //批量插入检查内容对象 | ||
72 | LambdaQueryWrapper<DangerInspectInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectInfo>(); | ||
73 | queryWrapper.eq(DangerInspectInfo::getDangerId, dangerId); | ||
74 | List<DangerInspectInfo> dangerInspectInfoList = inspectInfoMapper.selectList( queryWrapper ); | ||
75 | |||
76 | LambdaQueryWrapper<DangerInspectItem> queryItemWrapper = new LambdaQueryWrapper<DangerInspectItem>(); | ||
77 | List<DangerInspectItem> inspectItemList = null; | ||
78 | |||
79 | |||
80 | if(dangerInspectInfoList != null && !dangerInspectInfoList.isEmpty()){ | ||
81 | DangerInspectionInfo inspectionInfo = null; | ||
82 | for(DangerInspectInfo dangerInspectInfo : dangerInspectInfoList){ | ||
83 | inspectionInfo = new DangerInspectionInfo(); | ||
84 | // ( depart_id , user_id, danger_id , inspect_obj_id,inspect_name,inspect_standard , inspect_method,report_user, ) | ||
85 | inspectionInfo.setDepartId(dangerLevelManage.getDepartId() ) ; | ||
86 | inspectionInfo.setInspectionRecordId( dangerInspection.getId()); | ||
87 | inspectionInfo.setDangerId( dangerInspectInfo.getDangerId() ); | ||
88 | inspectionInfo.setInspectName( dangerInspectInfo.getInspectName() ); | ||
89 | inspectionInfo.setInspectMethod( dangerInspectInfo.getInspectMethod()); | ||
90 | inspectionInfo.setInspectStandard( dangerInspectInfo.getInspectStandard() ); | ||
91 | inspectionInfo.setReportUser( userId) ; | ||
92 | dangerInspectionInfoMapper.insert(inspectionInfo); | ||
93 | |||
94 | //搜索检查内容对象,检查项目 | ||
95 | queryItemWrapper.eq(DangerInspectItem::getInspectObjId, dangerInspectInfo.getId()); | ||
96 | inspectItemList = inspectItemMapper.selectList(queryItemWrapper); | ||
97 | if(inspectItemList != null && !inspectItemList.isEmpty()){ | ||
98 | DangerInspectionItem inspectionItem = null; | ||
99 | |||
100 | for(DangerInspectItem inspectItem : inspectItemList){ | ||
101 | inspectionItem = new DangerInspectionItem(); | ||
102 | // ( depart_id , user_id, danger_id , inspect_obj_id,inspect_name,inspect_standard , inspect_method,report_user, ) | ||
103 | inspectionItem.setInspectObjId( inspectItem.getInspectObjId() ) ; | ||
104 | inspectionItem.setItemName( inspectItem.getItemName()); | ||
105 | inspectionItem.setItemType( inspectItem.getItemType()); | ||
106 | inspectionItem.setInspectionInfoId (inspectionInfo.getId()); | ||
107 | dangerInspectionItemMapper.insert(inspectionItem); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | // inspectInfoMapper. | ||
113 | |||
114 | //this.baseMapper.batchSaveInspectionInfo(dangerInspection); | ||
115 | // 批量插入检查选项集合 | ||
116 | //this.baseMapper.batchSaveInspectionItem(dangerInspection); | ||
117 | /* LambdaQueryWrapper<DangerInspectItem> queryItemWrapper = new LambdaQueryWrapper<DangerInspectItem>(); | ||
118 | queryItemWrapper.eq(DangerInspectItem::getDangerId, dangerId); | ||
119 | List<DangerInspectItem> inspectItemList = inspectItemMapper.selectList(queryItemWrapper); | ||
120 | if(inspectItemList != null && !inspectItemList.isEmpty()){ | ||
121 | DangerInspectionItem inspectionItem = null; | ||
122 | |||
123 | for(DangerInspectItem inspectItem : inspectItemList){ | ||
124 | inspectionItem = new DangerInspectionItem(); | ||
125 | // ( depart_id , user_id, danger_id , inspect_obj_id,inspect_name,inspect_standard , inspect_method,report_user, ) | ||
126 | inspectionItem.setInspectObjId( inspectItem.getInspectObjId() ) ; | ||
127 | inspectionItem.setItemName( inspectItem.getItemName()); | ||
128 | inspectionItem.setItemType( inspectItem.getItemType()); | ||
129 | inspectionItem.setUserId(userId); | ||
130 | dangerInspectionItemMapper.insert(inspectionItem); | ||
131 | } | ||
132 | }*/ | ||
133 | // 添加检查对象的检查项目 | ||
134 | } | ||
135 | |||
136 | List<DangerInspectionInfo> inspectionInfoList = queryInspectionInfoByDangerId( dangerId ,userId); | ||
137 | dangerInspection.setInspectionInfoList( inspectionInfoList ) ; | ||
138 | return dangerInspection; | ||
139 | } | ||
140 | |||
141 | /*** | ||
142 | * 根据检查点编号,获取用户的巡检检查集合 | ||
143 | * @param dangerId | ||
144 | * @param userId | ||
145 | * @return | ||
146 | */ | ||
147 | public List<DangerInspectionInfo> queryInspectionInfoByDangerId(String dangerId ,String userId){ | ||
148 | LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>(); | ||
149 | queryWrapper.eq(DangerInspectionInfo::getReportUser, userId); | ||
150 | queryWrapper.eq(DangerInspectionInfo::getDangerId, dangerId); | ||
151 | queryWrapper.orderByAsc( DangerInspectionInfo::getCreateTime ); | ||
152 | List<DangerInspectionInfo> inspectionInfoList = dangerInspectionInfoMapper.selectList( queryWrapper) ; | ||
153 | |||
154 | return inspectionInfoList; | ||
155 | } | ||
156 | } |
-
请 注册 或 登录 后发表评论