| | |
| | | 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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | 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.util.*; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | private ComActActivityDAO comActActivityDAO; |
| | | @Resource |
| | | private ComPbCheckUnitDao comPbCheckUnitDao; |
| | | @Resource |
| | | private SysUserDao sysUserDao; |
| | | /** |
| | | * 分页查询邻里圈列表 |
| | | * |
| | |
| | | if (StringUtils.isNotEmpty(addNeighborCircleAppDTO.getPhone())) { |
| | | neighborCircleDO.setReleasePhone(addNeighborCircleAppDTO.getPhone()); |
| | | } |
| | | |
| | | //判断当前邻里圈是否需要审核 |
| | | if(addNeighborCircleAppDTO.getIsExamine().equals(AddComActNeighborCircleAppDTO.isExamine.no)){ |
| | | //当邻里圈不需要审核才进入自动审核 |
| | |
| | | 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()); |
| | |
| | | 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( |
| | |
| | | } |
| | | |
| | | 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("评论失败"); |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 判断活动统计列表中是否已有该单位的数据 |
| | | * */ |