| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private ComActDynDAO comActDynDAO; |
| | | |
| | | @Resource |
| | | private ComActActivityDAO comActActivityDAO; |
| | | |
| | | @Resource |
| | | private ComActCommitteeDao comActCommitteeDao; |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | |
| | | //捐赠图片 |
| | | List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, pageSize); |
| | | statisticsVO.setWarehouseImages(warehouseImages); |
| | | |
| | | //居民活动柱状统计 |
| | | List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true); |
| | | //居民活动发布总数 |
| | | int residentActTotalCount = 0; |
| | | if (!residentActHistogram.isEmpty()) { |
| | | residentActTotalCount = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum(); |
| | | } |
| | | statisticsVO.setResidentActTotalCount(residentActTotalCount); |
| | | statisticsVO.setResidentActHistogram(residentActHistogram); |
| | | //业主委员会党员占比 |
| | | List<StatisticsCommVO> committeePartyPercent = comActCommitteeDao.selectCommitteePartyPercent(communityId); |
| | | statisticsVO.setCommitteePartyPercent(committeePartyPercent); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | |
| | | 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(); |