From b2fce0dc7dc4ea5dec9792a2bc3ceb9d33d6e07b Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期一, 04 九月 2023 13:59:52 +0800 Subject: [PATCH] 修改后台社区动态加载不出来 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java | 228 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 187 insertions(+), 41 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java index 0277595..5d8bfc6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java @@ -1,22 +1,10 @@ package com.panzhihua.service_community.service.impl; -import java.util.*; - -import javax.annotation.Resource; - import cn.hutool.core.collection.ListUtil; -import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.PageUtil; -import com.panzhihua.common.model.vos.LoginUserInfoVO; -import com.panzhihua.common.model.vos.PageVO; -import com.panzhihua.common.service.user.UserService; -import com.panzhihua.service_community.entity.ComPbCheckUnit; -import com.panzhihua.service_community.service.ComActNeighborCircleTopicService; -import org.apache.commons.lang3.ObjectUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.util.PageUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -24,18 +12,32 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.constants.NeighborCircleConstants; import com.panzhihua.common.model.dtos.neighbor.*; +import com.panzhihua.common.model.vos.PageVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.neighbor.*; import com.panzhihua.common.model.vos.user.AdministratorsUserVO; -import com.panzhihua.common.utlis.DateUtils; -import com.panzhihua.common.utlis.StringUtils; +import com.panzhihua.common.service.user.UserService; +import com.panzhihua.common.utlis.*; import com.panzhihua.service_community.dao.*; +import com.panzhihua.service_community.entity.ComPbCheckUnit; +import com.panzhihua.service_community.entity.SysUser; import com.panzhihua.service_community.model.dos.*; import com.panzhihua.service_community.service.ComActNeighborCircleBrowseService; import com.panzhihua.service_community.service.ComActNeighborCircleService; - +import com.panzhihua.service_community.service.ComActNeighborCircleTopicService; import lombok.extern.slf4j.Slf4j; -import org.springframework.util.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.panzhihua.common.utlis.PayUtil.makeUUID; /** * @auther lyq @@ -81,6 +83,8 @@ private ComActActivityDAO comActActivityDAO; @Resource private ComPbCheckUnitDao comPbCheckUnitDao; + @Resource + private SysUserDao sysUserDao; /** * 分页查询邻里圈列表 * @@ -102,6 +106,15 @@ // } // } // } + Long communityId = neighborCircleAppDTO.getCommunityId(); + if(null != communityId){ + List<Long> communityIds = comActDAO.selectIds(communityId); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + neighborCircleAppDTO.setCommunityIds(communityIds); + } Page userPage = new Page(neighborCircleAppDTO.getPageNum(), neighborCircleAppDTO.getPageSize()); IPage<ComActNeighborCircleAppVO> doPager = this.baseMapper.pageNeighborByApp(userPage, neighborCircleAppDTO); if (!doPager.getRecords().isEmpty()) { @@ -192,6 +205,7 @@ if (StringUtils.isNotEmpty(addNeighborCircleAppDTO.getPhone())) { neighborCircleDO.setReleasePhone(addNeighborCircleAppDTO.getPhone()); } + //判断当前邻里圈是否需要审核 if(addNeighborCircleAppDTO.getIsExamine().equals(AddComActNeighborCircleAppDTO.isExamine.no)){ //当邻里圈不需要审核才进入自动审核 @@ -242,7 +256,7 @@ if(circleDetailAppVO.getOrderType()!=null){ if(circleDetailAppVO.getOrderType()==2){ AdministratorsUserVO user1 = this.baseMapper.selectUserByUserId(circleDetailAppVO.getSolveId()); - circleDetailAppVO.setSolveName(user1.getName()); + circleDetailAppVO.setSolveName(SensitiveUtil.replaceName(user1.getName())); } if(circleDetailAppVO.getOrderType()==1){ ComPbCheckUnit comPbCheckUnit=comPbCheckUnitDao.selectById(circleDetailAppVO.getSolveUnitId()); @@ -267,7 +281,12 @@ circleDetailAppVO.setHaveSign(2); } } - + ComActActivityDO comActActivityDO=comActActivityDAO.selectOne(new QueryWrapper<ComActActivityDO>().lambda().eq(ComActActivityDO::getRelationId,neighborCircleAppDTO.getCircleId())); + if(comActActivityDO!=null){ + circleDetailAppVO.setActivityDate(comActActivityDO.getCreateAt()); + circleDetailAppVO.setActivityId(comActActivityDO.getId()); + circleDetailAppVO.setActivityName(comActActivityDO.getActivityName()); + } // 查询邻里圈下评论列表 IPage<ComActNeighborCircleCommentAppVO> circleCommentAppPage = comActNeighborCircleCommentDAO.pageNeighborCommentByApp( @@ -330,6 +349,15 @@ @Override public R pageNeighborByAdmin(ComActNeighborCircleAdminDTO neighborCircleAdminDTO) { + Long communityId = neighborCircleAdminDTO.getCommunityId(); + if(null != communityId){ + List<Long> communityIds = comActDAO.selectIds(communityId); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + neighborCircleAdminDTO.setCommunityIds(communityIds); + } Page page = new Page(neighborCircleAdminDTO.getPageNum(), neighborCircleAdminDTO.getPageSize()); IPage<ComActNeighborCircleAdminVO> doPager = this.baseMapper.pageNeighborByAdmin(page, neighborCircleAdminDTO); doPager.getRecords().forEach(data -> { @@ -339,6 +367,12 @@ } } }); + return R.ok(doPager); + } + @Override + public R pageNeighborByBigScreen(ComActNeighborCircleAdminDTO neighborCircleAdminDTO) { + Page page = new Page(neighborCircleAdminDTO.getPageNum(), neighborCircleAdminDTO.getPageSize()); + IPage<ComActNeighborCircleAdminVO> doPager = this.baseMapper.pageNeighborByBigScreen(page, neighborCircleAdminDTO); return R.ok(doPager); } @@ -583,6 +617,20 @@ } if (comActNeighborCircleCommentDAO.insert(circleCommentDO) > 0) { + SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId,neighborCircleDO.getSolveId())); + if(sysUser!=null) { + try { + WxXCXTempSend util = new WxXCXTempSend(); + if (neighborCircleDO.getBelongType()==2){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你有一条新的评价信息",neighborCircleDO.getReleaseContent().length()>10?neighborCircleDO.getReleaseContent().substring(0,10)+"..":neighborCircleDO.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+neighborCircleDO.getId()+"&type=888"); + } + if (neighborCircleDO.getBelongType()==3){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你有一条新的评价信息",neighborCircleDO.getReleaseContent().length()>10?neighborCircleDO.getReleaseContent().substring(0,10)+"..":neighborCircleDO.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+neighborCircleDO.getId()+"&type=777"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } return R.ok(); } else { return R.fail("评论失败"); @@ -717,8 +765,7 @@ @Override public R detailNeighborByAdmin(Long id) { - ComActNeighborCircleDetailAppVO comActNeighborCircleDO = - this.baseMapper.neighborDetailByApp(id); + ComActNeighborCircleDetailAppVO comActNeighborCircleDO = baseMapper.neighborDetailByApp(id); if (comActNeighborCircleDO == null) { return R.fail("id有误"); } @@ -746,7 +793,11 @@ if (comActNeighborCircleDO.getTopicId() != null) { ComActNeighborCircleTopicDO circleTopicDO = comActNeighborCircleTopicMapper.selectById(comActNeighborCircleDO.getTopicId()); - vo.setTopicName(circleTopicDO.getName()); + if(circleTopicDO!=null && !StringUtils.isEmpty(circleTopicDO.getName())) + { + vo.setTopicName(circleTopicDO.getName()); + } + } return R.ok(vo); } @@ -1006,7 +1057,7 @@ public R orderAndSolve(EditNeighborCircleAdminVO editNeighborCircleAdminVO) { ComActNeighborCircleDO comActNeighborCircleDO=new ComActNeighborCircleDO(); BeanUtils.copyProperties(editNeighborCircleAdminVO,comActNeighborCircleDO); - if(comActNeighborCircleDO.getSolveStatus()!=null){ + if(comActNeighborCircleDO.getSolveStatus()!=null && comActNeighborCircleDO.getSolveStatus() == 3){ comActNeighborCircleDO.setSolveTime(new Date()); } if(comActNeighborCircleDO.getOrderStatus()!=null){ @@ -1015,27 +1066,80 @@ if(StringUtils.isNotEmpty(comActNeighborCircleDO.getComment())){ comActNeighborCircleDO.setCommentTime(new Date()); } - return R.ok(this.baseMapper.updateById(comActNeighborCircleDO)); + int result=this.baseMapper.updateById(comActNeighborCircleDO); + if(result>0){ + ComActNeighborCircleDO comActNeighborCircleDO1=this.baseMapper.selectById(comActNeighborCircleDO.getId()); + if(comActNeighborCircleDO.getOrderStatus()!=null){ + SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId,comActNeighborCircleDO1.getReleaseId())); + if(sysUser!=null) { + try { + WxXCXTempSend util = new WxXCXTempSend(); + if (comActNeighborCircleDO1.getBelongType()==2){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你反馈的问题已被人认领",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=888"); + } + if (comActNeighborCircleDO1.getBelongType()==3){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你反馈的需求已被人认领",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=777"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + if(comActNeighborCircleDO.getSolveStatus()==3){ + SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId,comActNeighborCircleDO1.getReleaseId())); + if(sysUser!=null) { + try { + WxXCXTempSend util = new WxXCXTempSend(); + if (comActNeighborCircleDO1.getBelongType()==2){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你反馈的问题已被人处理",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=888"); + } + if (comActNeighborCircleDO1.getBelongType()==3){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你反馈的需求已被人处理",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=777"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + if(comActNeighborCircleDO.getSolveStatus()==4){ + SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId,comActNeighborCircleDO1.getSolveId())); + if(sysUser!=null) { + try { + WxXCXTempSend util = new WxXCXTempSend(); + if (comActNeighborCircleDO1.getBelongType()==2){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你有一条新的评价信息",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=888"); + } + if (comActNeighborCircleDO1.getBelongType()==3){ + WxUtil.sendLongTimeTemplate(sysUser.getOpenid(),util.getAccessToken(),"你有一条新的评价信息",comActNeighborCircleDO1.getReleaseContent().length()>10?comActNeighborCircleDO1.getReleaseContent().substring(0,10)+"..":comActNeighborCircleDO1.getReleaseContent(),"packageB/pages/partySecond/problemDetails/index?id="+comActNeighborCircleDO.getId()+"&type=777"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + return R.ok(result); + } + return R.fail(); } @Override public R serviceStatic(ServiceStaticDTO serviceStaticDTO) { - ServiceStaticsVO serviceStaticsVO=new ServiceStaticsVO(); - if(serviceStaticDTO.getCheckUnitId()!=null){ - serviceStaticsVO=this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear()); - serviceStaticsVO=this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear()); - serviceStaticsVO.setServiceProjecList(this.baseMapper.selectListByCheckUnitId(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear())); - serviceStaticsVO.setServiceActivityList(comActActivityDAO.selectListByRelationId(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear())); - } - else { - serviceStaticsVO=this.baseMapper.selectStatsUser(serviceStaticDTO.getPhone(),serviceStaticDTO.getYear()); - serviceStaticsVO.setServiceProjecList(this.baseMapper.selectListByPhone(serviceStaticDTO.getPhone(),serviceStaticDTO.getYear())); - ComPbMemberDO comPbMemberDO=comPbMemberDAO.selectOne(new QueryWrapper<ComPbMemberDO>().lambda().eq(ComPbMemberDO::getPhone,serviceStaticDTO.getPhone()).last("limit 1")); - if(comPbMemberDO!=null){ - serviceStaticsVO.setWorkActivityList(comActActivityDAO.selectListByRelationId(comPbMemberDO.getCheckUnitId(),serviceStaticDTO.getYear())); - serviceStaticsVO.setServiceActivityList(comActActivityDAO.selectListByCommunityId(comPbMemberDO.getCommunityId(),serviceStaticDTO.getYear(),serviceStaticDTO.getPhone())); + ServiceStaticsVO serviceStaticsVO = new ServiceStaticsVO(); + if (serviceStaticDTO.getCheckUnitId() != null) { + serviceStaticsVO = + this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(), serviceStaticDTO.getYear()); + serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailList(serviceStaticDTO.getCheckUnitId(), + serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType())); + } else { + serviceStaticsVO = this.baseMapper.selectStatsUser(serviceStaticDTO.getPhone(), serviceStaticDTO.getYear()); + ComPbMemberDO comPbMemberDO = comPbMemberDAO.selectOne(new QueryWrapper<ComPbMemberDO>().lambda() + .eq(ComPbMemberDO::getPhone, serviceStaticDTO.getPhone()).last("limit 1")); + Long checkUnitId = null; + if (comPbMemberDO != null) { + checkUnitId = comPbMemberDO.getCheckUnitId(); } - + serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailListForPersonal(checkUnitId, serviceStaticDTO.getPhone(), + serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType())); } return R.ok(serviceStaticsVO); } @@ -1190,6 +1294,48 @@ return null; } + @Override + public R selectCount(Integer type, String phone,Long communityId) { + return R.ok(this.baseMapper.selectCount(type,phone,communityId)); + } + + /** + * 分页查询可关联清单列表 + * @param neighborCircleAppDTO + * @return + */ + @Override + public R pageRelationList(ComActNeighborCircleAppDTO neighborCircleAppDTO) { + Page userPage = new Page(neighborCircleAppDTO.getPageNum(), neighborCircleAppDTO.getPageSize()); + IPage<ComActNeighborCircleAppVO> doPager = this.baseMapper.pageRelationList(userPage, neighborCircleAppDTO); + if (!doPager.getRecords().isEmpty()) { + for (ComActNeighborCircleAppVO circleAppVO : doPager.getRecords()) { + if (neighborCircleAppDTO.getUserId() != null) { + // 查询点赞信息 + ComActNeighborCircleFabulousDO circleFabulousDO = + comActNeighborCircleFabulousDAO.selectOne(new QueryWrapper<ComActNeighborCircleFabulousDO>() + .lambda().eq(ComActNeighborCircleFabulousDO::getParentId, circleAppVO.getId()) + .eq(ComActNeighborCircleFabulousDO::getUserId, neighborCircleAppDTO.getUserId()) + .eq(ComActNeighborCircleFabulousDO::getType, ComActNeighborCircleFabulousDO.type.llq) + .eq(ComActNeighborCircleFabulousDO::getIsEffective, + ComActNeighborCircleFabulousDO.isEffective.yes)); + if (circleFabulousDO != null) { + circleAppVO.setHaveSign(1); + } else { + circleAppVO.setHaveSign(2); + } + } + if (circleAppVO.getType() != null && circleAppVO.getType().equals(ComActNeighborCircleDO.type.admin)) { + ComActDO actDO = comActDAO.selectById(circleAppVO.getCommunityId()); + if (actDO != null) { + circleAppVO.setName(actDO.getName()); + } + } + } + } + return R.ok(doPager); + } + /** * 判断活动统计列表中是否已有该单位的数据 * */ -- Gitblit v1.7.1