| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenResidentActStatisticsInfo; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerActStatisticsInfo; |
| | | import com.panzhihua.service_community.dao.ComActActivityDAO; |
| | | import com.panzhihua.service_community.dao.ComActCommitteeDao; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.PageBaseDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.common.model.vos.community.ComActQuestnaireVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCommunityStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenDynStatisticsInfo; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenEasyPhotoStatisticsInfo; |
| | |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenNeighborStatisticsInfo; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenQuestionnaireStatisticsInfo; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO; |
| | | import com.panzhihua.service_community.dao.ComActDynDAO; |
| | | import com.panzhihua.service_community.dao.ComActQuestnaireDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ConvenientMerchantDAO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO; |
| | | import com.panzhihua.service_community.dao.ComActDiscussDAO; |
| | | import com.panzhihua.service_community.dao.ComActDynDAO; |
| | | import com.panzhihua.service_community.dao.ComActEasyPhotoDAO; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishDAO; |
| | | import com.panzhihua.service_community.dao.ComActNeighborCircleDAO; |
| | | import com.panzhihua.service_community.dao.ComActQuestnaireDAO; |
| | | import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ComPropertyDao; |
| | | import com.panzhihua.service_community.dao.ConvenientMerchantDAO; |
| | | import com.panzhihua.service_community.service.BigScreenStatisticsService; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Resource |
| | | private ComActDynDAO comActDynDAO; |
| | | |
| | | @Resource |
| | | private ComActActivityDAO comActActivityDAO; |
| | | |
| | | @Resource |
| | | private ComActCommitteeDao comActCommitteeDao; |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | | * @param communityId |
| | |
| | | List<StatisticsCommVO> microWishRealizePercent = comActMicroWishDAO.selectRealizePercent(communityId); |
| | | statisticsVO.setMicroWishRealizePercent(microWishRealizePercent); |
| | | //微心愿图片 |
| | | List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, pageSize); |
| | | List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, 20); |
| | | statisticsVO.setMicroWishImages(microWishImages); |
| | | |
| | | //议事投票类型占比 |
| | |
| | | statisticsVO.setVoteTitles(voteTitles); |
| | | |
| | | //邻里圈图片 |
| | | List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, pageSize); |
| | | List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, 20); |
| | | statisticsVO.setNeighborImages(neighborImages); |
| | | //邻里圈文本内容 |
| | | List<String> neighborContents = comActNeighborCircleDAO.getContents(communityId, pageSize); |
| | |
| | | List<String> warehouseLoveTransfer = comActWarehouseDonatesDao.getWarehouseLoveTransfer(communityId, pageSize); |
| | | statisticsVO.setWarehouseLoveTransfer(warehouseLoveTransfer); |
| | | //捐赠图片 |
| | | List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, pageSize); |
| | | List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, 20); |
| | | statisticsVO.setWarehouseImages(warehouseImages); |
| | | |
| | | //居民活动柱状统计 |
| | | List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true); |
| | | //居民活动新增数据 |
| | | List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true); |
| | | for (int i = 1; i <= currentMon; i++) { |
| | | String temp; |
| | | if (i > 9) { |
| | | temp = "" + i; |
| | | } else { |
| | | temp = "0" + i; |
| | | } |
| | | boolean isExist = actAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | actAddPolylineData.add(other); |
| | | } |
| | | } |
| | | actAddPolylineData = actAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | //居民活动发布总数 |
| | | int residentActTotalCount = 0; |
| | | if (!residentActHistogram.isEmpty()) { |
| | | residentActTotalCount = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum(); |
| | | } |
| | | statisticsVO.setResidentActTotalCount(residentActTotalCount); |
| | | // statisticsVO.setResidentActHistogram(residentActHistogram); |
| | | statisticsVO.setResidentActHistogram(actAddPolylineData); |
| | | //业主委员会党员占比 |
| | | List<StatisticsCommVO> committeePartyPercent = comActCommitteeDao.selectCommitteePartyPercent(communityId); |
| | | statisticsVO.setCommitteePartyPercent(committeePartyPercent); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | |
| | | microWishTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setMicroWishTotalPolylineData(microWishTotalPolylineData); |
| | | //微心愿展示列表 |
| | | List<ComActMicroWishVO> microWishDisplayList = comActMicroWishDAO.selectScreenDisplayList(communityId, pageSize); |
| | | statisticsInfo.setMicroWishDisplayList(microWishDisplayList); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 首页二级页面-随手拍展示列表 |
| | | * @param communityId |
| | | * @param classifyId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexEasyPhotoList(Long communityId, Long classifyId) { |
| | | List<ComActEasyPhotoVO> easyPhotoVOList = comActEasyPhotoDAO.indexEasyPhotoList(communityId, classifyId, pageSize); |
| | | return R.ok(easyPhotoVOList); |
| | | public R indexEasyPhotoList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActEasyPhotoDAO.indexEasyPhotoList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | |
| | | questionnaireTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setQuestionnaireTotalPolylineData(questionnaireTotalPolylineData); |
| | | //展示列表 |
| | | List<ComActQuestnaireVO> displayList = comActQuestnaireDAO.selectQuestionnaireDisplayList(communityId, pageSize); |
| | | statisticsInfo.setQuestionnaireDisplayList(displayList); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 首页二级页面-社区动态展示列表 |
| | | * @param communityId |
| | | * @param type |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexDynList(Long communityId, Long type) { |
| | | List<ComActDynVO> dynList = comActDynDAO.indexDynList(communityId, type, pageSize); |
| | | return R.ok(dynList); |
| | | public R indexDynList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActDynDAO.indexDynList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | |
| | | statisticsInfo.setNeighborCircleData(neighborCircleData); |
| | | if (!neighborCircleData.isEmpty()) { |
| | | statisticsInfo.setPublishContentNum(neighborCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum()); |
| | | statisticsInfo.setPublishTopicNum(neighborCircleData.size()); |
| | | statisticsInfo.setPublishTopicNum(neighborCircleData.stream().filter(e -> !"无话题".equals(e.getFiled())).collect(Collectors.toList()).size()); |
| | | } |
| | | //邻里圈新增折线数据 |
| | | Date nowDate = new Date(); |
| | |
| | | |
| | | /** |
| | | * 首页二级页面-邻里圈展示列表 |
| | | * @param communityId |
| | | * @param topicId |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexNeighborList(Long communityId, Long topicId) { |
| | | List<ComActNeighborCircleAdminVO> neighborList = comActNeighborCircleDAO.indexNeighborList(communityId, topicId, pageSize); |
| | | return R.ok(neighborList); |
| | | public R indexNeighborList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActNeighborCircleDAO.indexNeighborList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 首页二级页面-商家展示列表 |
| | | * @param communityId |
| | | * @param categoryId |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexMerchantList(Long communityId, Long categoryId) { |
| | | List<ConvenientMerchantVO> merchantList = convenientMerchantDAO.indexMerchantList(communityId, categoryId, pageSize); |
| | | return R.ok(merchantList); |
| | | public R indexMerchantList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(convenientMerchantDAO.indexMerchantList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-微心愿展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexMicroWishList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActMicroWishDAO.selectScreenDisplayList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-社区问卷展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexQuestionnaireList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActQuestnaireDAO.selectQuestionnaireDisplayList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-居民活动 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexResidentAct(Long communityId) { |
| | | BigScreenResidentActStatisticsInfo statisticsInfo = new BigScreenResidentActStatisticsInfo(); |
| | | List<StatisticsCommVO> actCircleData = comActActivityDAO.getIndexResidentActBaseData(communityId, true); |
| | | statisticsInfo.setActCircleData(actCircleData); |
| | | if (!actCircleData.isEmpty()) { |
| | | statisticsInfo.setJoinNum(actCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum()); |
| | | } |
| | | List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true); |
| | | //居民活动发布总数 |
| | | int publishNum = 0; |
| | | if (!residentActHistogram.isEmpty()) { |
| | | publishNum = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum(); |
| | | } |
| | | statisticsInfo.setPublishNum(publishNum); |
| | | //居民活动新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true); |
| | | int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate)); |
| | | for (int i = 1; i <= currentMon; i++) { |
| | | String temp; |
| | | if (i > 9) { |
| | | temp = "" + i; |
| | | } else { |
| | | temp = "0" + i; |
| | | } |
| | | boolean isExist = actAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | actAddPolylineData.add(other); |
| | | } |
| | | } |
| | | actAddPolylineData = actAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setActAddPolylineData(actAddPolylineData); |
| | | //居民活动累计折线数据 |
| | | List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | actAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, true, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | actTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setActTotalPolylineData(actTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-居民活动展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexResidentActList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActActivityDAO.indexActList(page, pageBaseDTO, true)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-志愿者活动 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexVolunteerAct(Long communityId) { |
| | | BigScreenVolunteerActStatisticsInfo statisticsInfo = new BigScreenVolunteerActStatisticsInfo(); |
| | | List<StatisticsCommVO> actCircleData = comActActivityDAO.getIndexResidentActBaseData(communityId, false); |
| | | statisticsInfo.setActCircleData(actCircleData); |
| | | if (!actCircleData.isEmpty()) { |
| | | statisticsInfo.setJoinNum(actCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum()); |
| | | } |
| | | List<StatisticsCommVO> volunteerActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, false); |
| | | //志愿者活动发布总数 |
| | | int publishNum = 0; |
| | | if (!volunteerActHistogram.isEmpty()) { |
| | | publishNum = volunteerActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum(); |
| | | } |
| | | statisticsInfo.setPublishNum(publishNum); |
| | | //志愿者活动新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, false); |
| | | int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate)); |
| | | for (int i = 1; i <= currentMon; i++) { |
| | | String temp; |
| | | if (i > 9) { |
| | | temp = "" + i; |
| | | } else { |
| | | temp = "0" + i; |
| | | } |
| | | boolean isExist = actAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | actAddPolylineData.add(other); |
| | | } |
| | | } |
| | | actAddPolylineData = actAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setActAddPolylineData(actAddPolylineData); |
| | | //志愿者活动累计折线数据 |
| | | List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | actAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, false, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | actTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setActTotalPolylineData(actTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-志愿者活动展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexVolunteerActList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActActivityDAO.indexActList(page, pageBaseDTO, false)); |
| | | } |
| | | |
| | | private Page retrievePage(PageBaseDTO pageBaseDTO) { |
| | | Long pageNum = pageBaseDTO.getPageNum(); |
| | | Long size = pageBaseDTO.getPageSize(); |
| | | Page page = new Page<>(); |
| | | if (nonNull(pageNum) && nonNull(size)) { |
| | | page.setCurrent(pageNum); |
| | | page.setSize(size); |
| | | } else { |
| | | page.setCurrent(1); |
| | | page.setSize(pageSize); |
| | | } |
| | | return page; |
| | | } |
| | | } |