消息提醒

main
zhangyue 2026-05-14 19:02:09 +08:00
parent aecde5aa71
commit 290a606961
14 changed files with 332 additions and 23 deletions

View File

@ -4,6 +4,8 @@ import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.hidden.HiddenAcceptRecordGateway; import com.zcloud.key.project.domain.gateway.hidden.HiddenAcceptRecordGateway;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway;
import com.zcloud.key.project.domain.model.hidden.HiddenAcceptRecordE; import com.zcloud.key.project.domain.model.hidden.HiddenAcceptRecordE;
@ -11,8 +13,10 @@ import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspect
import com.zcloud.key.project.dto.hidden.HiddenAcceptRecordAcceptCmd; import com.zcloud.key.project.dto.hidden.HiddenAcceptRecordAcceptCmd;
import com.zcloud.key.project.dto.hidden.HiddenAcceptRecordUpdateCmd; import com.zcloud.key.project.dto.hidden.HiddenAcceptRecordUpdateCmd;
import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO; import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO;
import com.zcloud.key.project.persistence.dataobject.hidden.HiddenFindUserDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
@ -43,6 +47,9 @@ public class HiddenAcceptRecordUpdateExe {
private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository; private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository;
private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository; private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository;
private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway; private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway;
private final HiddenFindUserRepository hiddenFindUserRepository;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void execute(HiddenAcceptRecordUpdateCmd hiddenAcceptRecordUpdateCmd) { public void execute(HiddenAcceptRecordUpdateCmd hiddenAcceptRecordUpdateCmd) {
@ -94,6 +101,17 @@ public class HiddenAcceptRecordUpdateExe {
safetyEnvironmentalInspectionUserGateway.add(inspectionUserFileE); safetyEnvironmentalInspectionUserGateway.add(inspectionUserFileE);
// 如果是修改安全环保检查状态为归档 // 如果是修改安全环保检查状态为归档
safetyEnvironmentalInspectionRepository.updateStatus(cmd.getForeignKey(), 5); safetyEnvironmentalInspectionRepository.updateStatus(cmd.getForeignKey(), 5);
//TODO 站内信 给发起人发归档信息
// 查找发起人,作为归档人
SafetyEnvironmentalInspectionDO inspectionDO = safetyEnvironmentalInspectionRepository.getByInspectionId(cmd.getForeignKey());
List<SafetyEnvironmentalInspectionUserDO> initiator = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getForeignKey(), 1);
Map<String, Object> sendParamsPigeonhole = new HashMap<>();
sendParamsPigeonhole.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(initiator.get(0).getUserId(), messageTemplateConfig.getCheckInitiatorApplyAcceptancePass(), sendParamsPigeonhole);
// 完成隐患整改待办
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getForeignKey(), 7);
messageNoticeExe.sendMessageCompleteEvent(userList.get(0).getId());
} }
} else if (cmd.getState() == 0) { // 验收未通过 } else if (cmd.getState() == 0) { // 验收未通过
// 将修改安全环保检查隐患整改操作记录改为未完成 // 将修改安全环保检查隐患整改操作记录改为未完成
@ -106,6 +124,24 @@ public class HiddenAcceptRecordUpdateExe {
safetyEnvironmentalInspectionUserRepository.editUserInfo(inspectionUserDO); safetyEnvironmentalInspectionUserRepository.editUserInfo(inspectionUserDO);
} }
} }
Map<String, Object> params = new HashMap<>();
params.put("hiddenId", cmd.getHiddenId());
List<HiddenFindUserDO> findList = hiddenFindUserRepository.listAll(params);
for (HiddenFindUserDO findUserDO : findList) {
// TODO 完成该隐患的待办
messageNoticeExe.sendMessageCompleteEvent(findUserDO.getId());
}
// 驳回给整改人发代办
if(cmd.getState() == 0){
SafetyEnvironmentalInspectionDO inspectionDO = safetyEnvironmentalInspectionRepository.getByInspectionId(cmd.getForeignKey());
Map<String, Object> sendParamsPigeonhole = new HashMap<>();
sendParamsPigeonhole.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(hiddenDO.getRectificationUserId(), messageTemplateConfig.getCheckInitiatorApplyAcceptanceNotPass(), sendParamsPigeonhole);
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getForeignKey(), 7);
messageNoticeExe.sendMessageAddEvent(userList.get(0).getUserId(), "您有一条安全检查任务的隐患验收未通过,请及时处理。","验收被驳回", hiddenDO.getId(), hiddenDO.getId());
}
if (!res) { if (!res) {
throw new BizException("修改失败"); throw new BizException("修改失败");
} }

View File

@ -3,13 +3,17 @@ package com.zcloud.key.project.command.hidden;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.hidden.HiddenRectificationRecordGateway; import com.zcloud.key.project.domain.gateway.hidden.HiddenRectificationRecordGateway;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway;
import com.zcloud.key.project.domain.model.hidden.HiddenRectificationRecordE; import com.zcloud.key.project.domain.model.hidden.HiddenRectificationRecordE;
import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE; import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE;
import com.zcloud.key.project.dto.hidden.HiddenRectificationRecordUpdateCmd; import com.zcloud.key.project.dto.hidden.HiddenRectificationRecordUpdateCmd;
import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO; import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO;
import com.zcloud.key.project.persistence.dataobject.hidden.HiddenFindUserDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
@ -20,7 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -34,10 +40,13 @@ import java.util.List;
public class HiddenRectificationRecordUpdateExe { public class HiddenRectificationRecordUpdateExe {
private final HiddenRectificationRecordGateway hiddenRectificationRecordGateway; private final HiddenRectificationRecordGateway hiddenRectificationRecordGateway;
private final HiddenRepository hiddenRepository; private final HiddenRepository hiddenRepository;
private final HiddenFindUserRepository hiddenFindUserRepository;
private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository; private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository;
private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository; private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository;
private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway; private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void execute(HiddenRectificationRecordUpdateCmd hiddenRectificationRecordUpdateCmd) { public void execute(HiddenRectificationRecordUpdateCmd hiddenRectificationRecordUpdateCmd) {
HiddenRectificationRecordE hiddenRectificationRecordE = new HiddenRectificationRecordE(); HiddenRectificationRecordE hiddenRectificationRecordE = new HiddenRectificationRecordE();
@ -81,6 +90,17 @@ public class HiddenRectificationRecordUpdateExe {
} }
} }
//TODO 站内信 给隐患验收发站内信和待办
Map<String, Object> params = new HashMap<>();
params.put("hiddenId", cmd.getHiddenId());
List<HiddenFindUserDO> findList = hiddenFindUserRepository.listAll(params);
for (HiddenFindUserDO findUserDO : findList) {
Map<String, Object> sendParams = new HashMap<>();
messageNoticeExe.messageNotice(findUserDO.getFindUserId(), messageTemplateConfig.getHiddenDangerAcceptancePersonApplyAcceptance(), sendParams);
//待办
messageNoticeExe.sendMessageAddEvent(findUserDO.getFindUserId(), "您有一条安全检查任务的待验收隐患,请及时验收。","待验收", findUserDO.getId(), findUserDO.getId());
}
messageNoticeExe.sendMessageCompleteEvent(hiddenDO.getId());
if (!res) { if (!res) {
throw new BizException("修改失败"); throw new BizException("修改失败");
} }

View File

@ -2,17 +2,21 @@ package com.zcloud.key.project.command.inspection;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.key.project.command.hidden.HiddenAddExe; import com.zcloud.key.project.command.hidden.HiddenAddExe;
import com.zcloud.key.project.command.hidden.HiddenFindUserRemoveExe; import com.zcloud.key.project.command.hidden.HiddenFindUserRemoveExe;
import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway;
import com.zcloud.key.project.domain.model.hidden.HiddenE; import com.zcloud.key.project.domain.model.hidden.HiddenE;
import com.zcloud.key.project.domain.model.hidden.HiddenFindUserE; import com.zcloud.key.project.domain.model.hidden.HiddenFindUserE;
import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionContentE; import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionContentE;
import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionE; import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionE;
import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE; import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE;
import com.zcloud.key.project.domain.model.project.KeyProjectE;
import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO; import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO;
import com.zcloud.key.project.dto.hidden.HiddenAddCmd; import com.zcloud.key.project.dto.hidden.HiddenAddCmd;
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionAddCmd; import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionAddCmd;
@ -22,11 +26,13 @@ import com.zcloud.key.project.persistence.dataobject.hidden.HiddenDO;
import com.zcloud.key.project.persistence.dataobject.hidden.HiddenFindUserDO; import com.zcloud.key.project.persistence.dataobject.hidden.HiddenFindUserDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionContentDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionContentDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.dataobject.project.KeyProjectDO;
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
import com.zcloud.key.project.persistence.repository.impl.inspection.SafetyEnvironmentalInspectionContentRepositoryImpl; import com.zcloud.key.project.persistence.repository.impl.inspection.SafetyEnvironmentalInspectionContentRepositoryImpl;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
import com.zcloud.key.project.persistence.repository.project.KeyProjectRepository;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -53,6 +59,9 @@ public class SafetyEnvironmentalInspectionAddExe {
private final SafetyEnvironmentalInspectionContentRepository safetyEnvironmentalInspectionContentRepository; private final SafetyEnvironmentalInspectionContentRepository safetyEnvironmentalInspectionContentRepository;
private final HiddenRepository hiddenRepository; private final HiddenRepository hiddenRepository;
private final HiddenFindUserRepository hiddenFindUserRepository; private final HiddenFindUserRepository hiddenFindUserRepository;
private final KeyProjectRepository keyProjectRepository;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -171,6 +180,23 @@ public class SafetyEnvironmentalInspectionAddExe {
} }
SafetyEnvironmentalInspectionCO safetyEnvironmentalInspectionCO = new SafetyEnvironmentalInspectionCO(); SafetyEnvironmentalInspectionCO safetyEnvironmentalInspectionCO = new SafetyEnvironmentalInspectionCO();
BeanUtils.copyProperties(safetyEnvironmentalInspectionE, safetyEnvironmentalInspectionCO); BeanUtils.copyProperties(safetyEnvironmentalInspectionE, safetyEnvironmentalInspectionCO);
//TODO 站内信
if (cmd.getStatus() == 1) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 2);
for (SafetyEnvironmentalInspectionUserDO insUser : messageUserList){
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("initiatorName", ssoUser.getName());
sendParams.put("checkTitle", keyProjectDO.getProjectName());
messageNoticeExe.messageNotice(insUser.getUserId(), messageTemplateConfig.getCheckerApplyCheck(), sendParams);
//待办
messageNoticeExe.sendMessageAddEvent(insUser.getUserId(), "您有一条【安全环保检查】待处理","待核实", safetyEnvironmentalInspectionCO.getId(), insUser.getId());
}
}
return safetyEnvironmentalInspectionCO; return safetyEnvironmentalInspectionCO;
} }
} }

View File

@ -3,6 +3,8 @@ package com.zcloud.key.project.command.inspection;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionDefendGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionDefendGateway;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway;
@ -14,6 +16,7 @@ import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmen
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
import com.zcloud.key.project.persistence.repository.project.KeyProjectRepository;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -21,7 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -37,7 +42,9 @@ public class SafetyEnvironmentalInspectionDefendAddExe {
private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository; private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository;
private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository; private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository;
private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway; private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway;
private final KeyProjectRepository keyProjectRepository;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean execute(SafetyEnvironmentalInspectionDefendAddCmd cmd) { public boolean execute(SafetyEnvironmentalInspectionDefendAddCmd cmd) {
SafetyEnvironmentalInspectionDefendE safetyEnvironmentalInspectionDefendE = new SafetyEnvironmentalInspectionDefendE(); SafetyEnvironmentalInspectionDefendE safetyEnvironmentalInspectionDefendE = new SafetyEnvironmentalInspectionDefendE();
@ -70,6 +77,7 @@ public class SafetyEnvironmentalInspectionDefendAddExe {
safetyEnvironmentalInspectionUserDO.setUserId(ssoUser.getUserId()); safetyEnvironmentalInspectionUserDO.setUserId(ssoUser.getUserId());
safetyEnvironmentalInspectionUserDO.setType(type); safetyEnvironmentalInspectionUserDO.setType(type);
safetyEnvironmentalInspectionUserDO.setSignatureTime(LocalDateTime.now()); safetyEnvironmentalInspectionUserDO.setSignatureTime(LocalDateTime.now());
if(cmd.getIsDefend() == 1){ // 申辩 if(cmd.getIsDefend() == 1){ // 申辩
// 将确认人改为不通过 // 将确认人改为不通过
safetyEnvironmentalInspectionUserDO.setStatus(2); safetyEnvironmentalInspectionUserDO.setStatus(2);
@ -84,6 +92,14 @@ public class SafetyEnvironmentalInspectionDefendAddExe {
SafetyEnvironmentalInspectionUserE inspectionUserE = new SafetyEnvironmentalInspectionUserE(); SafetyEnvironmentalInspectionUserE inspectionUserE = new SafetyEnvironmentalInspectionUserE();
inspectionUserE.init(cmd.getInspectionId(), 0, 4, initiator.get(0).getCorpId(), initiator.get(0).getDepartmentId(), initiator.get(0).getUserId()); inspectionUserE.init(cmd.getInspectionId(), 0, 4, initiator.get(0).getCorpId(), initiator.get(0).getDepartmentId(), initiator.get(0).getUserId());
safetyEnvironmentalInspectionUserGateway.add(inspectionUserE); safetyEnvironmentalInspectionUserGateway.add(inspectionUserE);
//TODO 站内信 给发起人发送申辩待处理
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("examineeName", ssoUser.getName());
messageNoticeExe.messageNotice(initiator.get(0).getUserId(), messageTemplateConfig.getCheckedPersonApplyDefend(), sendParams);
messageNoticeExe.sendMessageAddEvent(initiator.get(0).getUserId(), "您有一条【安全环保检查】申辩待处理","申辩待处理", inspectionDO.getId(), inspectionUserE.getId());
}else if (cmd.getIsDefend() == 0){ // 不申辩 }else if (cmd.getIsDefend() == 0){ // 不申辩
// 将确认人改为通过 // 将确认人改为通过
safetyEnvironmentalInspectionUserDO.setStatus(1); safetyEnvironmentalInspectionUserDO.setStatus(1);
@ -97,6 +113,11 @@ public class SafetyEnvironmentalInspectionDefendAddExe {
SafetyEnvironmentalInspectionUserE hiddenRectificationUser = new SafetyEnvironmentalInspectionUserE(); SafetyEnvironmentalInspectionUserE hiddenRectificationUser = new SafetyEnvironmentalInspectionUserE();
hiddenRectificationUser.init(cmd.getInspectionId(), 0, 7, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId()); hiddenRectificationUser.init(cmd.getInspectionId(), 0, 7, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId());
safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser); safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser);
//TODO 站内信 给隐患整改人发送隐患整改待处理
Map<String, Object> sendParamsHidden = new HashMap<>();
messageNoticeExe.messageNotice(inspectionDO.getXgfMasterUserId(), messageTemplateConfig.getHiddenDangerRectifyPersonApplyRectify(), sendParamsHidden);
messageNoticeExe.sendMessageAddEvent(inspectionDO.getXgfMasterUserId(), "您有一条安全检查任务的待整改隐患,请及时整改。","待整改", inspectionDO.getId(), hiddenRectificationUser.getId());
} else { } else {
// 没有隐患,将安全环保检查状态改为已归档 // 没有隐患,将安全环保检查状态改为已归档
safetyEnvironmentalInspectionRepository.updateStatus(cmd.getInspectionId(), 5); safetyEnvironmentalInspectionRepository.updateStatus(cmd.getInspectionId(), 5);
@ -105,8 +126,18 @@ public class SafetyEnvironmentalInspectionDefendAddExe {
hiddenRectificationUser.init(cmd.getInspectionId(), 1, 9, inspectionDO.getTenantId(), inspectionDO.getOrgId(), inspectionDO.getCreateId()); hiddenRectificationUser.init(cmd.getInspectionId(), 1, 9, inspectionDO.getTenantId(), inspectionDO.getOrgId(), inspectionDO.getCreateId());
hiddenRectificationUser.setSignatureTime(LocalDateTime.now()); hiddenRectificationUser.setSignatureTime(LocalDateTime.now());
safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser); safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser);
//TODO 站内信 给发起人发归档信息
// 查找发起人,作为归档人
List<SafetyEnvironmentalInspectionUserDO> initiator = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 1);
Map<String, Object> sendParamsPigeonhole = new HashMap<>();
sendParamsPigeonhole.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(initiator.get(0).getUserId(), messageTemplateConfig.getCheckInitiatorApplyAcceptancePass(), sendParamsPigeonhole);
} }
} }
// 完成当前确认人的待办
List<SafetyEnvironmentalInspectionUserDO> affirmList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), type, ssoUser.getUserId());
messageNoticeExe.sendMessageCompleteEvent(affirmList.get(0).getId());
} }
} }

View File

@ -2,10 +2,13 @@ package com.zcloud.key.project.command.inspection;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade; import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway;
import com.zcloud.key.project.domain.model.hidden.HiddenE; import com.zcloud.key.project.domain.model.hidden.HiddenE;
@ -22,12 +25,14 @@ import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmen
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDefendDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDefendDO;
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.dataobject.project.KeyProjectDO;
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository; import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionDefendRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionDefendRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
import com.zcloud.key.project.persistence.repository.project.KeyProjectRepository;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
@ -59,6 +64,9 @@ public class SafetyEnvironmentalInspectionUpdateExe {
private final SafetyEnvironmentalInspectionDefendRepository safetyEnvironmentalInspectionDefendRepository; private final SafetyEnvironmentalInspectionDefendRepository safetyEnvironmentalInspectionDefendRepository;
private final HiddenRepository hiddenRepository; private final HiddenRepository hiddenRepository;
private final HiddenFindUserRepository hiddenFindUserRepository; private final HiddenFindUserRepository hiddenFindUserRepository;
private final KeyProjectRepository keyProjectRepository;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@DubboReference @DubboReference
private ZcloudImgFilesFacade zcloudImgFilesFacade; private ZcloudImgFilesFacade zcloudImgFilesFacade;
@ -99,8 +107,15 @@ public class SafetyEnvironmentalInspectionUpdateExe {
try { try {
// 修改安全环保检查数据 // 修改安全环保检查数据
res = safetyEnvironmentalInspectionGateway.update(safetyEnvironmentalInspectionE); res = safetyEnvironmentalInspectionGateway.update(safetyEnvironmentalInspectionE);
// 删除检查核实人数据
// 删除检查核实人数据 及对应待办信息
safetyEnvironmentalInspectionUserRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2); safetyEnvironmentalInspectionUserRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2);
List<SafetyEnvironmentalInspectionUserDO> deleteUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(),2);
for (SafetyEnvironmentalInspectionUserDO deleteUser : deleteUserList){
messageNoticeExe.sendMessageDeleteEvent(deleteUser.getId());
}
// 新增检查核实人数据 // 新增检查核实人数据
safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class)); safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class));
@ -181,6 +196,27 @@ public class SafetyEnvironmentalInspectionUpdateExe {
// 新增隐患发现人 // 新增隐患发现人
hiddenFindUserRepository.batchInsert(BeanUtil.copyToList(hiddenFindUserList, HiddenFindUserDO.class)); hiddenFindUserRepository.batchInsert(BeanUtil.copyToList(hiddenFindUserList, HiddenFindUserDO.class));
} }
//TODO 站内信
// 发送站内信和待办
if (cmd.getStatus() == 1) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 2);
for (SafetyEnvironmentalInspectionUserDO insUser : messageUserList){
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("initiatorName", ssoUser.getName());
sendParams.put("checkTitle", keyProjectDO.getProjectName());
messageNoticeExe.messageNotice(insUser.getUserId(), messageTemplateConfig.getCheckerApplyCheck(), sendParams);
//待办
messageNoticeExe.sendMessageAddEvent(insUser.getUserId(), "您有一条【安全环保检查】待处理","待核实", cmd.getId(), insUser.getId());
}
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 1);
// 完成重新发起待办
messageNoticeExe.sendMessageCompleteEvent(userList.get(0).getId());
}
} catch (Exception e) { } catch (Exception e) {
log.error("报错了", e); log.error("报错了", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@ -248,7 +284,11 @@ public class SafetyEnvironmentalInspectionUpdateExe {
res = safetyEnvironmentalInspectionGateway.update(safetyEnvironmentalInspectionE); res = safetyEnvironmentalInspectionGateway.update(safetyEnvironmentalInspectionE);
// 新增检查核实人数据 // 新增检查核实人数据
safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class)); safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class));
// 删除未核实人员的待办
List<SafetyEnvironmentalInspectionUserDO> deleteUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2);
for (SafetyEnvironmentalInspectionUserDO deleteUser : deleteUserList){
messageNoticeExe.sendMessageDeleteEvent(deleteUser.getId());
}
// 删除检查内容 // 删除检查内容
List<SafetyEnvironmentalInspectionContentDO> deleteContentList = safetyEnvironmentalInspectionContentRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId()); List<SafetyEnvironmentalInspectionContentDO> deleteContentList = safetyEnvironmentalInspectionContentRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId());
safetyEnvironmentalInspectionContentRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId()); safetyEnvironmentalInspectionContentRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId());
@ -259,6 +299,7 @@ public class SafetyEnvironmentalInspectionUpdateExe {
safetyEnvironmentalInspectionContentRepository.batchInsert(BeanUtil.copyToList(insContentList, SafetyEnvironmentalInspectionContentDO.class)); safetyEnvironmentalInspectionContentRepository.batchInsert(BeanUtil.copyToList(insContentList, SafetyEnvironmentalInspectionContentDO.class));
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("eqForeignKey", safetyEnvironmentalInspectionE.getInspectionId()); params.put("eqForeignKey", safetyEnvironmentalInspectionE.getInspectionId());
// 删除隐患 // 删除隐患
@ -269,9 +310,6 @@ public class SafetyEnvironmentalInspectionUpdateExe {
hiddenFindUserRepository.batchDelete(params); hiddenFindUserRepository.batchDelete(params);
// 新增隐患数据 // 新增隐患数据
if (hiddenAddCmdList != null && hiddenAddCmdList.size() > 0){ if (hiddenAddCmdList != null && hiddenAddCmdList.size() > 0){
List<Long> findUserIds = hiddenAddCmdList.stream() List<Long> findUserIds = hiddenAddCmdList.stream()
.map(HiddenAddCmd::getHiddenFindUserList) .map(HiddenAddCmd::getHiddenFindUserList)
.filter(Objects::nonNull) .filter(Objects::nonNull)
@ -328,6 +366,25 @@ public class SafetyEnvironmentalInspectionUpdateExe {
// 新增隐患发现人 // 新增隐患发现人
hiddenFindUserRepository.batchInsert(BeanUtil.copyToList(hiddenFindUserList, HiddenFindUserDO.class)); hiddenFindUserRepository.batchInsert(BeanUtil.copyToList(hiddenFindUserList, HiddenFindUserDO.class));
} }
// 发送站内信和待办
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 5);
for (SafetyEnvironmentalInspectionUserDO insUser : messageUserList){
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("initiatorName", ssoUser.getName());
sendParams.put("checkTitle", keyProjectDO.getProjectName());
messageNoticeExe.messageNotice(insUser.getUserId(), messageTemplateConfig.getCheckerApplyCheck(), sendParams);
//待办
messageNoticeExe.sendMessageAddEvent(insUser.getUserId(), "您有一条【安全环保检查】待处理","待核实", cmd.getId(), insUser.getId());
}
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 4);
// 完成申辩待办
messageNoticeExe.sendMessageCompleteEvent(userList.get(0).getId());
} catch (Exception e) { } catch (Exception e) {
log.error("报错了", e); log.error("报错了", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@ -366,6 +423,15 @@ public class SafetyEnvironmentalInspectionUpdateExe {
SafetyEnvironmentalInspectionUserE hiddenRectificationUser = new SafetyEnvironmentalInspectionUserE(); SafetyEnvironmentalInspectionUserE hiddenRectificationUser = new SafetyEnvironmentalInspectionUserE();
hiddenRectificationUser.init(cmd.getInspectionId(), 0, 7, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId()); hiddenRectificationUser.init(cmd.getInspectionId(), 0, 7, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId());
safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser); safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser);
//TODO 站内信 给隐患整改人发送隐患整改待处理
Map<String, Object> sendParamsHidden = new HashMap<>();
messageNoticeExe.messageNotice(inspectionDO.getXgfMasterUserId(), messageTemplateConfig.getCheckedPersonApplyDefend(), sendParamsHidden);
messageNoticeExe.sendMessageAddEvent(inspectionDO.getXgfMasterUserId(), "您有一条安全检查任务的待整改隐患,请及时整改。","待整改", inspectionDO.getId(), hiddenRectificationUser.getId());
} else { } else {
// 没有隐患,将安全环保检查状态改为已归档 // 没有隐患,将安全环保检查状态改为已归档
safetyEnvironmentalInspectionRepository.updateStatus(cmd.getInspectionId(), 5); safetyEnvironmentalInspectionRepository.updateStatus(cmd.getInspectionId(), 5);
@ -374,7 +440,19 @@ public class SafetyEnvironmentalInspectionUpdateExe {
hiddenRectificationUser.init(cmd.getInspectionId(), 1, 9, inspectionDO.getTenantId(), inspectionDO.getOrgId(), inspectionDO.getCreateId()); hiddenRectificationUser.init(cmd.getInspectionId(), 1, 9, inspectionDO.getTenantId(), inspectionDO.getOrgId(), inspectionDO.getCreateId());
hiddenRectificationUser.setSignatureTime(LocalDateTime.now()); hiddenRectificationUser.setSignatureTime(LocalDateTime.now());
safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser); safetyEnvironmentalInspectionUserGateway.add(hiddenRectificationUser);
//TODO 站内信 给发起人发归档信息
// 查找发起人,作为归档人
List<SafetyEnvironmentalInspectionUserDO> initiator = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 1);
Map<String, Object> sendParamsPigeonhole = new HashMap<>();
sendParamsPigeonhole.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(initiator.get(0).getUserId(), messageTemplateConfig.getCheckInitiatorApplyAcceptancePass(), sendParamsPigeonhole);
} }
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 4);
// 完成申辩待办
messageNoticeExe.sendMessageCompleteEvent(userList.get(0).getId());
} }
} }

View File

@ -3,7 +3,8 @@ package com.zcloud.key.project.command.inspection;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionGateway; import com.zcloud.key.project.command.project.MessageNoticeExe;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway; import com.zcloud.key.project.domain.gateway.inspection.SafetyEnvironmentalInspectionUserGateway;
import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE; import com.zcloud.key.project.domain.model.inspection.SafetyEnvironmentalInspectionUserE;
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionUserUpdateCmd; import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionUserUpdateCmd;
@ -12,13 +13,17 @@ import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmen
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO; import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionRepository;
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository; import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionUserRepository;
import io.swagger.models.auth.In; import com.zcloud.key.project.persistence.repository.project.KeyProjectRepository;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* web-app * web-app
@ -32,6 +37,9 @@ public class SafetyEnvironmentalInspectionUserUpdateExe {
private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway; private final SafetyEnvironmentalInspectionUserGateway safetyEnvironmentalInspectionUserGateway;
private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository; private final SafetyEnvironmentalInspectionUserRepository safetyEnvironmentalInspectionUserRepository;
private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository; private final SafetyEnvironmentalInspectionRepository safetyEnvironmentalInspectionRepository;
private final KeyProjectRepository keyProjectRepository;
private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void execute(SafetyEnvironmentalInspectionUserUpdateCmd safetyEnvironmentalInspectionUserUpdateCmd) { public void execute(SafetyEnvironmentalInspectionUserUpdateCmd safetyEnvironmentalInspectionUserUpdateCmd) {
@ -60,6 +68,8 @@ public class SafetyEnvironmentalInspectionUserUpdateExe {
inspectionUserDO.setType(type); inspectionUserDO.setType(type);
// 修改自己的检查信息 // 修改自己的检查信息
safetyEnvironmentalInspectionUserRepository.verifyEdit(inspectionUserDO); safetyEnvironmentalInspectionUserRepository.verifyEdit(inspectionUserDO);
List<SafetyEnvironmentalInspectionUserDO> verifyUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), type, ssoUser.getUserId());
if (cmd.getStatus() == 1){ // 如果通过 if (cmd.getStatus() == 1){ // 如果通过
// 查询是否所有人都核实, // 查询是否所有人都核实,
Long count = safetyEnvironmentalInspectionUserRepository.countByInspectionId(inspectionUserE.getInspectionId(), 0, type); Long count = safetyEnvironmentalInspectionUserRepository.countByInspectionId(inspectionUserE.getInspectionId(), 0, type);
@ -70,11 +80,27 @@ public class SafetyEnvironmentalInspectionUserUpdateExe {
SafetyEnvironmentalInspectionUserE affirmUser = new SafetyEnvironmentalInspectionUserE(); SafetyEnvironmentalInspectionUserE affirmUser = new SafetyEnvironmentalInspectionUserE();
affirmUser.init(cmd.getInspectionId(), 0, type+1, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId()); affirmUser.init(cmd.getInspectionId(), 0, type+1, inspectionDO.getXgfMasterUserCorpinfoId(), inspectionDO.getXgfMasterUserDepartmentId(), inspectionDO.getXgfMasterUserId());
safetyEnvironmentalInspectionUserGateway.add(affirmUser); safetyEnvironmentalInspectionUserGateway.add(affirmUser);
//TODO 站内信 给确认人发站内信
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("initiatorName", inspectionDO.getCreateName());
sendParams.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(affirmUser.getUserId(), messageTemplateConfig.getCheckedPersonApplyCheckConfirm(), sendParams);
messageNoticeExe.sendMessageAddEvent(affirmUser.getUserId(), "您有一条【安全环保检查】待确认","待确认", inspectionDO.getId(), affirmUser.getId());
} }
} else if (cmd.getStatus() == 2){ // 如果不通过 } else if (cmd.getStatus() == 2){ // 如果不通过
// 将安全环保检查改为核实打回 // 将安全环保检查改为核实打回
safetyEnvironmentalInspectionRepository.updateStatus(inspectionUserE.getInspectionId(), 6); safetyEnvironmentalInspectionRepository.updateStatus(inspectionUserE.getInspectionId(), 6);
List<SafetyEnvironmentalInspectionUserDO> userList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 1);
//TODO 站内信
Map<String, Object> sendParams = new HashMap<>();
sendParams.put("initiatorName", inspectionDO.getCreateName());
sendParams.put("checkTitle", inspectionDO.getProjectName());
messageNoticeExe.messageNotice(inspectionDO.getCreateId(), messageTemplateConfig.getCheckInitiatorApplyCheckNotPass(), sendParams);
messageNoticeExe.sendMessageAddEvent(inspectionDO.getCreateId(), "您有一条【安全环保检查】待处理","检查任务核实不通过,请您尽快处理。", inspectionDO.getId(), userList.get(0).getId());
} }
// 关闭当前人员核实待办
messageNoticeExe.sendMessageCompleteEvent(verifyUserList.get(0).getId());
} }
} }

View File

@ -3,6 +3,7 @@ package com.zcloud.key.project.command.project;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor; import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.enums.KeyProjectApplyStatusEnum; import com.zcloud.key.project.domain.enums.KeyProjectApplyStatusEnum;
import com.zcloud.key.project.domain.gateway.project.KeyProjectGateway; import com.zcloud.key.project.domain.gateway.project.KeyProjectGateway;
import com.zcloud.key.project.domain.model.project.KeyProjectE; import com.zcloud.key.project.domain.model.project.KeyProjectE;
@ -34,6 +35,7 @@ public class KeyProjectAddExe {
private final KeyProjectCameraRepository keyProjectCameraRepository; private final KeyProjectCameraRepository keyProjectCameraRepository;
private final KeyProjectCameraCoConvertor keyProjectCameraCoConvertor; private final KeyProjectCameraCoConvertor keyProjectCameraCoConvertor;
private final MessageNoticeExe messageNoticeExe; private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public KeyProjectCO execute(KeyProjectAddCmd cmd) { public KeyProjectCO execute(KeyProjectAddCmd cmd) {
@ -65,9 +67,9 @@ public class KeyProjectAddExe {
if(KeyProjectApplyStatusEnum.NOT_STARTED.getCode().equals(cmd.getApplyStatus())){ if(KeyProjectApplyStatusEnum.NOT_STARTED.getCode().equals(cmd.getApplyStatus())){
Map<String, Object> sendParams = new HashMap<>(); Map<String, Object> sendParams = new HashMap<>();
sendParams.put("keyProject", cmd.getProjectName()); sendParams.put("keyProject", cmd.getProjectName());
messageNoticeExe.messageNotice(cmd.getXgfMasterUserId(), "MS000109", sendParams); messageNoticeExe.messageNotice(cmd.getXgfMasterUserId(), messageTemplateConfig.getRelatedPartyUnitLeaderApplyStartWork(), sendParams);
//待办 //待办
messageNoticeExe.sendMessageAddEvent(cmd.getXgfMasterUserId(), "您有一条【重点作业】待处理","未开工", keyProjectE.getId()); messageNoticeExe.sendMessageAddEvent(cmd.getXgfMasterUserId(), "您有一条【重点作业】待处理","未开工", keyProjectE.getId(), keyProjectE.getId());
} }
return keyProjectCO; return keyProjectCO;
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor; import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor;
import com.zcloud.key.project.domain.config.MessageTemplateConfig;
import com.zcloud.key.project.domain.enums.KeyProjectApplyStatusEnum; import com.zcloud.key.project.domain.enums.KeyProjectApplyStatusEnum;
import com.zcloud.key.project.domain.gateway.project.KeyProjectGateway; import com.zcloud.key.project.domain.gateway.project.KeyProjectGateway;
import com.zcloud.key.project.domain.model.project.KeyProjectE; import com.zcloud.key.project.domain.model.project.KeyProjectE;
@ -40,6 +41,7 @@ public class KeyProjectUpdateExe {
private final KeyProjectCameraCoConvertor keyProjectCameraCoConvertor; private final KeyProjectCameraCoConvertor keyProjectCameraCoConvertor;
private final KeyProjectCameraRepository keyProjectCameraRepository; private final KeyProjectCameraRepository keyProjectCameraRepository;
private final MessageNoticeExe messageNoticeExe; private final MessageNoticeExe messageNoticeExe;
private final MessageTemplateConfig messageTemplateConfig;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void execute(KeyProjectUpdateCmd keyProjectUpdateCmd) { public void execute(KeyProjectUpdateCmd keyProjectUpdateCmd) {
@ -79,7 +81,7 @@ public class KeyProjectUpdateExe {
sendParams.put("keyProject", keyProjectUpdateCmd.getProjectName()); sendParams.put("keyProject", keyProjectUpdateCmd.getProjectName());
messageNoticeExe.messageNotice(keyProjectUpdateCmd.getXgfMasterUserId(), "MS000109", sendParams); messageNoticeExe.messageNotice(keyProjectUpdateCmd.getXgfMasterUserId(), "MS000109", sendParams);
//待办 //待办
messageNoticeExe.sendMessageAddEvent(keyProjectUpdateCmd.getXgfMasterUserId(), "您有一条【重点作业】待处理","未开工", keyProjectE.getId()); messageNoticeExe.sendMessageAddEvent(keyProjectUpdateCmd.getXgfMasterUserId(), "您有一条【重点作业】待处理","未开工", keyProjectE.getId(), keyProjectE.getId());
} }
} }
@ -97,10 +99,10 @@ public class KeyProjectUpdateExe {
//发送消息及待办处理 //发送消息及待办处理
Map<String, Object> sendParams = new HashMap<>(); Map<String, Object> sendParams = new HashMap<>();
sendParams.put("keyProject", byId.getProjectName()); sendParams.put("keyProject", byId.getProjectName());
messageNoticeExe.messageNotice(byId.getJurisdictionUserId(), "MS000110", sendParams); messageNoticeExe.messageNotice(byId.getJurisdictionUserId(), messageTemplateConfig.getXqUnitLeaderConfirmStartWork(), sendParams);
//待办 //待办
messageNoticeExe.sendMessageCompleteEvent(byId.getId()); messageNoticeExe.sendMessageCompleteEvent(byId.getId());
messageNoticeExe.sendMessageAddEvent(byId.getJurisdictionUserId(), "您有一条【重点作业】待处理","开工申请中", byId.getId()); messageNoticeExe.sendMessageAddEvent(byId.getJurisdictionUserId(), "您有一条【重点作业】待处理","开工申请中", byId.getId(), byId.getId());
} }
if(KeyProjectApplyStatusEnum.IN_PROGRESS.getCode().equals(keyProjectUpdateStatusCmd.getApplyStatus())){ if(KeyProjectApplyStatusEnum.IN_PROGRESS.getCode().equals(keyProjectUpdateStatusCmd.getApplyStatus())){
@ -112,10 +114,10 @@ public class KeyProjectUpdateExe {
//完工申请发小消息 //完工申请发小消息
Map<String, Object> sendParams = new HashMap<>(); Map<String, Object> sendParams = new HashMap<>();
sendParams.put("keyProject", byId.getProjectName()); sendParams.put("keyProject", byId.getProjectName());
messageNoticeExe.messageNotice(byId.getJurisdictionUserId(), "MS000112", sendParams); messageNoticeExe.messageNotice(byId.getJurisdictionUserId(), messageTemplateConfig.getXqUnitLeaderConfirmFinishWork(),sendParams);
//待办 //待办
messageNoticeExe.sendMessageCompleteEvent(byId.getId()); messageNoticeExe.sendMessageCompleteEvent(byId.getId());
messageNoticeExe.sendMessageAddEvent(byId.getJurisdictionUserId(), "您有一条【重点作业】待处理","完工申请中", byId.getId()); messageNoticeExe.sendMessageAddEvent(byId.getJurisdictionUserId(), "您有一条【重点作业】待处理","完工申请中", byId.getId(), byId.getId());
} }
if(KeyProjectApplyStatusEnum.FINISHED.getCode().equals(keyProjectUpdateStatusCmd.getApplyStatus())){ if(KeyProjectApplyStatusEnum.FINISHED.getCode().equals(keyProjectUpdateStatusCmd.getApplyStatus())){
@ -148,7 +150,7 @@ public class KeyProjectUpdateExe {
list.forEach(keyProjectDO -> { list.forEach(keyProjectDO -> {
Map<String, Object> sendParams = new HashMap<>(); Map<String, Object> sendParams = new HashMap<>();
sendParams.put("keyProject", keyProjectDO.getProjectName()); sendParams.put("keyProject", keyProjectDO.getProjectName());
messageNoticeExe.messageNotice(keyProjectDO.getXgfMasterUserId(), "MS000111", sendParams); messageNoticeExe.messageNotice(keyProjectDO.getXgfMasterUserId(), messageTemplateConfig.getRelatedPartyUnitLeaderApplyFinishWork(), sendParams);
}); });
} }

View File

@ -10,6 +10,7 @@ import com.jjb.saas.message.client.message.request.MessageTargetCmd;
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil; import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
import com.zcloud.gbscommon.todolistmq.event.TodoListAddEvent; import com.zcloud.gbscommon.todolistmq.event.TodoListAddEvent;
import com.zcloud.gbscommon.todolistmq.event.TodoListCompleteEvent; import com.zcloud.gbscommon.todolistmq.event.TodoListCompleteEvent;
import com.zcloud.gbscommon.todolistmq.event.TodoListDeleteEvent;
import com.zcloud.gbscommon.utils.Tools; import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.gbscommon.utils.UuidUtil; import com.zcloud.gbscommon.utils.UuidUtil;
import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor; import com.zcloud.key.project.command.convertor.project.KeyProjectCameraCoConvertor;
@ -68,7 +69,7 @@ public class MessageNoticeExe {
} }
} }
@Async("asyncExecutor") @Async("asyncExecutor")
public void sendMessageAddEvent(Long userId, String title,String content, Long foreignKey) { public void sendMessageAddEvent(Long userId, String title,String content, Long foreignKey, Long foreignSubsidiaryKey) {
//消息通知 //消息通知
try{ try{
// 发送待办 // 发送待办
@ -76,7 +77,7 @@ public class MessageNoticeExe {
event.setTitle(title); event.setTitle(title);
event.setContent(content); event.setContent(content);
event.setForeignKey(foreignKey); // 业务表ID -申请 event.setForeignKey(foreignKey); // 业务表ID -申请
event.setForeignSubsidiaryKey(foreignKey); // 业务附表ID 没有附表时为foreignKey的值 event.setForeignSubsidiaryKey(foreignSubsidiaryKey); // 业务附表ID 没有附表时为foreignKey的值
event.setReceiveUser(userId);// user表ID event.setReceiveUser(userId);// user表ID
event.setPcFlag(1); // 是否PC端待办 1是 0否 event.setPcFlag(1); // 是否PC端待办 1是 0否
event.setAppFlag(1); // 是否APP端待办 1是 0否 event.setAppFlag(1); // 是否APP端待办 1是 0否
@ -90,6 +91,7 @@ public class MessageNoticeExe {
log.error("消息待办,{},发送消息异常:", title,e); log.error("消息待办,{},发送消息异常:", title,e);
} }
} }
public void sendMessageCompleteEvent(Long foreignKey) { public void sendMessageCompleteEvent(Long foreignKey) {
//消息通知 //消息通知
try{ try{
@ -104,5 +106,19 @@ public class MessageNoticeExe {
} }
} }
public void sendMessageDeleteEvent(Long foreignKey) {
try{
TodoListDeleteEvent event2 = new TodoListDeleteEvent();
event2.setForeignSubsidiaryKey(foreignKey);// 业务附表ID 没有附表时为foreignKey的值
log.info("删除待办,请求:{}",foreignKey);
boolean b = todoListEventPusherUtil.sendMessageDeleteEvent(event2);
log.info("删除待办,结果:{}",b);
}catch (Exception e) {
log.error("完成待办失败",e);
}
}
} }

View File

@ -0,0 +1,53 @@
package com.zcloud.key.project.domain.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
/**
* @author zhangyue
* @date 2026/2/11 10:05
*/
@Component
@ConfigurationProperties(prefix = "message.template")
@Data
public class MessageTemplateConfig {
// 相关方单位负责人-发起开工申请
private String relatedPartyUnitLeaderApplyStartWork;
// 辖区单位负责人-确认开工
private String xqUnitLeaderConfirmStartWork;
// 相关方单位负责人-发起完工申请
private String relatedPartyUnitLeaderApplyFinishWork;
// 辖区单位负责人-确认完工
private String xqUnitLeaderConfirmFinishWork;
// 重点作业-相关方单位负责人-开工申请通过
private String relatedPartyUnitLeaderApplyStartWorkPass;
// 重点作业-相关方单位负责人-完工申请通过
private String relatedPartyUnitLeaderApplyFinishWorkPass;
// 重点作业-检查发起人-发起检查不通过
private String checkInitiatorApplyCheckNotPass;
// 重点作业-被检查人-发起申辩
private String checkedPersonApplyDefend;
// 重点作业-检查人-检查核实
private String checkerApplyCheck;
// 重点作业-被检查人-检查确认
private String checkedPersonApplyCheckConfirm;
// 重点作业-被检查人-申辩通过
private String checkedPersonApplyDefendPass;
// 重点作业-被检查人-申辩不通过
private String checkedPersonApplyDefendNotPass;
// 重点作业-隐患整改人-整改
private String hiddenDangerRectifyPersonApplyRectify;
// 重点作业-隐患验收人-验收
private String hiddenDangerAcceptancePersonApplyAcceptance;
// 重点作业-检查发起人-验收通过
private String checkInitiatorApplyAcceptancePass;
// 重点作业-检查发起人-验收未通过
private String checkInitiatorApplyAcceptanceNotPass;
}

View File

@ -27,6 +27,7 @@ public class SafetyEnvironmentalInspectionUserGatewayImpl implements SafetyEnvir
SafetyEnvironmentalInspectionUserDO d = new SafetyEnvironmentalInspectionUserDO(Tools.get32UUID()); SafetyEnvironmentalInspectionUserDO d = new SafetyEnvironmentalInspectionUserDO(Tools.get32UUID());
BeanUtils.copyProperties(safetyEnvironmentalInspectionUserE, d, "${uuid}"); BeanUtils.copyProperties(safetyEnvironmentalInspectionUserE, d, "${uuid}");
safetyEnvironmentalInspectionUserRepository.save(d); safetyEnvironmentalInspectionUserRepository.save(d);
safetyEnvironmentalInspectionUserE.setId(d.getId());
return true; return true;
} }

View File

@ -76,6 +76,20 @@ public class SafetyEnvironmentalInspectionUserRepositoryImpl extends BaseReposit
return safetyEnvironmentalInspectionUserMapper.selectListByInspectionId(params); return safetyEnvironmentalInspectionUserMapper.selectListByInspectionId(params);
} }
@Override
public List<SafetyEnvironmentalInspectionUserDO> listAllByInspectionId(String inspectionId, Integer type, Long userId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("inspectionId", inspectionId);
if (!ObjectUtils.isEmpty(type)){
params.put("type", type);
}
if (!ObjectUtils.isEmpty(userId)){
params.put("userId", userId);
}
return safetyEnvironmentalInspectionUserMapper.selectListByInspectionId(params);
}
@Override @Override
public void verifyEdit(SafetyEnvironmentalInspectionUserDO inspectionUserDO) { public void verifyEdit(SafetyEnvironmentalInspectionUserDO inspectionUserDO) {
UpdateWrapper updateWrapper = new UpdateWrapper<>(); UpdateWrapper updateWrapper = new UpdateWrapper<>();

View File

@ -26,6 +26,7 @@ public interface SafetyEnvironmentalInspectionUserRepository extends BaseReposit
List<SafetyEnvironmentalInspectionUserDO> listAllByInspectionId(String inspectionId, Integer type); List<SafetyEnvironmentalInspectionUserDO> listAllByInspectionId(String inspectionId, Integer type);
List<SafetyEnvironmentalInspectionUserDO> listAllByInspectionId(String inspectionId, Integer type, Long userId);
void verifyEdit(SafetyEnvironmentalInspectionUserDO inspectionUserDO); void verifyEdit(SafetyEnvironmentalInspectionUserDO inspectionUserDO);
void editUserInfo(SafetyEnvironmentalInspectionUserDO inspectionUserDO); void editUserInfo(SafetyEnvironmentalInspectionUserDO inspectionUserDO);

View File

@ -21,6 +21,9 @@
<if test="params.type != null and params.type != ''"> <if test="params.type != null and params.type != ''">
and iu.type = #{params.type} and iu.type = #{params.type}
</if> </if>
<if test="params.userId != null">
and iu.user_id = #{params.userId}
</if>
</where> </where>
</select> </select>