| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private final HistoryService historyService; |
| | | private final ISysUserService sysUserService; |
| | | private final ISysRoleService sysRoleService; |
| | | private final ISysDeptService sysDeptService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | .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); |
| | |
| | | .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 { |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | // 绑定的是角色,查出角色名称 |
| | | } 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())); |