|
@@ -1,7 +1,23 @@
|
|
|
package com.zd.security.controller;
|
|
package com.zd.security.controller;
|
|
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.zd.common.core.annotation.Log;
|
|
|
|
|
+import com.zd.common.core.log.BusinessType;
|
|
|
|
|
+import com.zd.common.core.utils.StringUtils;
|
|
|
|
|
+import com.zd.common.core.web.controller.AbstractController;
|
|
|
|
|
+import com.zd.model.domain.ResultData;
|
|
|
|
|
+import com.zd.security.api.bo.CheckRectifyBo;
|
|
|
|
|
+import com.zd.security.api.vo.CheckRectifyVo;
|
|
|
|
|
+import com.zd.security.entity.CheckHazard;
|
|
|
|
|
+import com.zd.security.entity.CheckRectify;
|
|
|
|
|
+import com.zd.security.service.CheckHazardService;
|
|
|
|
|
+import com.zd.security.service.CheckRectifyService;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -13,6 +29,106 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
*/
|
|
*/
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/checkRectify")
|
|
@RequestMapping("/checkRectify")
|
|
|
-public class CheckRectifyController {
|
|
|
|
|
|
|
+public class CheckRectifyController extends AbstractController {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CheckHazardService checkHazardService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CheckRectifyService checkRectifyService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据隐患详情,跳入到整改信息表
|
|
|
|
|
+ * @param checkRectifyBo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping(value = "/findByCheckRectifyList")
|
|
|
|
|
+ public ResultData find(CheckRectifyBo checkRectifyBo) {
|
|
|
|
|
+ //先查询隐患表数据
|
|
|
|
|
+ CheckHazard checkHazard = checkHazardService.getById(checkRectifyBo.getCheckHazardId());
|
|
|
|
|
+
|
|
|
|
|
+ //查询条件
|
|
|
|
|
+ QueryWrapper <CheckRectify> wrapper = new QueryWrapper <>();
|
|
|
|
|
+ //过滤物理删除数据及正序叙
|
|
|
|
|
+ wrapper.lambda().eq(CheckRectify::getIsDeleted, Boolean.FALSE)
|
|
|
|
|
+ .eq(CheckRectify::getCheckHazardId,checkRectifyBo.getCheckHazardId()).orderByAsc(CheckRectify::getId);
|
|
|
|
|
+ List <CheckRectify> checkRectifyList = checkRectifyService.list(wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ //整合隐患和整改数据
|
|
|
|
|
+ CheckRectifyVo checkRectifyVo = new CheckRectifyVo();
|
|
|
|
|
+ Optional.ofNullable(checkRectifyList).orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(a->{
|
|
|
|
|
+ if(StringUtils.isNotNull(a.getRectifyResult())){
|
|
|
|
|
+ LinkedHashMap <String,Object> linkedHashMap = new LinkedHashMap <>();
|
|
|
|
|
+ linkedHashMap.put("rectifyResult",a.getRectifyResult()+"");
|
|
|
|
|
+ linkedHashMap.put("rectifyMeasure",a.getRectifyMeasure()+"");
|
|
|
|
|
+ linkedHashMap.put("rectifyImgs", new ArrayList<>());
|
|
|
|
|
+ linkedHashMap.put("rectifyName",a.getCreateName());
|
|
|
|
|
+ linkedHashMap.put("rectifyTime",a.getCreateTime());
|
|
|
|
|
+ checkRectifyVo.getCheckRectifyMap().add(linkedHashMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotNull(a.getExamineResult())){
|
|
|
|
|
+ LinkedHashMap <String,Object> linkedHashMap = new LinkedHashMap <>();
|
|
|
|
|
+ linkedHashMap.put("examineResult",a.getExamineResult()+"");
|
|
|
|
|
+ linkedHashMap.put("examineOpinion",a.getExamineOpinion()+"");
|
|
|
|
|
+ linkedHashMap.put("reviewedName",a.getReviewedName()+"");
|
|
|
|
|
+ linkedHashMap.put("reviewedTime",a.getReviewedTime()+"");
|
|
|
|
|
+ checkRectifyVo.getCheckRectifyMap().add(linkedHashMap);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return ResultData.success(checkRectifyVo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 整改提交
|
|
|
|
|
+ * @param checkRectifyBo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Log(title = "安全服务-整改添加", businessType = BusinessType.INSERT)
|
|
|
|
|
+ @PostMapping(value = "/addOrApprove")
|
|
|
|
|
+ public ResultData addOrApprove(@RequestBody CheckRectifyBo checkRectifyBo) {
|
|
|
|
|
+ //判断整改是否有id,如果有,说明是整改审核,如果没有,就是整改提交。
|
|
|
|
|
+ if(StringUtils.isNotNull(checkRectifyBo.getId())){
|
|
|
|
|
+ CheckRectify checkRectify = new CheckRectify();
|
|
|
|
|
+ BeanUtils.copyProperties(checkRectifyBo,checkRectify);
|
|
|
|
|
+ checkRectify.setReviewedBy(getCurrentUserId());
|
|
|
|
|
+ checkRectify.setReviewedName(getCurrentUserName());
|
|
|
|
|
+ checkRectify.setReviewedTime(LocalDateTime.now());
|
|
|
|
|
+ checkRectifyService.saveOrUpdate(checkRectify);
|
|
|
|
|
+ ResultData.success("操作成功");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ CheckRectify checkRectify = new CheckRectify();
|
|
|
|
|
+ BeanUtils.copyProperties(checkRectifyBo,checkRectify);
|
|
|
|
|
+ checkRectifyService.save(checkRectify);
|
|
|
|
|
+ ResultData.success("操作成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultData.fail("操作失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量审批
|
|
|
|
|
+ * @param checkRectifyList
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Log(title = "安全服务-批量审批", businessType = BusinessType.INSERT)
|
|
|
|
|
+ @PostMapping(value = "/batchApprove")
|
|
|
|
|
+ public ResultData batchApprove(@RequestBody List<CheckRectifyBo> checkRectifyList) {
|
|
|
|
|
+ Optional.ofNullable(checkRectifyList).orElseGet(Collections::emptyList)
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .forEach(a->{
|
|
|
|
|
+ if(StringUtils.isNotNull(a.getId())){
|
|
|
|
|
+ CheckRectify checkRectify = new CheckRectify();
|
|
|
|
|
+ BeanUtils.copyProperties(a,checkRectify);
|
|
|
|
|
+ checkRectify.setReviewedName(getCurrentUserName());
|
|
|
|
|
+ checkRectify.setReviewedBy(getCurrentUserId());
|
|
|
|
|
+ checkRectify.setReviewedTime(LocalDateTime.now());
|
|
|
|
|
+ checkRectifyService.saveOrUpdate(checkRectify);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return ResultData.success("操作成功");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|