|
@@ -7,9 +7,11 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.common.core.domain.dto.RoleDTO;
|
|
|
import org.dromara.common.core.domain.dto.UserDTO;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
+import org.dromara.common.core.service.OssService;
|
|
|
import org.dromara.common.core.service.UserService;
|
|
|
import org.dromara.common.core.utils.StreamUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
@@ -64,6 +66,7 @@ import static org.dromara.workflow.common.constant.FlowConstant.*;
|
|
|
*
|
|
|
* @author may
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
public class ActTaskServiceImpl implements IActTaskService {
|
|
@@ -78,8 +81,9 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
private final ActHiTaskinstMapper actHiTaskinstMapper;
|
|
|
private final IWfNodeConfigService wfNodeConfigService;
|
|
|
private final IWfDefinitionConfigService wfDefinitionConfigService;
|
|
|
- private final UserService userService;
|
|
|
private final FlowProcessEventHandler flowProcessEventHandler;
|
|
|
+ private final UserService userService;
|
|
|
+ private final OssService ossService;
|
|
|
|
|
|
/**
|
|
|
* 启动任务
|
|
@@ -175,7 +179,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
return true;
|
|
|
}
|
|
|
//附件上传
|
|
|
- AttachmentCmd attachmentCmd = new AttachmentCmd(completeTaskBo.getFileId(), task.getId(), task.getProcessInstanceId());
|
|
|
+ AttachmentCmd attachmentCmd = new AttachmentCmd(completeTaskBo.getFileId(), task.getId(), task.getProcessInstanceId(), ossService);
|
|
|
managementService.executeCommand(attachmentCmd);
|
|
|
String businessStatus = WorkflowUtils.getBusinessStatus(processInstance.getBusinessKey());
|
|
|
//流程提交监听
|
|
@@ -184,8 +188,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
}
|
|
|
runtimeService.updateBusinessStatus(task.getProcessInstanceId(), BusinessStatusEnum.WAITING.getStatus());
|
|
|
//办理监听
|
|
|
- String keyNode = processInstance.getProcessDefinitionKey() + "_" + task.getTaskDefinitionKey();
|
|
|
- flowProcessEventHandler.processTaskHandler(keyNode, task.getId(), processInstance.getBusinessKey());
|
|
|
+ flowProcessEventHandler.processTaskHandler(processInstance.getProcessDefinitionKey(), task.getTaskDefinitionKey(),
|
|
|
+ task.getId(), processInstance.getBusinessKey());
|
|
|
//办理意见
|
|
|
taskService.addComment(completeTaskBo.getTaskId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), StringUtils.isBlank(completeTaskBo.getMessage()) ? "同意" : completeTaskBo.getMessage());
|
|
|
//办理任务
|
|
@@ -225,6 +229,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
}
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -239,7 +244,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
*/
|
|
|
@Async
|
|
|
public void sendMessage(List<Task> list, String name, List<String> messageType, String message) {
|
|
|
- WorkflowUtils.sendMessage(list, name, messageType, message);
|
|
|
+ WorkflowUtils.sendMessage(list, name, messageType, message, userService);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -273,7 +278,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
List<WfNodeConfigVo> wfNodeConfigVoList = wfNodeConfigService.selectByDefIds(processDefinitionIds);
|
|
|
for (TaskVo task : taskList) {
|
|
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
|
|
- task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
|
|
+ task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
|
|
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
|
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
|
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
|
@@ -338,7 +343,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
});
|
|
|
}
|
|
|
taskVo.setAssignee(StringUtils.isNotBlank(task.getAssignee()) ? Long.valueOf(task.getAssignee()) : null);
|
|
|
- taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
|
|
+ taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
|
|
taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
|
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
|
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
|
@@ -473,7 +478,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
taskService.complete(newTask.getId());
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -543,7 +548,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
taskService.setAssignee(task.getId(), transmitBo.getUserId());
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -591,7 +596,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
taskService.complete(newTask.getId());
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -641,7 +646,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
taskService.complete(newTask.getId());
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -721,6 +726,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
//删除驳回后的流程节点
|
|
|
wfTaskBackNodeService.deleteBackTaskNode(processInstanceId, backProcessBo.getTargetActivityId());
|
|
|
} catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
return task.getProcessInstanceId();
|
|
@@ -741,6 +747,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|
|
taskService.setAssignee(task.getId(), userId);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ log.error("修改失败:" + e.getMessage(), e);
|
|
|
throw new ServiceException("修改失败:" + e.getMessage());
|
|
|
}
|
|
|
return true;
|