|
@@ -4,10 +4,6 @@ import cn.hutool.core.util.ArrayUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
|
|
import com.ningdatech.basic.util.SpringUtils; |
|
|
|
|
|
import com.ningdatech.cache.model.cache.CacheHashKey; |
|
|
|
|
|
import com.ningdatech.cache.repository.CachePlusOps; |
|
|
|
|
|
import com.hz.pm.api.common.util.SpringContextHolder; |
|
|
import com.hz.pm.api.common.util.SpringContextHolder; |
|
|
import com.hz.pm.api.meeting.builder.ExpertInviteBuilder; |
|
|
import com.hz.pm.api.meeting.builder.ExpertInviteBuilder; |
|
|
import com.hz.pm.api.meeting.entity.domain.Meeting; |
|
|
import com.hz.pm.api.meeting.entity.domain.Meeting; |
|
@@ -25,11 +21,14 @@ import com.hz.pm.api.meeting.service.IExpertInviteAvoidRuleService; |
|
|
import com.hz.pm.api.meeting.service.IExpertInviteRuleService; |
|
|
import com.hz.pm.api.meeting.service.IExpertInviteRuleService; |
|
|
import com.hz.pm.api.meeting.service.IMeetingExpertService; |
|
|
import com.hz.pm.api.meeting.service.IMeetingExpertService; |
|
|
import com.hz.pm.api.meeting.service.IMeetingService; |
|
|
import com.hz.pm.api.meeting.service.IMeetingService; |
|
|
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
|
|
import com.ningdatech.basic.util.SpringUtils; |
|
|
|
|
|
import com.ningdatech.cache.model.cache.CacheHashKey; |
|
|
|
|
|
import com.ningdatech.cache.repository.CachePlusOps; |
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.Data; |
|
|
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.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; |
|
@@ -37,10 +36,7 @@ import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
import javax.annotation.PostConstruct; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.time.Duration; |
|
|
|
|
|
import java.time.Instant; |
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
|
|
|
|
import java.time.*; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
@@ -83,18 +79,20 @@ public class ExpertRandomInviteTask { |
|
|
*/ |
|
|
*/ |
|
|
private static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_TASK_MAP = new ConcurrentHashMap<>(); |
|
|
private static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_TASK_MAP = new ConcurrentHashMap<>(); |
|
|
|
|
|
|
|
|
private ExpertRandomInviteTask currProxy() { |
|
|
|
|
|
return (ExpertRandomInviteTask) AopContext.currentProxy(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private CacheHashKey getCacheKey(Long meetingId) { |
|
|
private CacheHashKey getCacheKey(Long meetingId) { |
|
|
String field = meetingId == null ? null : meetingId.toString(); |
|
|
String field = meetingId == null ? null : meetingId.toString(); |
|
|
return new CacheHashKey(MEETING_ID_INVITE_RANDOM, field, EXPIRE_TIME); |
|
|
return new CacheHashKey(MEETING_ID_INVITE_RANDOM, field, EXPIRE_TIME); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean inInviteTimeRange() { |
|
|
|
|
|
int currHour = LocalTime.now().getHour(); |
|
|
|
|
|
return currHour >= properties.getInviteStartHour() |
|
|
|
|
|
&& currHour < properties.getInviteEndHour(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
@PostConstruct |
|
|
public void initTask() { |
|
|
public void initTask() { |
|
|
if (!properties.getEnable()) { |
|
|
|
|
|
|
|
|
if (Boolean.FALSE.equals(properties.getEnable())) { |
|
|
log.warn("随机邀请已关闭……"); |
|
|
log.warn("随机邀请已关闭……"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@@ -227,6 +225,10 @@ public class ExpertRandomInviteTask { |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void invite(Long meetingId, Boolean reInvite, LocalDateTime tsTime) { |
|
|
public void invite(Long meetingId, Boolean reInvite, LocalDateTime tsTime) { |
|
|
log.info("开始进行专家后台抽取:{}", meetingId); |
|
|
log.info("开始进行专家后台抽取:{}", meetingId); |
|
|
|
|
|
if (!inInviteTimeRange()) { |
|
|
|
|
|
log.warn("不在会议抽取执行时间:{}",meetingId); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
Meeting meeting = meetingService.getById(meetingId); |
|
|
Meeting meeting = meetingService.getById(meetingId); |
|
|
if (meeting.getInviteStatus() || meeting.getStartTime().isBefore(LocalDateTime.now())) { |
|
|
if (meeting.getInviteStatus() || meeting.getStartTime().isBefore(LocalDateTime.now())) { |
|
|
log.info("会议已开始停止抽取:{}", meeting); |
|
|
log.info("会议已开始停止抽取:{}", meeting); |
|
|