diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java index 15d5ec3..809dca5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java @@ -105,4 +105,8 @@ public class BizUtils { }))); } + public static String inSqlJoin(List strings) { + return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); + } + } 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 1cc38c1..923a93a 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 @@ -83,6 +83,19 @@ public class ExpertInviteManage { .eq(ExpertUserFullInfo::getExpertAccountStatus, ExpertAccountStatusEnum.AVAILABLE.getKey()); } + private void buildAvoidCompanyAndBusinessStrip(LambdaQueryWrapper query, List units, List strips) { + if (CollUtil.isNotEmpty(units)) { + String unitStr = BizUtils.inSqlJoin(units); + 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 " + unitStr); + } + if (CollUtil.isNotEmpty(strips)) { + String orgStr = BizUtils.inSqlJoin(strips); + query.notExists("select 1 from expert_gov_business_strip egbs where egbs.expert_user_id = nd_expert_user_full_info.user_id" + + " and business_strip_code in " + orgStr); + } + } + /** * 增加专家层级限制 * @@ -272,10 +285,8 @@ public class ExpertInviteManage { // 回避信息 LambdaQueryWrapper query = buildBaseExpertQuery(); query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, tmpAvoidCompany); - if (avoidCompany) { - 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())); - } + // 处理回避单位与回避条线 + buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); Set expertIdsIn = new HashSet<>(); Set expertIdsNotIn = new HashSet<>(); if (CollUtil.isNotEmpty(merge.getExpertIdsIn())) { @@ -365,8 +376,8 @@ public class ExpertInviteManage { LambdaQueryWrapper query = buildBaseExpertQuery(); // 设置回避单位 Set notInCompanyUniqCodeList = new HashSet<>(avoidRule.getAvoidUnitIdList()); - 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())); + // 处理回避单位与回避条线 + buildAvoidCompanyAndBusinessStrip(query, avoidRule.getAvoidUnitIdList(), avoidRule.getAvoidOrgIdList()); // 处理专家层级 addRegionLimit(query, randomRule); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java index 2c0c5bd..1614be1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java @@ -207,7 +207,7 @@ public class ExpertCallResultRewriteTask { status = REFUSED; } } catch (Exception e) { - log.error("获取电话回调结果异常", e); + log.error("获取电话回调结果异常{}", mrd, e); status = UNANSWERED; } } else {