From 1a054c486c9037b7cb0bca5c4472c628d1d1c36c Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期一, 28 六月 2021 16:54:06 +0800 Subject: [PATCH] 解决代码被合并后删除问题 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java index fc552b0..f325c99 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java @@ -7,20 +7,15 @@ import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentDTO; import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; -import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO; -import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO; import com.panzhihua.common.model.vos.R; 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.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.common.utlis.DateUtils; +import com.panzhihua.common.utlis.SensitiveUtil; +import com.panzhihua.common.utlis.StringUtils; +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; /** * 分页查询随手拍 * @@ -78,6 +75,7 @@ }else { comActEasyPhotoVO1.setHaveGiveThumbsUp(1); } + comActEasyPhotoVO1.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO1.getPhone())); }); iPage.setRecords(records); } @@ -94,7 +92,8 @@ @Override public R detailEasyPhoto(Long id, Long userId) { ComActEasyPhotoVO comActEasyPhotoVO=comActEasyPhotoDAO.detailEasyPhoto(id); - if (ObjectUtils.isEmpty(comActEasyPhotoVO)||null==comActEasyPhotoVO.getStatus()) { + Integer status = comActEasyPhotoVO.getStatus(); + 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)); @@ -103,7 +102,17 @@ } else { comActEasyPhotoVO.setHaveGiveThumbsUp(1); } - List<ComActEasyPhotoCommentVO> comActEasyPhotoCommentVOList=new ArrayList<>(); + + if (status.intValue()==4) { + Date feedbackAt = comActEasyPhotoVO.getFeedbackAt(); + if (null==feedbackAt) { + comActEasyPhotoVO.setFeedbackAt(comActEasyPhotoVO.getExamineAt()); + } + } + comActEasyPhotoVO.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO.getPhone())); + if(comActEasyPhotoVO.getAddrRemark()==null){ + comActEasyPhotoVO.setAddrRemark(""); + } return R.ok(comActEasyPhotoVO); } @@ -117,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(); @@ -245,8 +263,9 @@ Long id = comActEasyPhotoVO1.getId(); Integer status = comActEasyPhotoVO1.getStatus(); Date feedbackAt = comActEasyPhotoVO1.getFeedbackAt(); - ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); - if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { + 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); @@ -280,6 +299,13 @@ 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())){ + commentVO.setName(commentVO.getNickName()); + } + } + } return R.ok(iPage); } -- Gitblit v1.7.1