|
@@ -93,8 +93,6 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
case TASK_CREATED:
|
|
|
log.info("流程任务创建_TASK_CREATED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
|
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
|
|
-
|
|
|
- TSJobRemindService jobRemindService = SpringContextHolder.getBean(TSJobRemindService.class);
|
|
|
ActivitiEntityEvent activitiEntityEvent = (ActivitiEntityEvent) event;
|
|
|
if (activitiEntityEvent.getEntity() instanceof Task) {
|
|
|
Task task = (Task) activitiEntityEvent.getEntity();
|
|
@@ -111,36 +109,21 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
TFFlowLog tfFlowLog = (TFFlowLog) taskService.getVariable(task.getId(), SystemConstant.FLOW_APPROVE_LOG);
|
|
|
Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
|
|
|
- SysUser sysUser = (SysUser) taskService.getVariable(task.getId(), SystemConstant.FLOW_SYS_USER);
|
|
|
- Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
-
|
|
|
-// Map<String, Object> map = (Map) taskService.getVariable(task.getId(), SystemConstant.APPROVE_MAP_VAR);
|
|
|
-
|
|
|
//此处统一流程节点保存延期预警任务
|
|
|
if ((tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW || tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW)
|
|
|
&& tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.DRAFT
|
|
|
&& tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.END
|
|
|
&& tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.FINISH) {
|
|
|
- List<TSJobRemind> tsJobRemindArrayList = new ArrayList<>();
|
|
|
if (Objects.nonNull(task.getAssignee())) {
|
|
|
- tsJobRemindArrayList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(), sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
-// if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
|
|
|
this.sendSopFlowDoneSms(tfCustomFlow.getType(), tfCustomFlowEntity, task.getName(), Long.parseLong(task.getAssignee()));
|
|
|
-// jobRemindService.saveJobRemind(tsJobRemindArrayList);
|
|
|
-// }
|
|
|
} else {
|
|
|
List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
|
|
|
if (!CollectionUtils.isEmpty(identityLinkList)) {
|
|
|
for (IdentityLink i : identityLinkList) {
|
|
|
- tsJobRemindArrayList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(), Long.parseLong(i.getTaskId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER, Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
-// if (CollectionUtils.isEmpty(map)) {//系统自动提交的不发待办短信
|
|
|
this.sendSopFlowDoneSms(tfCustomFlow.getType(), tfCustomFlowEntity, task.getName(), Long.parseLong(i.getUserId()));
|
|
|
-// jobRemindService.saveJobRemind(tsJobRemindArrayList);
|
|
|
-// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- jobRemindService.saveJobRemind(tsJobRemindArrayList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -149,7 +132,7 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
// 任务被完成了。它会在ENTITY_DELETE事件之前触发。当任务是流程一部分时,事件会在流程继续运行之前, 后续事件将是ACTIVITY_COMPLETE,对应着完成任务的节点。
|
|
|
log.info("流程任务完成_TASK_COMPLETED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
|
taskService = SpringContextHolder.getBean(TaskService.class);
|
|
|
- jobRemindService = SpringContextHolder.getBean(TSJobRemindService.class);
|
|
|
+ TSJobRemindService jobRemindService = SpringContextHolder.getBean(TSJobRemindService.class);
|
|
|
activitiEntityEvent = (ActivitiEntityEvent) event;
|
|
|
if (activitiEntityEvent.getEntity() instanceof Task) {
|
|
|
Task task = (Task) activitiEntityEvent.getEntity();
|
|
@@ -160,8 +143,7 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
TFFlowLog tfFlowLog = (TFFlowLog) taskService.getVariable(task.getId(), SystemConstant.FLOW_APPROVE_LOG);
|
|
|
Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
|
|
|
- if ((tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW || tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW)
|
|
|
- && tfFlowLog.getApproveSetup().intValue() > 1) {//流程提交不需要提醒
|
|
|
+ if ((tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW || tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) && tfFlowLog.getApproveSetup().intValue() > 1) {//流程提交不需要提醒
|
|
|
//任务完成后统一设置延期预警任务enable为false
|
|
|
jobRemindService.updateJobRemind(Long.parseLong(task.getId()));
|
|
|
}
|
|
@@ -350,19 +332,17 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
protected void sendSopFlowDoneSms(TFCustomTypeEnum type, TFCustomFlowEntity tfCustomFlowEntity, String taskName, Long userId) {
|
|
|
SmsSendUtil smsSendUtil = SpringContextHolder.getBean(SmsSendUtil.class);
|
|
|
TFCustomFlowEntityService tfCustomFlowEntityService = SpringContextHolder.getBean(TFCustomFlowEntityService.class);
|
|
|
- if (type == TFCustomTypeEnum.OFFICE_SOP_FLOW || type == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//发送待审批短信
|
|
|
- FlowTaskSmsResult flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getId(), userId);
|
|
|
- if (Objects.isNull(flowTaskSmsResult)) {
|
|
|
- flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getCrmNo(), userId);
|
|
|
- }
|
|
|
- Optional.ofNullable(flowTaskSmsResult).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
- Map<String, Object> templateParam = new HashMap<>();
|
|
|
- templateParam.put("userName", flowTaskSmsResult.getRealName());
|
|
|
- templateParam.put("serviceName", flowTaskSmsResult.getServiceName());
|
|
|
- templateParam.put("customName", flowTaskSmsResult.getCustomName());
|
|
|
- templateParam.put("flowName", type.getTitle() + "【" + taskName + "】");
|
|
|
- smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), SystemConstant.SMS_SOP_DONE_CODE, templateParam);
|
|
|
+ FlowTaskSmsResult flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getId(), userId);
|
|
|
+ if (Objects.isNull(flowTaskSmsResult)) {
|
|
|
+ flowTaskSmsResult = tfCustomFlowEntityService.getFlowTaskRemindSmsInfo(tfCustomFlowEntity.getCrmNo(), userId);
|
|
|
}
|
|
|
+ Optional.ofNullable(flowTaskSmsResult).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
+ Map<String, Object> templateParam = new HashMap<>();
|
|
|
+ templateParam.put("userName", flowTaskSmsResult.getRealName());
|
|
|
+ templateParam.put("serviceName", flowTaskSmsResult.getServiceName());
|
|
|
+ templateParam.put("customName", flowTaskSmsResult.getCustomName());
|
|
|
+ templateParam.put("flowName", type.getTitle() + "【" + taskName + "】");
|
|
|
+ smsSendUtil.sendSms(flowTaskSmsResult.getMobileNumber(), SystemConstant.SMS_SOP_DONE_CODE, templateParam);
|
|
|
}
|
|
|
|
|
|
/**
|