|
@@ -0,0 +1,180 @@
|
|
|
|
+package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
+
|
|
|
|
+import com.rongwei.bscommon.sys.service.RohhService;
|
|
|
|
+import com.rongwei.bscommon.sys.utils.QHSEUtils;
|
|
|
|
+import com.rongwei.bsentity.domain.*;
|
|
|
|
+import com.rongwei.bsentity.vo.ROHHEventVo;
|
|
|
|
+import com.rongwei.bsentity.vo.TaskTransferVo;
|
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
|
+import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * RohhServiceImpl class
|
|
|
|
+ *
|
|
|
|
+ * @author XH
|
|
|
|
+ * @date 2025/08/18
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class RohhServiceImpl implements RohhService {
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(RohhServiceImpl.class);
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private QhseRohhServiceImpl qhseRohhService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private QhseRohhRectificationServiceImpl qhseRohhRectificationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private QhseRohhValidateServiceImpl qhseRohhValidateService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private QhseRohhRpServiceImpl qhseRohhRpService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private QhseRohhEventServiceImpl qhseRohhEventService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void createRectification(String id) {
|
|
|
|
+ QhseRohhDo qhseRohhDo = rohhCheck(id);
|
|
|
|
+ SysUserVo currentUser = QHSEUtils.getCurrentUser();
|
|
|
|
+ QhseRohhRectificationDo qhseRohhRectificationDo = new QhseRohhRectificationDo();
|
|
|
|
+ qhseRohhRectificationDo.setId(SecurityUtil.getUUID());
|
|
|
|
+ QHSEUtils.initModelGeneralParameters(qhseRohhRectificationDo, currentUser);
|
|
|
|
+ qhseRohhRectificationDo.setRectificationplan(qhseRohhDo.getRectificationplan());
|
|
|
|
+ qhseRohhRectificationDo.setPlanatt(qhseRohhDo.getPlanatt());
|
|
|
|
+ qhseRohhRectificationDo.setRectificationphoto(qhseRohhDo.getRectificationphoto());
|
|
|
|
+ qhseRohhRectificationDo.setRectificationtime(qhseRohhDo.getRectificationtime());
|
|
|
|
+ qhseRohhRectificationDo.setRohhid(id);
|
|
|
|
+ qhseRohhRectificationDo.setUserid(currentUser.getId());
|
|
|
|
+ qhseRohhRectificationDo.setUsername(currentUser.getName());
|
|
|
|
+ qhseRohhRectificationService.save(qhseRohhRectificationDo);
|
|
|
|
+ // 增加事件
|
|
|
|
+ ROHHEventVo rohhEventVo = new ROHHEventVo();
|
|
|
|
+ rohhEventVo.setRohhid(id);
|
|
|
|
+ rohhEventVo.setEventname("分配");
|
|
|
|
+ rohhEventVo.setEventtype("任务分配");
|
|
|
|
+ rohhEventVo.setDescribe("当前任务已交由" + qhseRohhDo.getRectificationuser() + "整改");
|
|
|
|
+ createRPEvent(rohhEventVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void createValidate(String id) {
|
|
|
|
+ QhseRohhDo qhseRohhDo = rohhCheck(id);
|
|
|
|
+ SysUserVo currentUser = QHSEUtils.getCurrentUser();
|
|
|
|
+ QhseRohhValidateDo qhseRohhValidateDo = new QhseRohhValidateDo();
|
|
|
|
+ qhseRohhValidateDo.setId(SecurityUtil.getUUID());
|
|
|
|
+ QHSEUtils.initModelGeneralParameters(qhseRohhValidateDo, currentUser);
|
|
|
|
+ qhseRohhValidateDo.setRohhid(id);
|
|
|
|
+ qhseRohhValidateDo.setVerifier(qhseRohhDo.getVerifier());
|
|
|
|
+ qhseRohhValidateDo.setVerifierid(qhseRohhDo.getVerifierid());
|
|
|
|
+ qhseRohhValidateDo.setHdtype(qhseRohhDo.getHdtype());
|
|
|
|
+ qhseRohhValidateDo.setVerifierdesc(qhseRohhDo.getVerifierdesc());
|
|
|
|
+ qhseRohhValidateDo.setVerifierphoto(qhseRohhDo.getVerifierphoto());
|
|
|
|
+ qhseRohhValidateDo.setVerifierresult(qhseRohhDo.getVerifierresult());
|
|
|
|
+ qhseRohhValidateService.save(qhseRohhValidateDo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void createRP(String id) {
|
|
|
|
+ QhseRohhDo qhseRohhDo = rohhCheck(id);
|
|
|
|
+ SysUserVo currentUser = QHSEUtils.getCurrentUser();
|
|
|
|
+ QhseRohhRpDo qhseRohhRpDo = new QhseRohhRpDo();
|
|
|
|
+ QHSEUtils.initModelGeneralParameters(qhseRohhRpDo, currentUser);
|
|
|
|
+ qhseRohhRpDo.setId(id);
|
|
|
|
+ qhseRohhRpDo.setRohhid(qhseRohhDo.getId());
|
|
|
|
+ qhseRohhRpDo.setRptype("1");
|
|
|
|
+ qhseRohhRpDo.setUsername(qhseRohhDo.getInspectuser());
|
|
|
|
+ qhseRohhRpDo.setUserid(qhseRohhDo.getInspectuserid());
|
|
|
|
+ qhseRohhRpDo.setDeptid(qhseRohhDo.getInspectuserdeptid());
|
|
|
|
+ qhseRohhRpDo.setDeptname(qhseRohhDo.getInspectuserdept());
|
|
|
|
+ qhseRohhRpService.save(qhseRohhRpDo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void createRPEvent(ROHHEventVo rohhEventVo) {
|
|
|
|
+ QhseRohhEventDo qhseRohhEventDo = new QhseRohhEventDo();
|
|
|
|
+ SysUserVo currentUser = QHSEUtils.getCurrentUser();
|
|
|
|
+ QHSEUtils.initModelGeneralParameters(qhseRohhEventDo, currentUser);
|
|
|
|
+ qhseRohhEventDo.setId(SecurityUtil.getUUID());
|
|
|
|
+ qhseRohhEventDo.setRohhid(rohhEventVo.getRohhid());
|
|
|
|
+ qhseRohhEventDo.setEventname(rohhEventVo.getEventname());
|
|
|
|
+ qhseRohhEventDo.setEventtype(rohhEventVo.getEventtype());
|
|
|
|
+ qhseRohhEventDo.setDescribe(rohhEventVo.getDescribe());
|
|
|
|
+ qhseRohhEventService.save(qhseRohhEventDo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void taskTransfer(TaskTransferVo taskTransferVo) {
|
|
|
|
+ List<String> ids = taskTransferVo.getIds();
|
|
|
|
+ if (ids == null || ids.isEmpty()) {
|
|
|
|
+ throw new CustomException("参数异常");
|
|
|
|
+ }
|
|
|
|
+ String userId = taskTransferVo.getUserId();
|
|
|
|
+ String userName = taskTransferVo.getUserName();
|
|
|
|
+ if (StringUtils.isBlank(userId) || StringUtils.isBlank(userName)) {
|
|
|
|
+ throw new CustomException("重新选择的整改人为空");
|
|
|
|
+ }
|
|
|
|
+ QhseRohhDo qhseRohhDo;
|
|
|
|
+ QhseRohhEventDo qhseRohhEventDo;
|
|
|
|
+ List<QhseRohhDo> savaList = new ArrayList<>();
|
|
|
|
+ List<QhseRohhEventDo> eventSavaList = new ArrayList<>();
|
|
|
|
+ SysUserVo currentUser = QHSEUtils.getCurrentUser();
|
|
|
|
+ for (String id : ids) {
|
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ qhseRohhDo = new QhseRohhDo();
|
|
|
|
+
|
|
|
|
+ qhseRohhDo.setId(id);
|
|
|
|
+ qhseRohhDo.setModifydate(new Date());
|
|
|
|
+ qhseRohhDo.setModifyuserid(currentUser.getId());
|
|
|
|
+ qhseRohhDo.setModifyusername(currentUser.getName());
|
|
|
|
+ qhseRohhDo.setState("2");
|
|
|
|
+ qhseRohhDo.setRectificationuser(userName);
|
|
|
|
+ qhseRohhDo.setRectificationuserid(userId);
|
|
|
|
+ savaList.add(qhseRohhDo);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ qhseRohhEventDo = new QhseRohhEventDo();
|
|
|
|
+ qhseRohhEventDo.setRohhid(id);
|
|
|
|
+ qhseRohhEventDo.setId(SecurityUtil.getUUID());
|
|
|
|
+ qhseRohhEventDo.setEventname("整改");
|
|
|
|
+ qhseRohhEventDo.setEventtype("任务转派");
|
|
|
|
+ qhseRohhEventDo.setDescribe("当前任务已交由" + userName + "处理");
|
|
|
|
+ QHSEUtils.initModelGeneralParameters(qhseRohhEventDo, currentUser);
|
|
|
|
+ eventSavaList.add(qhseRohhEventDo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!savaList.isEmpty()) {
|
|
|
|
+ qhseRohhService.updateBatchById(savaList);
|
|
|
|
+ }
|
|
|
|
+ if (!eventSavaList.isEmpty()) {
|
|
|
|
+ qhseRohhEventService.saveBatch(eventSavaList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 参数校验
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public QhseRohhDo rohhCheck(String id) {
|
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
|
+ throw new CustomException("参数异常");
|
|
|
|
+ }
|
|
|
|
+ QhseRohhDo qhseRohhDo = qhseRohhService.getById(id);
|
|
|
|
+ if (qhseRohhDo == null) {
|
|
|
|
+ throw new CustomException("无法获取到隐患任务信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return qhseRohhDo;
|
|
|
|
+ }
|
|
|
|
+}
|