kangwei: 风险点---移动端---风险点巡检--开始巡检
正在显示
20 个修改的文件
包含
1144 行增加
和
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
1 | package com.skua.modules.safe.controller; | ||
2 | |||
3 | import java.util.Arrays; | ||
4 | import java.util.List; | ||
5 | import java.util.Map; | ||
6 | import java.io.IOException; | ||
7 | import java.io.UnsupportedEncodingException; | ||
8 | import java.net.URLDecoder; | ||
9 | import javax.servlet.http.HttpServletRequest; | ||
10 | import javax.servlet.http.HttpServletResponse; | ||
11 | import com.skua.core.api.vo.Result; | ||
12 | import com.skua.core.aspect.annotation.AutoLog; | ||
13 | import com.skua.core.context.BaseContextHandler; | ||
14 | import com.skua.core.query.QueryGenerator; | ||
15 | import com.skua.core.service.ISequenceService; | ||
16 | import com.skua.core.util.ConvertUtils; | ||
17 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
18 | import com.skua.modules.safe.service.IDangerInspectionInfoService; | ||
19 | import java.util.Date; | ||
20 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
21 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
22 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
23 | import lombok.extern.slf4j.Slf4j; | ||
24 | |||
25 | import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
27 | import org.jeecgframework.poi.excel.entity.ExportParams; | ||
28 | import org.jeecgframework.poi.excel.entity.ImportParams; | ||
29 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
30 | |||
31 | import org.springframework.beans.factory.annotation.Autowired; | ||
32 | import org.springframework.web.bind.annotation.*; | ||
33 | import org.springframework.web.multipart.MultipartFile; | ||
34 | import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
35 | import org.springframework.web.servlet.ModelAndView; | ||
36 | import com.alibaba.fastjson.JSON; | ||
37 | import io.swagger.annotations.Api; | ||
38 | import io.swagger.annotations.ApiOperation; | ||
39 | |||
40 | /** | ||
41 | * <pre> | ||
42 | * 巡检对象 | ||
43 | * </pre> | ||
44 | * @author 开发者姓名 | ||
45 | * @version V0.1, 开发时间 | ||
46 | */ | ||
47 | @Slf4j | ||
48 | @Api(tags="巡检对象") | ||
49 | @RestController("webDangerInspectionInfoController") | ||
50 | @RequestMapping("/web/safe/dangerInspectionInfo") | ||
51 | public class DangerInspectionInfoController { | ||
52 | @Autowired | ||
53 | private IDangerInspectionInfoService dangerInspectionInfoService; | ||
54 | |||
55 | /** | ||
56 | * <pre> | ||
57 | * 分页列表查询 | ||
58 | * </pre> | ||
59 | * @param dangerInspectionInfo | ||
60 | * @param pageNo | ||
61 | * @param pageSize | ||
62 | * @param req | ||
63 | * @return | ||
64 | * @author 开发者姓名, 开发时间 | ||
65 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
66 | */ | ||
67 | |||
68 | @AutoLog(value = "巡检对象-分页列表查询") | ||
69 | @ApiOperation(value="巡检对象-分页列表查询", notes="巡检对象-分页列表查询") | ||
70 | @GetMapping(value = "/list") | ||
71 | public Result<IPage<DangerInspectionInfo>> queryPageList(DangerInspectionInfo dangerInspectionInfo, | ||
72 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
73 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
74 | HttpServletRequest req) { | ||
75 | Result<IPage<DangerInspectionInfo>> result = new Result<IPage<DangerInspectionInfo>>(); | ||
76 | QueryWrapper<DangerInspectionInfo> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionInfo, req.getParameterMap()); | ||
77 | Page<DangerInspectionInfo> page = new Page<DangerInspectionInfo>(pageNo, pageSize); | ||
78 | IPage<DangerInspectionInfo> pageList = dangerInspectionInfoService.page(page, queryWrapper); | ||
79 | result.setSuccess(true); | ||
80 | result.setResult(pageList); | ||
81 | return result; | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * <pre> | ||
86 | * 添加 | ||
87 | * </pre> | ||
88 | * @param dangerInspectionInfo | ||
89 | * @return | ||
90 | * @author 开发者姓名, 开发时间 | ||
91 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
92 | */ | ||
93 | @AutoLog(value = "巡检对象-添加") | ||
94 | @ApiOperation(value="巡检对象-添加", notes="巡检对象-添加") | ||
95 | @PostMapping(value = "/add") | ||
96 | public Result<DangerInspectionInfo> add(@RequestBody DangerInspectionInfo dangerInspectionInfo) { | ||
97 | Result<DangerInspectionInfo> result = new Result<DangerInspectionInfo>(); | ||
98 | try { | ||
99 | dangerInspectionInfoService.save(dangerInspectionInfo); | ||
100 | result.success("添加成功!"); | ||
101 | } catch (Exception e) { | ||
102 | log.error(e.getMessage(),e); | ||
103 | result.error500("操作失败"); | ||
104 | } | ||
105 | return result; | ||
106 | } | ||
107 | /** | ||
108 | * <pre> | ||
109 | * 编辑 | ||
110 | * </pre> | ||
111 | * @param dangerInspectionInfo | ||
112 | * @return | ||
113 | * @author 开发者姓名, 开发时间 | ||
114 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
115 | */ | ||
116 | @AutoLog(value = "巡检对象-编辑") | ||
117 | @ApiOperation(value="巡检对象-编辑", notes="巡检对象-编辑") | ||
118 | @PutMapping(value = "/edit") | ||
119 | public Result<DangerInspectionInfo> edit(@RequestBody DangerInspectionInfo dangerInspectionInfo) { | ||
120 | Result<DangerInspectionInfo> result = new Result<DangerInspectionInfo>(); | ||
121 | DangerInspectionInfo dangerInspectionInfoEntity = dangerInspectionInfoService.getById(dangerInspectionInfo.getId()); | ||
122 | if(dangerInspectionInfoEntity==null) { | ||
123 | result.error500("未找到对应实体"); | ||
124 | }else { | ||
125 | boolean ok = dangerInspectionInfoService.updateById(dangerInspectionInfo); | ||
126 | //TODO 返回false说明什么? | ||
127 | if(ok) { | ||
128 | result.success("修改成功!"); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | return result; | ||
133 | } | ||
134 | /** | ||
135 | * <pre> | ||
136 | * 通过id删除 | ||
137 | * </pre> | ||
138 | * @param id | ||
139 | * @return | ||
140 | * @author 开发者姓名, 开发时间 | ||
141 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
142 | */ | ||
143 | @AutoLog(value = "巡检对象-通过id删除") | ||
144 | @ApiOperation(value="巡检对象-通过id删除", notes="巡检对象-通过id删除") | ||
145 | @DeleteMapping(value = "/delete") | ||
146 | public Result<?> delete(@RequestParam(name="id",required=true) String id) { | ||
147 | try { | ||
148 | dangerInspectionInfoService.removeById(id); | ||
149 | } catch (Exception e) { | ||
150 | log.error("删除失败",e.getMessage()); | ||
151 | return Result.error("删除失败!"); | ||
152 | } | ||
153 | return Result.ok("删除成功!"); | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * <pre> | ||
158 | * 批量删除 | ||
159 | * </pre> | ||
160 | * @param ids | ||
161 | * @return | ||
162 | * @author 开发者姓名, 开发时间 | ||
163 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
164 | */ | ||
165 | @AutoLog(value = "巡检对象-批量删除") | ||
166 | @ApiOperation(value="巡检对象-批量删除", notes="巡检对象-批量删除") | ||
167 | @DeleteMapping(value = "/deleteBatch") | ||
168 | public Result<DangerInspectionInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
169 | Result<DangerInspectionInfo> result = new Result<DangerInspectionInfo>(); | ||
170 | if(ids==null || "".equals(ids.trim())) { | ||
171 | result.error500("参数不识别!"); | ||
172 | }else { | ||
173 | this.dangerInspectionInfoService.removeByIds(Arrays.asList(ids.split(","))); | ||
174 | result.success("删除成功!"); | ||
175 | } | ||
176 | return result; | ||
177 | } | ||
178 | /** | ||
179 | * <pre> | ||
180 | * 通过id查询 | ||
181 | * </pre> | ||
182 | * @param id | ||
183 | * @return | ||
184 | * @author 开发者姓名, 开发时间 | ||
185 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
186 | */ | ||
187 | @AutoLog(value = "巡检对象-通过id查询") | ||
188 | @ApiOperation(value="巡检对象-通过id查询", notes="巡检对象-通过id查询") | ||
189 | @GetMapping(value = "/queryById") | ||
190 | public Result<DangerInspectionInfo> queryById(@RequestParam(name="id",required=true) String id) { | ||
191 | Result<DangerInspectionInfo> result = new Result<DangerInspectionInfo>(); | ||
192 | DangerInspectionInfo dangerInspectionInfo = dangerInspectionInfoService.getById(id); | ||
193 | if(dangerInspectionInfo==null) { | ||
194 | result.error500("未找到对应实体"); | ||
195 | }else { | ||
196 | result.setResult(dangerInspectionInfo); | ||
197 | result.setSuccess(true); | ||
198 | } | ||
199 | return result; | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * <pre> | ||
204 | * 导出excel | ||
205 | * </pre> | ||
206 | * @param request | ||
207 | * @param response | ||
208 | * @return | ||
209 | * @author 开发者姓名, 开发时间 | ||
210 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
211 | */ | ||
212 | |||
213 | @RequestMapping(value = "/exportXls") | ||
214 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | ||
215 | // Step.1 组装查询条件 | ||
216 | QueryWrapper<DangerInspectionInfo> queryWrapper = null; | ||
217 | try { | ||
218 | String paramsStr = request.getParameter("paramsStr"); | ||
219 | if (ConvertUtils.isNotEmpty(paramsStr)) { | ||
220 | String deString = URLDecoder.decode(paramsStr, "UTF-8"); | ||
221 | DangerInspectionInfo dangerInspectionInfo = JSON.parseObject(deString, DangerInspectionInfo.class); | ||
222 | queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionInfo, request.getParameterMap()); | ||
223 | } | ||
224 | } catch (UnsupportedEncodingException e) { | ||
225 | e.printStackTrace(); | ||
226 | } | ||
227 | |||
228 | //Step.2 AutoPoi 导出Excel | ||
229 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
230 | List<DangerInspectionInfo> pageList = dangerInspectionInfoService.list(queryWrapper); | ||
231 | //导出文件名称 | ||
232 | mv.addObject(NormalExcelConstants.FILE_NAME, "巡检对象列表"); | ||
233 | mv.addObject(NormalExcelConstants.CLASS, DangerInspectionInfo.class); | ||
234 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("巡检对象列表数据", "导出人:Jeecg", "导出信息")); | ||
235 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
236 | return mv; | ||
237 | } | ||
238 | |||
239 | /** | ||
240 | * <pre> | ||
241 | * 通过excel导入数据 | ||
242 | * </pre> | ||
243 | * @param request | ||
244 | * @param response | ||
245 | * @return | ||
246 | * @author 开发者姓名, 开发时间 | ||
247 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
248 | */ | ||
249 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
250 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
251 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | ||
252 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | ||
253 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | ||
254 | MultipartFile file = entity.getValue();// 获取上传文件对象 | ||
255 | ImportParams params = new ImportParams(); | ||
256 | params.setTitleRows(2); | ||
257 | params.setHeadRows(1); | ||
258 | params.setNeedSave(true); | ||
259 | try { | ||
260 | List<DangerInspectionInfo> listDangerInspectionInfos = ExcelImportUtil.importExcel(file.getInputStream(), DangerInspectionInfo.class, params); | ||
261 | dangerInspectionInfoService.saveBatch(listDangerInspectionInfos); | ||
262 | return Result.ok("文件导入成功!数据行数:" + listDangerInspectionInfos.size()); | ||
263 | } catch (Exception e) { | ||
264 | log.error(e.getMessage(),e); | ||
265 | return Result.error("文件导入失败:"+e.getMessage()); | ||
266 | } finally { | ||
267 | try { | ||
268 | file.getInputStream().close(); | ||
269 | } catch (IOException e) { | ||
270 | e.printStackTrace(); | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | return Result.ok("文件导入失败!"); | ||
275 | } | ||
276 | |||
277 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerInspectionRecordController.java
0 → 100644
1 | package com.skua.modules.safe.controller; | ||
2 | |||
3 | import java.util.Arrays; | ||
4 | import java.util.List; | ||
5 | import java.util.Map; | ||
6 | import java.io.IOException; | ||
7 | import java.io.UnsupportedEncodingException; | ||
8 | import java.net.URLDecoder; | ||
9 | import javax.servlet.http.HttpServletRequest; | ||
10 | import javax.servlet.http.HttpServletResponse; | ||
11 | import com.skua.core.api.vo.Result; | ||
12 | import com.skua.core.aspect.annotation.AutoLog; | ||
13 | import com.skua.core.context.BaseContextHandler; | ||
14 | import com.skua.core.query.QueryGenerator; | ||
15 | import com.skua.core.service.ISequenceService; | ||
16 | import com.skua.core.util.ConvertUtils; | ||
17 | import com.skua.modules.safe.entity.DangerInspectionRecord; | ||
18 | import com.skua.modules.safe.service.IDangerInspectionRecordService; | ||
19 | import java.util.Date; | ||
20 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
21 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
22 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
23 | import lombok.extern.slf4j.Slf4j; | ||
24 | |||
25 | import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
27 | import org.jeecgframework.poi.excel.entity.ExportParams; | ||
28 | import org.jeecgframework.poi.excel.entity.ImportParams; | ||
29 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
30 | |||
31 | import org.springframework.beans.factory.annotation.Autowired; | ||
32 | import org.springframework.web.bind.annotation.*; | ||
33 | import org.springframework.web.multipart.MultipartFile; | ||
34 | import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
35 | import org.springframework.web.servlet.ModelAndView; | ||
36 | import com.alibaba.fastjson.JSON; | ||
37 | import io.swagger.annotations.Api; | ||
38 | import io.swagger.annotations.ApiOperation; | ||
39 | |||
40 | /** | ||
41 | * <pre> | ||
42 | * 巡检记录 | ||
43 | * </pre> | ||
44 | * @author 开发者姓名 | ||
45 | * @version V0.1, 开发时间 | ||
46 | */ | ||
47 | @Slf4j | ||
48 | @Api(tags="巡检记录") | ||
49 | @RestController("webDangerInspectionRecordController") | ||
50 | @RequestMapping("/web/safe/dangerInspectionRecord") | ||
51 | public class DangerInspectionRecordController { | ||
52 | @Autowired | ||
53 | private IDangerInspectionRecordService dangerInspectionRecordService; | ||
54 | |||
55 | /** | ||
56 | * <pre> | ||
57 | * 分页列表查询 | ||
58 | * </pre> | ||
59 | * @param dangerInspectionRecord | ||
60 | * @param pageNo | ||
61 | * @param pageSize | ||
62 | * @param req | ||
63 | * @return | ||
64 | * @author 开发者姓名, 开发时间 | ||
65 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
66 | */ | ||
67 | |||
68 | @AutoLog(value = "巡检记录-分页列表查询") | ||
69 | @ApiOperation(value="巡检记录-分页列表查询", notes="巡检记录-分页列表查询") | ||
70 | @GetMapping(value = "/list") | ||
71 | public Result<IPage<DangerInspectionRecord>> queryPageList(DangerInspectionRecord dangerInspectionRecord, | ||
72 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
73 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
74 | HttpServletRequest req) { | ||
75 | Result<IPage<DangerInspectionRecord>> result = new Result<IPage<DangerInspectionRecord>>(); | ||
76 | QueryWrapper<DangerInspectionRecord> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionRecord, req.getParameterMap()); | ||
77 | Page<DangerInspectionRecord> page = new Page<DangerInspectionRecord>(pageNo, pageSize); | ||
78 | IPage<DangerInspectionRecord> pageList = dangerInspectionRecordService.page(page, queryWrapper); | ||
79 | result.setSuccess(true); | ||
80 | result.setResult(pageList); | ||
81 | return result; | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * <pre> | ||
86 | * 添加 | ||
87 | * </pre> | ||
88 | * @param dangerInspectionRecord | ||
89 | * @return | ||
90 | * @author 开发者姓名, 开发时间 | ||
91 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
92 | */ | ||
93 | @AutoLog(value = "巡检记录-添加") | ||
94 | @ApiOperation(value="巡检记录-添加", notes="巡检记录-添加") | ||
95 | @PostMapping(value = "/add") | ||
96 | public Result<DangerInspectionRecord> add(@RequestBody DangerInspectionRecord dangerInspectionRecord) { | ||
97 | Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>(); | ||
98 | try { | ||
99 | dangerInspectionRecordService.save(dangerInspectionRecord); | ||
100 | result.success("添加成功!"); | ||
101 | } catch (Exception e) { | ||
102 | log.error(e.getMessage(),e); | ||
103 | result.error500("操作失败"); | ||
104 | } | ||
105 | return result; | ||
106 | } | ||
107 | /** | ||
108 | * <pre> | ||
109 | * 编辑 | ||
110 | * </pre> | ||
111 | * @param dangerInspectionRecord | ||
112 | * @return | ||
113 | * @author 开发者姓名, 开发时间 | ||
114 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
115 | */ | ||
116 | @AutoLog(value = "巡检记录-编辑") | ||
117 | @ApiOperation(value="巡检记录-编辑", notes="巡检记录-编辑") | ||
118 | @PutMapping(value = "/edit") | ||
119 | public Result<DangerInspectionRecord> edit(@RequestBody DangerInspectionRecord dangerInspectionRecord) { | ||
120 | Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>(); | ||
121 | DangerInspectionRecord dangerInspectionRecordEntity = dangerInspectionRecordService.getById(dangerInspectionRecord.getId()); | ||
122 | if(dangerInspectionRecordEntity==null) { | ||
123 | result.error500("未找到对应实体"); | ||
124 | }else { | ||
125 | boolean ok = dangerInspectionRecordService.updateById(dangerInspectionRecord); | ||
126 | //TODO 返回false说明什么? | ||
127 | if(ok) { | ||
128 | result.success("修改成功!"); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | return result; | ||
133 | } | ||
134 | /** | ||
135 | * <pre> | ||
136 | * 通过id删除 | ||
137 | * </pre> | ||
138 | * @param id | ||
139 | * @return | ||
140 | * @author 开发者姓名, 开发时间 | ||
141 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
142 | */ | ||
143 | @AutoLog(value = "巡检记录-通过id删除") | ||
144 | @ApiOperation(value="巡检记录-通过id删除", notes="巡检记录-通过id删除") | ||
145 | @DeleteMapping(value = "/delete") | ||
146 | public Result<?> delete(@RequestParam(name="id",required=true) String id) { | ||
147 | try { | ||
148 | dangerInspectionRecordService.removeById(id); | ||
149 | } catch (Exception e) { | ||
150 | log.error("删除失败",e.getMessage()); | ||
151 | return Result.error("删除失败!"); | ||
152 | } | ||
153 | return Result.ok("删除成功!"); | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * <pre> | ||
158 | * 批量删除 | ||
159 | * </pre> | ||
160 | * @param ids | ||
161 | * @return | ||
162 | * @author 开发者姓名, 开发时间 | ||
163 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
164 | */ | ||
165 | @AutoLog(value = "巡检记录-批量删除") | ||
166 | @ApiOperation(value="巡检记录-批量删除", notes="巡检记录-批量删除") | ||
167 | @DeleteMapping(value = "/deleteBatch") | ||
168 | public Result<DangerInspectionRecord> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
169 | Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>(); | ||
170 | if(ids==null || "".equals(ids.trim())) { | ||
171 | result.error500("参数不识别!"); | ||
172 | }else { | ||
173 | this.dangerInspectionRecordService.removeByIds(Arrays.asList(ids.split(","))); | ||
174 | result.success("删除成功!"); | ||
175 | } | ||
176 | return result; | ||
177 | } | ||
178 | /** | ||
179 | * <pre> | ||
180 | * 通过id查询 | ||
181 | * </pre> | ||
182 | * @param id | ||
183 | * @return | ||
184 | * @author 开发者姓名, 开发时间 | ||
185 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
186 | */ | ||
187 | @AutoLog(value = "巡检记录-通过id查询") | ||
188 | @ApiOperation(value="巡检记录-通过id查询", notes="巡检记录-通过id查询") | ||
189 | @GetMapping(value = "/queryById") | ||
190 | public Result<DangerInspectionRecord> queryById(@RequestParam(name="id",required=true) String id) { | ||
191 | Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>(); | ||
192 | DangerInspectionRecord dangerInspectionRecord = dangerInspectionRecordService.getById(id); | ||
193 | if(dangerInspectionRecord==null) { | ||
194 | result.error500("未找到对应实体"); | ||
195 | }else { | ||
196 | result.setResult(dangerInspectionRecord); | ||
197 | result.setSuccess(true); | ||
198 | } | ||
199 | return result; | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * <pre> | ||
204 | * 导出excel | ||
205 | * </pre> | ||
206 | * @param request | ||
207 | * @param response | ||
208 | * @return | ||
209 | * @author 开发者姓名, 开发时间 | ||
210 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
211 | */ | ||
212 | |||
213 | @RequestMapping(value = "/exportXls") | ||
214 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | ||
215 | // Step.1 组装查询条件 | ||
216 | QueryWrapper<DangerInspectionRecord> queryWrapper = null; | ||
217 | try { | ||
218 | String paramsStr = request.getParameter("paramsStr"); | ||
219 | if (ConvertUtils.isNotEmpty(paramsStr)) { | ||
220 | String deString = URLDecoder.decode(paramsStr, "UTF-8"); | ||
221 | DangerInspectionRecord dangerInspectionRecord = JSON.parseObject(deString, DangerInspectionRecord.class); | ||
222 | queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionRecord, request.getParameterMap()); | ||
223 | } | ||
224 | } catch (UnsupportedEncodingException e) { | ||
225 | e.printStackTrace(); | ||
226 | } | ||
227 | |||
228 | //Step.2 AutoPoi 导出Excel | ||
229 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
230 | List<DangerInspectionRecord> pageList = dangerInspectionRecordService.list(queryWrapper); | ||
231 | //导出文件名称 | ||
232 | mv.addObject(NormalExcelConstants.FILE_NAME, "巡检记录列表"); | ||
233 | mv.addObject(NormalExcelConstants.CLASS, DangerInspectionRecord.class); | ||
234 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("巡检记录列表数据", "导出人:Jeecg", "导出信息")); | ||
235 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
236 | return mv; | ||
237 | } | ||
238 | |||
239 | /** | ||
240 | * <pre> | ||
241 | * 通过excel导入数据 | ||
242 | * </pre> | ||
243 | * @param request | ||
244 | * @param response | ||
245 | * @return | ||
246 | * @author 开发者姓名, 开发时间 | ||
247 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
248 | */ | ||
249 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
250 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
251 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | ||
252 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | ||
253 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | ||
254 | MultipartFile file = entity.getValue();// 获取上传文件对象 | ||
255 | ImportParams params = new ImportParams(); | ||
256 | params.setTitleRows(2); | ||
257 | params.setHeadRows(1); | ||
258 | params.setNeedSave(true); | ||
259 | try { | ||
260 | List<DangerInspectionRecord> listDangerInspectionRecords = ExcelImportUtil.importExcel(file.getInputStream(), DangerInspectionRecord.class, params); | ||
261 | dangerInspectionRecordService.saveBatch(listDangerInspectionRecords); | ||
262 | return Result.ok("文件导入成功!数据行数:" + listDangerInspectionRecords.size()); | ||
263 | } catch (Exception e) { | ||
264 | log.error(e.getMessage(),e); | ||
265 | return Result.error("文件导入失败:"+e.getMessage()); | ||
266 | } finally { | ||
267 | try { | ||
268 | file.getInputStream().close(); | ||
269 | } catch (IOException e) { | ||
270 | e.printStackTrace(); | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | return Result.ok("文件导入失败!"); | ||
275 | } | ||
276 | |||
277 | } |
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 | } |
-
请 注册 或 登录 后发表评论