Sfoglia il codice sorgente

修复专家抽取为空

tags/24080901
WendyYang 1 anno fa
parent
commit
95d484a3f2
2 ha cambiato i file con 77 aggiunte e 29 eliminazioni
  1. +30
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MergeExpertIdDTO.java
  2. +47
    -29
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java

+ 30
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MergeExpertIdDTO.java Vedi File

@@ -0,0 +1,30 @@
package com.ningdatech.pmapi.meeting.entity.dto;

import lombok.Data;

import java.util.List;

/**
* <p>
* MergeExpertIdDTO
* </p>
*
* @author WendyYang
* @since 2023/4/14
**/
@Data
public class MergeExpertIdDTO {

private List<Long> expertIdsIn;

private List<Long> expertIdsNotIn;

private Boolean skip;

public static MergeExpertIdDTO noExpert() {
MergeExpertIdDTO condition = new MergeExpertIdDTO();
condition.setSkip(Boolean.TRUE);
return condition;
}

}

+ 47
- 29
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java Vedi File

@@ -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.Meeting;
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.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
@@ -124,30 +121,32 @@ public class ExpertInviteManage {
return new ArrayList<>();
}
LambdaQueryWrapper<ExpertAvoidCompany> query = Wrappers.lambdaQuery(ExpertAvoidCompany.class)
.select(ExpertAvoidCompany::getUserId)
.in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList);
List<ExpertAvoidCompany> expertAvoidCompanyList = expertAvoidCompanyService.list(query);
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);
if (COLL_EMPTY.evaluate(expertIdsByIntentionRegion)) {
return null;
return MergeExpertIdDTO.noExpert();
}
// 处理专家标签
List<Long> expertIdsByTag = expertIdsByTag(rule);
if (COLL_EMPTY.evaluate(expertIdsByTag)) {
return null;
return MergeExpertIdDTO.noExpert();
}
// 处理专家字典
List<Long> expertIdsByDict = expertIdsByDict(rule);
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
List<Long> expertIdsIn = new ArrayList<>();
if (ObjectUtils.anyNotNull(expertIdsByDict, expertIdsByTag, expertIdsByIntentionRegion)) {
@@ -167,17 +166,22 @@ public class ExpertInviteManage {
}
});
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()) {
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 eTime) {
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;
}
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" +
" 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);
if (!expertIdsIn.isEmpty()) {
if (avoidExpert) {
expertIdsIn.removeIf(w -> avoidRule.getExpertIds().contains(w));
if (expertIdsIn.isEmpty()) {
// 字典、标签、履职意向地筛选出的专家ID移除需要回避的专家ID
// 如果为空则说明没有符合条件的
// 字典、标签、履职意向地 筛选出的专家ID移除需要回避的专家ID、如果为空则说明没有符合条件的
return result;
}
}
@@ -293,15 +303,17 @@ public class ExpertInviteManage {
if (expertIdsIn.isEmpty()) {
return result;
}
query.in(ExpertUserFullInfo::getUserId, expertIdsIn);
} 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 {
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);
if (userInfoList.isEmpty()) {
@@ -334,11 +346,17 @@ public class ExpertInviteManage {
boolean invitedRefused) {
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;
}
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();
// 设置回避单位
Set<String> notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList());


Loading…
Annulla
Salva