Browse Source

Merge remote-tracking branch 'origin/dev' into dev

master
CMM 1 year ago
parent
commit
db126db9ef
3 changed files with 25 additions and 15 deletions
  1. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  2. +6
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingServiceImpl.java
  3. +16
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java

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

@@ -199,7 +199,7 @@ public class MeetingManage {
if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) {
throw BizException.wrap("转换失败,请刷新后重试");
}
expertRandomInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId);
LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteType, APPOINT.getCode())
.eq(Meeting::getId, meetingId);
@@ -654,7 +654,7 @@ public class MeetingManage {
}

public void stopRandomInvite(Long meetingId) {
expertRandomInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId);
}

@Transactional(rollbackFor = Exception.class)
@@ -676,7 +676,7 @@ public class MeetingManage {
.set(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode())
.eq(Meeting::getId, meetingId);
meetingService.update(meetingUpdate);
expertRandomInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingIdAndKillTask(meetingId);
// 发送通知给专家
List<MeetingExpert> experts = meetingExpertService.listAgreedExperts(meetingId);
if (!experts.isEmpty()) {


+ 6
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingServiceImpl.java View File

@@ -1,5 +1,7 @@
package com.ningdatech.pmapi.meeting.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.model.entity.CountGroupByDTO;
@@ -25,10 +27,10 @@ public class MeetingServiceImpl extends ServiceImpl<MeetingMapper, Meeting> impl

@Override
public void stopRandomInvite(Long meetingId) {
Meeting meeting = new Meeting();
meeting.setId(meetingId);
meeting.setInviteStatus(Boolean.TRUE);
baseMapper.updateById(meeting);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class)
.eq(Meeting::getId, meetingId)
.set(Meeting::getInviteStatus, Boolean.TRUE);
update(update);
}

@Override


+ 16
- 8
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java View File

@@ -228,9 +228,9 @@ public class ExpertRandomInviteTask {
public void invite(Long meetingId, Boolean reInvite, LocalDateTime tsTime) {
log.info("开始进行专家后台抽取:{}", meetingId);
Meeting meeting = meetingService.getById(meetingId);
if (meeting.getStartTime().isBefore(LocalDateTime.now())) {
if (meeting.getInviteStatus() || meeting.getStartTime().isBefore(LocalDateTime.now())) {
log.info("会议已开始停止抽取:{}", meeting);
cancelByMeetingId(meetingId);
killTaskAndDelCacheMeetingId(meetingId);
return;
}
// 随机邀请规则
@@ -275,9 +275,13 @@ public class ExpertRandomInviteTask {
});
if (notIgnoreCnt.get() == 0 || notIgnoreCnt.get() == notSupportCnt.get()) {
log.info("停止会议随机邀请:{} 未完成抽取规则数量 {} 无可抽取专家规则数量 {}", meetingId, notIgnoreCnt, notSupportCnt);
currProxy().cancelByMeetingId(meetingId);
meetingCallOrMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName());
meetingService.stopRandomInvite(meetingId);
if (notIgnoreCnt.get() == notSupportCnt.get() && notIgnoreCnt.get() > 0) {
// 当未完成抽取且无专家可抽取时
meetingCallOrMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName());
}
}
// 所有抽取规则抽取人数满足 自动召开会议
if (notIgnoreCnt.get() == 0 && notSupportCnt.get() == 0) {
MeetingManage meetingManage = SpringUtils.getBean(MeetingManage.class);
ConfirmedRosterReq req = new ConfirmedRosterReq();
@@ -287,10 +291,7 @@ public class ExpertRandomInviteTask {
}
}

@Transactional(rollbackFor = Exception.class)
public void cancelByMeetingId(Long meetingId) {
log.info("终止专家抽取:{}", meetingId);
meetingService.stopRandomInvite(meetingId);
private void killTaskAndDelCacheMeetingId(Long meetingId) {
cachePlusOps.hDel(getCacheKey(meetingId));
ScheduledFuture<?> future = INVITE_TASK_MAP.get(meetingId);
if (future != null) {
@@ -301,6 +302,13 @@ public class ExpertRandomInviteTask {
}
}

@Transactional(rollbackFor = Exception.class)
public void cancelByMeetingIdAndKillTask(Long meetingId) {
log.info("终止专家抽取:{}", meetingId);
meetingService.stopRandomInvite(meetingId);
killTaskAndDelCacheMeetingId(meetingId);
}

//==================================================================================================================

private Map<Long, ExpertCntBO> countByAttendStatus(Map<Long, MeetingExpert> expertMap) {


Loading…
Cancel
Save