| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.listener.PublishTopicLiveInfoEventListener; |
| | | import com.ruoyi.system.listener.event.PublishTopicLiveInfoEvent; |
| | | import com.ruoyi.system.mapper.TSysLiveMapper; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.model.TSysLive; |
| | |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.LivePushJob; |
| | | import com.ruoyi.system.utils.util.TemplateMessageSendUtil; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | import com.ruoyi.system.vo.TSysLiveVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ApplicationContext applicationContext; |
| | | @Override |
| | | public R pushUser(String id, String pushType) { |
| | | TSysLive sysLive = this.getById(id); |
| | |
| | | } |
| | | sysLive.setPushType(pushType); |
| | | this.updateById(sysLive); |
| | | // 添加定时任务 直播开始推送 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", sysLive.getId()) |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | LivePushJob.class, |
| | | (LivePushJob.name+sysLive.getId()).toUpperCase(), |
| | | TimeJobType.LIVE_PUSH, |
| | | DateUtils.localDateTimeToDate(sysLive.getStartTime()), |
| | | maps |
| | | ); |
| | | // 直播开始推送公众号消息 |
| | | applicationContext.publishEvent(new PublishTopicLiveInfoEvent(pushType+"_"+id)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | sysLive.setLiveStatus(3); |
| | | } |
| | | // 查看是否包含该值 |
| | | boolean memberInSet = redisCache.isMemberInSet(Constants.LIVE_APPOINTMENT_PUSH + sysLive.getId(), query.getAppUserId()); |
| | | sysLive.setAppointmentStatus(memberInSet ? 2 : 1); |
| | | // boolean memberInSet = redisCache.isMemberInSet(Constants.LIVE_APPOINTMENT_PUSH + sysLive.getId(), query.getAppUserId()); |
| | | // sysLive.setAppointmentStatus(memberInSet ? 2 : 1); |
| | | |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_ACTIVITY_CLICK_COUNT + sysLive.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | sysLive.setIsView(true); |
| | | } |
| | | } |
| | | |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |