feat(REQ-4586) - 新增节点检测告警逻辑
This commit is contained in:
parent
17178eaecb
commit
028c9d3b0f
@ -0,0 +1,19 @@
|
||||
package cn.axzo.workflow.common.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 节点检测告警对象
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2024-09-13 11:37
|
||||
*/
|
||||
@Data
|
||||
public class NextNodePreCheckAlterDTO {
|
||||
|
||||
private String processInstanceId;
|
||||
|
||||
private String activityId;
|
||||
|
||||
private String errorMsg;
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
}
|
||||
}
|
||||
|
||||
private String doCheck(JobEntity job, List<FlowElement> flowElements, ProcessEngineConfigurationImpl processEngineConfiguration) {
|
||||
private void doCheck(JobEntity job, List<FlowElement> flowElements, ProcessEngineConfigurationImpl processEngineConfiguration) {
|
||||
AtomicReference<String> checkActivityId = new AtomicReference<>("");
|
||||
ListUtils.emptyIfNull(flowElements).stream()
|
||||
.filter(i -> i instanceof UserTask || i instanceof ReceiveTask || i instanceof ServiceTask)
|
||||
@ -107,7 +107,7 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
});
|
||||
checkActivityId.set(flowElement.getId());
|
||||
});
|
||||
return checkActivityId.get();
|
||||
checkActivityId.get();
|
||||
}
|
||||
|
||||
public List<BpmnTaskDelegateAssigner> approverSelect(String type, FlowElement flowElement,
|
||||
|
||||
@ -10,5 +10,5 @@ import cn.axzo.workflow.common.model.dto.AlterDTO;
|
||||
*/
|
||||
public interface Alter {
|
||||
|
||||
void invoke(AlterDTO alterDTO);
|
||||
void invoke(Object obj);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.workflow.core.util;
|
||||
|
||||
import cn.axzo.workflow.common.model.NextNodePreCheckAlterDTO;
|
||||
import cn.axzo.workflow.common.model.dto.AlterDTO;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@ -167,6 +168,26 @@ public class DingTalkUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void sendDingTalkForNodePreCheck(String profile, NextNodePreCheckAlterDTO alterDTO, List<String> alterMobiles) {
|
||||
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
||||
request.setMsgtype("markdown");
|
||||
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
|
||||
markdown.setTitle("Notice 审批模板节点预检查告警, Env: " + profile);
|
||||
markdown.setText("#### [" + profile + "]审批模板节点预检查告警\n" +
|
||||
"> 相关信息: " + JSONUtil.toJsonStr(alterDTO) + "\n\n" +
|
||||
"> 实例 ID:" + alterDTO.getProcessInstanceId() + "\n\n" +
|
||||
"> 检测节点 ID:" + alterDTO.getActivityId() + "\n\n" +
|
||||
"> ##### 错误信息:" + alterDTO.getErrorMsg() + "\n\n" +
|
||||
mobiles(alterMobiles));
|
||||
request.setMarkdown(markdown);
|
||||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
||||
at.setAtMobiles(alterMobiles);
|
||||
at.setIsAtAll(false);
|
||||
request.setAt(at);
|
||||
sendDingTalk(request);
|
||||
|
||||
}
|
||||
|
||||
public static void sendDingTalkForTransferToAdminError(String profile, String processInstanceId, String taskDefinitionKey, Object orgScopes, String targetUrl) {
|
||||
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
||||
request.setMsgtype("markdown");
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.axzo.riven.client.common.enums.DingTalkMsgTypeEnum;
|
||||
import cn.axzo.riven.client.feign.DingDingMsgApi;
|
||||
import cn.axzo.riven.client.model.SampleMarkdown;
|
||||
import cn.axzo.riven.client.req.DingDingSendRebootGroupMsgReq;
|
||||
import cn.axzo.workflow.common.model.NextNodePreCheckAlterDTO;
|
||||
import cn.axzo.workflow.common.model.dto.AlterDTO;
|
||||
import cn.axzo.workflow.core.conf.SupportRefreshProperties;
|
||||
import cn.axzo.workflow.core.listener.Alter;
|
||||
@ -39,13 +40,47 @@ public class DingTalkAlter implements Alter {
|
||||
private DingDingMsgApi dingDingMsgApi;
|
||||
|
||||
@Override
|
||||
public void invoke(AlterDTO alterDTO) {
|
||||
log.info("send biz node alter : {}", JSON.toJSONString(alterDTO));
|
||||
if (Objects.equals(profile, "master")) {
|
||||
DingTalkUtils.sendDingTalkForBizNodeAlter(profile, alterDTO, refreshProperties.getAlterMobiles());
|
||||
} else {
|
||||
rivenDingtalk(alterDTO);
|
||||
public void invoke(Object obj) {
|
||||
log.info("send biz node alter : {}", JSON.toJSONString(obj));
|
||||
if (obj instanceof AlterDTO) {
|
||||
AlterDTO alterDTO = (AlterDTO) obj;
|
||||
if (Objects.equals(profile, "master")) {
|
||||
DingTalkUtils.sendDingTalkForBizNodeAlter(profile, alterDTO, refreshProperties.getAlterMobiles());
|
||||
} else {
|
||||
rivenDingtalk(alterDTO);
|
||||
}
|
||||
}
|
||||
if (obj instanceof NextNodePreCheckAlterDTO) {
|
||||
NextNodePreCheckAlterDTO alterDTO = (NextNodePreCheckAlterDTO) obj;
|
||||
if(Objects.equals(profile, "master")){
|
||||
DingTalkUtils.sendDingTalkForNodePreCheck(profile, alterDTO, refreshProperties.getAlterMobiles());
|
||||
} else {
|
||||
rivenDingtalkForNodePreCheck(alterDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void rivenDingtalkForNodePreCheck(NextNodePreCheckAlterDTO alterDTO) {
|
||||
DingDingSendRebootGroupMsgReq req = new DingDingSendRebootGroupMsgReq();
|
||||
req.setDingDingScene("WORKFLOW_ENGINE_BIZNODE_ALTER");
|
||||
String processInstanceId = alterDTO.getProcessInstanceId();
|
||||
String title = "Notice 审批模板节点预检查告警, Env: " + profile;
|
||||
String text = "#### [" + profile + "]审批模板节点预检查告警\n" +
|
||||
"> 相关信息: " + JSONUtil.toJsonStr(alterDTO) + "\n\n" +
|
||||
"> 实例 ID:" + alterDTO.getProcessInstanceId() + "\n\n" +
|
||||
"> 检测节点 ID:" + alterDTO.getActivityId() + "\n\n" +
|
||||
"> ##### 错误信息:" + alterDTO.getErrorMsg() + "\n\n" +
|
||||
mobiles(refreshProperties.getAlterMobiles());
|
||||
SampleMarkdown markdown = new SampleMarkdown(title, text);
|
||||
|
||||
JSONObject markdownJson = JSONObject.parseObject(markdown.toJson());
|
||||
JSONObject atMobiles = new JSONObject();
|
||||
atMobiles.put("atMobiles", refreshProperties.getAlterMobiles());
|
||||
markdownJson.put("at", atMobiles);
|
||||
markdownJson.put("isAtAll", false);
|
||||
req.setDingDingJson(markdownJson.toJSONString());
|
||||
req.setMsgType(DingTalkMsgTypeEnum.sampleMarkdown);
|
||||
dingDingMsgApi.sendRebootGroupMsg(req);
|
||||
}
|
||||
|
||||
private void rivenDingtalk(AlterDTO alterDTO) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user