| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | |
| | | resp.setEmployeeName(employee.getName()); resp.setEmployeeNo(employee.getEmployeeNo()); |
| | | resp.setDeptId(employee.getDeptId()); |
| | | DeptRespDTO dept = employee.getDeptId() == null ? null : deptApi.getDept(employee.getDeptId()); |
| | | PostRespDTO post = employee.getPostId() == null ? null |
| | | : postApi.getPostMap(Collections.singleton(employee.getPostId())).get(employee.getPostId()); |
| | | resp.setDeptName(dept == null ? null : dept.getName()); |
| | | resp.setPostName(post == null ? null : post.getName()); |
| | | // 岗位多选:解析 postIds JSON,拼接岗位名称 |
| | | if (StrUtil.isNotBlank(employee.getPostIds())) { |
| | | List<Long> postIds = JSONUtil.toList(employee.getPostIds(), Long.class); |
| | | if (CollUtil.isNotEmpty(postIds)) { |
| | | Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds); |
| | | resp.setPostName(postIds.stream() |
| | | .filter(postMap::containsKey) |
| | | .map(id -> postMap.get(id).getName()) |
| | | .collect(Collectors.joining(","))); |
| | | } |
| | | } |
| | | } |
| | | } |