xiangpei
2024-11-30 01410747fc92a6f7bccdf9497fcde43368dc9752
项目跟进回显部门
1个文件已修改
137 ■■■■ 已修改文件
business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -7,6 +8,7 @@
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.ycl.common.constant.ProcessConstants;
import com.ycl.common.core.domain.AjaxResult;
import com.ycl.common.core.domain.entity.SysDept;
import com.ycl.common.core.domain.entity.SysRole;
import com.ycl.common.core.domain.entity.SysUser;
import com.ycl.common.enums.FlowComment;
@@ -26,6 +28,7 @@
import com.ycl.domain.form.ProjectProcessForm;
import com.ycl.domain.vo.ProjectProcessVO;
import com.ycl.domain.query.ProjectProcessQuery;
import com.ycl.system.service.ISysDeptService;
import com.ycl.system.service.ISysRoleService;
import com.ycl.system.service.ISysUserService;
import org.apache.commons.lang3.StringUtils;
@@ -71,6 +74,7 @@
    private final HistoryService historyService;
    private final ISysUserService sysUserService;
    private final ISysRoleService sysRoleService;
    private final ISysDeptService sysDeptService;
    /**
     * 分页查询
@@ -366,14 +370,28 @@
                        }
                        taskVO.setHandlerName(sysUser.getNickName());
                    }
                    // 绑定的是角色,查出角色名称
                    // 绑定的是角色或者部门
                } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                    SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
                    if (Objects.nonNull(role)) {
                        taskVO.setHandlerUnitId(Long.parseLong(identityLink.getGroupId()));
                        taskVO.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                        taskVO.setHandlerName("暂未处理");
                        taskVO.setHandlerId(null);
                    if (identityLink.getGroupId().startsWith("dept")) {   // 部门的id是加了前缀的如:dept:1
                        String[] split = identityLink.getGroupId().split(":");
                        if (split.length > 1) {
                            // 部门
                            SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
                            if (Objects.nonNull(dept)) {
                                taskVO.setHandlerUnitId(dept.getDeptId());
                                taskVO.setHandlerUnitName(dept.getDeptName());
                                taskVO.setHandlerName("暂未处理");
                                taskVO.setHandlerId(null);
                            }
                        }
                    } else {
                        SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
                        if (Objects.nonNull(role)) {
                            taskVO.setHandlerUnitId(Long.parseLong(identityLink.getGroupId()));
                            taskVO.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                            taskVO.setHandlerName("暂未处理");
                            taskVO.setHandlerId(null);
                        }
                    }
                }
            }
@@ -426,6 +444,39 @@
                        .includeIdentityLinks()
                        .singleResult();
                if (Objects.isNull(historicTask)) {
                    // 未开始的任务,其关联的用户组这些都可以从UserTask中拿到,因为本身未开始的任务是没有task的,所以这里直接查
                    if (StringUtils.isNotBlank(userTask.getAssignee())) {
                        SysUser sysUser = sysUserService.selectUserById(Long.parseLong(userTask.getAssignee()));
                        if (Objects.nonNull(sysUser)) {
                            vo.setHandlerId(sysUser.getUserId());
                            vo.setHandlerName(sysUser.getNickName());
                            vo.setHandlerUnitId(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptId() : null);
                            vo.setHandlerUnitName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : null);
                        }
                    } else if (CollectionUtil.isNotEmpty(userTask.getCandidateGroups())) {
                        String groupId = userTask.getCandidateGroups().get(0);
                        if (groupId.startsWith("dept")) {   // 部门的id是加了前缀的如:dept:1
                            String[] split = groupId.split(":");
                            if (split.length > 1) {
                                // 部门
                                SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
                                if (Objects.nonNull(dept)) {
                                    vo.setHandlerUnitId(dept.getDeptId());
                                    vo.setHandlerUnitName(dept.getDeptName());
                                    vo.setHandlerName("未开始");
                                    vo.setHandlerId(null);
                                }
                            }
                        } else {
                            SysRole role = sysRoleService.selectRoleById(Long.parseLong(groupId));
                            if (Objects.nonNull(role)) {
                                vo.setHandlerUnitId(Long.parseLong(groupId));
                                vo.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                                vo.setHandlerName("未开始");
                                vo.setHandlerId(null);
                            }
                        }
                    }
                    vo.setTaskStatus(TaskStatusEnum.NOT_START);
                } else {
                    vo.setTaskStatus(TaskStatusEnum.FINISHED);
@@ -500,6 +551,39 @@
                        .includeIdentityLinks()
                        .singleResult();
                if (Objects.isNull(historicTask)) {
                    // 未开始的任务,其关联的用户组这些都可以从UserTask中拿到,因为本身未开始的任务是没有task的,所以这里直接查
                    if (StringUtils.isNotBlank(userTask.getAssignee())) {
                        SysUser sysUser = sysUserService.selectUserById(Long.parseLong(userTask.getAssignee()));
                        if (Objects.nonNull(sysUser)) {
                            vo.setHandlerId(sysUser.getUserId());
                            vo.setHandlerName(sysUser.getNickName());
                            vo.setHandlerUnitId(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptId() : null);
                            vo.setHandlerUnitName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : null);
                        }
                    } else if (CollectionUtil.isNotEmpty(userTask.getCandidateGroups())) {
                        String groupId = userTask.getCandidateGroups().get(0);
                        if (groupId.startsWith("dept")) {   // 部门的id是加了前缀的如:dept:1
                            String[] split = groupId.split(":");
                            if (split.length > 1) {
                                // 部门
                                SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
                                if (Objects.nonNull(dept)) {
                                    vo.setHandlerUnitId(dept.getDeptId());
                                    vo.setHandlerUnitName(dept.getDeptName());
                                    vo.setHandlerName("未开始");
                                    vo.setHandlerId(null);
                                }
                            }
                        } else {
                            SysRole role = sysRoleService.selectRoleById(Long.parseLong(groupId));
                            if (Objects.nonNull(role)) {
                                vo.setHandlerUnitId(Long.parseLong(groupId));
                                vo.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                                vo.setHandlerName("未开始");
                                vo.setHandlerId(null);
                            }
                        }
                    }
                    vo.setTaskStatus(TaskStatusEnum.NOT_START);
                    return vo;
                } else {
@@ -577,14 +661,28 @@
                        }
                        taskVO.setHandlerName(sysUser.getNickName());
                    }
                    // 绑定的是角色,查出角色名称
                    // 绑定的是角色或者是部门,需要根据id判断
                } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                    SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
                    if (Objects.nonNull(role)) {
                        taskVO.setHandlerUnitId(Long.parseLong(identityLink.getGroupId()));
                        taskVO.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                        taskVO.setHandlerName("暂未处理");
                        taskVO.setHandlerId(null);
                    if (identityLink.getGroupId().startsWith("dept")) {   // 部门的id是加了前缀的如:dept:1
                        String[] split = identityLink.getGroupId().split(":");
                        if (split.length > 1) {
                            // 部门
                            SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
                            if (Objects.nonNull(dept)) {
                                taskVO.setHandlerUnitId(dept.getDeptId());
                                taskVO.setHandlerUnitName(dept.getDeptName());
                                taskVO.setHandlerName("暂未处理");
                                taskVO.setHandlerId(null);
                            }
                        }
                    } else {
                        SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
                        if (Objects.nonNull(role)) {
                            taskVO.setHandlerUnitId(Long.parseLong(identityLink.getGroupId()));
                            taskVO.setHandlerUnitName("由拥有角色:【" + role.getRoleName() + "】的人处理");
                            taskVO.setHandlerName("暂未处理");
                            taskVO.setHandlerId(null);
                        }
                    }
                }
            }
@@ -603,6 +701,17 @@
                    }
                    // 绑定的是角色,查出角色名称
                } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                    if (identityLink.getGroupId().startsWith("dept")) {
                        String[] split = identityLink.getGroupId().split(":");
                        if (split.length > 1) {
                            // 部门
                            SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
                            if (Objects.nonNull(dept)) {
                                taskVO.setHandlerUnitId(dept.getDeptId());
                                taskVO.setHandlerUnitName(dept.getDeptName());
                            }
                        }
                    }
                    SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
                    if (Objects.nonNull(role)) {
                        taskVO.setHandlerUnitId(Long.parseLong(identityLink.getGroupId()));