Commit 9dc9f2d6 authored by jiuping's avatar jiuping

找问题测试

parent 163c2e41
...@@ -7,10 +7,9 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi; ...@@ -7,10 +7,9 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -26,6 +25,7 @@ import static java.util.Collections.emptySet; ...@@ -26,6 +25,7 @@ import static java.util.Collections.emptySet;
* *
* @author 捷道源码 * @author 捷道源码
*/ */
@Slf4j
public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssignScript { public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssignScript {
@Resource @Resource
...@@ -41,31 +41,38 @@ public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssign ...@@ -41,31 +41,38 @@ public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssign
// 获得发起人 // 获得发起人
ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId()); ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId());
Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId()); Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
log.error("111:{}", startUserId);
// 获得对应 leve 的部门 // 获得对应 leve 的部门
DeptRespDTO dept = null; DeptRespDTO dept = null;
for (int i = 0; i < level; i++) { for (int i = 0; i < level; i++) {
// 获得 level 对应的部门 // 获得 level 对应的部门
if (dept == null) { if (dept == null) {
dept = getStartUserDept(startUserId); dept = getStartUserDept(startUserId);
log.error("222:{}", dept);
if (dept == null) { // 找不到发起人的部门,所以无法使用该规则 if (dept == null) { // 找不到发起人的部门,所以无法使用该规则
return emptySet(); return emptySet();
} }
} else { } else {
log.error("333:{}", dept.getParentId());
DeptRespDTO parentDept = deptApi.getDept(dept.getParentId()); DeptRespDTO parentDept = deptApi.getDept(dept.getParentId());
if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少 if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
break; break;
} }
dept = parentDept; dept = parentDept;
log.error("444:{}", parentDept);
} }
} }
return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet(); return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
} }
private DeptRespDTO getStartUserDept(Long startUserId) { private DeptRespDTO getStartUserDept(Long startUserId) {
log.error("555:{}", startUserId);
AdminUserRespDTO startUser = adminUserApi.getUser(startUserId); AdminUserRespDTO startUser = adminUserApi.getUser(startUserId);
if (startUser.getDeptId() == null) { // 找不到部门,所以无法使用该规则 if (startUser.getDeptId() == null) { // 找不到部门,所以无法使用该规则
return null; return null;
} }
log.error("6666:{}", startUser.getDeptId());
return deptApi.getDept(startUser.getDeptId()); return deptApi.getDept(startUser.getDeptId());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment