From 82bf849c82dda23f216c798aa020587e724869da Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 18 Apr 2023 00:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=9A=E5=8A=A1=E6=9D=A1?= =?UTF-8?q?=E7=BA=BF=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/common/util/BizUtils.java | 4 ++++ .../pmapi/meeting/manage/ExpertInviteManage.java | 23 ++++++++++++++++------ .../meeting/task/ExpertCallResultRewriteTask.java | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) 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 {