Browse Source

新建会议回避同单位专家错误

master
WendyYang 1 year ago
parent
commit
87afd89f29
2 changed files with 26 additions and 10 deletions
  1. +13
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java
  2. +13
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java

+ 13
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java View File

@@ -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<ExpertUserFullInfo>
List<ExpertUserFullInfo> listByUserId(List<Long> userId);



/**
* 批量查询专家用户信息
*
@@ -42,4 +46,12 @@ public interface IExpertUserFullInfoService extends IService<ExpertUserFullInfo>
*/
List<ExpertUserFullInfo> listByUserIds(List<Long> userIds);

default List<String> listCompanyUniqCodeByUserIds(Collection<Long> userIds) {
LambdaQueryWrapper<ExpertUserFullInfo> query = Wrappers
.lambdaQuery(ExpertUserFullInfo.class)
.select(ExpertUserFullInfo::getCompanyUniqCode)
.in(ExpertUserFullInfo::getUserId, userIds);
return CollUtils.fieldList(list(query), ExpertUserFullInfo::getCompanyUniqCode);
}

}

+ 13
- 9
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java View File

@@ -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<Long> appointExpertIds,
List<Long> 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<String> tmpAvoidCompany = new HashSet<>();
Set<String> avoidCompanyUniqCodes = new HashSet<>();
if (avoidCompany) {
tmpAvoidCompany.addAll(avoidRule.getAvoidUnitIdList());
avoidCompanyUniqCodes.addAll(avoidRule.getAvoidUnitIdList());
}
if (CollUtil.isNotEmpty(invitedExpertIds)) {
List<String> tmpCompanyUniqCodes = expertUserFullInfoService.listCompanyUniqCodeByUserIds(invitedExpertIds);
avoidCompanyUniqCodes.addAll(tmpCompanyUniqCodes);
}
// 回避信息
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, tmpAvoidCompany);
query.notIn(!avoidCompanyUniqCodes.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, avoidCompanyUniqCodes);
// 处理回避单位与回避条线
buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList());
Set<Long> 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<Long> tmpExpert = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime);
} else if (avoidExpert || CollUtil.isNotEmpty(invitedExpertIds)) {
Set<Long> tmpExpert = expertInviteHelper.getAvoidExpert(invitedExpertIds, avoidRule, sTime, eTime);
expertIdsNotIn.addAll(tmpExpert);
} else {
Set<Long> tmpNotInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime);


Loading…
Cancel
Save