Browse Source

会议专家抽取列表增加邀请类型

tags/24080901
WendyYang 1 year ago
parent
commit
eec1f79003
4 changed files with 15 additions and 15 deletions
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java
  2. +2
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java
  3. +8
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  4. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java View File

@@ -41,6 +41,9 @@ public class InviteExpertListItemVO extends ExpertBasicInfoVO {
@ApiModelProperty("邀请状态") @ApiModelProperty("邀请状态")
private Integer status; private Integer status;


@ApiModelProperty("抽取类型")
private Integer inviteType;

@ApiModelProperty("通知时间") @ApiModelProperty("通知时间")
private LocalDateTime noticeTime; private LocalDateTime noticeTime;



+ 2
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java View File

@@ -20,7 +20,6 @@ import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule;
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.AvoidRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO; import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
@@ -236,12 +235,10 @@ public class MeetingManageHelper {
if (expertInfo != null) { if (expertInfo != null) {
String expertName = expertInfo.getExpertName(); String expertName = expertInfo.getExpertName();
switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) { switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) {
case REFUSED:
throw BizException.wrap("专家%s已拒绝参加", expertName);
case AGREED: case AGREED:
throw BizException.wrap("专家%s已同意参加", expertName);
throw BizException.wrap("专家 %s 已同意参加", expertName);
case NOTICING: case NOTICING:
throw BizException.wrap("专家%s正在通知中", expertName);
throw BizException.wrap("专家 %s 正在通知中", expertName);
default: default:
break; break;
} }


+ 8
- 6
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -56,7 +56,7 @@ import org.springframework.util.Assert;


import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.function.BiFunction;
import java.util.stream.Collectors; import java.util.stream.Collectors;


import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*;
@@ -238,7 +238,7 @@ public class MeetingManage {
// 随机抽取的话则需进行抽取数量校验 // 随机抽取的话则需进行抽取数量校验
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), 5, now);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now);
LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class) LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteStatus, false) .set(Meeting::getInviteStatus, false)
.eq(Meeting::getId, meeting.getId()); .eq(Meeting::getId, meeting.getId());
@@ -470,7 +470,7 @@ public class MeetingManage {
} }
List<Long> expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); List<Long> expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId);
Map<Long, ExpertBasicInfoVO> expertMap = meetingManageHelper.getExpertBasicInfo(expertIds); Map<Long, ExpertBasicInfoVO> expertMap = meetingManageHelper.getExpertBasicInfo(expertIds);
Function<MeetingExpert, InviteExpertListItemVO> mapping = me -> {
BiFunction<MeetingExpert, Map<Long, ExpertInviteRule>, InviteExpertListItemVO> mapping = (me, ruleMap) -> {
ExpertBasicInfoVO expert = expertMap.get(me.getExpertId()); ExpertBasicInfoVO expert = expertMap.get(me.getExpertId());
InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class); InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class);
item.setExpertMeetingId(me.getId()); item.setExpertMeetingId(me.getId());
@@ -480,6 +480,8 @@ public class MeetingManage {
item.setNoticeTime(me.getCreateOn()); item.setNoticeTime(me.getCreateOn());
item.setRuleId(me.getRuleId()); item.setRuleId(me.getRuleId());
item.setIsHeadman(me.getIsHeadman()); item.setIsHeadman(me.getIsHeadman());
ExpertInviteRule rule = ruleMap.get(me.getRuleId());
item.setInviteType(rule == null ? ExpertInviteTypeEnum.APPOINT.getCode() : rule.getInviteType());
if (NOTICING.eq(me.getStatus())) { if (NOTICING.eq(me.getStatus())) {
item.setNoticeStatus("通知中"); item.setNoticeStatus("通知中");
} else { } else {
@@ -487,12 +489,12 @@ public class MeetingManage {
} }
return item; return item;
}; };
List<ExpertInviteRule> inviteRules = inviteRuleService.listByMeetingId(meetingId);
Map<Long, ExpertInviteRule> ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId);
boolean isRandom = ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType()); boolean isRandom = ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType());
if (isRandom) { if (isRandom) {
result.setInviteStatistics(new ArrayList<>()); result.setInviteStatistics(new ArrayList<>());
Map<Long, List<MeetingExpert>> groupByRule = CollUtils.group(experts, MeetingExpert::getRuleId); Map<Long, List<MeetingExpert>> groupByRule = CollUtils.group(experts, MeetingExpert::getRuleId);
List<ExpertInviteRule> inviteRules = inviteRuleService.listByMeetingId(meetingId);
Map<Long, ExpertInviteRule> ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId);
ruleMap.forEach((k, v) -> { ruleMap.forEach((k, v) -> {
InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(k); InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(k);
statistics.setInviteCnt(v.getInviteCount()); statistics.setInviteCnt(v.getInviteCount());
@@ -508,7 +510,7 @@ public class MeetingManage {
result.getInviteStatistics().add(statistics); result.getInviteStatistics().add(statistics);
}); });
} }
List<InviteExpertListItemVO> converts = CollUtils.convert(experts, mapping);
List<InviteExpertListItemVO> converts = CollUtils.convert(experts, me -> mapping.apply(me, ruleMap));
result.setInviteExpertList(converts); result.setInviteExpertList(converts);
// 确定参加列表 // 确定参加列表
return result; return result;


+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java View File

@@ -27,7 +27,6 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.aop.framework.AopContext; import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -205,13 +204,12 @@ public class ExpertInviteTask {
* 创建会议时添加抽取任务 * 创建会议时添加抽取任务
* *
* @param meetingId 会议ID * @param meetingId 会议ID
* @param delayTime 延迟时间
* @param tsTime 开始时间 * @param tsTime 开始时间
* @author WendyYang * @author WendyYang
**/ **/
public void addInviteTaskByMeetingCreate(Long meetingId, int delayTime, LocalDateTime tsTime) {
public void addInviteTaskByMeetingCreate(Long meetingId, LocalDateTime tsTime) {
Assert.isTrue(properties.getEnable(), "随机邀请已关闭"); Assert.isTrue(properties.getEnable(), "随机邀请已关闭");
addInviteTask(meetingId, false, delayTime, false, tsTime);
addInviteTask(meetingId, false, properties.getInviteDelay(), false, tsTime);
InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false, tsTime); InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false, tsTime);
cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); cachePlusOps.hSet(getCacheKey(meetingId), cacheVal);
} }


Loading…
Cancel
Save