| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.query.TSysLiveQuery; |
| | | import com.ruoyi.system.service.TSysLiveService; |
| | | 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.vo.TSysLiveVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "查看直播管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysLive> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysLiveService.getById(id)); |
| | | TSysLive sysLive = sysLiveService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysLiveService.update( |
| | | Wrappers.<TSysLive>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysLive::getId, id) |
| | | ); |
| | | return R.ok(sysLive); |
| | | } |
| | | |
| | | /** |
| | |
| | | Set<String> appointmentPush = new HashSet<>(); |
| | | appointmentPush.add(userId); |
| | | redisCache.setCacheSet(Constants.LIVE_APPOINTMENT_PUSH + id, appointmentPush); |
| | | |
| | | TSysLive sysLive = sysLiveService.getById(id); |
| | | 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().minusHours(1)), |
| | | maps |
| | | ); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |