|
@@ -16,10 +16,7 @@ import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.Meeting; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.Meeting; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; |
|
|
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; |
|
|
import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.dto.ExpertDictChooseDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.dto.*; |
|
|
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; |
|
|
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; |
|
|
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; |
|
|
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; |
|
|
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; |
|
|
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; |
|
@@ -124,30 +121,32 @@ public class ExpertInviteManage { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
LambdaQueryWrapper<ExpertAvoidCompany> query = Wrappers.lambdaQuery(ExpertAvoidCompany.class) |
|
|
LambdaQueryWrapper<ExpertAvoidCompany> query = Wrappers.lambdaQuery(ExpertAvoidCompany.class) |
|
|
|
|
|
.select(ExpertAvoidCompany::getUserId) |
|
|
.in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList); |
|
|
.in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList); |
|
|
List<ExpertAvoidCompany> expertAvoidCompanyList = expertAvoidCompanyService.list(query); |
|
|
List<ExpertAvoidCompany> expertAvoidCompanyList = expertAvoidCompanyService.list(query); |
|
|
return CollUtils.fieldList(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); |
|
|
return CollUtils.fieldList(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private List<Long> mergeExpertIdsByCondition(RandomInviteRuleDTO rule, AvoidRuleDTO avoidInfo) { |
|
|
|
|
|
|
|
|
private MergeExpertIdDTO mergeExpertIdsByCondition(RandomInviteRuleDTO rule, AvoidRuleDTO avoidInfo) { |
|
|
// 处理履职意向地 |
|
|
// 处理履职意向地 |
|
|
List<Long> expertIdsByIntentionRegion = expertIdsByRegion(rule); |
|
|
List<Long> expertIdsByIntentionRegion = expertIdsByRegion(rule); |
|
|
if (COLL_EMPTY.evaluate(expertIdsByIntentionRegion)) { |
|
|
if (COLL_EMPTY.evaluate(expertIdsByIntentionRegion)) { |
|
|
return null; |
|
|
|
|
|
|
|
|
return MergeExpertIdDTO.noExpert(); |
|
|
} |
|
|
} |
|
|
// 处理专家标签 |
|
|
// 处理专家标签 |
|
|
List<Long> expertIdsByTag = expertIdsByTag(rule); |
|
|
List<Long> expertIdsByTag = expertIdsByTag(rule); |
|
|
if (COLL_EMPTY.evaluate(expertIdsByTag)) { |
|
|
if (COLL_EMPTY.evaluate(expertIdsByTag)) { |
|
|
return null; |
|
|
|
|
|
|
|
|
return MergeExpertIdDTO.noExpert(); |
|
|
} |
|
|
} |
|
|
// 处理专家字典 |
|
|
// 处理专家字典 |
|
|
List<Long> expertIdsByDict = expertIdsByDict(rule); |
|
|
List<Long> expertIdsByDict = expertIdsByDict(rule); |
|
|
if (COLL_EMPTY.evaluate(expertIdsByDict)) { |
|
|
if (COLL_EMPTY.evaluate(expertIdsByDict)) { |
|
|
return null; |
|
|
|
|
|
|
|
|
return MergeExpertIdDTO.noExpert(); |
|
|
} |
|
|
} |
|
|
// 处理专家回避单位 与 抽取回避单位是否相同 |
|
|
// 处理专家回避单位 与 抽取回避单位是否相同 |
|
|
List<Long> avoidCompanyExpertIds = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList()); |
|
|
|
|
|
|
|
|
List<Long> avoidExpertIdsByUnit = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList()); |
|
|
|
|
|
|
|
|
|
|
|
MergeExpertIdDTO merge = new MergeExpertIdDTO(); |
|
|
// 聚合用户ID |
|
|
// 聚合用户ID |
|
|
List<Long> expertIdsIn = new ArrayList<>(); |
|
|
List<Long> expertIdsIn = new ArrayList<>(); |
|
|
if (ObjectUtils.anyNotNull(expertIdsByDict, expertIdsByTag, expertIdsByIntentionRegion)) { |
|
|
if (ObjectUtils.anyNotNull(expertIdsByDict, expertIdsByTag, expertIdsByIntentionRegion)) { |
|
@@ -167,17 +166,22 @@ public class ExpertInviteManage { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
return null; |
|
|
|
|
|
|
|
|
return MergeExpertIdDTO.noExpert(); |
|
|
} |
|
|
} |
|
|
|
|
|
merge.setExpertIdsIn(expertIdsIn); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(avoidCompanyExpertIds)) { |
|
|
|
|
|
expertIdsIn.removeIf(avoidCompanyExpertIds::contains); |
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(avoidExpertIdsByUnit)) { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
return null; |
|
|
|
|
|
|
|
|
merge.setExpertIdsNotIn(avoidExpertIdsByUnit); |
|
|
|
|
|
} else { |
|
|
|
|
|
expertIdsIn.removeIf(avoidExpertIdsByUnit::contains); |
|
|
|
|
|
if (expertIdsIn.isEmpty()) { |
|
|
|
|
|
return MergeExpertIdDTO.noExpert(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return expertIdsIn; |
|
|
|
|
|
|
|
|
merge.setSkip(Boolean.FALSE); |
|
|
|
|
|
return merge; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -253,8 +257,8 @@ public class ExpertInviteManage { |
|
|
LocalDateTime sTime, |
|
|
LocalDateTime sTime, |
|
|
LocalDateTime eTime) { |
|
|
LocalDateTime eTime) { |
|
|
ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); |
|
|
ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); |
|
|
List<Long> expertIdsIn = mergeExpertIdsByCondition(randomRule, avoidRule); |
|
|
|
|
|
if (expertIdsIn == null) { |
|
|
|
|
|
|
|
|
MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); |
|
|
|
|
|
if (merge.getSkip()) { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
boolean avoidExpert = CollUtil.isNotEmpty(avoidRule.getExpertIds()); |
|
|
boolean avoidExpert = CollUtil.isNotEmpty(avoidRule.getExpertIds()); |
|
@@ -270,14 +274,20 @@ public class ExpertInviteManage { |
|
|
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" + |
|
|
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" + |
|
|
" and company_uniq_code in ({0})", CollUtils.joinByComma(avoidRule.getAvoidUnitIdList())); |
|
|
" and company_uniq_code in ({0})", CollUtils.joinByComma(avoidRule.getAvoidUnitIdList())); |
|
|
} |
|
|
} |
|
|
|
|
|
Set<Long> expertIdsIn = new HashSet<>(); |
|
|
|
|
|
Set<Long> expertIdsNotIn = new HashSet<>(); |
|
|
|
|
|
if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { |
|
|
|
|
|
expertIdsIn.addAll(merge.getExpertIdsIn()); |
|
|
|
|
|
} else { |
|
|
|
|
|
expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); |
|
|
|
|
|
} |
|
|
// 处理专家层级 |
|
|
// 处理专家层级 |
|
|
addRegionLimit(query, randomRule); |
|
|
addRegionLimit(query, randomRule); |
|
|
if (!expertIdsIn.isEmpty()) { |
|
|
if (!expertIdsIn.isEmpty()) { |
|
|
if (avoidExpert) { |
|
|
if (avoidExpert) { |
|
|
expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); |
|
|
expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w)); |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
// 字典、标签、履职意向地筛选出的专家ID移除需要回避的专家ID |
|
|
|
|
|
// 如果为空则说明没有符合条件的 |
|
|
|
|
|
|
|
|
// 字典、标签、履职意向地 筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的 |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -293,15 +303,17 @@ public class ExpertInviteManage { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
if (expertIdsIn.isEmpty()) { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
query.in(ExpertUserFullInfo::getUserId, expertIdsIn); |
|
|
|
|
|
} else if (avoidExpert || CollUtil.isNotEmpty(appointExpertIds)) { |
|
|
} else if (avoidExpert || CollUtil.isNotEmpty(appointExpertIds)) { |
|
|
Set<Long> tempExperts = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime); |
|
|
|
|
|
query.notIn(ExpertUserFullInfo::getUserId, tempExperts); |
|
|
|
|
|
|
|
|
Set<Long> tmpExpert = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime); |
|
|
|
|
|
expertIdsNotIn.addAll(tmpExpert); |
|
|
} else { |
|
|
} else { |
|
|
Set<Long> notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime); |
|
|
|
|
|
if (!notInUserIds.isEmpty()) { |
|
|
|
|
|
query.notIn(ExpertUserFullInfo::getUserId, notInUserIds); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Set<Long> tmpNotInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime); |
|
|
|
|
|
expertIdsNotIn.addAll(tmpNotInUserIds); |
|
|
|
|
|
} |
|
|
|
|
|
if (!expertIdsIn.isEmpty()) { |
|
|
|
|
|
query.in(ExpertUserFullInfo::getUserId, expertIdsIn); |
|
|
|
|
|
} else if (!expertIdsNotIn.isEmpty()) { |
|
|
|
|
|
query.notIn(ExpertUserFullInfo::getUserId, expertIdsNotIn); |
|
|
} |
|
|
} |
|
|
List<ExpertUserFullInfo> userInfoList = expertUserFullInfoService.list(query); |
|
|
List<ExpertUserFullInfo> userInfoList = expertUserFullInfoService.list(query); |
|
|
if (userInfoList.isEmpty()) { |
|
|
if (userInfoList.isEmpty()) { |
|
@@ -334,11 +346,17 @@ public class ExpertInviteManage { |
|
|
boolean invitedRefused) { |
|
|
boolean invitedRefused) { |
|
|
ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); |
|
|
ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); |
|
|
// 合并标签、字典 |
|
|
// 合并标签、字典 |
|
|
List<Long> expertIdsIn = mergeExpertIdsByCondition(randomRule, avoidRule); |
|
|
|
|
|
List<Long> expertIdsNotIn = new ArrayList<>(); |
|
|
|
|
|
if (expertIdsIn == null) { |
|
|
|
|
|
|
|
|
MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); |
|
|
|
|
|
if (merge.getSkip()) { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
Set<Long> expertIdsIn = new HashSet<>(); |
|
|
|
|
|
Set<Long> expertIdsNotIn = new HashSet<>(); |
|
|
|
|
|
if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { |
|
|
|
|
|
expertIdsIn.addAll(merge.getExpertIdsIn()); |
|
|
|
|
|
} else { |
|
|
|
|
|
expertIdsNotIn.addAll(merge.getExpertIdsNotIn()); |
|
|
|
|
|
} |
|
|
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery(); |
|
|
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery(); |
|
|
// 设置回避单位 |
|
|
// 设置回避单位 |
|
|
Set<String> notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList()); |
|
|
Set<String> notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList()); |
|
|