Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev
This commit is contained in:
commit
08df74e4d7
@ -65,30 +65,30 @@ public class BpmOAProjectController {
|
|||||||
BpmOAProjectRespVO respVO = BeanUtils.toBean(project, BpmOAProjectRespVO.class);
|
BpmOAProjectRespVO respVO = BeanUtils.toBean(project, BpmOAProjectRespVO.class);
|
||||||
|
|
||||||
if (respVO != null) {
|
if (respVO != null) {
|
||||||
|
// 获取项目中所有人员的用户编号列表
|
||||||
|
Set<Long> userIds = respVO.getStaff() == null ? new HashSet<>() : respVO.getStaff();
|
||||||
|
userIds.add(respVO.getDirectorUserId());
|
||||||
|
|
||||||
// 获取项目中所有部门编号列表
|
// 获取项目中所有部门编号列表
|
||||||
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
||||||
deptIds.add(respVO.getResponsibleDept());
|
deptIds.add(respVO.getResponsibleDept());
|
||||||
|
|
||||||
// 获取所有用户信息
|
// 获取所有用户信息
|
||||||
AdminUserRespDTO userRespDTO = userApi.getUser(respVO.getDirectorUserId()).getCheckedData();
|
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
||||||
// 获取所有部门信息
|
// 获取所有部门信息
|
||||||
List<DeptRespDTO> deptDOS = deptApi.getDeptList(deptIds).getCheckedData();
|
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds);
|
||||||
Map<Long, DeptRespDTO> deptMap = convertMap(deptDOS, DeptRespDTO::getId);
|
|
||||||
|
|
||||||
// 设置责任人名称
|
// 设置责任人名称
|
||||||
respVO.setDirectorUserName(userRespDTO.getNickname());
|
respVO.setDirectorUserName(userMap.get(respVO.getDirectorUserId()).getNickname());
|
||||||
|
// 设置项目人员名称
|
||||||
// 筛选出不是责任人部门的部门信息
|
userMap.remove(respVO.getDirectorUserId());
|
||||||
List<DeptRespDTO> deptVOs = deptDOS.stream()
|
respVO.setStaffName(userMap.values().stream().map(AdminUserRespDTO::getNickname).collect(Collectors.joining("、")));
|
||||||
.filter(dept -> !dept.getId().equals(respVO.getResponsibleDept()))
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
// 设置责任部门名称
|
// 设置责任部门名称
|
||||||
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
||||||
// 拼接参与部门名称
|
// 拼接参与部门名称
|
||||||
respVO.setParticipationDeptName(deptVOs.stream().map(DeptRespDTO::getName).collect(Collectors.joining("、")));
|
deptMap.remove(respVO.getResponsibleDept());
|
||||||
|
respVO.setParticipationDeptName(deptMap.values().stream().map(DeptRespDTO::getName).collect(Collectors.joining("、")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return success(respVO);
|
return success(respVO);
|
||||||
|
@ -46,6 +46,9 @@ public class BpmOAProjectCreateReqVO {
|
|||||||
@NotNull(message = "责任人不能为空")
|
@NotNull(message = "责任人不能为空")
|
||||||
private Long directorUserId;
|
private Long directorUserId;
|
||||||
|
|
||||||
|
@Schema(description = "团队成员")
|
||||||
|
private Set<Long> staff;
|
||||||
|
|
||||||
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "项目开始日期不能为空")
|
@NotNull(message = "项目开始日期不能为空")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
|
@ -51,6 +51,12 @@ public class BpmOAProjectRespVO extends BpmOABaseRespVO {
|
|||||||
@Schema(description = "责任人名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "责任人名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private String directorUserName;
|
private String directorUserName;
|
||||||
|
|
||||||
|
@Schema(description = "团队成员")
|
||||||
|
private Set<Long> staff;
|
||||||
|
|
||||||
|
@Schema(description = "团队成员名称")
|
||||||
|
private String staffName;
|
||||||
|
|
||||||
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDate startDate;
|
private LocalDate startDate;
|
||||||
|
@ -68,6 +68,12 @@ public class BpmOAProjectDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Long directorUserId;
|
private Long directorUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参与人员
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||||
|
private Set<Long> staff;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目开始日期
|
* 项目开始日期
|
||||||
*/
|
*/
|
||||||
|
@ -77,44 +77,32 @@ public class ProjectController {
|
|||||||
public CommonResult<ProjectRespVO> getProject(@RequestParam("id") Long id) {
|
public CommonResult<ProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||||
ProjectDO project = projectService.getProject(id);
|
ProjectDO project = projectService.getProject(id);
|
||||||
ProjectRespVO respVO = BeanUtils.toBean(project, ProjectRespVO.class);
|
ProjectRespVO respVO = BeanUtils.toBean(project, ProjectRespVO.class);
|
||||||
if (respVO != null) {
|
// if (respVO != null) {
|
||||||
// 获取项目中所有人员的用户编号列表
|
// // 获取项目中所有人员的用户编号列表
|
||||||
Set<Long> userIds = respVO.getStaff() == null ? new HashSet<>() : respVO.getStaff();
|
// Set<Long> userIds = respVO.getStaff() == null ? new HashSet<>() : respVO.getStaff();
|
||||||
userIds.add(respVO.getDirectorUserId());
|
// userIds.add(respVO.getDirectorUserId());
|
||||||
|
//
|
||||||
// 获取项目中所有部门编号列表
|
// // 获取项目中所有部门编号列表
|
||||||
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
// Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
||||||
deptIds.add(respVO.getResponsibleDept());
|
// deptIds.add(respVO.getResponsibleDept());
|
||||||
|
//
|
||||||
// 获取所有用户信息
|
// // 获取所有用户信息
|
||||||
List<AdminUserDO> userDOS = userService.getUserList(userIds);
|
// Map<Long, AdminUserDO> userMap = userService.getUserMap(userIds);
|
||||||
Map<Long, AdminUserDO> userMap = convertMap(userDOS, AdminUserDO::getId);
|
// // 获取所有部门信息
|
||||||
// 获取所有部门信息
|
// Map<Long, DeptDO> deptMap = deptService.getDeptMap(deptIds);
|
||||||
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
//
|
||||||
Map<Long, DeptDO> deptMap = convertMap(deptDOS, DeptDO::getId);
|
// // 设置责任人名称
|
||||||
|
// respVO.setDirectorUserName(userMap.get(respVO.getDirectorUserId()).getNickname());
|
||||||
// 筛选出不是责任人的用户信息
|
// // 拼接项目人员名称
|
||||||
List<AdminUserDO> userVOs = userDOS.stream()
|
// userMap.remove(respVO.getDirectorUserId());
|
||||||
.filter(user -> !user.getId().equals(respVO.getDirectorUserId()))
|
// respVO.setStaffName(userMap.values().stream().map(AdminUserDO::getNickname).collect(Collectors.joining("、")));
|
||||||
.distinct()
|
//
|
||||||
.collect(Collectors.toList());
|
// // 设置责任部门名称
|
||||||
|
// respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
||||||
// 设置责任人名称
|
// // 拼接参与部门名称
|
||||||
respVO.setDirectorUserName(userMap.get(respVO.getDirectorUserId()).getNickname());
|
// deptMap.remove(respVO.getResponsibleDept());
|
||||||
// 拼接项目人员名称
|
// respVO.setParticipationDeptName(deptMap.values().stream().map(DeptDO::getName).collect(Collectors.joining("、")));
|
||||||
respVO.setStaffName(userVOs.stream().map(AdminUserDO::getNickname).collect(Collectors.joining("、")));
|
// }
|
||||||
|
|
||||||
// 筛选出不是责任人部门的部门信息
|
|
||||||
List<DeptDO> deptVOs = deptDOS.stream()
|
|
||||||
.filter(dept -> !dept.getId().equals(respVO.getResponsibleDept()))
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
// 设置责任部门名称
|
|
||||||
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
|
||||||
// 拼接参与部门名称
|
|
||||||
respVO.setParticipationDeptName(deptVOs.stream().map(DeptDO::getName).collect(Collectors.joining("、")));
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(respVO);
|
return success(respVO);
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,11 @@ public interface ProjectMapper extends BaseMapperX<ProjectDO> {
|
|||||||
.betweenIfPresent(ProjectDO::getEndDate, reqVO.getEndDate())
|
.betweenIfPresent(ProjectDO::getEndDate, reqVO.getEndDate())
|
||||||
.eqIfPresent(ProjectDO::getIsLongTerm, reqVO.getIsLongTerm())
|
.eqIfPresent(ProjectDO::getIsLongTerm, reqVO.getIsLongTerm())
|
||||||
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
|
||||||
.likeLeft(ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept())
|
.likeLeft(Objects.nonNull(reqVO.getParticipationDept()), ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept())
|
||||||
.or()
|
.or()
|
||||||
.likeRight(ProjectDO::getParticipationDept, reqVO.getParticipationDept() + "-")
|
.likeRight(Objects.nonNull(reqVO.getParticipationDept()), ProjectDO::getParticipationDept, reqVO.getParticipationDept() + "-")
|
||||||
.or()
|
.or()
|
||||||
.like(ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept() + "-")
|
.like(Objects.nonNull(reqVO.getParticipationDept()), ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept() + "-")
|
||||||
.orderByDesc(ProjectDO::getId));
|
.orderByDesc(ProjectDO::getId));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user