From 5d727156a182bc137020b829cf0fbe8f9c1acde9 Mon Sep 17 00:00:00 2001 From: poffyzhang <99775271@qq.com> Date: Mon, 10 Apr 2023 21:37:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=B0=E5=A4=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectdeclared/manage/DeclaredProjectManage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 80aa1d4..4850981 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -423,9 +423,9 @@ public class DeclaredProjectManage { public void exportList(HttpServletResponse response, ProjectListReq param) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 - param.setBuildOrgCode(user.getOrganizationCode()); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 + preQuery(query,user); List records = projectService.list(query); AtomicInteger serialNumber = new AtomicInteger(0); From 3e97c8c7bfd61a71b6205852b5333ca0e2be9ada Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 11 Apr 2023 14:19:05 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=9E=E9=81=BF?= =?UTF-8?q?=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/meeting/manage/ExpertInviteManage.java | 26 +++++++++++----------- .../pmapi/meeting/manage/MeetingManage.java | 24 +++++++++----------- 2 files changed, 23 insertions(+), 27 deletions(-) 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 39fa7ef..aab476b 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 @@ -3,9 +3,9 @@ package com.ningdatech.pmapi.meeting.manage; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.common.util.StrUtils; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; @@ -307,11 +307,8 @@ public class ExpertInviteManage { return result; } Map> userGroupByUnit = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode); - result.setTotal(userInfoList.size()); - // count为空表示数量校验 - if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) { - result.setExperts(inviteGroupByCompany(userGroupByUnit, randomRule.getCount())); - } + result.setTotal(userGroupByUnit.size()); + result.setExperts(inviteGroupByCompany(userGroupByUnit, randomRule.getCount())); return result; } @@ -526,25 +523,28 @@ public class ExpertInviteManage { * 专家抽取(会议创建时抽取) * * @param randomRules 随机抽取规则 - * @param avoidRuled 回避信息 + * @param avoidRule 回避信息 * @param meeting 会议信息 * @author WendyYang **/ public void expertInviteByMeetingCreate(Meeting meeting, List randomRules, - AvoidRuleDTO avoidRuled) { + AvoidRuleDTO avoidRule) { List expertInserts = new ArrayList<>(); // 处理随机抽取规则 if (CollectionUtils.isNotEmpty(randomRules)) { List randoms = new ArrayList<>(); List expertsByRandom = new ArrayList<>(); List chooseExpertIds = new ArrayList<>(); - LocalDateTime startTime = meeting.getStartTime(); - LocalDateTime endTime = meeting.getEndTime(); + LocalDateTime sTime = meeting.getStartTime(); + LocalDateTime eTime = meeting.getEndTime(); randomRules.forEach(rule -> { - ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoidRuled, rule, chooseExpertIds, startTime, endTime); - expertsByRandom.add(tempExperts); - chooseExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId)); + ExpertChooseDTO tmpExperts = expertInviteByRandomRule(avoidRule, rule, chooseExpertIds, sTime, eTime); + if (tmpExperts.getTotal() < rule.getCount()) { + throw BizException.wrap("可抽取专家数量不足"); + } + expertsByRandom.add(tmpExperts); + chooseExpertIds.addAll(CollUtils.fieldList(tmpExperts.getExperts(), ExpertUserFullInfo::getUserId)); randoms.add(getExpertInviteRule(rule, meeting.getId())); }); inviteRuleService.saveBatch(randoms); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 8577e93..9b0fff6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -233,21 +233,12 @@ public class MeetingManage { AvoidRuleDTO avoidInfo = req.getAvoidRule(); Assert.notNull(avoidInfo, "回避信息不能为空"); // 随机抽取的话则需进行抽取数量校验 - ExpertCountOnChangeVO countOnChange = expertCountOnChange(req); - if (!countOnChange.getStatus()) { - throw BizException.wrap(countOnChange.getMessage()); - } - for (int i = 0; i < randomRules.size(); i++) { - Integer checkCount = countOnChange.getCountList().get(i); - Integer inviteCount = randomRules.get(i).getCount(); - Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足"); - } expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), 5); - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Meeting.class); - update.set(Meeting::getInviteStatus, false); - update.eq(Meeting::getId, meeting.getId()); - meetingService.update(update); + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getInviteStatus, false) + .eq(Meeting::getId, meeting.getId()); + meetingService.update(mUpdate); // 回避规则 ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule(); avoidRule.setMeetingId(meeting.getId()); @@ -301,9 +292,14 @@ public class MeetingManage { return resultCount; } List expertIdsChoose = new ArrayList<>(); - for (RandomInviteRuleDTO randomRule : req.getRandomRules()) { + for (int i = 0; i < req.getRandomRules().size(); i++) { + RandomInviteRuleDTO randomRule = req.getRandomRules().get(i); ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(), randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime()); + if (i < req.getRandomRules().size() - 1 && chooseExpert.getTotal() > 0) { + List tempUserIds = CollUtils.fieldList(chooseExpert.getExperts(), ExpertUserFullInfo::getUserId); + expertIdsChoose.addAll(tempUserIds); + } resultCount.addCountList(chooseExpert.getTotal()); } return resultCount; From 172cf015312c970fbf0468f78f4b3ad29722a26f Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 11 Apr 2023 15:02:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=9E=E9=81=BF?= =?UTF-8?q?=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/meeting/manage/ExpertInviteManage.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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 aab476b..0c53657 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 @@ -172,8 +172,9 @@ public class ExpertInviteManage { } if (CollUtil.isNotEmpty(avoidCompanyExpertIds)) { - for (Long avoidCompanyExpertId : avoidCompanyExpertIds) { - expertIdsIn.remove(avoidCompanyExpertId); + expertIdsIn.removeIf(avoidCompanyExpertIds::contains); + if (expertIdsIn.isEmpty()) { + return null; } } return expertIdsIn; @@ -249,8 +250,8 @@ public class ExpertInviteManage { public ExpertChooseDTO expertInviteByRandomRule(AvoidRuleDTO avoidRule, RandomInviteRuleDTO randomRule, List appointExpertIds, - LocalDateTime start, - LocalDateTime end) { + LocalDateTime sTime, + LocalDateTime eTime) { ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); List expertIdsIn = mergeExpertIdsByCondition(randomRule, avoidRule); if (expertIdsIn == null) { @@ -287,17 +288,17 @@ public class ExpertInviteManage { } } // 过滤掉已参加会议的专家 - List expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(start, end); + List expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(sTime, eTime); expertIdsIn.removeIf(expertIdsLockByMeeting::contains); if (expertIdsIn.isEmpty()) { return result; } query.in(ExpertUserFullInfo::getUserId, expertIdsIn); } else if (avoidExpert || CollUtil.isNotEmpty(appointExpertIds)) { - Set tempExperts = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, start, end); + Set tempExperts = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime); query.notIn(ExpertUserFullInfo::getUserId, tempExperts); } else { - Set notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(start, end); + Set notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime); if (!notInUserIds.isEmpty()) { query.notIn(ExpertUserFullInfo::getUserId, notInUserIds); } From f7000239b001759cbb47f6f875fa23b81be0f8c6 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 12 Apr 2023 14:11:10 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8B=92=E7=BB=9D=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0c53657..4183bf4 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 @@ -380,7 +380,7 @@ public class ExpertInviteManage { List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); } - if (invitedRefused) { + if (!invitedRefused) { // 拒绝参加的不可以被再次抽中 List refusedExperts = expertGroupByStatus.get(REFUSED); if (refusedExperts.size() > 0) {