|  |  |  | 
|---|
|  |  |  | package com.panzhihua.service_community.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.common.PageComActEasyPhotoEvaluateDto; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.common.ComActEasyPhotoHandlerVo; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.easyPhoto.BannerVO; | 
|---|
|  |  |  | import com.panzhihua.service_community.entity.ComActEasyPhotoEvaluate; | 
|---|
|  |  |  | import com.panzhihua.service_community.entity.ComActEasyPhotoHandler; | 
|---|
|  |  |  | import com.panzhihua.service_community.entity.SysTemplateConfig; | 
|---|
|  |  |  | import com.panzhihua.service_community.service.ComActEasyPhotoHandlerService; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.GrantRewardDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.R; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.*; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.*; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.DateUtils; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.StringUtils; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.WxUtil; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.WxXCXTempSend; | 
|---|
|  |  |  | import com.panzhihua.service_community.dao.*; | 
|---|
|  |  |  | import com.panzhihua.service_community.model.dos.*; | 
|---|
|  |  |  | import com.panzhihua.service_community.service.ComActEasyPhotoService; | 
|---|
|  |  |  | import com.panzhihua.service_community.service.ComActUserWalletService; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @program: springcloud_k8s_panzhihuazhihuishequ | 
|---|
|  |  |  | 
|---|
|  |  |  | **/ | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class ComActEasyPhotoServiceImpl extends ServiceImpl<ComActEasyPhotoDAO, ComActEasyPhotoDO> implements ComActEasyPhotoService { | 
|---|
|  |  |  | public class ComActEasyPhotoServiceImpl extends ServiceImpl<ComActEasyPhotoDAO, ComActEasyPhotoDO> | 
|---|
|  |  |  | implements ComActEasyPhotoService { | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoDAO comActEasyPhotoDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoUserDAO comActEasyPhotoUserDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoCommentDAO comActEasyPhotoCommentDAO ; | 
|---|
|  |  |  | private ComActEasyPhotoCommentDAO comActEasyPhotoCommentDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoCommentUserDAO comActEasyPhotoCommentUserDAO ; | 
|---|
|  |  |  | private ComActEasyPhotoCommentUserDAO comActEasyPhotoCommentUserDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoActivityMapper comActEasyPhotoActivityMapper; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | 
|---|
|  |  |  | private ComActUserWalletService comActUserWalletService; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActActSignDAO comActActSignDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoFeedbackMapper comActEasyPhotoFeedbackMapper; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActQuestnaireDAO comActQuestnaireDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActReserveMapper comActReserveMapper; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActActivityDAO comActActivityDAO; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private SysTemplateConfigDao sysTemplateConfigDao; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoHandlerService easyPhotoHandlerService; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActEasyPhotoEvaluateMapper comActEasyPhotoEvaluateMapper; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ComActReserveRecordMapper comActReserveRecordMapper; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分页查询随手拍 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO 查询参数 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            查询参数 | 
|---|
|  |  |  | * @return 心愿列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | Long pageNum = comActEasyPhotoVO.getPageNum(); | 
|---|
|  |  |  | Long pageSize = comActEasyPhotoVO.getPageSize(); | 
|---|
|  |  |  | Long userId = comActEasyPhotoVO.getLogInUserId(); | 
|---|
|  |  |  | if (null==pageNum||0==pageNum) { | 
|---|
|  |  |  | if (null == pageNum || 0 == pageNum) { | 
|---|
|  |  |  | pageNum = 1l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null==pageSize||0==pageSize) { | 
|---|
|  |  |  | if (null == pageSize || 0 == pageSize) { | 
|---|
|  |  |  | pageSize = 10l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | page.setSize(pageSize); | 
|---|
|  |  |  | page.setCurrent(pageNum); | 
|---|
|  |  |  | IPage<ComActEasyPhotoVO> iPage = comActEasyPhotoDAO.pageEasyPhoto(page, comActEasyPhotoVO); | 
|---|
|  |  |  | IPage<ComActEasyPhotoVO> iPage = comActEasyPhotoDAO.pageEasyPhotoAdmin(page, comActEasyPhotoVO); | 
|---|
|  |  |  | List<ComActEasyPhotoVO> records = iPage.getRecords(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(records)) { | 
|---|
|  |  |  | records.forEach(comActEasyPhotoVO1 -> { | 
|---|
|  |  |  | Long id = comActEasyPhotoVO1.getId(); | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = | 
|---|
|  |  |  | comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(0); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | comActEasyPhotoVO1.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO1.getPhone())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(comActEasyPhotoVO1.getActivityId() != null && comActEasyPhotoVO1.getStatus().equals(ComActEasyPhotoDO.status.ywc)){ | 
|---|
|  |  |  | //查询随手拍活动 | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO1.getActivityId()); | 
|---|
|  |  |  | if(photoActivityDO != null){ | 
|---|
|  |  |  | if(comActEasyPhotoVO1.getActivityType() != null){ | 
|---|
|  |  |  | if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)){ | 
|---|
|  |  |  | if (comActEasyPhotoVO1.getActivityId() != null | 
|---|
|  |  |  | && comActEasyPhotoVO1.getStatus().equals(ComActEasyPhotoDO.status.dpj)) { | 
|---|
|  |  |  | // 查询随手拍活动 | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO1.getActivityId()); | 
|---|
|  |  |  | if (photoActivityDO != null) { | 
|---|
|  |  |  | if (comActEasyPhotoVO1.getActivityType() != null) { | 
|---|
|  |  |  | if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getGoodReward()); | 
|---|
|  |  |  | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)){ | 
|---|
|  |  |  | } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getExcellentReward()); | 
|---|
|  |  |  | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)){ | 
|---|
|  |  |  | } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getOrdinaryReward()); | 
|---|
|  |  |  | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)){ | 
|---|
|  |  |  | } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getCommonlyReward()); | 
|---|
|  |  |  | } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.wu)) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setActivityMoney(BigDecimal.ZERO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 随手拍详情 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param id 随手拍主键 | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | *            随手拍主键 | 
|---|
|  |  |  | * @param userId | 
|---|
|  |  |  | * @return 详情内容 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R detailEasyPhoto(Long id, Long userId) { | 
|---|
|  |  |  | ComActEasyPhotoVO comActEasyPhotoVO=comActEasyPhotoDAO.detailEasyPhoto(id); | 
|---|
|  |  |  | ComActEasyPhotoVO comActEasyPhotoVO = comActEasyPhotoDAO.detailEasyPhoto(id); | 
|---|
|  |  |  | Integer status = comActEasyPhotoVO.getStatus(); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoVO)||null== status) { | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoVO) || null == status) { | 
|---|
|  |  |  | return R.fail("随手拍不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { | 
|---|
|  |  |  | comActEasyPhotoVO.setHaveGiveThumbsUp(0); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | comActEasyPhotoVO.setHaveGiveThumbsUp(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (status.intValue()==4) { | 
|---|
|  |  |  | Date feedbackAt = comActEasyPhotoVO.getFeedbackAt(); | 
|---|
|  |  |  | if (null==feedbackAt) { | 
|---|
|  |  |  | comActEasyPhotoVO.setFeedbackAt(comActEasyPhotoVO.getExamineAt()); | 
|---|
|  |  |  | if (!userId.equals(0L)) { | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = | 
|---|
|  |  |  | comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { | 
|---|
|  |  |  | comActEasyPhotoVO.setHaveGiveThumbsUp(0); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | comActEasyPhotoVO.setHaveGiveThumbsUp(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | comActEasyPhotoVO.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO.getPhone())); | 
|---|
|  |  |  | if(comActEasyPhotoVO.getAddrRemark()==null){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // if (status.equals(4)) { | 
|---|
|  |  |  | // Date feedbackAt = comActEasyPhotoVO.getFeedbackAt(); | 
|---|
|  |  |  | // if (null==feedbackAt) { | 
|---|
|  |  |  | // comActEasyPhotoVO.setFeedbackAt(comActEasyPhotoVO.getExamineAt()); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查询反馈信息 | 
|---|
|  |  |  | List<ComActEasyPhotoFeedbackVO> photoFeedbackList = comActEasyPhotoFeedbackMapper.getPhotoFeedbackList(id); | 
|---|
|  |  |  | if (!photoFeedbackList.isEmpty()) { | 
|---|
|  |  |  | comActEasyPhotoVO.setPhotoFeedbackList(photoFeedbackList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // comActEasyPhotoVO.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO.getPhone())); | 
|---|
|  |  |  | if (comActEasyPhotoVO.getAddrRemark() == null) { | 
|---|
|  |  |  | comActEasyPhotoVO.setAddrRemark(""); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(comActEasyPhotoVO.getActivityId() != null){ | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO.getActivityId()); | 
|---|
|  |  |  | if(photoActivityDO != null){ | 
|---|
|  |  |  | if (comActEasyPhotoVO.getActivityId() != null) { | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO.getActivityId()); | 
|---|
|  |  |  | if (photoActivityDO != null) { | 
|---|
|  |  |  | ComActEasyPhotoActivityVO easyPhotoActivityVO = new ComActEasyPhotoActivityVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(photoActivityDO,easyPhotoActivityVO); | 
|---|
|  |  |  | BeanUtils.copyProperties(photoActivityDO, easyPhotoActivityVO); | 
|---|
|  |  |  | comActEasyPhotoVO.setEasyPhotoActivityVO(easyPhotoActivityVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | PageComActEasyPhotoEvaluateDto evaluateDto = new PageComActEasyPhotoEvaluateDto(); | 
|---|
|  |  |  | evaluateDto.setServiceId(id); | 
|---|
|  |  |  | evaluateDto.setServiceType(ComActEasyPhotoEvaluate.ServiceType.SSP); | 
|---|
|  |  |  | comActEasyPhotoVO.setEvaluateList(comActEasyPhotoEvaluateMapper.queryAllByList(evaluateDto)); | 
|---|
|  |  |  | return R.ok(comActEasyPhotoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 上传随手拍 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO 上传数据 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            上传数据 | 
|---|
|  |  |  | * @return 上传结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R addEasyPhoto(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | ComActEasyPhotoDO comActEasyPhotoDO=new ComActEasyPhotoDO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(comActEasyPhotoVO,comActEasyPhotoDO); | 
|---|
|  |  |  | //查询是否在活动时间内 | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getStatus,ComActEasyPhotoActivityDO.status.jxz)); | 
|---|
|  |  |  | if(!photoActivityDOS.isEmpty()){ | 
|---|
|  |  |  | List<ComActEasyPhotoActivityDO> photoActivityDOS = | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.selectList(new QueryWrapper<ComActEasyPhotoActivityDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getCommunityId, comActEasyPhotoVO.getCommunityId()) | 
|---|
|  |  |  | .le(ComActEasyPhotoActivityDO::getActivityStartAt, nowDate) | 
|---|
|  |  |  | .ge(ComActEasyPhotoActivityDO::getActivityEndAt, nowDate) | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getStatus, ComActEasyPhotoActivityDO.status.jxz)); | 
|---|
|  |  |  | if (!photoActivityDOS.isEmpty()) { | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = photoActivityDOS.get(0); | 
|---|
|  |  |  | photoActivityDO.setCount(photoActivityDO.getCount() + 1); | 
|---|
|  |  |  | comActEasyPhotoDO.setActivityId(photoActivityDO.getId()); | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.updateById(photoActivityDO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int insert = comActEasyPhotoDAO.insert(comActEasyPhotoDO); | 
|---|
|  |  |  | if (insert>0) { | 
|---|
|  |  |  | if (insert > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 点赞/取消点赞随手拍 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO 操作参数 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            操作参数 | 
|---|
|  |  |  | * @return 操作结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | Integer haveGiveThumbsUp = comActEasyPhotoVO.getHaveGiveThumbsUp(); | 
|---|
|  |  |  | Long userId = comActEasyPhotoVO.getSponsorId(); | 
|---|
|  |  |  | Long easyPhotoId = comActEasyPhotoVO.getId(); | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getUserId, userId).eq(ComActEasyPhotoUserDO::getEasyPhotoId, easyPhotoId)); | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO = | 
|---|
|  |  |  | comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoUserDO::getUserId, userId).eq(ComActEasyPhotoUserDO::getEasyPhotoId, easyPhotoId)); | 
|---|
|  |  |  | boolean empty = ObjectUtils.isEmpty(comActEasyPhotoUserDO); | 
|---|
|  |  |  | int num=0; | 
|---|
|  |  |  | if (haveGiveThumbsUp.intValue()==1) { | 
|---|
|  |  |  | if(empty){ | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO1=new ComActEasyPhotoUserDO(); | 
|---|
|  |  |  | int num = 0; | 
|---|
|  |  |  | if (haveGiveThumbsUp.intValue() == 1) { | 
|---|
|  |  |  | if (empty) { | 
|---|
|  |  |  | ComActEasyPhotoUserDO comActEasyPhotoUserDO1 = new ComActEasyPhotoUserDO(); | 
|---|
|  |  |  | comActEasyPhotoUserDO1.setEasyPhotoId(easyPhotoId); | 
|---|
|  |  |  | comActEasyPhotoUserDO1.setUserId(userId); | 
|---|
|  |  |  | num=comActEasyPhotoUserDAO.insert(comActEasyPhotoUserDO1); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | num = comActEasyPhotoUserDAO.insert(comActEasyPhotoUserDO1); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(empty){ | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (empty) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | num=comActEasyPhotoUserDAO.deleteById(comActEasyPhotoUserDO.getId()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | num = comActEasyPhotoUserDAO.deleteById(comActEasyPhotoUserDO.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (num>0) { | 
|---|
|  |  |  | if (num > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核反馈随手拍 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO 操作参数 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            操作参数 | 
|---|
|  |  |  | * @return 操作结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R putEasypHotoStatus(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | Integer type = comActEasyPhotoVO.getType(); | 
|---|
|  |  |  | //        操作类型 1审核通过 2驳回  3反馈 | 
|---|
|  |  |  | ComActEasyPhotoDO cmActEasyPhotoDO=new ComActEasyPhotoDO(); | 
|---|
|  |  |  | cmActEasyPhotoDO.setId(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | //        cmActEasyPhotoDO.setActivityType(comActEasyPhotoVO.getActivityType()); | 
|---|
|  |  |  | Date date = new Date(); | 
|---|
|  |  |  | switch (type){ | 
|---|
|  |  |  | comActEasyPhotoVO.setIsNeedFeedBack(1); | 
|---|
|  |  |  | Date nowDate = new Date(); | 
|---|
|  |  |  | // 操作类型 1审核通过 2驳回 3反馈 4完成随手拍 | 
|---|
|  |  |  | ComActEasyPhotoDO cmActEasyPhotoDO = this.comActEasyPhotoDAO.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if (cmActEasyPhotoDO == null) { | 
|---|
|  |  |  | return R.fail("未查询到随手拍记录"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | switch (type) { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | cmActEasyPhotoDO = this.comActEasyPhotoDAO.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)){ | 
|---|
|  |  |  | return R.fail("该随手拍已审核,不可重复操作"); | 
|---|
|  |  |  | if (!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)) { | 
|---|
|  |  |  | return R.fail("该随手拍已处理,不可重复操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer isNeedFeedBack = comActEasyPhotoVO.getIsNeedFeedBack(); | 
|---|
|  |  |  | if (isNeedFeedBack==1) { | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(2);//进行中 | 
|---|
|  |  |  | cmActEasyPhotoDO.setIsNeedFeedBack(1); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(4);//已完成 | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(2);// 进行中 | 
|---|
|  |  |  | cmActEasyPhotoDO.setIsNeedFeedBack(1); | 
|---|
|  |  |  | cmActEasyPhotoDO.setIsPublicity(comActEasyPhotoVO.getIsPublicity()); | 
|---|
|  |  |  | if (comActEasyPhotoVO.getIsReportUrban().equals(ComActEasyPhotoVO.isReportUrban.yes)) { | 
|---|
|  |  |  | cmActEasyPhotoDO.setIsReportUrban(ComActEasyPhotoVO.isReportUrban.yes); | 
|---|
|  |  |  | cmActEasyPhotoDO.setTransferReason(comActEasyPhotoVO.getTransferReason()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setTransferTime(nowDate); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | cmActEasyPhotoDO.setIsReportUrban(ComActEasyPhotoVO.isReportUrban.no); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setExamineAt(date); | 
|---|
|  |  |  | cmActEasyPhotoDO.setExamineAt(nowDate); | 
|---|
|  |  |  | cmActEasyPhotoDO.setActivityType(comActEasyPhotoVO.getActivityType()); | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(comActEasyPhotoVO.getHandleResult()) | 
|---|
|  |  |  | || StringUtils.isNotEmpty(comActEasyPhotoVO.getHandlePhotoList())) { | 
|---|
|  |  |  | // 说明此处有反馈,需要给随手拍新增反馈信息 | 
|---|
|  |  |  | ComActEasyPhotoFeedbackDO photoFeedbackDO = new ComActEasyPhotoFeedbackDO(); | 
|---|
|  |  |  | photoFeedbackDO.setEasyId(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackContent(comActEasyPhotoVO.getHandleResult()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackImg(comActEasyPhotoVO.getHandlePhotoList()); | 
|---|
|  |  |  | photoFeedbackDO.setCreateAt(nowDate); | 
|---|
|  |  |  | photoFeedbackDO.setCreateBy(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | comActEasyPhotoFeedbackMapper.insert(photoFeedbackDO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 审核通过判断随手拍是否有活动并计算用户收益 | 
|---|
|  |  |  | comActUserWalletService.examineAddMoney(comActEasyPhotoVO.getActivityType(), comActEasyPhotoVO.getId(), | 
|---|
|  |  |  | comActEasyPhotoVO.getUserId(), BigDecimal.ZERO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //添加分配人员 | 
|---|
|  |  |  | if(comActEasyPhotoVO.getHandleList() != null && comActEasyPhotoVO.getHandleList().size() > 0){ | 
|---|
|  |  |  | comActEasyPhotoVO.getHandleList().forEach(handle -> { | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandlerId(handle.getUserId()); | 
|---|
|  |  |  | easyPhotoHandlerService.addHandleRecord(cmActEasyPhotoDO.getCommunityId(),handle.getUserId() | 
|---|
|  |  |  | ,cmActEasyPhotoDO.getId(),handle.getType(), ComActEasyPhotoHandler.ServiceType.SSP,comActEasyPhotoVO.getSponsorId()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | cmActEasyPhotoDO = this.comActEasyPhotoDAO.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)){ | 
|---|
|  |  |  | return R.fail("该随手拍已审核,不可重复操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(3);//已驳回 | 
|---|
|  |  |  | cmActEasyPhotoDO.setExamineAt(date); | 
|---|
|  |  |  | cmActEasyPhotoDO.setRejectReason(comActEasyPhotoVO.getRejectReason()); | 
|---|
|  |  |  | // if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)){ | 
|---|
|  |  |  | // return R.fail("该随手拍已处理,不可重复操作"); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | // cmActEasyPhotoDO.setStatus(3);//已驳回 | 
|---|
|  |  |  | // cmActEasyPhotoDO.setExamineAt(nowDate); | 
|---|
|  |  |  | // cmActEasyPhotoDO.setRejectReason(comActEasyPhotoVO.getRejectReason()); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | cmActEasyPhotoDO = this.comActEasyPhotoDAO.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dfk)){ | 
|---|
|  |  |  | return R.fail("该随手拍不是待反馈状态,不可进行反馈"); | 
|---|
|  |  |  | if (!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dfk)) { | 
|---|
|  |  |  | return R.fail("该随手拍不是进行中状态,不可进行反馈"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandleResult(comActEasyPhotoVO.getHandleResult()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setHandlePhotoList(comActEasyPhotoVO.getHandlePhotoList()); | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(4);//已完成 | 
|---|
|  |  |  | cmActEasyPhotoDO.setFeedbackAt(date); | 
|---|
|  |  |  | // 给随手拍新增反馈信息 | 
|---|
|  |  |  | ComActEasyPhotoFeedbackDO photoFeedbackDO = new ComActEasyPhotoFeedbackDO(); | 
|---|
|  |  |  | photoFeedbackDO.setEasyId(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackContent(comActEasyPhotoVO.getHandleResult()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackImg(comActEasyPhotoVO.getHandlePhotoList()); | 
|---|
|  |  |  | photoFeedbackDO.setCreateAt(nowDate); | 
|---|
|  |  |  | photoFeedbackDO.setCreateBy(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | comActEasyPhotoFeedbackMapper.insert(photoFeedbackDO); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default:break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | if (cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.ypj)) { | 
|---|
|  |  |  | return R.fail("该随手拍已完成,不可重复操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(comActEasyPhotoVO.getHandleResult()) | 
|---|
|  |  |  | || StringUtils.isNotEmpty(comActEasyPhotoVO.getHandlePhotoList())) { | 
|---|
|  |  |  | // 说明此处有反馈,需要给随手拍新增反馈信息 | 
|---|
|  |  |  | ComActEasyPhotoFeedbackDO photoFeedback = new ComActEasyPhotoFeedbackDO(); | 
|---|
|  |  |  | photoFeedback.setEasyId(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | photoFeedback.setFeedbackContent(comActEasyPhotoVO.getHandleResult()); | 
|---|
|  |  |  | photoFeedback.setFeedbackImg(comActEasyPhotoVO.getHandlePhotoList()); | 
|---|
|  |  |  | photoFeedback.setCreateAt(nowDate); | 
|---|
|  |  |  | photoFeedback.setCreateBy(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | comActEasyPhotoFeedbackMapper.insert(photoFeedback); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // if(cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)){ | 
|---|
|  |  |  | // cmActEasyPhotoDO.setExamineAt(nowDate); | 
|---|
|  |  |  | // cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | // cmActEasyPhotoDO.setActivityType(comActEasyPhotoVO.getActivityType()); | 
|---|
|  |  |  | // //审核通过判断随手拍是否有活动并计算用户收益 | 
|---|
|  |  |  | // comActUserWalletService.examineAddMoney(comActEasyPhotoVO.getActivityType(),comActEasyPhotoVO.getId(),comActEasyPhotoVO.getUserId(),BigDecimal.ZERO); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | cmActEasyPhotoDO.setFeedbackAt(nowDate); | 
|---|
|  |  |  | cmActEasyPhotoDO.setStatus(ComActEasyPhotoDO.status.dpj); | 
|---|
|  |  |  | cmActEasyPhotoDO.setCompleteId(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | if(comActEasyPhotoVO.getUrbanStatus()!=null&&comActEasyPhotoVO.getUrbanStatus()==2){ | 
|---|
|  |  |  | cmActEasyPhotoDO.setUrbanStatus(2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int update = comActEasyPhotoDAO.updateById(cmActEasyPhotoDO); | 
|---|
|  |  |  | if (update>0) { | 
|---|
|  |  |  | if (!type.equals(3)) { | 
|---|
|  |  |  | int update = comActEasyPhotoDAO.updateById(cmActEasyPhotoDO); | 
|---|
|  |  |  | if (update > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 随手拍是否有待审核和带反馈的事件 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param communityId 社区id | 
|---|
|  |  |  | * @param userId      登录用户id | 
|---|
|  |  |  | * @param communityId | 
|---|
|  |  |  | *            社区id | 
|---|
|  |  |  | * @param userId | 
|---|
|  |  |  | *            登录用户id | 
|---|
|  |  |  | * @return 待处理事件集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<TodoEventsVO> selectNeedToDo(Long communityId, Long userId) { | 
|---|
|  |  |  | List<TodoEventsVO> todoEventsVOS=comActEasyPhotoDAO.selectNeedToDo(communityId,userId); | 
|---|
|  |  |  | List<TodoEventsVO> todoEventsVOS = comActEasyPhotoDAO.selectNeedToDo(communityId, userId); | 
|---|
|  |  |  | return todoEventsVOS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 小程序分页查询随手拍 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO 查询参数 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            查询参数 | 
|---|
|  |  |  | * @return 返回结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | Long pageNum = comActEasyPhotoVO.getPageNum(); | 
|---|
|  |  |  | Long pageSize = comActEasyPhotoVO.getPageSize(); | 
|---|
|  |  |  | Long userId = comActEasyPhotoVO.getLogInUserId(); | 
|---|
|  |  |  | if (null==pageNum||0==pageNum) { | 
|---|
|  |  |  | if (null == pageNum || 0 == pageNum) { | 
|---|
|  |  |  | pageNum = 1l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null==pageSize||0==pageSize) { | 
|---|
|  |  |  | if (null == pageSize || 0 == pageSize) { | 
|---|
|  |  |  | pageSize = 10l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | page.setSize(pageSize); | 
|---|
|  |  |  | page.setCurrent(pageNum); | 
|---|
|  |  |  | IPage<ComActEasyPhotoVO> iPage = comActEasyPhotoDAO.pageEasyPhotoApplets(page, comActEasyPhotoVO); | 
|---|
|  |  |  | List<ComActEasyPhotoVO> records = iPage.getRecords(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(records)) { | 
|---|
|  |  |  | records.forEach(comActEasyPhotoVO1 -> { | 
|---|
|  |  |  | Long id = comActEasyPhotoVO1.getId(); | 
|---|
|  |  |  | Integer status = comActEasyPhotoVO1.getStatus(); | 
|---|
|  |  |  | Date feedbackAt = comActEasyPhotoVO1.getFeedbackAt(); | 
|---|
|  |  |  | List<ComActEasyPhotoUserDO> comActEasyPhotoUserDO = | 
|---|
|  |  |  | comActEasyPhotoUserDAO.selectList(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | if (comActEasyPhotoUserDO==null||comActEasyPhotoUserDO.size()==0) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(0); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(status.intValue()==4&&null==feedbackAt){ | 
|---|
|  |  |  | comActEasyPhotoVO1.setFeedbackAt(comActEasyPhotoVO1.getExamineAt()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | iPage.setRecords(records); | 
|---|
|  |  |  | if (userId != null) { | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(records)) { | 
|---|
|  |  |  | records.forEach(comActEasyPhotoVO1 -> { | 
|---|
|  |  |  | Long id = comActEasyPhotoVO1.getId(); | 
|---|
|  |  |  | Integer status = comActEasyPhotoVO1.getStatus(); | 
|---|
|  |  |  | Date feedbackAt = comActEasyPhotoVO1.getFeedbackAt(); | 
|---|
|  |  |  | List<ComActEasyPhotoUserDO> comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectList( | 
|---|
|  |  |  | new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id) | 
|---|
|  |  |  | .eq(ComActEasyPhotoUserDO::getUserId, userId)); | 
|---|
|  |  |  | if (comActEasyPhotoUserDO == null || comActEasyPhotoUserDO.size() == 0) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(0); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | comActEasyPhotoVO1.setHaveGiveThumbsUp(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (status.intValue() == 4 && null == feedbackAt) { | 
|---|
|  |  |  | comActEasyPhotoVO1.setFeedbackAt(comActEasyPhotoVO1.getExamineAt()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | iPage.setRecords(records); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(iPage); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 随手拍评论分页查询 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param pageComActEasyPhotoCommentDTO 查询参数 | 
|---|
|  |  |  | * @param pageComActEasyPhotoCommentDTO | 
|---|
|  |  |  | *            查询参数 | 
|---|
|  |  |  | * @return 查询结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | Page page = new Page<>(); | 
|---|
|  |  |  | Long pageNum = pageComActEasyPhotoCommentDTO.getPageNum(); | 
|---|
|  |  |  | Long pageSize = pageComActEasyPhotoCommentDTO.getPageSize(); | 
|---|
|  |  |  | if (null==pageNum||0==pageNum) { | 
|---|
|  |  |  | if (null == pageNum || 0 == pageNum) { | 
|---|
|  |  |  | pageNum = 1l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null==pageSize||0==pageSize) { | 
|---|
|  |  |  | if (null == pageSize || 0 == pageSize) { | 
|---|
|  |  |  | pageSize = 10l; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | page.setSize(pageSize); | 
|---|
|  |  |  | page.setCurrent(pageNum); | 
|---|
|  |  |  | IPage<ComActEasyPhotoCommentVO> iPage = comActEasyPhotoCommentDAO.pageComActEasyPhotoComment(page, pageComActEasyPhotoCommentDTO); | 
|---|
|  |  |  | if(!iPage.getRecords().isEmpty()){ | 
|---|
|  |  |  | for (ComActEasyPhotoCommentVO commentVO:iPage.getRecords()) { | 
|---|
|  |  |  | if(StringUtils.isEmpty(commentVO.getName())){ | 
|---|
|  |  |  | IPage<ComActEasyPhotoCommentVO> iPage = | 
|---|
|  |  |  | comActEasyPhotoCommentDAO.pageComActEasyPhotoComment(page, pageComActEasyPhotoCommentDTO); | 
|---|
|  |  |  | if (!iPage.getRecords().isEmpty()) { | 
|---|
|  |  |  | for (ComActEasyPhotoCommentVO commentVO : iPage.getRecords()) { | 
|---|
|  |  |  | if (StringUtils.isEmpty(commentVO.getName())) { | 
|---|
|  |  |  | commentVO.setName(commentVO.getNickName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 评论点赞/取消点赞 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoCommentUserDTO 操作 | 
|---|
|  |  |  | * @param comActEasyPhotoCommentUserDTO | 
|---|
|  |  |  | *            操作 | 
|---|
|  |  |  | * @return 操作结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R commentSign(ComActEasyPhotoCommentUserDTO comActEasyPhotoCommentUserDTO) { | 
|---|
|  |  |  | Long id = comActEasyPhotoCommentUserDTO.getId(); | 
|---|
|  |  |  | if (null==id||0==id) { | 
|---|
|  |  |  | if (null == id || 0 == id) { | 
|---|
|  |  |  | return R.fail("主键不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ComActEasyPhotoCommentDO comActEasyPhotoCommentDO = comActEasyPhotoCommentDAO.selectById(id); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.fail("评论不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer type = comActEasyPhotoCommentUserDTO.getType(); | 
|---|
|  |  |  | if (null==type||type.intValue()>2||type.intValue()==0) { | 
|---|
|  |  |  | if (null == type || type.intValue() > 2 || type.intValue() == 0) { | 
|---|
|  |  |  | return R.fail("操作类型错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Long userId = comActEasyPhotoCommentUserDTO.getUserId(); | 
|---|
|  |  |  | int num=0; | 
|---|
|  |  |  | if (type.intValue()==1) { | 
|---|
|  |  |  | ComActEasyPhotoCommentUserDO comActEasyPhotoCommentUserDO=new ComActEasyPhotoCommentUserDO(); | 
|---|
|  |  |  | int num = 0; | 
|---|
|  |  |  | if (type.intValue() == 1) { | 
|---|
|  |  |  | ComActEasyPhotoCommentUserDO comActEasyPhotoCommentUserDO = new ComActEasyPhotoCommentUserDO(); | 
|---|
|  |  |  | comActEasyPhotoCommentUserDO.setUserId(userId); | 
|---|
|  |  |  | comActEasyPhotoCommentUserDO.setEasyPhotoCommentId(id); | 
|---|
|  |  |  | ComActEasyPhotoCommentUserDO actEasyPhotoCommentUserDO = comActEasyPhotoCommentUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoCommentUserDO>().lambda().eq(ComActEasyPhotoCommentUserDO::getUserId, userId).eq(ComActEasyPhotoCommentUserDO::getEasyPhotoCommentId, id)); | 
|---|
|  |  |  | ComActEasyPhotoCommentUserDO actEasyPhotoCommentUserDO = | 
|---|
|  |  |  | comActEasyPhotoCommentUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoCommentUserDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoCommentUserDO::getUserId, userId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoCommentUserDO::getEasyPhotoCommentId, id)); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(actEasyPhotoCommentUserDO)) { | 
|---|
|  |  |  | num=1; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | num=comActEasyPhotoCommentUserDAO.insert(comActEasyPhotoCommentUserDO); | 
|---|
|  |  |  | num = 1; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | num = comActEasyPhotoCommentUserDAO.insert(comActEasyPhotoCommentUserDO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | num=comActEasyPhotoCommentUserDAO.delete(new QueryWrapper<ComActEasyPhotoCommentUserDO>().lambda().eq(ComActEasyPhotoCommentUserDO::getUserId,userId).eq(ComActEasyPhotoCommentUserDO::getEasyPhotoCommentId,id)); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | num = comActEasyPhotoCommentUserDAO.delete(new QueryWrapper<ComActEasyPhotoCommentUserDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoCommentUserDO::getUserId, userId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoCommentUserDO::getEasyPhotoCommentId, id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (num>0) { | 
|---|
|  |  |  | if (num > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 随手拍--评论--新增评论 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoCommentDTO 新增内容 | 
|---|
|  |  |  | * @param comActEasyPhotoCommentDTO | 
|---|
|  |  |  | *            新增内容 | 
|---|
|  |  |  | * @return 新增结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(comActEasyPhotoDO)) { | 
|---|
|  |  |  | return R.fail("随手拍不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ComActEasyPhotoCommentDO comActEasyPhotoCommentDO=new ComActEasyPhotoCommentDO(); | 
|---|
|  |  |  | ComActEasyPhotoCommentDO comActEasyPhotoCommentDO = new ComActEasyPhotoCommentDO(); | 
|---|
|  |  |  | comActEasyPhotoCommentDO.setComment(comActEasyPhotoCommentDTO.getComment()); | 
|---|
|  |  |  | comActEasyPhotoCommentDO.setUserId(comActEasyPhotoCommentDTO.getUserId()); | 
|---|
|  |  |  | comActEasyPhotoCommentDO.setEasyPhotoId(id); | 
|---|
|  |  |  | int insert = comActEasyPhotoCommentDAO.insert(comActEasyPhotoCommentDO); | 
|---|
|  |  |  | if (insert>0) { | 
|---|
|  |  |  | if (insert > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 社区随手拍列表统计 | 
|---|
|  |  |  | * @param communityId   社区id | 
|---|
|  |  |  | * @return  统计结果 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param communityId | 
|---|
|  |  |  | *            社区id | 
|---|
|  |  |  | * @return 统计结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R easyPhotoStatistics(Long communityId){ | 
|---|
|  |  |  | public R easyPhotoStatistics(Long communityId) { | 
|---|
|  |  |  | return R.ok(this.baseMapper.getEasyPhotoStatistics(communityId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 随手拍发放奖励 | 
|---|
|  |  |  | * @param grantRewardDTO    请求参数 | 
|---|
|  |  |  | * @return  发放结果 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param grantRewardDTO | 
|---|
|  |  |  | *            请求参数 | 
|---|
|  |  |  | * @return 发放结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R grantReward(GrantRewardDTO grantRewardDTO){ | 
|---|
|  |  |  | public R grantReward(GrantRewardDTO grantRewardDTO) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(grantRewardDTO.getIds() == null){ | 
|---|
|  |  |  | if (grantRewardDTO.getIds() == null) { | 
|---|
|  |  |  | return R.fail("参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Long id:grantRewardDTO.getIds()) { | 
|---|
|  |  |  | //查询随手拍 | 
|---|
|  |  |  | for (Long id : grantRewardDTO.getIds()) { | 
|---|
|  |  |  | // 查询随手拍 | 
|---|
|  |  |  | ComActEasyPhotoDO easyPhotoDO = this.baseMapper.selectById(id); | 
|---|
|  |  |  | if(easyPhotoDO != null){ | 
|---|
|  |  |  | if(easyPhotoDO.getActivityAmount() != null){ | 
|---|
|  |  |  | if (easyPhotoDO != null) { | 
|---|
|  |  |  | if (easyPhotoDO.getActivityAmount() != null) { | 
|---|
|  |  |  | log.info("该随手拍已发放过奖励,不可重复发放,随手拍id" + easyPhotoDO.getId()); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //审核通过判断随手拍是否有活动并计算用户收益 | 
|---|
|  |  |  | comActUserWalletService.examineAddMoney(easyPhotoDO.getActivityType(),easyPhotoDO.getId(),easyPhotoDO.getSponsorId(),grantRewardDTO.getAmount()); | 
|---|
|  |  |  | // 审核通过判断随手拍是否有活动并计算用户收益 | 
|---|
|  |  |  | comActUserWalletService.examineAddMoney(easyPhotoDO.getActivityType(), easyPhotoDO.getId(), | 
|---|
|  |  |  | easyPhotoDO.getSponsorId(), grantRewardDTO.getAmount()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发放奖励以后给用户推送消息 | 
|---|
|  |  |  | Map<String,String> map = comActActSignDAO.getUserOpenId(easyPhotoDO.getSponsorId()); | 
|---|
|  |  |  | if(map != null){ | 
|---|
|  |  |  | String activityType = ""; | 
|---|
|  |  |  | if (easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)) { | 
|---|
|  |  |  | activityType = "优质"; | 
|---|
|  |  |  | } else if (easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)) { | 
|---|
|  |  |  | activityType = "精良"; | 
|---|
|  |  |  | } else if (easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)) { | 
|---|
|  |  |  | activityType = "普通"; | 
|---|
|  |  |  | } else if (easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)) { | 
|---|
|  |  |  | activityType = "一般"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 发放奖励以后给用户推送消息 | 
|---|
|  |  |  | Map<String, String> map = comActActSignDAO.getUserOpenId(easyPhotoDO.getSponsorId()); | 
|---|
|  |  |  | if (map != null) { | 
|---|
|  |  |  | String openid = map.get("openid"); | 
|---|
|  |  |  | SysTemplateConfig sysTemplateConfig=sysTemplateConfigDao.selectOne(new QueryWrapper<SysTemplateConfig>().lambda().eq(SysTemplateConfig::getAreaCode, grantRewardDTO.getAreaCode()).eq(SysTemplateConfig::getType,7)); | 
|---|
|  |  |  | WxXCXTempSend util = new WxXCXTempSend(); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | WxUtil.sendSubscribeJLDZ(openid,util.getAppAccessToken(),easyPhotoDO.getDetail(),grantRewardDTO.getAmount(),"发放随手拍奖励"); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | WxUtil.sendSubscribeJLDZ(openid, util.getAccessToken(), "随手拍有奖活动", | 
|---|
|  |  |  | grantRewardDTO.getAmount(), activityType,sysTemplateConfig.getTemplateId()); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("消息推送失败,失败原因:" + e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取最新活动和用户最新收益 | 
|---|
|  |  |  | * @param userId    用户id | 
|---|
|  |  |  | * @param communityId   社区id | 
|---|
|  |  |  | * @return  最新活动和用户最新收益 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param userId | 
|---|
|  |  |  | *            用户id | 
|---|
|  |  |  | * @param communityId | 
|---|
|  |  |  | *            社区id | 
|---|
|  |  |  | * @return 最新活动和用户最新收益 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R getUserReward(Long userId,Long communityId){ | 
|---|
|  |  |  | //结果返回参数 | 
|---|
|  |  |  | public R getUserReward(Long userId, Long communityId) { | 
|---|
|  |  |  | // 结果返回参数 | 
|---|
|  |  |  | ComActEasyPhotoRewardVO easyPhotoRewardVO = new ComActEasyPhotoRewardVO(); | 
|---|
|  |  |  | //查询随手拍活动 | 
|---|
|  |  |  | // 查询随手拍活动 | 
|---|
|  |  |  | ComActEasyPhotoActivityVO photoActivityVO = new ComActEasyPhotoActivityVO(); | 
|---|
|  |  |  | Date nowDate = DateUtils.getCurrentDate(DateUtils.ymdhms_format); | 
|---|
|  |  |  | List<ComActEasyPhotoActivityDO> photoActivityDOS = comActEasyPhotoActivityMapper.selectList( | 
|---|
|  |  |  | new QueryWrapper<ComActEasyPhotoActivityDO>().lambda().eq(ComActEasyPhotoActivityDO::getCommunityId,communityId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getStatus,ComActEasyPhotoActivityDO.status.jxz) | 
|---|
|  |  |  | .le(ComActEasyPhotoActivityDO::getActivityStartAt,nowDate).ge(ComActEasyPhotoActivityDO::getActivityEndAt,nowDate)); | 
|---|
|  |  |  | if(!photoActivityDOS.isEmpty()){ | 
|---|
|  |  |  | List<ComActEasyPhotoActivityDO> photoActivityDOS = | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.selectList(new QueryWrapper<ComActEasyPhotoActivityDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getCommunityId, communityId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getStatus, ComActEasyPhotoActivityDO.status.jxz) | 
|---|
|  |  |  | .le(ComActEasyPhotoActivityDO::getActivityStartAt, nowDate) | 
|---|
|  |  |  | .ge(ComActEasyPhotoActivityDO::getActivityEndAt, nowDate)); | 
|---|
|  |  |  | if (!photoActivityDOS.isEmpty()) { | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = photoActivityDOS.get(0); | 
|---|
|  |  |  | BeanUtils.copyProperties(photoActivityDO,photoActivityVO); | 
|---|
|  |  |  | BeanUtils.copyProperties(photoActivityDO, photoActivityVO); | 
|---|
|  |  |  | easyPhotoRewardVO.setEasyPhotoActivityVO(photoActivityVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询用户未读奖励金额 | 
|---|
|  |  |  | BigDecimal amount = comActEasyPhotoRewardMapper.getUserReward(userId,communityId); | 
|---|
|  |  |  | if(amount != null){ | 
|---|
|  |  |  | easyPhotoRewardVO.setAmount(amount); | 
|---|
|  |  |  | if (userId != null && userId != 0L) { | 
|---|
|  |  |  | // 查询用户未读奖励金额 | 
|---|
|  |  |  | BigDecimal amount = comActEasyPhotoRewardMapper.getUserReward(userId, communityId); | 
|---|
|  |  |  | if (amount != null) { | 
|---|
|  |  |  | easyPhotoRewardVO.setAmount(amount); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查询当前社区正在进行中的弹窗调查问卷 | 
|---|
|  |  |  | ComActQuestnaireDO popupQuestnaireDO = comActQuestnaireDAO.selectOne(new QueryWrapper<ComActQuestnaireDO>() | 
|---|
|  |  |  | .lambda().le(ComActQuestnaireDO::getStartTime, nowDate).ge(ComActQuestnaireDO::getEndTime, nowDate) | 
|---|
|  |  |  | .eq(ComActQuestnaireDO::getCommunityId, communityId).eq(ComActQuestnaireDO::getState, 2) | 
|---|
|  |  |  | .eq(ComActQuestnaireDO::getAdverPositionPopup, ComActQuestnaireDO.isOk.yes)); | 
|---|
|  |  |  | if (popupQuestnaireDO != null) { | 
|---|
|  |  |  | ComActQuestnaireAppVO popupQuestnaireVO = new ComActQuestnaireAppVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(popupQuestnaireDO, popupQuestnaireVO); | 
|---|
|  |  |  | if (userId != null) { | 
|---|
|  |  |  | if (popupQuestnaireDO.getIsForce().equals(ComActQuestnaireDO.isOk.no)) { | 
|---|
|  |  |  | // 查询用户是否已点击不再提醒 | 
|---|
|  |  |  | Integer count = comActQuestnaireDAO.getNoRemindCount(userId, popupQuestnaireVO.getId()); | 
|---|
|  |  |  | if (count <= 0) { | 
|---|
|  |  |  | popupQuestnaireVO.setIsDisplay(ComActQuestnaireDO.isOk.yes); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | popupQuestnaireVO.setIsDisplay(ComActQuestnaireDO.isOk.yes); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | easyPhotoRewardVO.setPopupQuestnaireVO(popupQuestnaireVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查询社区正在进行中的banner位置调查问卷列表 | 
|---|
|  |  |  | List<ComActQuestnaireAppVO> bannerQuestnaireList = comActQuestnaireDAO.getIndexTopQuestnaireList(communityId); | 
|---|
|  |  |  | if (!bannerQuestnaireList.isEmpty()) { | 
|---|
|  |  |  | easyPhotoRewardVO.setBannerQuestnaireList(bannerQuestnaireList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询社区正在进行中的banner位置的社区活动 | 
|---|
|  |  |  | List<ComActActivityVO> comActActivityVOList = comActActivityDAO.getIndexTopActivityList(communityId); | 
|---|
|  |  |  | if (!comActActivityVOList.isEmpty()) { | 
|---|
|  |  |  | easyPhotoRewardVO.setBannerActivityList(comActActivityVOList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查询社区正在进行中的应用位置调查问卷列表 | 
|---|
|  |  |  | List<ComActQuestnaireAppVO> applicationQuestnaireList = | 
|---|
|  |  |  | comActQuestnaireDAO.getIndexApplicationQuestnaireList(communityId); | 
|---|
|  |  |  | if (!applicationQuestnaireList.isEmpty()) { | 
|---|
|  |  |  | easyPhotoRewardVO.setApplicationQuestnaireList(applicationQuestnaireList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询社区正在进行中的banner预约/登记列表 | 
|---|
|  |  |  | List<ComActReserveIndexVo> comActReserveIndexVos=comActReserveMapper.indexBanner(communityId); | 
|---|
|  |  |  | if(!comActReserveIndexVos.isEmpty()){ | 
|---|
|  |  |  | easyPhotoRewardVO.setComActReserveIndexBannerVos(comActReserveIndexVos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询社区正在进行中的应用预约/登记列表 | 
|---|
|  |  |  | List<ComActReserveIndexVo> comActReserveIndexApplicationVos=comActReserveMapper.indexApplication(communityId); | 
|---|
|  |  |  | if(!comActReserveIndexApplicationVos.isEmpty()){ | 
|---|
|  |  |  | comActReserveIndexApplicationVos.forEach(comActReserveIndexVo -> { | 
|---|
|  |  |  | Integer count=comActReserveRecordMapper.selectCount(new QueryWrapper<ComActReserveRecordDO>().lambda().eq(ComActReserveRecordDO::getReserveId,comActReserveIndexVo.getId()).eq(ComActReserveRecordDO::getUserId,userId)); | 
|---|
|  |  |  | if(count>0){ | 
|---|
|  |  |  | comActReserveIndexVo.setIsCommit(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else { | 
|---|
|  |  |  | comActReserveIndexVo.setIsCommit(2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | easyPhotoRewardVO.setComActReserveIndexApplicationVos(comActReserveIndexApplicationVos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询banner | 
|---|
|  |  |  | List<BannerVO> bannerVOS=this.comActEasyPhotoDAO.banner(communityId); | 
|---|
|  |  |  | if(!bannerVOS.isEmpty()){ | 
|---|
|  |  |  | easyPhotoRewardVO.setBannerVOS(bannerVOS); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(easyPhotoRewardVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取首页弹窗接口 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param userId | 
|---|
|  |  |  | *            用户id | 
|---|
|  |  |  | * @param communityId | 
|---|
|  |  |  | *            社区id | 
|---|
|  |  |  | * @return 首页弹窗接口 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R getUserRewards(Long userId, Long communityId) { | 
|---|
|  |  |  | // 结果返回参数 | 
|---|
|  |  |  | ComActEasyPhotoRewardVO easyPhotoRewardVO = new ComActEasyPhotoRewardVO(); | 
|---|
|  |  |  | // 查询随手拍活动 | 
|---|
|  |  |  | ComActEasyPhotoActivityVO photoActivityVO = new ComActEasyPhotoActivityVO(); | 
|---|
|  |  |  | Date nowDate = DateUtils.getCurrentDate(DateUtils.ymdhms_format); | 
|---|
|  |  |  | List<ComActEasyPhotoActivityDO> photoActivityDOS = | 
|---|
|  |  |  | comActEasyPhotoActivityMapper.selectList(new QueryWrapper<ComActEasyPhotoActivityDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getCommunityId, communityId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoActivityDO::getStatus, ComActEasyPhotoActivityDO.status.jxz) | 
|---|
|  |  |  | .le(ComActEasyPhotoActivityDO::getActivityStartAt, nowDate) | 
|---|
|  |  |  | .ge(ComActEasyPhotoActivityDO::getActivityEndAt, nowDate)); | 
|---|
|  |  |  | if (!photoActivityDOS.isEmpty()) { | 
|---|
|  |  |  | ComActEasyPhotoActivityDO photoActivityDO = photoActivityDOS.get(0); | 
|---|
|  |  |  | BeanUtils.copyProperties(photoActivityDO, photoActivityVO); | 
|---|
|  |  |  | easyPhotoRewardVO.setEasyPhotoActivityVO(photoActivityVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (userId != null && userId != 0L) { | 
|---|
|  |  |  | // 查询用户未读奖励金额 | 
|---|
|  |  |  | BigDecimal amount = comActEasyPhotoRewardMapper.getUserReward(userId, communityId); | 
|---|
|  |  |  | if (amount != null) { | 
|---|
|  |  |  | easyPhotoRewardVO.setAmount(amount); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 查询当前社区正在进行中的弹窗调查问卷 | 
|---|
|  |  |  | ComActQuestnaireDO popupQuestnaireDO = comActQuestnaireDAO.selectOne(new QueryWrapper<ComActQuestnaireDO>() | 
|---|
|  |  |  | .lambda().le(ComActQuestnaireDO::getStartTime, nowDate).ge(ComActQuestnaireDO::getEndTime, nowDate) | 
|---|
|  |  |  | .eq(ComActQuestnaireDO::getCommunityId, communityId).eq(ComActQuestnaireDO::getState, 2) | 
|---|
|  |  |  | .eq(ComActQuestnaireDO::getAdverPositionPopup, ComActQuestnaireDO.isOk.yes)); | 
|---|
|  |  |  | if (popupQuestnaireDO != null) { | 
|---|
|  |  |  | ComActQuestnaireAppVO popupQuestnaireVO = new ComActQuestnaireAppVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(popupQuestnaireDO, popupQuestnaireVO); | 
|---|
|  |  |  | if (userId != null) { | 
|---|
|  |  |  | if (popupQuestnaireDO.getIsForce().equals(ComActQuestnaireDO.isOk.no)) { | 
|---|
|  |  |  | // 查询用户是否已点击不再提醒 | 
|---|
|  |  |  | Integer count = comActQuestnaireDAO.getNoRemindCount(userId, popupQuestnaireVO.getId()); | 
|---|
|  |  |  | if (count <= 0) { | 
|---|
|  |  |  | popupQuestnaireVO.setIsDisplay(ComActQuestnaireDO.isOk.yes); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | popupQuestnaireVO.setIsDisplay(ComActQuestnaireDO.isOk.yes); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | easyPhotoRewardVO.setPopupQuestnaireVO(popupQuestnaireVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(easyPhotoRewardVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 读取用户随手拍奖励 | 
|---|
|  |  |  | * @param userId    用户id | 
|---|
|  |  |  | * @return  读取结果 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param userId | 
|---|
|  |  |  | *            用户id | 
|---|
|  |  |  | * @return 读取结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R readUserReward(Long userId,Long communityId){ | 
|---|
|  |  |  | ComActEasyPhotoRewardDO easyPhotoRewardDO = comActEasyPhotoRewardMapper.selectOne(new QueryWrapper<ComActEasyPhotoRewardDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoRewardDO::getUserId,userId).eq(ComActEasyPhotoRewardDO::getCommunityId,communityId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoRewardDO::getIsRead,ComActEasyPhotoRewardDO.isRead.no)); | 
|---|
|  |  |  | if(easyPhotoRewardDO != null){ | 
|---|
|  |  |  | public R readUserReward(Long userId, Long communityId) { | 
|---|
|  |  |  | ComActEasyPhotoRewardDO easyPhotoRewardDO = | 
|---|
|  |  |  | comActEasyPhotoRewardMapper.selectOne(new QueryWrapper<ComActEasyPhotoRewardDO>().lambda() | 
|---|
|  |  |  | .eq(ComActEasyPhotoRewardDO::getUserId, userId).eq(ComActEasyPhotoRewardDO::getCommunityId, communityId) | 
|---|
|  |  |  | .eq(ComActEasyPhotoRewardDO::getIsRead, ComActEasyPhotoRewardDO.isRead.no)); | 
|---|
|  |  |  | if (easyPhotoRewardDO != null) { | 
|---|
|  |  |  | easyPhotoRewardDO.setIsRead(ComActEasyPhotoRewardDO.isRead.yes); | 
|---|
|  |  |  | easyPhotoRewardDO.setUpdateAt(new Date()); | 
|---|
|  |  |  | comActEasyPhotoRewardMapper.updateById(easyPhotoRewardDO); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R easyPhotoCount(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | return R.ok(this.comActEasyPhotoDAO.easyPhotoCount(comActEasyPhotoVO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R updatePageeasyphoto(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | ComActEasyPhotoDO comActEasyPhotoDO = new ComActEasyPhotoDO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(comActEasyPhotoVO, comActEasyPhotoDO); | 
|---|
|  |  |  | int result = this.comActEasyPhotoDAO.updateById(comActEasyPhotoDO); | 
|---|
|  |  |  | if (result > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R export(ExportEasyPhotoDTO exportEasyPhotoDTO) { | 
|---|
|  |  |  | if (exportEasyPhotoDTO != null) { | 
|---|
|  |  |  | List<ExportEasyPhotoVO> list; | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(exportEasyPhotoDTO.getIds())) { | 
|---|
|  |  |  | list = this.comActEasyPhotoDAO.exportByIds(exportEasyPhotoDTO.getIds()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list = this.comActEasyPhotoDAO.export(exportEasyPhotoDTO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail("参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 社区后台-切换随手拍公示状态 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | *            请求参数 | 
|---|
|  |  |  | * @return 切换结果 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R easyPhotoSwitchPublicity(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | // 查询随手拍 | 
|---|
|  |  |  | ComActEasyPhotoDO easyPhotoDO = this.baseMapper.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if (easyPhotoDO == null) { | 
|---|
|  |  |  | return R.fail("未查询到随手拍记录"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | easyPhotoDO.setIsPublicity(comActEasyPhotoVO.getIsPublicity()); | 
|---|
|  |  |  | if (this.baseMapper.updateById(easyPhotoDO) > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询社区待处理随手拍id集合 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param communityId | 
|---|
|  |  |  | *            社区id | 
|---|
|  |  |  | * @return 社区待处理随手拍id集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R easyPhotoNoHandleList(Long communityId) { | 
|---|
|  |  |  | return R.ok(this.baseMapper.easyPhotoNoHandleIds(communityId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取人大代表反馈记录 | 
|---|
|  |  |  | * @param id 随手拍id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R getFeedbackList(Long id) { | 
|---|
|  |  |  | return R.ok(comActEasyPhotoFeedbackMapper.getPhotoFeedbackListForDpc(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 人大代表反馈随手拍 | 
|---|
|  |  |  | * @param comActEasyPhotoVO | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R addEasyPhotoFeedbackForDpc(ComActEasyPhotoVO comActEasyPhotoVO) { | 
|---|
|  |  |  | Date nowDate = new Date(); | 
|---|
|  |  |  | // 操作类型 1审核通过 2驳回 3反馈 4完成随手拍 | 
|---|
|  |  |  | ComActEasyPhotoDO cmActEasyPhotoDO = this.comActEasyPhotoDAO.selectById(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | if (cmActEasyPhotoDO == null) { | 
|---|
|  |  |  | return R.fail("未查询到随手拍记录"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dfk)) { | 
|---|
|  |  |  | return R.fail("该随手拍不是进行中状态,不可进行反馈"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 给随手拍新增反馈信息 | 
|---|
|  |  |  | ComActEasyPhotoFeedbackDO photoFeedbackDO = new ComActEasyPhotoFeedbackDO(); | 
|---|
|  |  |  | photoFeedbackDO.setEasyId(comActEasyPhotoVO.getId()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackContent(comActEasyPhotoVO.getHandleResult()); | 
|---|
|  |  |  | photoFeedbackDO.setFeedbackImg(comActEasyPhotoVO.getHandlePhotoList()); | 
|---|
|  |  |  | photoFeedbackDO.setType(2); | 
|---|
|  |  |  | photoFeedbackDO.setCreateAt(nowDate); | 
|---|
|  |  |  | photoFeedbackDO.setCreateBy(comActEasyPhotoVO.getUserId()); | 
|---|
|  |  |  | int result = comActEasyPhotoFeedbackMapper.insert(photoFeedbackDO); | 
|---|
|  |  |  | if (result > 0) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.fail(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|