mirror of
https://gitee.com/zhijiantianya/yudao-cloud.git
synced 2025-12-26 07:06:24 +08:00
【同步】BOOT 和 CLOUD 的功能
This commit is contained in:
parent
8becb49a3b
commit
6dcbb1829b
@ -779,8 +779,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
*/
|
||||
private void approveDelegateTask(BpmTaskApproveReqVO reqVO, Task task) {
|
||||
// 1. 添加审批意见
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(WebFrameworkUtils.getLoginUserId());
|
||||
AdminUserRespDTO ownerUser = adminUserApi.getUser(NumberUtils.parseLong(task.getOwner())); // 发起委托的用户
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(WebFrameworkUtils.getLoginUserId()).getCheckedData();
|
||||
AdminUserRespDTO ownerUser = adminUserApi.getUser(NumberUtils.parseLong(task.getOwner())).getCheckedData(); // 发起委托的用户
|
||||
Assert.notNull(ownerUser, "委派任务找不到原审批人,需要检查数据");
|
||||
taskService.addComment(reqVO.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_END.getType(),
|
||||
BpmCommentTypeEnum.DELEGATE_END.formatComment(currentUser.getNickname(), ownerUser.getNickname(), reqVO.getReason()));
|
||||
@ -1002,13 +1002,13 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
throw exception(TASK_DELEGATE_FAIL_USER_REPEAT);
|
||||
}
|
||||
// 1.2 校验目标用户存在
|
||||
AdminUserRespDTO delegateUser = adminUserApi.getUser(reqVO.getDelegateUserId());
|
||||
AdminUserRespDTO delegateUser = adminUserApi.getUser(reqVO.getDelegateUserId()).getCheckedData();
|
||||
if (delegateUser == null) {
|
||||
throw exception(TASK_DELEGATE_FAIL_USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 2. 添加委托意见
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId);
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId).getCheckedData();
|
||||
taskService.addComment(taskId, task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_START.getType(),
|
||||
BpmCommentTypeEnum.DELEGATE_START.formatComment(currentUser.getNickname(), delegateUser.getNickname(), reqVO.getReason()));
|
||||
|
||||
@ -1033,13 +1033,13 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
throw exception(TASK_TRANSFER_FAIL_USER_REPEAT);
|
||||
}
|
||||
// 1.2 校验目标用户存在
|
||||
AdminUserRespDTO assigneeUser = adminUserApi.getUser(reqVO.getAssigneeUserId());
|
||||
AdminUserRespDTO assigneeUser = adminUserApi.getUser(reqVO.getAssigneeUserId()).getCheckedData();
|
||||
if (assigneeUser == null) {
|
||||
throw exception(TASK_TRANSFER_FAIL_USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 2. 添加委托意见
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId);
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId).getCheckedData();
|
||||
taskService.addComment(taskId, task.getProcessInstanceId(), BpmCommentTypeEnum.TRANSFER.getType(),
|
||||
BpmCommentTypeEnum.TRANSFER.formatComment(currentUser.getNickname(), assigneeUser.getNickname(), reqVO.getReason()));
|
||||
|
||||
@ -1098,7 +1098,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
public void createSignTask(Long userId, BpmTaskSignCreateReqVO reqVO) {
|
||||
// 1. 获取和校验任务
|
||||
TaskEntityImpl taskEntity = validateTaskCanCreateSign(userId, reqVO);
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(reqVO.getUserIds());
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(reqVO.getUserIds()).getCheckedData();
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
throw exception(TASK_SIGN_CREATE_USER_NOT_EXIST);
|
||||
}
|
||||
@ -1125,7 +1125,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
createSignTaskList(convertList(reqVO.getUserIds(), String::valueOf), taskEntity);
|
||||
|
||||
// 4. 记录加签的评论到 task 任务
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId);
|
||||
AdminUserRespDTO currentUser = adminUserApi.getUser(userId).getCheckedData();
|
||||
String comment = StrUtil.format(BpmCommentTypeEnum.ADD_SIGN.getComment(),
|
||||
currentUser.getNickname(), BpmTaskSignTypeEnum.nameOfType(reqVO.getType()),
|
||||
String.join(",", convertList(userList, AdminUserRespDTO::getNickname)), reqVO.getReason());
|
||||
@ -1157,7 +1157,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
List<Long> currentAssigneeList = convertListByFlatMap(taskList, task -> // 需要考虑 owner 的情况,因为向后加签时,它暂时没 assignee 而是 owner
|
||||
Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner())));
|
||||
if (CollUtil.containsAny(currentAssigneeList, reqVO.getUserIds())) {
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(CollUtil.intersection(currentAssigneeList, reqVO.getUserIds()));
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(CollUtil.intersection(currentAssigneeList, reqVO.getUserIds())).getCheckedData();
|
||||
throw exception(TASK_SIGN_CREATE_USER_REPEAT, String.join(",", convertList(userList, AdminUserRespDTO::getNickname)));
|
||||
}
|
||||
return taskEntity;
|
||||
@ -1219,10 +1219,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 1.2 校验取消人存在
|
||||
AdminUserRespDTO cancelUser = null;
|
||||
if (StrUtil.isNotBlank(task.getAssignee())) {
|
||||
cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getAssignee()));
|
||||
cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getAssignee())).getCheckedData();
|
||||
}
|
||||
if (cancelUser == null && StrUtil.isNotBlank(task.getOwner())) {
|
||||
cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getOwner()));
|
||||
cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getOwner())).getCheckedData();
|
||||
}
|
||||
Assert.notNull(cancelUser, "任务中没有所有者和审批人,数据错误");
|
||||
|
||||
@ -1236,7 +1236,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
taskService.deleteTasks(convertList(childTaskList, Task::getId));
|
||||
|
||||
// 3. 记录日志到父任务中。先记录日志是因为,通过 handleParentTask 方法之后,任务可能被完成了,并且不存在了,会报异常,所以先记录
|
||||
AdminUserRespDTO user = adminUserApi.getUser(userId);
|
||||
AdminUserRespDTO user = adminUserApi.getUser(userId).getCheckedData();
|
||||
taskService.addComment(task.getParentTaskId(), task.getProcessInstanceId(), BpmCommentTypeEnum.SUB_SIGN.getType(),
|
||||
StrUtil.format(BpmCommentTypeEnum.SUB_SIGN.getComment(), user.getNickname(), cancelUser.getNickname()));
|
||||
|
||||
@ -1538,9 +1538,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 情况二:转交给部门负责人审批
|
||||
if (ObjectUtils.equalsAny(assignStartUserHandlerType,
|
||||
BpmUserTaskAssignStartUserHandlerTypeEnum.TRANSFER_DEPT_LEADER.getType())) {
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId()));
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||
Assert.notNull(startUser, "提交人({})信息为空", processInstance.getStartUserId());
|
||||
DeptRespDTO dept = startUser.getDeptId() != null ? deptApi.getDept(startUser.getDeptId()) : null;
|
||||
DeptRespDTO dept = startUser.getDeptId() != null ? deptApi.getDept(startUser.getDeptId()).getCheckedData() : null;
|
||||
Assert.notNull(dept, "提交人({})部门({})信息为空", processInstance.getStartUserId(), startUser.getDeptId());
|
||||
// 找不到部门负责人的情况下,自动审批通过
|
||||
// noinspection DataFlowIssue
|
||||
@ -1562,7 +1562,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
}
|
||||
// 注意:需要基于 instance 设置租户编号,避免 Flowable 内部异步时,丢失租户编号
|
||||
FlowableUtils.execute(processInstance.getTenantId(), () -> {
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId()));
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||
messageService.sendMessageWhenTaskAssigned(BpmTaskConvert.INSTANCE.convert(processInstance, startUser, task));
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user