罗元桥
2021-06-29 cd7bec2448443f88eee6f73df68df829fc95eed9
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -11,16 +11,11 @@
import com.panzhihua.common.model.vos.community.ComActEasyPhotoCommentVO;
import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO;
import com.panzhihua.common.model.vos.community.TodoEventsVO;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.SensitiveUtil;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActEasyPhotoCommentDAO;
import com.panzhihua.service_community.dao.ComActEasyPhotoCommentUserDAO;
import com.panzhihua.service_community.dao.ComActEasyPhotoDAO;
import com.panzhihua.service_community.dao.ComActEasyPhotoUserDAO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoCommentDO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoCommentUserDO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoUserDO;
import com.panzhihua.service_community.dao.*;
import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.ComActEasyPhotoService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -47,6 +42,8 @@
    private ComActEasyPhotoCommentDAO comActEasyPhotoCommentDAO ;
    @Resource
    private ComActEasyPhotoCommentUserDAO comActEasyPhotoCommentUserDAO ;
    @Resource
    private ComActEasyPhotoActivityMapper comActEasyPhotoActivityMapper;
    /**
     * 分页查询随手拍
     *
@@ -129,6 +126,15 @@
    public R addEasyPhoto(ComActEasyPhotoVO comActEasyPhotoVO) {
        ComActEasyPhotoDO comActEasyPhotoDO=new ComActEasyPhotoDO();
        BeanUtils.copyProperties(comActEasyPhotoVO,comActEasyPhotoDO);
        //查询是否在活动时间内
        Date nowDate = DateUtils.getCurrentDate(DateUtils.ymdhms_format);
        List<ComActEasyPhotoActivityDO> photoActivityDOS = comActEasyPhotoActivityMapper.selectList(
                new QueryWrapper<ComActEasyPhotoActivityDO>().lambda().eq(ComActEasyPhotoActivityDO::getCommunityId,comActEasyPhotoVO.getCommunityId())
                        .le(ComActEasyPhotoActivityDO::getActivityStartAt,nowDate).ge(ComActEasyPhotoActivityDO::getActivityEndAt,nowDate));
        if(!photoActivityDOS.isEmpty()){
            ComActEasyPhotoActivityDO photoActivityDO = photoActivityDOS.get(0);
            comActEasyPhotoDO.setActivityId(photoActivityDO.getId());
        }
        int insert = comActEasyPhotoDAO.insert(comActEasyPhotoDO);
        if (insert>0) {
            return R.ok();