| | |
| | | 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 com.panzhihua.service_community.service.ComActNeighborCircleService; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | @Resource |
| | | private ComPbMemberDAO comPbMemberDAO; |
| | | @Resource |
| | | private ComActNeighborCircleDAO comActNeighborCircleDAO; |
| | | @Resource |
| | | private ComActActivityDAO comActActivityDAO; |
| | | @Resource ComActNeighborCircleDAO comActNeighborCircleDAO; |
| | | |
| | | @Resource |
| | | private ComPbCheckUnitDao comPbCheckUnitDao; |
| | | /** |
| | | * 分页查询邻里圈列表 |
| | | * |
| | |
| | | ComActDO actDO = comActDAO.selectById(circleDetailAppVO.getCommunityId()); |
| | | if (actDO != null) { |
| | | circleDetailAppVO.setName(actDO.getName()); |
| | | } |
| | | } |
| | | if(circleDetailAppVO.getOrderType()!=null){ |
| | | if(circleDetailAppVO.getOrderType()==2){ |
| | | AdministratorsUserVO user1 = this.baseMapper.selectUserByUserId(circleDetailAppVO.getSolveId()); |
| | | circleDetailAppVO.setSolveName(user1.getName()); |
| | | } |
| | | if(circleDetailAppVO.getOrderType()==1){ |
| | | ComPbCheckUnit comPbCheckUnit=comPbCheckUnitDao.selectById(circleDetailAppVO.getSolveUnitId()); |
| | | if(comPbCheckUnit!=null){ |
| | | circleDetailAppVO.setSolveName(comPbCheckUnit.getName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return R.fail(); |
| | | } |
| | | if (comActNeighborCircleDO.getStatus() == 1) { |
| | | return R.fail("待审核的邻里圈不能删除"); |
| | | return R.fail("待审核的数据不能删除"); |
| | | } |
| | | // 邻里圈删除 |
| | | this.baseMapper.deleteById(id); |
| | |
| | | AdministratorsUserVO user = this.baseMapper.selectUserByUserId(comActNeighborCircleDO.getReleaseId()); |
| | | DetailNeighborCircleAdminVO vo = new DetailNeighborCircleAdminVO(); |
| | | BeanUtils.copyProperties(comActNeighborCircleDO, vo); |
| | | vo.setReleaseName(user.getName()); |
| | | vo.setImageUrl(user.getImageUrl()); |
| | | if(user!=null){ |
| | | vo.setReleaseName(user.getName()); |
| | | vo.setImageUrl(user.getImageUrl()); |
| | | } |
| | | if(comActNeighborCircleDO.getOrderType()!=null){ |
| | | if(comActNeighborCircleDO.getOrderType()==2){ |
| | | AdministratorsUserVO user1 = this.baseMapper.selectUserByUserId(comActNeighborCircleDO.getSolveId()); |
| | | vo.setSolveName(user1.getName()); |
| | | } |
| | | if(comActNeighborCircleDO.getOrderType()==1){ |
| | | ComPbCheckUnit comPbCheckUnit=comPbCheckUnitDao.selectById(comActNeighborCircleDO.getSolveUnitId()); |
| | | if(comPbCheckUnit!=null){ |
| | | vo.setSolveName(comPbCheckUnit.getName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 查询话题名称 |
| | | if (comActNeighborCircleDO.getTopicId() != null) { |
| | |
| | | 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())); |
| | | serviceStaticsVO.setServiceActivityList(comActActivityDAO.selectListByCommunityId(comPbMemberDO.getCommunityId(),serviceStaticDTO.getYear(),serviceStaticDTO.getPhone())); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range, Long communityId,Integer page,Integer size,String belongTo) { |
| | | public R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range, Long communityId,Integer page,Integer size,String belongTo,Long unitId) { |
| | | ActivityAnalysisVO activityVO=new ActivityAnalysisVO(); |
| | | String beginTime=null; |
| | | String endTime=null; |
| | |
| | | activityVO.setPartyMemberCount(comActDAO.selectUnitCount()); |
| | | activityVO.setUnitCount(comActDAO.selectMemberCount()); |
| | | //获取单位活动统计数据(邻里圈) |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS = comActNeighborCircleDAO.institutionalUnitServiceAnalysis(beginTime, endTime, belongTo); |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS = comActNeighborCircleDAO.institutionalUnitServiceAnalysis(beginTime, endTime, belongTo,communityId); |
| | | //获取单位活动统计数据(活动) |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS1 = comActNeighborCircleDAO.institutionalUnitActivityAnalysis(beginTime, endTime, belongTo); |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS1 = comActNeighborCircleDAO.institutionalUnitActivityAnalysis(beginTime, endTime, belongTo,communityId); |
| | | if (unitActivityAnalysisVOS.size()>0){ |
| | | for (UnitActivityAnalysisVO unitActivityAnalysisVO : unitActivityAnalysisVOS){ |
| | | if (ObjectUtils.isNotEmpty(unitActivityAnalysisVO)){ |
| | |
| | | } |
| | | } |
| | | //获取党员活动统计数据 |
| | | List<PartyMemberAnalysisVO> partyMemberAnalysisVOS = comActNeighborCircleDAO.institutionalPartyMemberServiceAnalysis(beginTime, endTime, belongTo); |
| | | List<PartyMemberAnalysisVO> partyMemberAnalysisVOS = comActNeighborCircleDAO.institutionalPartyMemberServiceAnalysis(beginTime, endTime, belongTo,communityId,unitId); |
| | | List<PartyMemberAnalysisVO> partyMemberAnalysisVOS1 = comActNeighborCircleDAO.institutionalPartyMemberActAnalysis(beginTime, endTime, belongTo,communityId,unitId); |
| | | if (partyMemberAnalysisVOS1.size()>0){ |
| | | for (PartyMemberAnalysisVO vo : partyMemberAnalysisVOS1) { |
| | | if (ObjectUtils.isNotEmpty(vo)){ |
| | | if (ObjectUtils.isNotEmpty(vo.getMemberId())){ |
| | | Map<String, Integer> param = memberAlreadyAnalysis(vo.getMemberId(), partyMemberAnalysisVOS); |
| | | if (param.get("flag")==1){ |
| | | Integer serviceTime = vo.getServiceTime(); |
| | | Integer serviceTimes = vo.getServiceTimes(); |
| | | partyMemberAnalysisVOS.get(param.get("index")).setServiceTime(partyMemberAnalysisVOS.get(param.get("index")).getServiceTime()+serviceTime); |
| | | partyMemberAnalysisVOS.get(param.get("index")).setServiceTimes(partyMemberAnalysisVOS.get(param.get("index")).getServiceTimes()+serviceTimes); |
| | | }else{ |
| | | partyMemberAnalysisVOS.add(vo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //统计总时长和总次数 |
| | | Integer unitServiceCount=0; |
| | | Integer unitServiceTotalTime=0; |
| | | Integer memberServiceCount=0; |
| | | Integer memberServiceTotalTome=0; |
| | | for (UnitActivityAnalysisVO vo : unitActivityAnalysisVOS) { |
| | | unitServiceCount+=vo.getServiceTime(); |
| | | unitServiceTotalTime+=vo.getServiceTimes(); |
| | | //避免空指针 |
| | | if (ObjectUtils.isNotEmpty(vo)){ |
| | | if (ObjectUtils.isNotEmpty(vo.getServiceTime())){ |
| | | unitServiceCount+=vo.getServiceTime(); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(vo.getServiceTimes())){ |
| | | unitServiceTotalTime+=vo.getServiceTimes(); |
| | | } |
| | | } |
| | | } |
| | | for (PartyMemberAnalysisVO vo : partyMemberAnalysisVOS) { |
| | | memberServiceCount+=vo.getServiceTime(); |
| | | memberServiceTotalTome+=vo.getServiceTimes(); |
| | | //避免空指针 |
| | | if (ObjectUtils.isNotEmpty(vo)){ |
| | | if (ObjectUtils.isNotEmpty(vo.getServiceTime())){ |
| | | memberServiceCount+=vo.getServiceTime(); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(vo.getServiceTimes())){ |
| | | memberServiceTotalTome+=vo.getServiceTimes(); |
| | | } |
| | | } |
| | | } |
| | | activityVO.setUnitServiceTotalCount(unitServiceCount); |
| | | activityVO.setUnitServiceTotalTime(unitServiceTotalTime); |
| | | activityVO.setPartyMemberServiceTotalCount(memberServiceCount); |
| | | activityVO.setPartyMemberServiceTotalTime(memberServiceTotalTome); |
| | | //处理排序 |
| | | if (null != type){ |
| | | if (type.equals(1)){ |
| | | //按时长排序 |
| | | ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTime"); |
| | | ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTime"); |
| | | }else if (type.equals(2)){ |
| | | //按次数排序 |
| | | ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTimes"); |
| | | ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTimes"); |
| | | } |
| | | } |
| | | // if (null != type){ |
| | | // if (type.equals(1)){ |
| | | // //按时长排序 |
| | | // ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTime"); |
| | | // ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTime"); |
| | | // }else if (type.equals(2)){ |
| | | // //按次数排序 |
| | | // ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTimes"); |
| | | // ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTimes"); |
| | | // } |
| | | // } |
| | | //处理分页 |
| | | PageVO<List<UnitActivityAnalysisVO>> unitPage=new PageVO<>(); |
| | | PageVO<List<PartyMemberAnalysisVO>> memberPage=new PageVO<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断党员的统计是是否已存在 |
| | | * */ |
| | | public Map<String,Integer> memberAlreadyAnalysis(Long memberId,List<PartyMemberAnalysisVO> list){ |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | if (memberId != null && list.size() > 0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | PartyMemberAnalysisVO vo = list.get(i); |
| | | if (ObjectUtils.isNotEmpty(vo)){ |
| | | if (ObjectUtils.isNotEmpty(vo.getMemberId())){ |
| | | if (memberId.equals(vo.getMemberId())){ |
| | | map.put("index",i ); |
| | | map.put("flag",1 ); |
| | | return map; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map.put("flag",0 ); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | |