Merge remote-tracking branch 'origin/master' into master
正在显示
19 个修改的文件
包含
93 行增加
和
853 行删除
... | @@ -99,7 +99,7 @@ public class DangerInspectInfoController { | ... | @@ -99,7 +99,7 @@ public class DangerInspectInfoController { |
99 | @AutoLog(value = "检查内容对象-添加") | 99 | @AutoLog(value = "检查内容对象-添加") |
100 | @ApiOperation(value="检查内容对象-添加", notes="检查内容对象-添加") | 100 | @ApiOperation(value="检查内容对象-添加", notes="检查内容对象-添加") |
101 | @PostMapping(value = "/add") | 101 | @PostMapping(value = "/add") |
102 | public Result<DangerInspectInfo> add(@RequestBody DangerInspectInfoVO dangerInspectInfo) { | 102 | public Result<DangerInspectInfo> add(@RequestBody DangerInspectInfo dangerInspectInfo) { |
103 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); | 103 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); |
104 | try { | 104 | try { |
105 | dangerInspectInfoService.saveDangerInspectInfo(dangerInspectInfo); | 105 | dangerInspectInfoService.saveDangerInspectInfo(dangerInspectInfo); |
... | @@ -122,7 +122,7 @@ public class DangerInspectInfoController { | ... | @@ -122,7 +122,7 @@ public class DangerInspectInfoController { |
122 | @AutoLog(value = "检查内容对象-编辑") | 122 | @AutoLog(value = "检查内容对象-编辑") |
123 | @ApiOperation(value="检查内容对象-编辑", notes="检查内容对象-编辑") | 123 | @ApiOperation(value="检查内容对象-编辑", notes="检查内容对象-编辑") |
124 | @PutMapping(value = "/edit") | 124 | @PutMapping(value = "/edit") |
125 | public Result<DangerInspectInfo> edit(@RequestBody DangerInspectInfoVO dangerInspectInfo) { | 125 | public Result<DangerInspectInfo> edit(@RequestBody DangerInspectInfo dangerInspectInfo) { |
126 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); | 126 | Result<DangerInspectInfo> result = new Result<DangerInspectInfo>(); |
127 | DangerInspectInfo dangerInspectInfoEntity = dangerInspectInfoService.getById(dangerInspectInfo.getId()); | 127 | DangerInspectInfo dangerInspectInfoEntity = dangerInspectInfoService.getById(dangerInspectInfo.getId()); |
128 | if(dangerInspectInfoEntity==null) { | 128 | if(dangerInspectInfoEntity==null) { | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerInspectionController.java
deleted
100644 → 0
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.DangerInspection; | ||
18 | import com.skua.modules.safe.service.IDangerInspectionService; | ||
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("webDangerInspectionController") | ||
50 | @RequestMapping("/web/safe/dangerInspection") | ||
51 | public class DangerInspectionController { | ||
52 | @Autowired | ||
53 | private IDangerInspectionService dangerInspectionService; | ||
54 | |||
55 | /** | ||
56 | * <pre> | ||
57 | * 分页列表查询 | ||
58 | * </pre> | ||
59 | * @param dangerInspection | ||
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<DangerInspection>> queryPageList(DangerInspection dangerInspection, | ||
72 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
73 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
74 | HttpServletRequest req) { | ||
75 | Result<IPage<DangerInspection>> result = new Result<IPage<DangerInspection>>(); | ||
76 | QueryWrapper<DangerInspection> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspection, req.getParameterMap()); | ||
77 | Page<DangerInspection> page = new Page<DangerInspection>(pageNo, pageSize); | ||
78 | queryWrapper.eq("danger_id",dangerInspection.getDangerId()); | ||
79 | queryWrapper.orderByDesc("create_time"); | ||
80 | |||
81 | IPage<DangerInspection> pageList = dangerInspectionService.page(page, queryWrapper); | ||
82 | |||
83 | |||
84 | result.setSuccess(true); | ||
85 | result.setResult(pageList); | ||
86 | return result; | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * <pre> | ||
91 | * 添加 | ||
92 | * </pre> | ||
93 | * @param dangerInspection | ||
94 | * @return | ||
95 | * @author 开发者姓名, 开发时间 | ||
96 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
97 | */ | ||
98 | @AutoLog(value = "风险巡检-添加") | ||
99 | @ApiOperation(value="风险巡检-添加", notes="风险巡检-添加") | ||
100 | @PostMapping(value = "/add") | ||
101 | public Result<DangerInspection> add(@RequestBody DangerInspection dangerInspection) { | ||
102 | Result<DangerInspection> result = new Result<DangerInspection>(); | ||
103 | try { | ||
104 | dangerInspectionService.save(dangerInspection); | ||
105 | result.success("添加成功!"); | ||
106 | } catch (Exception e) { | ||
107 | log.error(e.getMessage(),e); | ||
108 | result.error500("操作失败"); | ||
109 | } | ||
110 | return result; | ||
111 | } | ||
112 | /** | ||
113 | * <pre> | ||
114 | * 编辑 | ||
115 | * </pre> | ||
116 | * @param dangerInspection | ||
117 | * @return | ||
118 | * @author 开发者姓名, 开发时间 | ||
119 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
120 | */ | ||
121 | @AutoLog(value = "风险巡检-编辑") | ||
122 | @ApiOperation(value="风险巡检-编辑", notes="风险巡检-编辑") | ||
123 | @PutMapping(value = "/edit") | ||
124 | public Result<DangerInspection> edit(@RequestBody DangerInspection dangerInspection) { | ||
125 | Result<DangerInspection> result = new Result<DangerInspection>(); | ||
126 | DangerInspection dangerInspectionEntity = dangerInspectionService.getById(dangerInspection.getId()); | ||
127 | if(dangerInspectionEntity==null) { | ||
128 | result.error500("未找到对应实体"); | ||
129 | }else { | ||
130 | boolean ok = dangerInspectionService.updateById(dangerInspection); | ||
131 | //TODO 返回false说明什么? | ||
132 | if(ok) { | ||
133 | result.success("修改成功!"); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | return result; | ||
138 | } | ||
139 | /** | ||
140 | * <pre> | ||
141 | * 通过id删除 | ||
142 | * </pre> | ||
143 | * @param id | ||
144 | * @return | ||
145 | * @author 开发者姓名, 开发时间 | ||
146 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
147 | */ | ||
148 | @AutoLog(value = "风险巡检-通过id删除") | ||
149 | @ApiOperation(value="风险巡检-通过id删除", notes="风险巡检-通过id删除") | ||
150 | @DeleteMapping(value = "/delete") | ||
151 | public Result<?> delete(@RequestParam(name="id",required=true) String id) { | ||
152 | try { | ||
153 | dangerInspectionService.removeById(id); | ||
154 | } catch (Exception e) { | ||
155 | log.error("删除失败",e.getMessage()); | ||
156 | return Result.error("删除失败!"); | ||
157 | } | ||
158 | return Result.ok("删除成功!"); | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * <pre> | ||
163 | * 批量删除 | ||
164 | * </pre> | ||
165 | * @param ids | ||
166 | * @return | ||
167 | * @author 开发者姓名, 开发时间 | ||
168 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
169 | */ | ||
170 | @AutoLog(value = "风险巡检-批量删除") | ||
171 | @ApiOperation(value="风险巡检-批量删除", notes="风险巡检-批量删除") | ||
172 | @DeleteMapping(value = "/deleteBatch") | ||
173 | public Result<DangerInspection> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
174 | Result<DangerInspection> result = new Result<DangerInspection>(); | ||
175 | if(ids==null || "".equals(ids.trim())) { | ||
176 | result.error500("参数不识别!"); | ||
177 | }else { | ||
178 | this.dangerInspectionService.removeByIds(Arrays.asList(ids.split(","))); | ||
179 | result.success("删除成功!"); | ||
180 | } | ||
181 | return result; | ||
182 | } | ||
183 | /** | ||
184 | * <pre> | ||
185 | * 通过id查询 | ||
186 | * </pre> | ||
187 | * @param id | ||
188 | * @return | ||
189 | * @author 开发者姓名, 开发时间 | ||
190 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
191 | */ | ||
192 | @AutoLog(value = "风险巡检-通过id查询") | ||
193 | @ApiOperation(value="风险巡检-通过id查询", notes="风险巡检-通过id查询") | ||
194 | @GetMapping(value = "/queryById") | ||
195 | public Result<DangerInspection> queryById(@RequestParam(name="id",required=true) String id) { | ||
196 | Result<DangerInspection> result = new Result<DangerInspection>(); | ||
197 | DangerInspection dangerInspection = dangerInspectionService.getById(id); | ||
198 | if(dangerInspection==null) { | ||
199 | result.error500("未找到对应实体"); | ||
200 | }else { | ||
201 | result.setResult(dangerInspection); | ||
202 | result.setSuccess(true); | ||
203 | } | ||
204 | return result; | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * <pre> | ||
209 | * 导出excel | ||
210 | * </pre> | ||
211 | * @param request | ||
212 | * @param response | ||
213 | * @return | ||
214 | * @author 开发者姓名, 开发时间 | ||
215 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
216 | */ | ||
217 | |||
218 | @RequestMapping(value = "/exportXls") | ||
219 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | ||
220 | // Step.1 组装查询条件 | ||
221 | QueryWrapper<DangerInspection> queryWrapper = null; | ||
222 | try { | ||
223 | String paramsStr = request.getParameter("paramsStr"); | ||
224 | if (ConvertUtils.isNotEmpty(paramsStr)) { | ||
225 | String deString = URLDecoder.decode(paramsStr, "UTF-8"); | ||
226 | DangerInspection dangerInspection = JSON.parseObject(deString, DangerInspection.class); | ||
227 | queryWrapper = QueryGenerator.initQueryWrapper(dangerInspection, request.getParameterMap()); | ||
228 | } | ||
229 | } catch (UnsupportedEncodingException e) { | ||
230 | e.printStackTrace(); | ||
231 | } | ||
232 | |||
233 | //Step.2 AutoPoi 导出Excel | ||
234 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
235 | List<DangerInspection> pageList = dangerInspectionService.list(queryWrapper); | ||
236 | //导出文件名称 | ||
237 | mv.addObject(NormalExcelConstants.FILE_NAME, "风险巡检列表"); | ||
238 | mv.addObject(NormalExcelConstants.CLASS, DangerInspection.class); | ||
239 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("风险巡检列表数据", "导出人:Jeecg", "导出信息")); | ||
240 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
241 | return mv; | ||
242 | } | ||
243 | |||
244 | /** | ||
245 | * <pre> | ||
246 | * 通过excel导入数据 | ||
247 | * </pre> | ||
248 | * @param request | ||
249 | * @param response | ||
250 | * @return | ||
251 | * @author 开发者姓名, 开发时间 | ||
252 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
253 | */ | ||
254 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
255 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
256 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | ||
257 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | ||
258 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | ||
259 | MultipartFile file = entity.getValue();// 获取上传文件对象 | ||
260 | ImportParams params = new ImportParams(); | ||
261 | params.setTitleRows(2); | ||
262 | params.setHeadRows(1); | ||
263 | params.setNeedSave(true); | ||
264 | try { | ||
265 | List<DangerInspection> listDangerInspections = ExcelImportUtil.importExcel(file.getInputStream(), DangerInspection.class, params); | ||
266 | dangerInspectionService.saveBatch(listDangerInspections); | ||
267 | return Result.ok("文件导入成功!数据行数:" + listDangerInspections.size()); | ||
268 | } catch (Exception e) { | ||
269 | log.error(e.getMessage(),e); | ||
270 | return Result.error("文件导入失败:"+e.getMessage()); | ||
271 | } finally { | ||
272 | try { | ||
273 | file.getInputStream().close(); | ||
274 | } catch (IOException e) { | ||
275 | e.printStackTrace(); | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | return Result.ok("文件导入失败!"); | ||
280 | } | ||
281 | |||
282 | } |
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.DangerInspectionRecode; | ||
18 | import com.skua.modules.safe.service.IDangerInspectionRecodeService; | ||
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("webDangerInspectionRecodeController") | ||
50 | @RequestMapping("/web/safe/dangerInspectionRecode") | ||
51 | public class DangerInspectionRecodeController { | ||
52 | @Autowired | ||
53 | private IDangerInspectionRecodeService dangerInspectionRecodeService; | ||
54 | |||
55 | /** | ||
56 | * <pre> | ||
57 | * 分页列表查询 | ||
58 | * </pre> | ||
59 | * @param dangerInspectionRecode | ||
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<DangerInspectionRecode>> queryPageList(DangerInspectionRecode dangerInspectionRecode, | ||
72 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
73 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
74 | HttpServletRequest req) { | ||
75 | Result<IPage<DangerInspectionRecode>> result = new Result<IPage<DangerInspectionRecode>>(); | ||
76 | QueryWrapper<DangerInspectionRecode> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionRecode, req.getParameterMap()); | ||
77 | Page<DangerInspectionRecode> page = new Page<DangerInspectionRecode>(pageNo, pageSize); | ||
78 | queryWrapper.eq("danger_id",dangerInspectionRecode.getDangerId()); | ||
79 | queryWrapper.orderByDesc("create_time"); | ||
80 | IPage<DangerInspectionRecode> pageList = dangerInspectionRecodeService.page(page, queryWrapper); | ||
81 | result.setSuccess(true); | ||
82 | result.setResult(pageList); | ||
83 | return result; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * <pre> | ||
88 | * 添加 | ||
89 | * </pre> | ||
90 | * @param dangerInspectionRecode | ||
91 | * @return | ||
92 | * @author 开发者姓名, 开发时间 | ||
93 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
94 | */ | ||
95 | @AutoLog(value = "风险巡检记录-添加") | ||
96 | @ApiOperation(value="风险巡检记录-添加", notes="风险巡检记录-添加") | ||
97 | @PostMapping(value = "/add") | ||
98 | public Result<DangerInspectionRecode> add(@RequestBody DangerInspectionRecode dangerInspectionRecode) { | ||
99 | Result<DangerInspectionRecode> result = new Result<DangerInspectionRecode>(); | ||
100 | try { | ||
101 | dangerInspectionRecodeService.save(dangerInspectionRecode); | ||
102 | result.success("添加成功!"); | ||
103 | } catch (Exception e) { | ||
104 | log.error(e.getMessage(),e); | ||
105 | result.error500("操作失败"); | ||
106 | } | ||
107 | return result; | ||
108 | } | ||
109 | /** | ||
110 | * <pre> | ||
111 | * 编辑 | ||
112 | * </pre> | ||
113 | * @param dangerInspectionRecode | ||
114 | * @return | ||
115 | * @author 开发者姓名, 开发时间 | ||
116 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
117 | */ | ||
118 | @AutoLog(value = "风险巡检记录-编辑") | ||
119 | @ApiOperation(value="风险巡检记录-编辑", notes="风险巡检记录-编辑") | ||
120 | @PutMapping(value = "/edit") | ||
121 | public Result<DangerInspectionRecode> edit(@RequestBody DangerInspectionRecode dangerInspectionRecode) { | ||
122 | Result<DangerInspectionRecode> result = new Result<DangerInspectionRecode>(); | ||
123 | DangerInspectionRecode dangerInspectionRecodeEntity = dangerInspectionRecodeService.getById(dangerInspectionRecode.getId()); | ||
124 | if(dangerInspectionRecodeEntity==null) { | ||
125 | result.error500("未找到对应实体"); | ||
126 | }else { | ||
127 | boolean ok = dangerInspectionRecodeService.updateById(dangerInspectionRecode); | ||
128 | //TODO 返回false说明什么? | ||
129 | if(ok) { | ||
130 | result.success("修改成功!"); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | return result; | ||
135 | } | ||
136 | /** | ||
137 | * <pre> | ||
138 | * 通过id删除 | ||
139 | * </pre> | ||
140 | * @param id | ||
141 | * @return | ||
142 | * @author 开发者姓名, 开发时间 | ||
143 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
144 | */ | ||
145 | @AutoLog(value = "风险巡检记录-通过id删除") | ||
146 | @ApiOperation(value="风险巡检记录-通过id删除", notes="风险巡检记录-通过id删除") | ||
147 | @DeleteMapping(value = "/delete") | ||
148 | public Result<?> delete(@RequestParam(name="id",required=true) String id) { | ||
149 | try { | ||
150 | dangerInspectionRecodeService.removeById(id); | ||
151 | } catch (Exception e) { | ||
152 | log.error("删除失败",e.getMessage()); | ||
153 | return Result.error("删除失败!"); | ||
154 | } | ||
155 | return Result.ok("删除成功!"); | ||
156 | } | ||
157 | |||
158 | /** | ||
159 | * <pre> | ||
160 | * 批量删除 | ||
161 | * </pre> | ||
162 | * @param ids | ||
163 | * @return | ||
164 | * @author 开发者姓名, 开发时间 | ||
165 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
166 | */ | ||
167 | @AutoLog(value = "风险巡检记录-批量删除") | ||
168 | @ApiOperation(value="风险巡检记录-批量删除", notes="风险巡检记录-批量删除") | ||
169 | @DeleteMapping(value = "/deleteBatch") | ||
170 | public Result<DangerInspectionRecode> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
171 | Result<DangerInspectionRecode> result = new Result<DangerInspectionRecode>(); | ||
172 | if(ids==null || "".equals(ids.trim())) { | ||
173 | result.error500("参数不识别!"); | ||
174 | }else { | ||
175 | this.dangerInspectionRecodeService.removeByIds(Arrays.asList(ids.split(","))); | ||
176 | result.success("删除成功!"); | ||
177 | } | ||
178 | return result; | ||
179 | } | ||
180 | /** | ||
181 | * <pre> | ||
182 | * 通过id查询 | ||
183 | * </pre> | ||
184 | * @param id | ||
185 | * @return | ||
186 | * @author 开发者姓名, 开发时间 | ||
187 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
188 | */ | ||
189 | @AutoLog(value = "风险巡检记录-通过id查询") | ||
190 | @ApiOperation(value="风险巡检记录-通过id查询", notes="风险巡检记录-通过id查询") | ||
191 | @GetMapping(value = "/queryById") | ||
192 | public Result<DangerInspectionRecode> queryById(@RequestParam(name="id",required=true) String id) { | ||
193 | Result<DangerInspectionRecode> result = new Result<DangerInspectionRecode>(); | ||
194 | DangerInspectionRecode dangerInspectionRecode = dangerInspectionRecodeService.getById(id); | ||
195 | if(dangerInspectionRecode==null) { | ||
196 | result.error500("未找到对应实体"); | ||
197 | }else { | ||
198 | result.setResult(dangerInspectionRecode); | ||
199 | result.setSuccess(true); | ||
200 | } | ||
201 | return result; | ||
202 | } | ||
203 | |||
204 | /** | ||
205 | * <pre> | ||
206 | * 导出excel | ||
207 | * </pre> | ||
208 | * @param request | ||
209 | * @param response | ||
210 | * @return | ||
211 | * @author 开发者姓名, 开发时间 | ||
212 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
213 | */ | ||
214 | |||
215 | @RequestMapping(value = "/exportXls") | ||
216 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | ||
217 | // Step.1 组装查询条件 | ||
218 | QueryWrapper<DangerInspectionRecode> queryWrapper = null; | ||
219 | try { | ||
220 | String paramsStr = request.getParameter("paramsStr"); | ||
221 | if (ConvertUtils.isNotEmpty(paramsStr)) { | ||
222 | String deString = URLDecoder.decode(paramsStr, "UTF-8"); | ||
223 | DangerInspectionRecode dangerInspectionRecode = JSON.parseObject(deString, DangerInspectionRecode.class); | ||
224 | queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionRecode, request.getParameterMap()); | ||
225 | } | ||
226 | } catch (UnsupportedEncodingException e) { | ||
227 | e.printStackTrace(); | ||
228 | } | ||
229 | |||
230 | //Step.2 AutoPoi 导出Excel | ||
231 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
232 | List<DangerInspectionRecode> pageList = dangerInspectionRecodeService.list(queryWrapper); | ||
233 | //导出文件名称 | ||
234 | mv.addObject(NormalExcelConstants.FILE_NAME, "风险巡检记录列表"); | ||
235 | mv.addObject(NormalExcelConstants.CLASS, DangerInspectionRecode.class); | ||
236 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("风险巡检记录列表数据", "导出人:Jeecg", "导出信息")); | ||
237 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
238 | return mv; | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * <pre> | ||
243 | * 通过excel导入数据 | ||
244 | * </pre> | ||
245 | * @param request | ||
246 | * @param response | ||
247 | * @return | ||
248 | * @author 开发者姓名, 开发时间 | ||
249 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
250 | */ | ||
251 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
252 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
253 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | ||
254 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | ||
255 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | ||
256 | MultipartFile file = entity.getValue();// 获取上传文件对象 | ||
257 | ImportParams params = new ImportParams(); | ||
258 | params.setTitleRows(2); | ||
259 | params.setHeadRows(1); | ||
260 | params.setNeedSave(true); | ||
261 | try { | ||
262 | List<DangerInspectionRecode> listDangerInspectionRecodes = ExcelImportUtil.importExcel(file.getInputStream(), DangerInspectionRecode.class, params); | ||
263 | dangerInspectionRecodeService.saveBatch(listDangerInspectionRecodes); | ||
264 | return Result.ok("文件导入成功!数据行数:" + listDangerInspectionRecodes.size()); | ||
265 | } catch (Exception e) { | ||
266 | log.error(e.getMessage(),e); | ||
267 | return Result.error("文件导入失败:"+e.getMessage()); | ||
268 | } finally { | ||
269 | try { | ||
270 | file.getInputStream().close(); | ||
271 | } catch (IOException e) { | ||
272 | e.printStackTrace(); | ||
273 | } | ||
274 | } | ||
275 | } | ||
276 | return Result.ok("文件导入失败!"); | ||
277 | } | ||
278 | |||
279 | } |
... | @@ -123,23 +123,23 @@ public class SafetyOffenceRecordController { | ... | @@ -123,23 +123,23 @@ public class SafetyOffenceRecordController { |
123 | Result<IPage<SafetyOffenceRecord>> result = new Result<IPage<SafetyOffenceRecord>>(); | 123 | Result<IPage<SafetyOffenceRecord>> result = new Result<IPage<SafetyOffenceRecord>>(); |
124 | 124 | ||
125 | Boolean flag = false; | 125 | Boolean flag = false; |
126 | /* String role_ah_id = sysConfigService.queryValueByKey("ROLE_AH_ADMIN");//安环管理员角色编号 | 126 | String role_ah_id = sysConfigService.queryValueByKey("ROLE_AH_ADMIN");//安环管理员角色编号 |
127 | String role_cz_id = sysConfigService.queryValueByKey("ROLE_CZ");//厂长角色编号 | 127 | String role_cz_id = sysConfigService.queryValueByKey("ROLE_CZ");//厂长角色编号 |
128 | String userRoleIds = BaseContextHandler.getRoles(); | 128 | String userRoleIds = BaseContextHandler.getRoles(); |
129 | 129 | ||
130 | safetyOffenceRecord.setDepartId( "0" );//屏蔽数据使用;非安环管理员、与厂长角色看不到数据 | 130 | safetyOffenceRecord.setDepartId( "0" );//屏蔽数据使用;非安环管理员、与厂长角色看不到数据 |
131 | safetyOffenceRecord.setReportType("1");//上报集团--默认 | ||
131 | 132 | ||
132 | //安装部长角色看集团类型的违法上报 | 133 | //安装部长角色看集团类型的违法上报 |
133 | if( userRoleIds != null && userRoleIds.contains( role_ah_id ) ){//判断安环管理员 | 134 | if( userRoleIds != null && userRoleIds.contains( role_ah_id ) ){//判断安环管理员 |
134 | safetyOffenceRecord.setDepartId( null ); | 135 | safetyOffenceRecord.setDepartId( null ); |
135 | safetyOffenceRecord.setReportType("1");//上报集团--默认 | ||
136 | flag = false; | 136 | flag = false; |
137 | } | 137 | } |
138 | if( userRoleIds != null && userRoleIds.contains( role_cz_id ) ){//判断 厂长 ,查询分管的所有长编号 | 138 | if( userRoleIds != null && userRoleIds.contains( role_cz_id ) ){//判断 厂长 ,查询分管的所有长编号 |
139 | safetyOffenceRecord.setDepartId( BaseContextHandler.getDeparts() );//BaseContextHandler.getRealDepartId() | 139 | safetyOffenceRecord.setDepartId( BaseContextHandler.getDeparts() );//BaseContextHandler.getRealDepartId() |
140 | safetyOffenceRecord.setReportType("2");//上报厂长 | 140 | safetyOffenceRecord.setReportType("2");//上报厂长 |
141 | flag = true; | 141 | flag = true; |
142 | }*/ | 142 | } |
143 | if(safetyOffenceRecord.getStatus() !=null && safetyOffenceRecord.getStatus().equals("0")){ | 143 | if(safetyOffenceRecord.getStatus() !=null && safetyOffenceRecord.getStatus().equals("0")){ |
144 | safetyOffenceRecord.setStatus(null);//默认全部 | 144 | safetyOffenceRecord.setStatus(null);//默认全部 |
145 | } | 145 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.skua.modules.safe.entity; | ... | @@ -2,6 +2,8 @@ package com.skua.modules.safe.entity; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | import java.util.Date; | 4 | import java.util.Date; |
5 | import java.util.List; | ||
6 | |||
5 | import com.baomidou.mybatisplus.annotation.IdType; | 7 | import com.baomidou.mybatisplus.annotation.IdType; |
6 | import com.baomidou.mybatisplus.annotation.TableId; | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
7 | import com.baomidou.mybatisplus.annotation.TableName; | 9 | import com.baomidou.mybatisplus.annotation.TableName; |
... | @@ -45,6 +47,8 @@ public class DangerInspectInfo { | ... | @@ -45,6 +47,8 @@ public class DangerInspectInfo { |
45 | @Excel(name = "检查方法", width = 15) | 47 | @Excel(name = "检查方法", width = 15) |
46 | @ApiModelProperty(value = "检查方法") | 48 | @ApiModelProperty(value = "检查方法") |
47 | private String inspectMethod; | 49 | private String inspectMethod; |
50 | |||
51 | |||
48 | /**备注*/ | 52 | /**备注*/ |
49 | @Excel(name = "备注", width = 15) | 53 | @Excel(name = "备注", width = 15) |
50 | @ApiModelProperty(value = "备注") | 54 | @ApiModelProperty(value = "备注") |
... | @@ -81,4 +85,7 @@ public class DangerInspectInfo { | ... | @@ -81,4 +85,7 @@ public class DangerInspectInfo { |
81 | @Excel(name = "删除标识,1有效,0删除", width = 15) | 85 | @Excel(name = "删除标识,1有效,0删除", width = 15) |
82 | @ApiModelProperty(value = "删除标识,1有效,0删除") | 86 | @ApiModelProperty(value = "删除标识,1有效,0删除") |
83 | private Integer delFlag; | 87 | private Integer delFlag; |
88 | |||
89 | |||
90 | |||
84 | } | 91 | } | ... | ... |
... | @@ -55,4 +55,9 @@ public class DangerInspectItem { | ... | @@ -55,4 +55,9 @@ public class DangerInspectItem { |
55 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | 55 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
56 | @ApiModelProperty(value = "创建时间") | 56 | @ApiModelProperty(value = "创建时间") |
57 | private Date createTime; | 57 | private Date createTime; |
58 | |||
59 | |||
60 | @TableField(exist=false) | ||
61 | @ApiModelProperty(value = "创建时间") | ||
62 | private String itemValue;// | ||
58 | } | 63 | } | ... | ... |
1 | package com.skua.modules.safe.entity; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import java.util.Date; | ||
5 | import com.baomidou.mybatisplus.annotation.IdType; | ||
6 | import com.baomidou.mybatisplus.annotation.TableId; | ||
7 | import com.baomidou.mybatisplus.annotation.TableName; | ||
8 | import com.baomidou.mybatisplus.annotation.TableField; | ||
9 | import io.swagger.annotations.ApiModel; | ||
10 | import io.swagger.annotations.ApiModelProperty; | ||
11 | import lombok.Data; | ||
12 | import lombok.EqualsAndHashCode; | ||
13 | import lombok.experimental.Accessors; | ||
14 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
15 | import org.springframework.format.annotation.DateTimeFormat; | ||
16 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
17 | |||
18 | /** | ||
19 | * 风险巡检 | ||
20 | */ | ||
21 | @Data | ||
22 | @TableName("danger_inspection") | ||
23 | @EqualsAndHashCode(callSuper = false) | ||
24 | @Accessors(chain = true) | ||
25 | @ApiModel(value="danger_inspection对象", description="风险巡检") | ||
26 | public class DangerInspection { | ||
27 | |||
28 | /**id*/ | ||
29 | @TableId(type = IdType.ID_WORKER_STR) | ||
30 | @ApiModelProperty(value = "id") | ||
31 | private String id; | ||
32 | /**厂id*/ | ||
33 | @Excel(name = "厂id", width = 15) | ||
34 | @ApiModelProperty(value = "厂id") | ||
35 | private String departId; | ||
36 | /**风险等级编号*/ | ||
37 | @Excel(name = "风险等级编号", width = 15) | ||
38 | @ApiModelProperty(value = "风险等级编号") | ||
39 | private String dangerId; | ||
40 | /**上报人(用户id)*/ | ||
41 | @Excel(name = "上报人(用户id)", width = 15) | ||
42 | @ApiModelProperty(value = "上报人(用户id)") | ||
43 | private String reportUser; | ||
44 | /**上报时间*/ | ||
45 | @Excel(name = "上报时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
46 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
47 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
48 | @ApiModelProperty(value = "上报时间") | ||
49 | private Date reportDate; | ||
50 | /**巡检状态(0:未开始,1:开始,2:结束,3:作废)*/ | ||
51 | @Excel(name = "巡检状态(0:未开始,1:开始,2:结束,3:作废)", width = 15) | ||
52 | @ApiModelProperty(value = "巡检状态(0:未开始,1:开始,2:结束,3:作废)") | ||
53 | private String status; | ||
54 | /**备注*/ | ||
55 | @Excel(name = "备注", width = 15) | ||
56 | @ApiModelProperty(value = "备注") | ||
57 | private String remark; | ||
58 | /**创建人Id*/ | ||
59 | @Excel(name = "创建人Id", width = 15) | ||
60 | @ApiModelProperty(value = "创建人Id") | ||
61 | private String createBy; | ||
62 | /**上报时间*/ | ||
63 | @Excel(name = "上报时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
64 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
65 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
66 | @ApiModelProperty(value = "上报时间") | ||
67 | private Date createTime; | ||
68 | /**修改人Id*/ | ||
69 | @Excel(name = "修改人Id", width = 15) | ||
70 | @ApiModelProperty(value = "修改人Id") | ||
71 | private String updateBy; | ||
72 | /**修改时间*/ | ||
73 | @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
74 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
75 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
76 | @ApiModelProperty(value = "修改时间") | ||
77 | private Date updateTime; | ||
78 | /**删除标识,1有效,0删除*/ | ||
79 | @Excel(name = "删除标识,1有效,0删除", width = 15) | ||
80 | @ApiModelProperty(value = "删除标识,1有效,0删除") | ||
81 | private Integer delFlag; | ||
82 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/entity/DangerInspectionRecode.java
deleted
100644 → 0
1 | package com.skua.modules.safe.entity; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import java.util.Date; | ||
5 | import com.baomidou.mybatisplus.annotation.IdType; | ||
6 | import com.baomidou.mybatisplus.annotation.TableId; | ||
7 | import com.baomidou.mybatisplus.annotation.TableName; | ||
8 | import com.baomidou.mybatisplus.annotation.TableField; | ||
9 | import io.swagger.annotations.ApiModel; | ||
10 | import io.swagger.annotations.ApiModelProperty; | ||
11 | import lombok.Data; | ||
12 | import lombok.EqualsAndHashCode; | ||
13 | import lombok.experimental.Accessors; | ||
14 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
15 | import org.springframework.format.annotation.DateTimeFormat; | ||
16 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
17 | |||
18 | /** | ||
19 | * 风险巡检记录 | ||
20 | */ | ||
21 | @Data | ||
22 | @TableName("danger_inspection_recode") | ||
23 | @EqualsAndHashCode(callSuper = false) | ||
24 | @Accessors(chain = true) | ||
25 | @ApiModel(value="danger_inspection_recode对象", description="风险巡检记录") | ||
26 | public class DangerInspectionRecode { | ||
27 | |||
28 | /**id*/ | ||
29 | @TableId(type = IdType.ID_WORKER_STR) | ||
30 | @ApiModelProperty(value = "id") | ||
31 | private String id; | ||
32 | /**厂id*/ | ||
33 | @Excel(name = "厂id", width = 15) | ||
34 | @ApiModelProperty(value = "厂id") | ||
35 | private String departId; | ||
36 | /**风险等级对象*/ | ||
37 | @Excel(name = "风险等级对象", width = 15) | ||
38 | @ApiModelProperty(value = "风险等级对象") | ||
39 | private String dangerId; | ||
40 | /**检查内容对象编号*/ | ||
41 | @Excel(name = "检查内容对象编号", width = 15) | ||
42 | @ApiModelProperty(value = "检查内容对象编号") | ||
43 | private String inspectObjId; | ||
44 | /**检查内容*/ | ||
45 | @Excel(name = "检查内容", width = 15) | ||
46 | @ApiModelProperty(value = "检查内容") | ||
47 | private String inspectContent; | ||
48 | /**检查方法*/ | ||
49 | @Excel(name = "检查方法", width = 15) | ||
50 | @ApiModelProperty(value = "检查方法") | ||
51 | private String inspectMethod; | ||
52 | /**检查图片*/ | ||
53 | @Excel(name = "检查图片", width = 15) | ||
54 | @ApiModelProperty(value = "检查图片") | ||
55 | private String inspectImg; | ||
56 | /**上报人(用户id)*/ | ||
57 | @Excel(name = "上报人(用户id)", width = 15) | ||
58 | @ApiModelProperty(value = "上报人(用户id)") | ||
59 | private String reportUser; | ||
60 | /**巡检状态(0:未开始,1:开始,2:结束,3:作废)*/ | ||
61 | @Excel(name = "巡检状态(0:未开始,1:开始,2:结束,3:作废)", width = 15) | ||
62 | @ApiModelProperty(value = "巡检状态(0:未开始,1:开始,2:结束,3:作废)") | ||
63 | private String status; | ||
64 | /**备注*/ | ||
65 | @Excel(name = "备注", width = 15) | ||
66 | @ApiModelProperty(value = "备注") | ||
67 | private String remark; | ||
68 | /**创建人Id*/ | ||
69 | @Excel(name = "创建人Id", width = 15) | ||
70 | @ApiModelProperty(value = "创建人Id") | ||
71 | private String createBy; | ||
72 | /**上报时间*/ | ||
73 | @Excel(name = "上报时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
74 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
75 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
76 | @ApiModelProperty(value = "上报时间") | ||
77 | private Date createTime; | ||
78 | /**修改人Id*/ | ||
79 | @Excel(name = "修改人Id", width = 15) | ||
80 | @ApiModelProperty(value = "修改人Id") | ||
81 | private String updateBy; | ||
82 | /**修改时间*/ | ||
83 | @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
84 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
85 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
86 | @ApiModelProperty(value = "修改时间") | ||
87 | private Date updateTime; | ||
88 | /**删除标识,1有效,0删除*/ | ||
89 | @Excel(name = "删除标识,1有效,0删除", width = 15) | ||
90 | @ApiModelProperty(value = "删除标识,1有效,0删除") | ||
91 | private Integer delFlag; | ||
92 | } |
... | @@ -128,4 +128,10 @@ public class DangerLevelManage { | ... | @@ -128,4 +128,10 @@ public class DangerLevelManage { |
128 | /**删除标识,1有效,0删除*/ | 128 | /**删除标识,1有效,0删除*/ |
129 | @ApiModelProperty(value = "删除标识,1有效,0删除") | 129 | @ApiModelProperty(value = "删除标识,1有效,0删除") |
130 | private Integer delFlag; | 130 | private Integer delFlag; |
131 | |||
132 | |||
133 | @TableField(exist=false) | ||
134 | @ApiModelProperty(value = "上次巡检时间") | ||
135 | private String lastInspectionTime; | ||
136 | |||
131 | } | 137 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/DangerInspectionMapper.java
deleted
100644 → 0
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.DangerInspection; | ||
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
8 | |||
9 | /** | ||
10 | * 风险巡检 | ||
11 | */ | ||
12 | public interface DangerInspectionMapper extends BaseMapper<DangerInspection> { | ||
13 | |||
14 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/DangerInspectionRecodeMapper.java
deleted
100644 → 0
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.DangerInspectionRecode; | ||
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
8 | |||
9 | /** | ||
10 | * 风险巡检记录 | ||
11 | */ | ||
12 | public interface DangerInspectionRecodeMapper extends BaseMapper<DangerInspectionRecode> { | ||
13 | |||
14 | } |
sk-module-biz/src/main/java/com/skua/modules/safe/mapper/xml/DangerInspectionMapper.xml
deleted
100644 → 0
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.DangerInspectionMapper"> | ||
4 | |||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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.DangerInspectionRecodeMapper"> | ||
4 | |||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -4,12 +4,27 @@ import com.skua.modules.safe.entity.DangerInspectInfo; | ... | @@ -4,12 +4,27 @@ import com.skua.modules.safe.entity.DangerInspectInfo; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.safe.vo.DangerInspectInfoVO; | 5 | import com.skua.modules.safe.vo.DangerInspectInfoVO; |
6 | 6 | ||
7 | import java.util.List; | ||
8 | |||
7 | /** | 9 | /** |
8 | * 检查内容对象 | 10 | * 检查内容对象 |
9 | */ | 11 | */ |
10 | public interface IDangerInspectInfoService extends IService<DangerInspectInfo> { | 12 | public interface IDangerInspectInfoService extends IService<DangerInspectInfo> { |
11 | 13 | ||
12 | /*** | 14 | /*** |
15 | * 根据id编号获取检查内容对象、检查项集合 | ||
16 | * @param id | ||
17 | * @return | ||
18 | */ | ||
19 | public DangerInspectInfo queryById(String id); | ||
20 | |||
21 | /*** | ||
22 | * 根据检查点编号,获取检查内容对象集合 | ||
23 | * @return | ||
24 | */ | ||
25 | public List<DangerInspectInfo> queryListByDangerId(String dangerId); | ||
26 | |||
27 | /*** | ||
13 | * 根据id删除检查内容对象、以及检查项对象 | 28 | * 根据id删除检查内容对象、以及检查项对象 |
14 | * @param id | 29 | * @param id |
15 | */ | 30 | */ |
... | @@ -17,15 +32,15 @@ public interface IDangerInspectInfoService extends IService<DangerInspectInfo> { | ... | @@ -17,15 +32,15 @@ public interface IDangerInspectInfoService extends IService<DangerInspectInfo> { |
17 | 32 | ||
18 | /*** | 33 | /*** |
19 | * 修改检查内容对象、以及检查项对象 | 34 | * 修改检查内容对象、以及检查项对象 |
20 | * @param dangerInspectInfoVO | 35 | * @param dangerInspectInfo |
21 | * @return | 36 | * @return |
22 | */ | 37 | */ |
23 | public boolean updateDangerInspectInfo(DangerInspectInfoVO dangerInspectInfoVO); | 38 | public boolean updateDangerInspectInfo(DangerInspectInfo dangerInspectInfo); |
24 | 39 | ||
25 | 40 | ||
26 | /*** | 41 | /*** |
27 | * 新增检查内容对象、以及检查项对象 | 42 | * 新增检查内容对象、以及检查项对象 |
28 | * @param dangerInspectInfoVO | 43 | * @param dangerInspectInfo |
29 | */ | 44 | */ |
30 | public void saveDangerInspectInfo(DangerInspectInfoVO dangerInspectInfoVO); | 45 | public void saveDangerInspectInfo(DangerInspectInfo dangerInspectInfo); |
31 | } | 46 | } | ... | ... |
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.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
3 | import com.skua.modules.safe.entity.DangerInspectInfo; | 5 | import com.skua.modules.safe.entity.DangerInspectInfo; |
4 | import com.skua.modules.safe.entity.DangerInspectItem; | 6 | import com.skua.modules.safe.entity.DangerInspectItem; |
5 | import com.skua.modules.safe.mapper.DangerInspectInfoMapper; | 7 | import com.skua.modules.safe.mapper.DangerInspectInfoMapper; |
... | @@ -13,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ... | @@ -13,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | import org.springframework.transaction.annotation.Transactional; | 15 | import org.springframework.transaction.annotation.Transactional; |
14 | 16 | ||
15 | import javax.annotation.Resource; | 17 | import javax.annotation.Resource; |
18 | import java.util.List; | ||
16 | 19 | ||
17 | /** | 20 | /** |
18 | * 检查内容对象 | 21 | * 检查内容对象 |
... | @@ -22,6 +25,40 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM | ... | @@ -22,6 +25,40 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM |
22 | 25 | ||
23 | @Resource | 26 | @Resource |
24 | private DangerInspectItemMapper inspectItemMapper; | 27 | private DangerInspectItemMapper inspectItemMapper; |
28 | |||
29 | /*** | ||
30 | * 根据id编号获取检查内容对象、检查项集合 | ||
31 | * @param id | ||
32 | * @return | ||
33 | */ | ||
34 | public DangerInspectInfo queryById(String id){ | ||
35 | DangerInspectInfo dangerInspectInfo = this.baseMapper.selectById(id); | ||
36 | |||
37 | |||
38 | String inspectObjId = id; | ||
39 | LambdaQueryWrapper<DangerInspectItem> queryWrapper = new LambdaQueryWrapper<DangerInspectItem>(); | ||
40 | queryWrapper.eq(DangerInspectItem::getInspectObjId, inspectObjId); | ||
41 | queryWrapper.orderByDesc(DangerInspectItem::getCreateTime);//添加排序 | ||
42 | List<DangerInspectItem> inspectItemList = this.inspectItemMapper.selectList(queryWrapper); | ||
43 | |||
44 | //dangerInspectInfo.setDangerInspectItemList( inspectItemList); | ||
45 | return dangerInspectInfo; | ||
46 | } | ||
47 | |||
48 | |||
49 | |||
50 | |||
51 | /*** | ||
52 | * 根据检查点编号,获取检查内容对象集合 | ||
53 | * @return | ||
54 | */ | ||
55 | public List<DangerInspectInfo> queryListByDangerId(String dangerId){ | ||
56 | LambdaQueryWrapper<DangerInspectInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectInfo>(); | ||
57 | queryWrapper.eq(DangerInspectInfo::getDangerLevelId, dangerId); | ||
58 | queryWrapper.orderByDesc(DangerInspectInfo::getCreateTime);//添加排序 | ||
59 | return this.baseMapper.selectList(queryWrapper); | ||
60 | } | ||
61 | |||
25 | /*** | 62 | /*** |
26 | * 根据id删除检查内容对象、以及检查项对象 | 63 | * 根据id删除检查内容对象、以及检查项对象 |
27 | * @param id | 64 | * @param id |
... | @@ -36,43 +73,40 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM | ... | @@ -36,43 +73,40 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM |
36 | 73 | ||
37 | /*** | 74 | /*** |
38 | * 修改检查内容对象、以及检查项对象 | 75 | * 修改检查内容对象、以及检查项对象 |
39 | * @param dangerInspectInfoVO | 76 | * @param dangerInspectInfo |
40 | * @return | 77 | * @return |
41 | */ | 78 | */ |
42 | @Transactional | 79 | @Transactional |
43 | public boolean updateDangerInspectInfo(DangerInspectInfoVO dangerInspectInfoVO){ | 80 | public boolean updateDangerInspectInfo(DangerInspectInfo dangerInspectInfo){ |
44 | DangerInspectInfo dangerInspectInfo = new DangerInspectInfo(); | 81 | |
45 | BeanUtils.copyProperties( dangerInspectInfoVO ,dangerInspectInfo ); | ||
46 | int count = this.baseMapper.updateById( dangerInspectInfo ); | 82 | int count = this.baseMapper.updateById( dangerInspectInfo ); |
47 | 83 | ||
48 | //根据检查内容对象,删除检查项目集合 | 84 | //根据检查内容对象,删除检查项目集合 |
49 | inspectItemMapper.deleteByInspectInfoId(dangerInspectInfoVO.getId()); | 85 | inspectItemMapper.deleteByInspectInfoId(dangerInspectInfo.getId()); |
50 | if(dangerInspectInfoVO.getDangerInspectItemList() != null ){ | 86 | /* if(dangerInspectInfo.getDangerInspectItemList() != null ){ |
51 | for(DangerInspectItem dangerInspectItem : dangerInspectInfoVO.getDangerInspectItemList()){ | 87 | for(DangerInspectItem dangerInspectItem : dangerInspectInfo.getDangerInspectItemList()){ |
52 | dangerInspectItem.setInspectObjId( dangerInspectInfoVO.getId() ) ; | 88 | dangerInspectItem.setInspectObjId( dangerInspectInfo.getId() ) ; |
53 | inspectItemMapper.insert(dangerInspectItem) ; | 89 | inspectItemMapper.insert(dangerInspectItem) ; |
54 | } | 90 | } |
55 | } | 91 | }*/ |
56 | return count > 0 ?true : false; | 92 | return count > 0 ?true : false; |
57 | } | 93 | } |
58 | 94 | ||
59 | 95 | ||
60 | /*** | 96 | /*** |
61 | * 新增检查内容对象、以及检查项对象 | 97 | * 新增检查内容对象、以及检查项对象 |
62 | * @param dangerInspectInfoVO | 98 | * @param dangerInspectInfo |
63 | */ | 99 | */ |
64 | public void saveDangerInspectInfo(DangerInspectInfoVO dangerInspectInfoVO){ | 100 | public void saveDangerInspectInfo(DangerInspectInfo dangerInspectInfo){ |
65 | DangerInspectInfo dangerInspectInfo = new DangerInspectInfo(); | ||
66 | BeanUtils.copyProperties( dangerInspectInfoVO ,dangerInspectInfo ); | ||
67 | this.baseMapper.insert( dangerInspectInfo ); | 101 | this.baseMapper.insert( dangerInspectInfo ); |
68 | 102 | ||
69 | //根据检查内容对象,删除检查项目集合 | 103 | //根据检查内容对象,删除检查项目集合 |
70 | if(dangerInspectInfoVO.getDangerInspectItemList() != null ){ | 104 | /* if(dangerInspectInfo.getDangerInspectItemList() != null ){ |
71 | for(DangerInspectItem dangerInspectItem : dangerInspectInfoVO.getDangerInspectItemList()){ | 105 | for(DangerInspectItem dangerInspectItem : dangerInspectInfo.getDangerInspectItemList()){ |
72 | dangerInspectItem.setInspectObjId( dangerInspectInfoVO.getId() ) ; | 106 | dangerInspectItem.setInspectObjId( dangerInspectInfo.getId() ) ; |
73 | inspectItemMapper.insert(dangerInspectItem) ; | 107 | inspectItemMapper.insert(dangerInspectItem) ; |
74 | } | 108 | } |
75 | } | 109 | }*/ |
76 | 110 | ||
77 | } | 111 | } |
78 | } | 112 | } | ... | ... |
1 | package com.skua.modules.safe.service.impl; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspectionRecode; | ||
4 | import com.skua.modules.safe.mapper.DangerInspectionRecodeMapper; | ||
5 | import com.skua.modules.safe.service.IDangerInspectionRecodeService; | ||
6 | import org.springframework.stereotype.Service; | ||
7 | |||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
9 | |||
10 | /** | ||
11 | * 风险巡检记录 | ||
12 | */ | ||
13 | @Service | ||
14 | public class DangerInspectionRecodeServiceImpl extends ServiceImpl<DangerInspectionRecodeMapper, DangerInspectionRecode> implements IDangerInspectionRecodeService { | ||
15 | |||
16 | } |
1 | package com.skua.modules.safe.service.impl; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspection; | ||
4 | import com.skua.modules.safe.mapper.DangerInspectionMapper; | ||
5 | import com.skua.modules.safe.service.IDangerInspectionService; | ||
6 | import org.springframework.stereotype.Service; | ||
7 | |||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
9 | |||
10 | /** | ||
11 | * 风险巡检 | ||
12 | */ | ||
13 | @Service | ||
14 | public class DangerInspectionServiceImpl extends ServiceImpl<DangerInspectionMapper, DangerInspection> implements IDangerInspectionService { | ||
15 | |||
16 | } |
-
请 注册 或 登录 后发表评论