package com.panzhihua.service_community.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.common.model.vos.community.ComActEasyPhotoActivityVO;
|
import com.panzhihua.common.utlis.DateUtils;
|
import com.panzhihua.service_community.dao.ComActEasyPhotoActivityMapper;
|
import com.panzhihua.service_community.model.dos.ComActEasyPhotoActivityDO;
|
import com.panzhihua.service_community.service.ComActEasyPhotoActivityService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @auther lyq
|
* @create 2021-06-25 10:34:16
|
* @describe 随手拍活动表服务实现类
|
*/
|
@Slf4j
|
@Service
|
public class ComActEasyPhotoActivityServiceImpl extends ServiceImpl<ComActEasyPhotoActivityMapper, ComActEasyPhotoActivityDO> implements ComActEasyPhotoActivityService {
|
|
/**
|
* 查询随手拍是否有活动
|
* @return 活动详情
|
*/
|
@Override
|
public R getEasyPhotoActivity(Long communityId){
|
ComActEasyPhotoActivityVO photoActivityVO = new ComActEasyPhotoActivityVO();
|
Date nowDate = DateUtils.getCurrentDate(DateUtils.ymdhms_format);
|
List<ComActEasyPhotoActivityDO> photoActivityDOS = this.baseMapper.selectList(
|
new QueryWrapper<ComActEasyPhotoActivityDO>().lambda().eq(ComActEasyPhotoActivityDO::getCommunityId,communityId)
|
.le(ComActEasyPhotoActivityDO::getActivityStartAt,nowDate).ge(ComActEasyPhotoActivityDO::getActivityEndAt,nowDate));
|
if(!photoActivityDOS.isEmpty()){
|
ComActEasyPhotoActivityDO photoActivityDO = photoActivityDOS.get(0);
|
BeanUtils.copyProperties(photoActivityDO,photoActivityVO);
|
return R.ok(photoActivityVO);
|
}
|
return R.ok();
|
}
|
}
|