| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.mapper.TSysLiveMapper; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.query.TSysLiveQuery; |
| | | import com.ruoyi.system.service.TSysLiveService; |
| | | import com.ruoyi.system.vo.TSysLiveVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TSysLiveServiceImpl extends ServiceImpl<TSysLiveMapper, TSysLive> implements TSysLiveService { |
| | | |
| | | @Override |
| | | public R pushUser(String id, String pushType) { |
| | | TSysLive sysLive = this.getById(id); |
| | | if (Objects.nonNull(sysLive)){ |
| | | sysLive.setPushType(pushType); |
| | | this.updateById(sysLive); |
| | | // TODO 添加定时推送 |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TSysLiveVO> pageList(TSysLiveQuery query) { |
| | | PageInfo<TSysLiveVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysLiveVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | // 判断状态 |
| | | for (TSysLiveVO sysLive : list) { |
| | | if(sysLive.getStartTime().isAfter(LocalDateTime.now())){ |
| | | sysLive.setLiveStatus(1); |
| | | } |
| | | if(sysLive.getStartTime().isBefore(LocalDateTime.now()) && sysLive.getEndTime().isAfter(LocalDateTime.now())){ |
| | | sysLive.setLiveStatus(2); |
| | | } |
| | | if(sysLive.getEndTime().isBefore(LocalDateTime.now())){ |
| | | sysLive.setLiveStatus(3); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |