| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.model.operation.XpActicity; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.operation.mapper.XpActicityMapper; |
| | | import com.xiaopeng.operation.service.IXpActicityService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | * @since 2026-02-03 |
| | | */ |
| | | @Service |
| | | public class XpActicityServiceImpl extends ServiceImpl<XpActicityMapper, XpActicity> implements IXpActicityService { |
| | | public class XpActicityServiceImpl extends ServiceImpl<XpActicityMapper, XpActivity> implements IXpActicityService { |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<String> findListToIds(String acticityName){ |
| | | LambdaQueryWrapper<XpActicity> query = new LambdaQueryWrapper<>(); |
| | | query.select(XpActicity::getId); |
| | | query.eq(XpActicity::getDeleted, 0); |
| | | query.like(XpActicity::getActicityName, acticityName); |
| | | LambdaQueryWrapper<XpActivity> query = new LambdaQueryWrapper<>(); |
| | | query.select(XpActivity::getId); |
| | | query.eq(XpActivity::getDeleted, 0); |
| | | query.like(XpActivity::getActicityName, acticityName); |
| | | return listObjs(query, Object::toString); |
| | | } |
| | | @Override |
| | | public XpActicity activiting() { |
| | | LambdaQueryWrapper<XpActicity> query = new LambdaQueryWrapper<>(); |
| | | public XpActivity activiting() { |
| | | LambdaQueryWrapper<XpActivity> query = new LambdaQueryWrapper<>(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | query.le(XpActicity::getStartTime, now) |
| | | .ge(XpActicity::getEndTime, now); |
| | | List<XpActicity> list = list(query); |
| | | query.le(XpActivity::getStartTime, now) |
| | | .ge(XpActivity::getEndTime, now); |
| | | List<XpActivity> list = list(query); |
| | | if(!list.isEmpty()){ |
| | | return list.get(new Random().nextInt(list.size())); |
| | | } |