From 87afd89f293635927b6a9cab33303da9e39e8a03 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 18 Apr 2023 14:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BC=9A=E8=AE=AE=E5=9B=9E?= =?UTF-8?q?=E9=81=BF=E5=90=8C=E5=8D=95=E4=BD=8D=E4=B8=93=E5=AE=B6=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/service/IExpertUserFullInfoService.java | 14 +++++++++++++- .../pmapi/meeting/manage/ExpertInviteManage.java | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java index a0a6c27..129e68b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java @@ -1,8 +1,13 @@ package com.ningdatech.pmapi.expert.service; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import java.util.Collection; import java.util.List; /** @@ -33,7 +38,6 @@ public interface IExpertUserFullInfoService extends IService List listByUserId(List userId); - /** * 批量查询专家用户信息 * @@ -42,4 +46,12 @@ public interface IExpertUserFullInfoService extends IService */ List listByUserIds(List userIds); + default List listCompanyUniqCodeByUserIds(Collection userIds) { + LambdaQueryWrapper query = Wrappers + .lambdaQuery(ExpertUserFullInfo.class) + .select(ExpertUserFullInfo::getCompanyUniqCode) + .in(ExpertUserFullInfo::getUserId, userIds); + return CollUtils.fieldList(list(query), ExpertUserFullInfo::getCompanyUniqCode); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java index 87447bc..cad0c9c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java @@ -282,13 +282,13 @@ public class ExpertInviteManage { * * @param avoidRule 回避信息 * @param randomRule 抽取规则 - * @param appointExpertIds 指定抽取专家ID + * @param invitedExpertIds 指定抽取专家ID * @return 满足抽取条件的专家 * @author WendyYang **/ public ExpertChooseDTO expertInviteByRandomRule(AvoidRuleDTO avoidRule, RandomInviteRuleDTO randomRule, - List appointExpertIds, + List invitedExpertIds, LocalDateTime sTime, LocalDateTime eTime) { ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); @@ -298,13 +298,17 @@ public class ExpertInviteManage { } boolean avoidExpert = CollUtil.isNotEmpty(avoidRule.getExpertIds()); boolean avoidCompany = CollUtil.isNotEmpty(avoidRule.getAvoidUnitIdList()); - Set tmpAvoidCompany = new HashSet<>(); + Set avoidCompanyUniqCodes = new HashSet<>(); if (avoidCompany) { - tmpAvoidCompany.addAll(avoidRule.getAvoidUnitIdList()); + avoidCompanyUniqCodes.addAll(avoidRule.getAvoidUnitIdList()); + } + if (CollUtil.isNotEmpty(invitedExpertIds)) { + List tmpCompanyUniqCodes = expertUserFullInfoService.listCompanyUniqCodeByUserIds(invitedExpertIds); + avoidCompanyUniqCodes.addAll(tmpCompanyUniqCodes); } // 回避信息 LambdaQueryWrapper query = buildBaseExpertQuery(); - query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, tmpAvoidCompany); + query.notIn(!avoidCompanyUniqCodes.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, avoidCompanyUniqCodes); // 处理回避单位与回避条线 buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); Set expertIdsIn = new HashSet<>(); @@ -330,8 +334,8 @@ public class ExpertInviteManage { return result; } } - if (CollUtil.isNotEmpty(appointExpertIds)) { - expertIdsIn.removeIf(appointExpertIds::contains); + if (CollUtil.isNotEmpty(invitedExpertIds)) { + expertIdsIn.removeIf(invitedExpertIds::contains); if (expertIdsIn.isEmpty()) { return result; } @@ -342,8 +346,8 @@ public class ExpertInviteManage { if (expertIdsIn.isEmpty()) { return result; } - } else if (avoidExpert || CollUtil.isNotEmpty(appointExpertIds)) { - Set tmpExpert = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime); + } else if (avoidExpert || CollUtil.isNotEmpty(invitedExpertIds)) { + Set tmpExpert = expertInviteHelper.getAvoidExpert(invitedExpertIds, avoidRule, sTime, eTime); expertIdsNotIn.addAll(tmpExpert); } else { Set tmpNotInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime);