Sfoglia il codice sorgente

抽取任务修改

tags/24080901
WendyYang 1 anno fa
parent
commit
d9953c41c7
1 ha cambiato i file con 12 aggiunte e 6 eliminazioni
  1. +12
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java

+ 12
- 6
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java Vedi File

@@ -78,9 +78,9 @@ public class ExpertInviteTask {
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;

/**
* 用来存入线程执行情况, 方便于停止定时任务时使用
* 用来存入线程执行句柄, 停止定时任务时使用
*/
protected static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_MAP = new ConcurrentHashMap<>();
private static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_TASK_MAP = new ConcurrentHashMap<>();

public ExpertInviteTask currProxy() {
return (ExpertInviteTask) AopContext.currentProxy();
@@ -155,7 +155,7 @@ public class ExpertInviteTask {
if (ArrayUtil.isNotEmpty(invitedRefused)) {
tmpInvitedRefused = invitedRefused[0];
}
if (!INVITE_MAP.containsKey(meetingId)) {
if (!INVITE_TASK_MAP.containsKey(meetingId)) {
addInviteTask(meetingId, false, properties.getInviteDelay(), tmpInvitedRefused);
log.info("重置会议的随机抽取状态:{}", meetingId);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
@@ -190,7 +190,7 @@ public class ExpertInviteTask {
log.error("执行专家邀请任务异常:{}", meetingId, e);
}
}, startTime, Duration.ofMinutes(properties.getInviteFixedRate()));
INVITE_MAP.putIfAbsent(meetingId, future);
INVITE_TASK_MAP.putIfAbsent(meetingId, future);
log.info("添加专家抽取后台任务:{}", meetingId);
}

@@ -208,6 +208,12 @@ public class ExpertInviteTask {
cachePlusOps.hSet(getCacheKey(meetingId), cacheVal);
}

/**
* 抽取过程
*
* @param meetingId 会议ID
* @param invitedRefused 是否可以邀请已拒绝的专家
*/
@Transactional(rollbackFor = Exception.class)
public void invite(Long meetingId, Boolean invitedRefused) {
log.info("开始进行专家后台抽取:{}", meetingId);
@@ -269,9 +275,9 @@ public class ExpertInviteTask {
log.info("终止专家抽取:{}", meetingId);
meetingService.stopRandomInvite(meetingId);
cachePlusOps.hDel(getCacheKey(meetingId));
ScheduledFuture<?> future = INVITE_MAP.get(meetingId);
ScheduledFuture<?> future = INVITE_TASK_MAP.get(meetingId);
if (future != null) {
INVITE_MAP.remove(meetingId);
INVITE_TASK_MAP.remove(meetingId);
if (!future.isCancelled()) {
future.cancel(true);
}


Loading…
Annulla
Salva