1. 补全后端的其余模块
2. 新增用户管理多部门的逻辑
This commit is contained in:
@@ -112,6 +112,12 @@
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-business</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
@@ -82,8 +83,7 @@ public class BpmProcessInstanceController {
|
||||
userIds.addAll(convertSetByFlatMap(taskMap.values(),
|
||||
tasks -> tasks.stream().map(Task::getAssignee).filter(StrUtil::isNotBlank).map(Long::parseLong)));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
|
||||
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult,
|
||||
processDefinitionMap, categoryMap, taskMap, userMap, deptMap, processDefinitionInfoMap));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class BpmProcessInstanceController {
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
|
||||
convertSet(pageResult.getList(), processInstance -> NumberUtils.parseLong(processInstance.getStartUserId())));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
|
||||
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(
|
||||
convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId));
|
||||
return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult,
|
||||
@@ -141,8 +141,11 @@ public class BpmProcessInstanceController {
|
||||
processInstance.getProcessDefinitionId());
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())).getCheckedData();
|
||||
DeptRespDTO dept = null;
|
||||
if (startUser != null && startUser.getDeptId() != null) {
|
||||
dept = deptApi.getDept(startUser.getDeptId()).getCheckedData();
|
||||
if (startUser != null) {
|
||||
Long deptId = DeptUtil.getDeptId(startUser);
|
||||
if (deptId > 0) {
|
||||
dept = deptApi.getDept(deptId).getCheckedData();
|
||||
}
|
||||
}
|
||||
return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstance(processInstance,
|
||||
processDefinition, processDefinitionInfo, startUser, dept));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
@@ -40,6 +41,9 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* @author chenbowen
|
||||
*/
|
||||
@Tag(name = "管理后台 - 流程任务实例")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/task")
|
||||
@@ -114,8 +118,7 @@ public class BpmTaskController {
|
||||
Set<Long> userIds = convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId()));
|
||||
userIds.addAll(convertSet(pageResult.getList(), task -> NumberUtils.parseLong(task.getAssignee())));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
|
||||
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(
|
||||
convertSet(pageResult.getList(), HistoricTaskInstance::getProcessDefinitionId));
|
||||
return success(BpmTaskConvert.INSTANCE.buildTaskPage(pageResult, processInstanceMap, userMap, deptMap, processDefinitionInfoMap));
|
||||
@@ -136,8 +139,7 @@ public class BpmTaskController {
|
||||
Set<Long> userIds = convertSetByFlatMap(taskList, task ->
|
||||
Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner())));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
|
||||
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
// 获得 Form Map
|
||||
Map<Long, BpmFormDO> formMap = formService.getFormMap(
|
||||
convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey())));
|
||||
@@ -231,8 +233,7 @@ public class BpmTaskController {
|
||||
// 拼接数据
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(taskList,
|
||||
user -> Stream.of(NumberUtils.parseLong(user.getAssignee()), NumberUtils.parseLong(user.getOwner()))));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
|
||||
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
return success(BpmTaskConvert.INSTANCE.buildTaskListByParentTaskId(taskList, userMap, deptMap));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.bpm.convert.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
|
||||
@@ -17,7 +19,6 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
||||
import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
|
||||
@@ -74,14 +75,14 @@ public interface BpmProcessInstanceConvert {
|
||||
AdminUserRespDTO startUser = userMap.get(NumberUtils.parseLong(pageResult.getList().get(i).getStartUserId()));
|
||||
if (startUser != null) {
|
||||
respVO.setStartUser(BeanUtils.toBean(startUser, UserSimpleBaseVO.class));
|
||||
MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName()));
|
||||
MapUtils.findAndThen(deptMap, DeptUtil.getDeptId(startUser), dept -> respVO.getStartUser().setDeptName(dept.getName()));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(respVO.getTasks())) {
|
||||
respVO.getTasks().forEach(task -> {
|
||||
AdminUserRespDTO assigneeUser = userMap.get(task.getAssignee());
|
||||
if (assigneeUser!= null) {
|
||||
task.setAssigneeUser(BeanUtils.toBean(assigneeUser, UserSimpleBaseVO.class));
|
||||
MapUtils.findAndThen(deptMap, assigneeUser.getDeptId(), dept -> task.getAssigneeUser().setDeptName(dept.getName()));
|
||||
MapUtils.findAndThen(deptMap, DeptUtil.getDeptId(assigneeUser), dept -> task.getAssigneeUser().setDeptName(dept.getName()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -189,7 +190,8 @@ public interface BpmProcessInstanceConvert {
|
||||
return null;
|
||||
}
|
||||
UserSimpleBaseVO userVO = BeanUtils.toBean(user, UserSimpleBaseVO.class);
|
||||
DeptRespDTO dept = user.getDeptId() != null ? deptMap.get(user.getDeptId()) : null;
|
||||
Long deptId = DeptUtil.getDeptId(user);
|
||||
DeptRespDTO dept = deptId != null ? deptMap.get(deptId) : null;
|
||||
if (dept != null) {
|
||||
userVO.setDeptName(dept.getName());
|
||||
}
|
||||
@@ -252,7 +254,8 @@ public interface BpmProcessInstanceConvert {
|
||||
BpmProcessInstanceRespVO processInstanceResp = null;
|
||||
if (processInstance != null) {
|
||||
AdminUserRespDTO startUser = userMap.get(NumberUtils.parseLong(processInstance.getStartUserId()));
|
||||
DeptRespDTO dept = startUser != null ? deptMap.get(startUser.getDeptId()) : null;
|
||||
Long deptId = DeptUtil.getDeptId(startUser);
|
||||
DeptRespDTO dept = deptMap.get(deptId);
|
||||
processInstanceResp = buildProcessInstance(processInstance, null, null, startUser, dept);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.bpm.convert.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
@@ -73,7 +73,7 @@ public interface BpmTaskConvert {
|
||||
AdminUserRespDTO assignUser = userMap.get(NumberUtils.parseLong(task.getAssignee()));
|
||||
if (assignUser != null) {
|
||||
taskVO.setAssigneeUser(BeanUtils.toBean(assignUser, UserSimpleBaseVO.class));
|
||||
findAndThen(deptMap, assignUser.getDeptId(), dept -> taskVO.getAssigneeUser().setDeptName(dept.getName()));
|
||||
findAndThen(deptMap, DeptUtil.getDeptId(assignUser), dept -> taskVO.getAssigneeUser().setDeptName(dept.getName()));
|
||||
}
|
||||
// 流程实例
|
||||
HistoricProcessInstance processInstance = processInstanceMap.get(taskVO.getProcessInstanceId());
|
||||
@@ -122,7 +122,7 @@ public interface BpmTaskConvert {
|
||||
AdminUserRespDTO assignUser = userMap.get(NumberUtils.parseLong(task.getAssignee()));
|
||||
if (assignUser != null) {
|
||||
taskVO.setAssigneeUser(BeanUtils.toBean(assignUser, UserSimpleBaseVO.class));
|
||||
DeptRespDTO dept = deptMap.get(assignUser.getDeptId());
|
||||
DeptRespDTO dept = deptMap.get(DeptUtil.getDeptId(assignUser));
|
||||
if (dept != null) {
|
||||
taskVO.getAssigneeUser().setDeptName(dept.getName());
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public interface BpmTaskConvert {
|
||||
AdminUserRespDTO ownerUser = userMap.get(NumberUtils.parseLong(task.getOwner()));
|
||||
if (ownerUser != null) {
|
||||
taskVO.setOwnerUser(BeanUtils.toBean(ownerUser, UserSimpleBaseVO.class));
|
||||
findAndThen(deptMap, ownerUser.getDeptId(), dept -> taskVO.getOwnerUser().setDeptName(dept.getName()));
|
||||
findAndThen(deptMap, DeptUtil.getDeptId(ownerUser), dept -> taskVO.getOwnerUser().setDeptName(dept.getName()));
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public interface BpmTaskConvert {
|
||||
AdminUserRespDTO ownerUser = userMap.get(NumberUtils.parseLong(taskOwner));
|
||||
if (ownerUser != null) {
|
||||
task.setOwnerUser(BeanUtils.toBean(ownerUser, UserSimpleBaseVO.class));
|
||||
findAndThen(deptMap, ownerUser.getDeptId(), dept -> task.getOwnerUser().setDeptName(dept.getName()));
|
||||
findAndThen(deptMap, DeptUtil.getDeptId(ownerUser), dept -> task.getOwnerUser().setDeptName(dept.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public interface BpmTaskConvert {
|
||||
AdminUserRespDTO assignUser = userMap.get(NumberUtils.parseLong(taskAssignee));
|
||||
if (assignUser != null) {
|
||||
task.setAssigneeUser(BeanUtils.toBean(assignUser, UserSimpleBaseVO.class));
|
||||
findAndThen(deptMap, assignUser.getDeptId(), dept -> task.getAssigneeUser().setDeptName(dept.getName()));
|
||||
findAndThen(deptMap, DeptUtil.getDeptId(assignUser), dept -> task.getAssigneeUser().setDeptName(dept.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.expression;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
@@ -68,10 +69,11 @@ public class BpmTaskAssignLeaderExpression {
|
||||
|
||||
private DeptRespDTO getStartUserDept(Long startUserId) {
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(startUserId).getCheckedData();
|
||||
if (startUser.getDeptId() == null) { // 找不到部门,所以无法使用该规则
|
||||
Long deptId = DeptUtil.getDeptId(startUser);
|
||||
if (deptId == 0L) { // 找不到部门,所以无法使用该规则
|
||||
return null;
|
||||
}
|
||||
return deptApi.getDept(startUser.getDeptId()).getCheckedData();
|
||||
return deptApi.getDept(deptId).getCheckedData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.d
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
@@ -85,10 +86,10 @@ public abstract class AbstractBpmTaskCandidateDeptLeaderStrategy implements BpmT
|
||||
*/
|
||||
protected DeptRespDTO getStartUserDept(Long startUserId) {
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(startUserId).getCheckedData();
|
||||
if (startUser.getDeptId() == null) { // 找不到部门
|
||||
if (CollUtil.isEmpty(startUser.getDeptIds())) { // 找不到部门
|
||||
return null;
|
||||
}
|
||||
return deptApi.getDept(startUser.getDeptId()).getCheckedData();
|
||||
return deptApi.getDept(DeptUtil.getDeptId(startUser)).getCheckedData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.definition;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||
@@ -103,8 +104,8 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
if (CollUtil.isNotEmpty(processDefinition.getStartDeptIds())) {
|
||||
AdminUserRespDTO user = adminUserApi.getUser(userId).getCheckedData();
|
||||
return user != null
|
||||
&& user.getDeptId() != null
|
||||
&& processDefinition.getStartDeptIds().contains(user.getDeptId());
|
||||
&& DeptUtil.getDeptId(user) > 0L
|
||||
&& processDefinition.getStartDeptIds().contains(DeptUtil.getDeptId(user));
|
||||
}
|
||||
|
||||
// 都为空,则所有人都可以发起
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
@@ -277,7 +278,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||
// 4. 拼接基础信息
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
|
||||
convertSetByFlatMap(nextActivityNodes, ActivityNode::getCandidateUserIds, Collection::stream));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
nextActivityNodes.forEach(node -> node.setCandidateUsers(convertList(node.getCandidateUserIds(), userId -> {
|
||||
AdminUserRespDTO user = userMap.get(userId);
|
||||
if (user != null) {
|
||||
@@ -366,7 +367,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||
asList(endApprovalNodeInfos, runningApprovalNodeInfos, simulateApprovalNodeInfos));
|
||||
Set<Long> userIds = BpmProcessInstanceConvert.INSTANCE.parseUserIds(processInstance, approveNodes, todoTask);
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
|
||||
// 2. 表单权限
|
||||
String taskId = reqVO.getTaskId() == null && todoTask != null ? todoTask.getId() : reqVO.getTaskId();
|
||||
@@ -689,7 +690,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||
// 2.2 拼接基础信息
|
||||
Set<Long> userIds = BpmProcessInstanceConvert.INSTANCE.parseUserIds02(processInstance, tasks);
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
return BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceBpmnModelView(processInstance, tasks, bpmnModel,
|
||||
simpleModel,
|
||||
unfinishedTaskActivityIds, finishedTaskActivityIds, finishedSequenceFlowActivityIds,
|
||||
|
||||
@@ -1391,8 +1391,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
BpmUserTaskAssignStartUserHandlerTypeEnum.TRANSFER_DEPT_LEADER.getType())) {
|
||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||
Assert.notNull(startUser, "提交人({})信息为空", processInstance.getStartUserId());
|
||||
DeptRespDTO dept = startUser.getDeptId() != null ? deptApi.getDept(startUser.getDeptId()).getCheckedData() : null;
|
||||
Assert.notNull(dept, "提交人({})部门({})信息为空", processInstance.getStartUserId(), startUser.getDeptId());
|
||||
Long deptId = startUser.getDeptIds().stream().findAny().orElse(null);
|
||||
DeptRespDTO dept = deptId != null ? deptApi.getDept(deptId).getCheckedData() : null;
|
||||
Assert.notNull(dept, "提交人({})部门({})信息为空", processInstance.getStartUserId(), deptId);
|
||||
// 找不到部门负责人的情况下,自动审批通过
|
||||
// noinspection DataFlowIssue
|
||||
if (dept.getLeaderUserId() == null) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@@ -40,7 +41,7 @@ public class BpmTaskAssignLeaderExpressionTest extends BaseMockitoUnitTest {
|
||||
// 准备参数
|
||||
DelegateExecution execution = mockDelegateExecution(1L);
|
||||
// mock 方法(startUser)
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptId(10L));
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptIds(Collections.singletonList(10L)));
|
||||
when(adminUserApi.getUser(eq(1L))).thenReturn(success(startUser));
|
||||
// mock 方法(getStartUserDept)没有部门
|
||||
when(deptApi.getDept(eq(10L))).thenReturn(success(null));
|
||||
@@ -56,7 +57,7 @@ public class BpmTaskAssignLeaderExpressionTest extends BaseMockitoUnitTest {
|
||||
// 准备参数
|
||||
DelegateExecution execution = mockDelegateExecution(1L);
|
||||
// mock 方法(startUser)
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptId(10L));
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptIds(Collections.singletonList(10L)));
|
||||
when(adminUserApi.getUser(eq(1L))).thenReturn(success(startUser));
|
||||
DeptRespDTO startUserDept = randomPojo(DeptRespDTO.class, o -> o.setId(10L).setParentId(100L)
|
||||
.setLeaderUserId(20L));
|
||||
@@ -75,7 +76,7 @@ public class BpmTaskAssignLeaderExpressionTest extends BaseMockitoUnitTest {
|
||||
// 准备参数
|
||||
DelegateExecution execution = mockDelegateExecution(1L);
|
||||
// mock 方法(startUser)
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptId(10L));
|
||||
AdminUserRespDTO startUser = randomPojo(AdminUserRespDTO.class, o -> o.setDeptIds(Collections.singletonList(10L)));
|
||||
when(adminUserApi.getUser(eq(1L))).thenReturn(success(startUser));
|
||||
DeptRespDTO startUserDept = randomPojo(DeptRespDTO.class, o -> o.setId(10L).setParentId(100L)
|
||||
.setLeaderUserId(20L));
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@@ -74,7 +75,7 @@ public class BpmTaskCandidateStartUserDeptLeaderMultiStrategyTest extends BaseMo
|
||||
|
||||
private void mockGetStartUserDept(Long startUserId) {
|
||||
when(adminUserApi.getUser(eq(startUserId))).thenReturn(
|
||||
success(randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptId(10L))));
|
||||
success(randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptIds(Collections.singletonList(10L)))));
|
||||
when(deptApi.getDept(any())).thenAnswer((Answer< CommonResult<DeptRespDTO>>) invocationOnMock -> {
|
||||
Long deptId = invocationOnMock.getArgument(0);
|
||||
return success(randomPojo(DeptRespDTO.class, o -> o.setId(deptId).setParentId(deptId * 100).setLeaderUserId(deptId + 1)));
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@@ -74,7 +75,7 @@ public class BpmTaskCandidateStartUserDeptLeaderStrategyTest extends BaseMockito
|
||||
|
||||
private void mockGetStartUserDeptLeader(Long startUserId) {
|
||||
when(adminUserApi.getUser(eq(startUserId))).thenReturn(
|
||||
success(randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptId(10L))));
|
||||
success(randomPojo(AdminUserRespDTO.class, o -> o.setId(startUserId).setDeptIds(Collections.singletonList(10L)))));
|
||||
when(deptApi.getDept(any())).thenAnswer((Answer< CommonResult<DeptRespDTO>>) invocationOnMock -> {
|
||||
Long deptId = invocationOnMock.getArgument(0);
|
||||
return success(randomPojo(DeptRespDTO.class, o -> o.setId(deptId).setParentId(deptId * 100).setLeaderUserId(deptId + 1)));
|
||||
|
||||
Reference in New Issue
Block a user