|
@@ -4,15 +4,24 @@ import cn.hutool.core.collection.CollUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
|
|
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; |
|
|
|
|
|
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.manage.NoticeManage; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.model.entity.Notify; |
|
|
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; |
|
|
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; |
|
|
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; |
|
|
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.service.INotifyService; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
|
|
import com.ningdatech.yxt.model.cmd.SendSmsCmd; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.workflow.notify.event.EarlyWarningEvent; |
|
|
import com.wflow.workflow.notify.event.EarlyWarningEvent; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
@@ -49,6 +58,14 @@ public class EarlyWarningListener { |
|
|
|
|
|
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
|
|
|
|
|
|
|
|
private final YxtCallOrSmsHelper yxtCallOrSmsHelper; |
|
|
|
|
|
|
|
|
|
|
|
private final NoticeManage noticeManage; |
|
|
|
|
|
|
|
|
|
|
|
private final INdWorkNoticeStagingService workNoticeStagingService; |
|
|
|
|
|
|
|
|
|
|
|
private final INotifyService notifyService; |
|
|
|
|
|
|
|
|
@Async |
|
|
@Async |
|
|
@EventListener |
|
|
@EventListener |
|
|
public void onApplicationEvent(EarlyWarningEvent event) { |
|
|
public void onApplicationEvent(EarlyWarningEvent event) { |
|
@@ -104,9 +121,19 @@ public class EarlyWarningListener { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for(HistoricActivityInstance hai : hais){ |
|
|
for(HistoricActivityInstance hai : hais){ |
|
|
|
|
|
if(StringUtils.isBlank(noticeMethod) || |
|
|
|
|
|
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && |
|
|
|
|
|
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ |
|
|
|
|
|
log.info("通知方式为空或者错误!"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//1.存入 预警记录 |
|
|
String assignee = hai.getAssignee(); |
|
|
String assignee = hai.getAssignee(); |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(assignee); |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(assignee); |
|
|
WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); |
|
|
WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); |
|
|
|
|
|
String content = convertContent(noticeContent,project.getProjectName(), |
|
|
|
|
|
InstTypeEnum.getByCode(pi.getInstType()),timeout); |
|
|
records.setAreaCode(project.getAreaCode()); |
|
|
records.setAreaCode(project.getAreaCode()); |
|
|
records.setBuildOrgCode(project.getBuildOrgCode()); |
|
|
records.setBuildOrgCode(project.getBuildOrgCode()); |
|
|
records.setBuildOrgName(project.getBuildOrgName()); |
|
|
records.setBuildOrgName(project.getBuildOrgName()); |
|
@@ -115,12 +142,34 @@ public class EarlyWarningListener { |
|
|
records.setInstStart(hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); |
|
|
records.setInstStart(hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); |
|
|
records.setInstType(pi.getInstType()); |
|
|
records.setInstType(pi.getInstType()); |
|
|
records.setNoticeMethod(noticeMethod); |
|
|
records.setNoticeMethod(noticeMethod); |
|
|
records.setNoticeContent(convertContent(noticeContent,project.getProjectName(),InstTypeEnum.getByCode(pi.getInstType()),timeout)); |
|
|
|
|
|
|
|
|
records.setNoticeContent(content); |
|
|
records.setProjectName(project.getProjectName()); |
|
|
records.setProjectName(project.getProjectName()); |
|
|
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); |
|
|
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); |
|
|
records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); |
|
|
records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); |
|
|
records.setWarningEmployeecode(assignee); |
|
|
records.setWarningEmployeecode(assignee); |
|
|
earlyWarningRecordsService.save(records); |
|
|
earlyWarningRecordsService.save(records); |
|
|
|
|
|
|
|
|
|
|
|
//2.消息提醒 |
|
|
|
|
|
Notify notify = noticeManage.assemblyAuditNotify(user.getUserId(), project, content); |
|
|
|
|
|
notify.setType(MsgTypeEnum.PROJECT_REVIEW.name()); |
|
|
|
|
|
notifyService.save(notify); |
|
|
|
|
|
|
|
|
|
|
|
//3.发短信 |
|
|
|
|
|
if(noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))){ |
|
|
|
|
|
SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); |
|
|
|
|
|
context.setReceiveNumber(user.getMobile()); |
|
|
|
|
|
context.setContent(content); |
|
|
|
|
|
yxtCallOrSmsHelper.sendSms(context); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//4.浙政钉 |
|
|
|
|
|
if(noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))){ |
|
|
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
|
|
WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(assignee); |
|
|
|
|
|
passWorkNoticeInfo.setMsg(content); |
|
|
|
|
|
// 放入工作通知暂存表中,通过扫表异步发送 |
|
|
|
|
|
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|