diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml index 66e01c9..e8420d5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml @@ -102,7 +102,7 @@ from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id inner join meeting m on m.id = mip.meeting_id inner join meeting_expert me on m.id = me.meeting_id - where m.is_inner_project = true + where m.is_inner_project = true and m.status != 3 and me.status = 3 and if(me.is_headman,,) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java index ac0f350..884b47e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java @@ -1,13 +1,12 @@ package com.ningdatech.pmapi.user.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.time.LocalDateTime; /** *

@@ -33,4 +32,10 @@ public class UserRole implements Serializable { @ApiModelProperty("角色 ID") private Long roleId; + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index badfff0..5f04246 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -83,59 +83,63 @@ public class UserInfoManage { Page page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); List records = page.getRecords(); long total = page.getTotal(); - List resUserInfoListVOList = new ArrayList<>(); + List result = new ArrayList<>(); if (records != null && records.size() > 0) { List employeeCodeList = records.stream().map(DingEmployeeInfo::getEmployeeCode) .distinct().collect(Collectors.toList()); - Map employeeCodeAvailableMap = new HashMap<>(); + Map employeeCodeAvailableMap = new HashMap<>(16); if (CollUtil.isNotEmpty(employeeCodeList)) { employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode, employeeCodeList)) + .in(UserInfo::getEmployeeCode, employeeCodeList)) .stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity())); } List orgCodeList = records.stream() - .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) - .map(DingEmployeeInfo::getOrganizationCode).distinct() + .map(DingEmployeeInfo::getOrganizationCode) + .filter(StringUtils::isNotBlank).distinct() .collect(Collectors.toList()); Map orgMap = iDingOrganizationService.getOrgMap(orgCodeList); Map finalEmployeeCodeAvailableMap = employeeCodeAvailableMap; - resUserInfoListVOList = records.stream() - .map(r -> { - ResUserInfoListVO resListVO = new ResUserInfoListVO(); - resListVO.setName(r.getEmployeeName()); - String organizationCode = r.getOrganizationCode(); - if (StringUtils.isNotBlank(organizationCode) && orgMap.containsKey(organizationCode)) { - resListVO.setOrgName(orgMap.get(organizationCode).getOrganizationName()); - resListVO.setOrgCode(organizationCode); - String regionCode = orgMap.get(organizationCode).getDivisionCode(); - resListVO.setRegionCode(regionCode); - if (Objects.nonNull(regionCode)) { - resListVO.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); - } - } - // TODO 从用户信息中获取 - // 从所属组织中获取 -// resListVO.setRegionId(); - UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode()); - // 装配用户状态 及 userId - userStatusAssembler(resListVO, userInfo); - - if (Objects.isNull(userInfo)) { - resListVO.setUpdateTime(r.getUpdateOn()); - } else { - resListVO.setUpdateTime(userInfo.getUpdateOn()); - } -// 从用户信息中获取 - resListVO.setEmployeeCode(r.getEmployeeCode()); - resListVO.setUserRoleList(getUserRoleVOList(resListVO.getUserId())); - return resListVO; - }).collect(Collectors.toList()); + records.forEach(r -> { + ResUserInfoListVO resListVO = new ResUserInfoListVO(); + resListVO.setName(r.getEmployeeName()); + String organizationCode = r.getOrganizationCode(); + if (StringUtils.isNotBlank(organizationCode) && orgMap.containsKey(organizationCode)) { + resListVO.setOrgName(orgMap.get(organizationCode).getOrganizationName()); + resListVO.setOrgCode(organizationCode); + String regionCode = orgMap.get(organizationCode).getDivisionCode(); + resListVO.setRegionCode(regionCode); + if (Objects.nonNull(regionCode)) { + resListVO.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); + } + } + // TODO 从用户信息中获取 + // 从所属组织中获取 + // resListVO.setRegionId(); + UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode()); + // 装配用户状态 及 userId + userStatusAssembler(resListVO, userInfo); + + if (Objects.isNull(userInfo)) { + resListVO.setUpdateTime(r.getUpdateOn()); + } else { + resListVO.setUpdateTime(userInfo.getUpdateOn()); + } + // 从用户信息中获取 + resListVO.setEmployeeCode(r.getEmployeeCode()); + List userRoles = getUserRoleVOList(resListVO.getUserId()); + resListVO.setUserRoleList(userRoles); + LocalDateTime roleModifyTime; + if ((roleModifyTime = userRoles.get(userRoles.size() - 1).getCreateOn()).isAfter(resListVO.getUpdateTime()) + && CollUtil.isNotEmpty(userRoles)) { + resListVO.setUpdateTime(roleModifyTime); + } + result.add(resListVO); + }); } - pageVo.setTotal(total); - pageVo.setRecords(resUserInfoListVOList); + pageVo.setRecords(result); return pageVo; } @@ -172,7 +176,7 @@ public class UserInfoManage { // TODO 这里过滤的非浙政钉用户的专家 后续需要增加补充逻辑 return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getId, compliantUserIdList)) + .in(UserInfo::getId, compliantUserIdList)) .stream().filter(r -> StringUtils.isNotBlank(r.getEmployeeCode())) .map(UserInfo::getEmployeeCode).collect(Collectors.toList()); @@ -214,6 +218,7 @@ public class UserInfoManage { UserRoleVO userRoleVO = new UserRoleVO(); userRoleVO.setId(r.getId()); userRoleVO.setName(r.getName()); + userRoleVO.setCreateOn(r.getCreateOn()); return userRoleVO; }).collect(Collectors.toList()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java index e13a6a2..3596a7b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.time.LocalDateTime; + /** * @author liuxinxin * @date 2023/2/15 下午5:47 @@ -22,4 +24,7 @@ public class UserRoleVO { @ApiModelProperty(value = "角色code") private String code; + + private transient LocalDateTime createOn; + }