增加消息通知
parent
f6e39da335
commit
05bec5e2b7
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/start/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/web-adapter/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/web-app/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/web-client/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/web-domain/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/web-infrastructure/src/main/java" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -49,3 +49,9 @@ openapi:
|
||||||
apiCode: test:01
|
apiCode: test:01
|
||||||
#多个可以逗号隔开,可以为空
|
#多个可以逗号隔开,可以为空
|
||||||
tenantIds: 1838408702262321152
|
tenantIds: 1838408702262321152
|
||||||
|
message:
|
||||||
|
code:
|
||||||
|
list-check-taskLogTemplate: MS000127
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,16 @@ import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageSendCmd;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageTargetCmd;
|
||||||
import com.zcloud.eightwork.command.convertor.TaskLogConvertUtil;
|
import com.zcloud.eightwork.command.convertor.TaskLogConvertUtil;
|
||||||
|
import com.zcloud.eightwork.domain.config.MessageConfig;
|
||||||
import com.zcloud.eightwork.domain.gateway.EightworkSupplementaryInfoGateway;
|
import com.zcloud.eightwork.domain.gateway.EightworkSupplementaryInfoGateway;
|
||||||
import com.zcloud.eightwork.domain.gateway.TaskFlowGateway;
|
import com.zcloud.eightwork.domain.gateway.TaskFlowGateway;
|
||||||
import com.zcloud.eightwork.domain.gateway.TaskLogGateway;
|
import com.zcloud.eightwork.domain.gateway.TaskLogGateway;
|
||||||
|
|
@ -30,17 +35,17 @@ 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.utils.Tools;
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
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 java.util.ArrayList;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -111,7 +116,9 @@ public class TaskLogUpdateExe {
|
||||||
private final EightworkSupplementaryInfoGateway eightworkSupplementaryInfoGateway;
|
private final EightworkSupplementaryInfoGateway eightworkSupplementaryInfoGateway;
|
||||||
private final EightworkSupplementaryInfoRepository eightworkSupplementaryInfoRepository;
|
private final EightworkSupplementaryInfoRepository eightworkSupplementaryInfoRepository;
|
||||||
private final EightworkSupplementaryInfoArchiveRepository eightworkSupplementaryInfoArchiveRepository;
|
private final EightworkSupplementaryInfoArchiveRepository eightworkSupplementaryInfoArchiveRepository;
|
||||||
|
@DubboReference
|
||||||
|
private MessageFacade messageFacade;
|
||||||
|
private MessageConfig messageConfig;
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void execute(TaskLogUpdateCmd taskLogUpdateCmd) {
|
public void execute(TaskLogUpdateCmd taskLogUpdateCmd) {
|
||||||
TaskLogE taskLogE = new TaskLogE();
|
TaskLogE taskLogE = new TaskLogE();
|
||||||
|
|
@ -658,6 +665,7 @@ public class TaskLogUpdateExe {
|
||||||
// 发送待办通知
|
// 发送待办通知
|
||||||
sendTodoAddEvent(workId, next, currentLog.getWorkType());
|
sendTodoAddEvent(workId, next, currentLog.getWorkType());
|
||||||
|
|
||||||
|
messageNotice(next.getActUser(),next, currentLog);
|
||||||
log.info("已激活下一步: {}", next.getStepName());
|
log.info("已激活下一步: {}", next.getStepName());
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1092,6 +1100,7 @@ public class TaskLogUpdateExe {
|
||||||
branchStep.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
|
branchStep.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
|
||||||
addActionLog(actionLogs, branchStep);
|
addActionLog(actionLogs, branchStep);
|
||||||
sendTodoAddEvent(getWorkId(currentLog.getWorkId()), branchStep, currentLog.getWorkType());
|
sendTodoAddEvent(getWorkId(currentLog.getWorkId()), branchStep, currentLog.getWorkType());
|
||||||
|
messageNotice(getWorkId(currentLog.getWorkId()),branchStep, currentLog);
|
||||||
log.info("已激活分支步骤: stepName={}, mergeTo={}", branchStep.getStepName(), branchStep.getBranchMergeStep());
|
log.info("已激活分支步骤: stepName={}, mergeTo={}", branchStep.getStepName(), branchStep.getBranchMergeStep());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1288,6 +1297,34 @@ public class TaskLogUpdateExe {
|
||||||
log.error("发送待办新增事件失败: stepId={}", nextStep.getId(), e);
|
log.error("发送待办新增事件失败: stepId={}", nextStep.getId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void messageNotice(Long userId,TaskLogE nextStep, TaskLogE currentLog) {
|
||||||
|
//消息通知
|
||||||
|
try{
|
||||||
|
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||||
|
messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
||||||
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||||
|
messageTargetCmd.setUserId(userId);
|
||||||
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||||
|
messageSendCmd.setSourceCode(messageConfig.getTaskLogTemplate());
|
||||||
|
messageSendCmd.setNeedTokenEnum(false);
|
||||||
|
|
||||||
|
EightworkInfoDO eightworkInfoDO = getEightworkInfoDO(currentLog.getWorkId());
|
||||||
|
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||||
|
sendParams.put("approvalStatus", TaskLogStatus.getByCode(nextStep.getStatus()).getDesc());
|
||||||
|
sendParams.put("workType", WorkCodeEnum.getNameByWorkType(currentLog.getWorkType()));
|
||||||
|
sendParams.put("checkNo",eightworkInfoDO.getCheckNo());
|
||||||
|
sendParams.put("stepName", nextStep.getStepName());
|
||||||
|
|
||||||
|
messageSendCmd.setParams(sendParams);
|
||||||
|
|
||||||
|
log.info("消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||||
|
SingleResponse<Boolean> d = messageFacade.send(messageSendCmd);
|
||||||
|
log.info("消息提醒发送消息结果:d: {}", JSONUtil.toJsonStr(d));
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("消息提醒发送消息异常:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作业ID
|
* 获取作业ID
|
||||||
|
|
@ -1299,6 +1336,13 @@ public class TaskLogUpdateExe {
|
||||||
.eq(EightworkInfoDO::getWorkId, workId)
|
.eq(EightworkInfoDO::getWorkId, workId)
|
||||||
).getId();
|
).getId();
|
||||||
}
|
}
|
||||||
|
private EightworkInfoDO getEightworkInfoDO(String workId) {
|
||||||
|
return eightworkInfoRepository.getOne(
|
||||||
|
new LambdaQueryWrapper<EightworkInfoDO>()
|
||||||
|
.select(EightworkInfoDO::getId)
|
||||||
|
.eq(EightworkInfoDO::getWorkId, workId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 智能添加步骤到待更新列表
|
* 智能添加步骤到待更新列表
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.zcloud.eightwork.domain.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@RefreshScope
|
||||||
|
@ConfigurationProperties(prefix = "message.code")
|
||||||
|
public class MessageConfig {
|
||||||
|
/**
|
||||||
|
* 模板
|
||||||
|
*/
|
||||||
|
private String taskLogTemplate;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue