|
@@ -47,26 +47,34 @@ public class ProcessListener implements ExecutionListener {
|
|
|
@Override
|
|
|
public void notify(DelegateExecution execution) {
|
|
|
log.info("ProcessListener触发了");
|
|
|
- execution.setVariable(PROCESS_STATUS,BUSINESS_STATUS_4);
|
|
|
+ execution.setVariable(PROCESS_STATUS, BUSINESS_STATUS_4);
|
|
|
String processInstanceId = execution.getProcessInstanceId();
|
|
|
- log.info("processInstanceId:{}",processInstanceId);
|
|
|
+ log.info("processInstanceId:{}", processInstanceId);
|
|
|
|
|
|
// TODO: 2024/3/4 根据流程实例id 修改表单的数据 修改状态
|
|
|
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
|
|
|
.includeProcessVariables().singleResult();
|
|
|
String processDefinitionKey = historicProcessInstance.getProcessDefinitionKey();
|
|
|
- ProcessTemplates processTemplates = processTemplateService.getById(processDefinitionKey.replace(PROCESS_PREFIX,""));
|
|
|
+ ProcessTemplates processTemplates = processTemplateService.getById(processDefinitionKey.replace(PROCESS_PREFIX, ""));
|
|
|
String tableConfigId = processTemplates.getTableConfigId();
|
|
|
- if (Optional.ofNullable(tableConfigId).isPresent()){
|
|
|
+ log.info("tableConfigId:{}", tableConfigId);
|
|
|
+ if (tableConfigId != null) {
|
|
|
//根据tableConfigId 查询需要修改的表单
|
|
|
WorkflowConfig workflowConfig = workflowConfigService.getById(tableConfigId);
|
|
|
//获取表名
|
|
|
String tableName = workflowConfig.getTableName();
|
|
|
//MQTT
|
|
|
- WorkFlowMessage workFlowMessage = new WorkFlowMessage().setTableName(tableName).setProcessInstanceId(processInstanceId);
|
|
|
+ String command = "UPDATE-STATE";
|
|
|
+ WorkFlowMessage workFlowMessage = new WorkFlowMessage().setTableName(tableName).setProcessInstanceId(processInstanceId).setCommand(command);
|
|
|
//发送表名和实例id
|
|
|
String topic = "workflow";
|
|
|
- sendMessageService.publish(topic,workFlowMessage);
|
|
|
+ boolean publish = sendMessageService.publish(topic, workFlowMessage);
|
|
|
+ if (publish) {
|
|
|
+ log.info("发送成功");
|
|
|
+ } else {
|
|
|
+ log.info("发送失败");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|