| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | 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.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.BigScreenMerchantStatisticsInfo; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenMicroWishStatisticsInfo; |
| | | 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.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; |
| | |
| | | @Slf4j |
| | | public class BigScreenStatisticsServiceImpl implements BigScreenStatisticsService { |
| | | |
| | | private static final Integer pageSize = 200; |
| | | private static final Integer pageSize = 100; |
| | | |
| | | @Resource |
| | | private ComActEasyPhotoDAO comActEasyPhotoDAO; |
| | |
| | | |
| | | @Resource |
| | | private ConvenientMerchantDAO convenientMerchantDAO; |
| | | |
| | | @Resource |
| | | private ComActQuestnaireDAO comActQuestnaireDAO; |
| | | |
| | | @Resource |
| | | private ComActDynDAO comActDynDAO; |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | |
| | | List<ConvenientMerchantVO> popularMerchants = convenientMerchantDAO.getScreenPopularMerchants(page, pagePopularMerchantDTO); |
| | | return R.ok(popularMerchants); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-微心愿 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexMicroWish(Long communityId) { |
| | | BigScreenMicroWishStatisticsInfo statisticsInfo = comActMicroWishDAO.selectIndexMicroWishBaseData(communityId); |
| | | //微心愿新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> microWishAddPolylineData = comActMicroWishDAO.getMicroWishAddPolylineData(communityId); |
| | | 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 = microWishAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | microWishAddPolylineData.add(other); |
| | | } |
| | | } |
| | | microWishAddPolylineData = microWishAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setMicroWishAddPolylineData(microWishAddPolylineData); |
| | | //微心愿累计折线数据 |
| | | List<StatisticsCommVO> microWishTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | microWishAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActMicroWishDAO.getMicroWishTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | microWishTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setMicroWishTotalPolylineData(microWishTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-随手拍 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexEasyPhoto(Long communityId) { |
| | | BigScreenEasyPhotoStatisticsInfo statisticsInfo = comActEasyPhotoDAO.selectIndexEasyPhotoBaseData(communityId); |
| | | //随手拍新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> easyPhotoAddPolylineData = comActEasyPhotoDAO.getEasyPhotoAddPolylineData(communityId); |
| | | 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 = easyPhotoAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | easyPhotoAddPolylineData.add(other); |
| | | } |
| | | } |
| | | easyPhotoAddPolylineData = easyPhotoAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setEasyPhotoAddPolylineData(easyPhotoAddPolylineData); |
| | | //随手拍累计折线数据 |
| | | List<StatisticsCommVO> easyPhotoTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | easyPhotoAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActEasyPhotoDAO.getEasyPhotoTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | easyPhotoTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setEasyPhotoTotalPolylineData(easyPhotoTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-随手拍展示列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexEasyPhotoList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActEasyPhotoDAO.indexEasyPhotoList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-社区问卷 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexQuestionnaire(Long communityId) { |
| | | BigScreenQuestionnaireStatisticsInfo statisticsInfo = comActQuestnaireDAO.getIndexQuestionnaireBaseData(communityId); |
| | | //社区问卷新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> questionnaireAddPolylineData = comActQuestnaireDAO.getQuestionnaireAddPolylineData(communityId); |
| | | 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 = questionnaireAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | questionnaireAddPolylineData.add(other); |
| | | } |
| | | } |
| | | questionnaireAddPolylineData = questionnaireAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setQuestionnaireAddPolylineData(questionnaireAddPolylineData); |
| | | //社区问卷累计折线数据 |
| | | List<StatisticsCommVO> questionnaireTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | questionnaireAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActQuestnaireDAO.getQuestionnaireTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | questionnaireTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setQuestionnaireTotalPolylineData(questionnaireTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-社区动态 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexDyn(Long communityId) { |
| | | BigScreenDynStatisticsInfo statisticsInfo = new BigScreenDynStatisticsInfo(); |
| | | List<StatisticsCommVO> dynCircleData = comActDynDAO.getIndexDynBaseData(communityId); |
| | | statisticsInfo.setDynCircleData(dynCircleData); |
| | | if (!dynCircleData.isEmpty()) { |
| | | statisticsInfo.setDynNum(dynCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum()); |
| | | } |
| | | //社区动态新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> dynAddPolylineData = comActDynDAO.getDynAddPolylineData(communityId); |
| | | 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 = dynAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | dynAddPolylineData.add(other); |
| | | } |
| | | } |
| | | dynAddPolylineData = dynAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setDynAddPolylineData(dynAddPolylineData); |
| | | //社区动态累计折线数据 |
| | | List<StatisticsCommVO> dynTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | dynAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActDynDAO.getDynTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | dynTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setDynTotalPolylineData(dynTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-社区动态展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexDynList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActDynDAO.indexDynList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-邻里圈 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexNeighbor(Long communityId) { |
| | | BigScreenNeighborStatisticsInfo statisticsInfo = new BigScreenNeighborStatisticsInfo(); |
| | | List<StatisticsCommVO> neighborCircleData = comActNeighborCircleDAO.getIndexNeighborBaseData(communityId); |
| | | statisticsInfo.setNeighborCircleData(neighborCircleData); |
| | | if (!neighborCircleData.isEmpty()) { |
| | | statisticsInfo.setPublishContentNum(neighborCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum()); |
| | | statisticsInfo.setPublishTopicNum(neighborCircleData.size()); |
| | | } |
| | | //邻里圈新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> neighborAddPolylineData = comActNeighborCircleDAO.getNeighborAddPolylineData(communityId); |
| | | 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 = neighborAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | neighborAddPolylineData.add(other); |
| | | } |
| | | } |
| | | neighborAddPolylineData = neighborAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setNeighborAddPolylineData(neighborAddPolylineData); |
| | | //邻里圈累计折线数据 |
| | | List<StatisticsCommVO> neighborTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | neighborAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comActNeighborCircleDAO.getNeighborTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | neighborTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setNeighborTotalPolylineData(neighborTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-邻里圈展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexNeighborList(PageBaseDTO pageBaseDTO) { |
| | | Page page = retrievePage(pageBaseDTO); |
| | | return R.ok(comActNeighborCircleDAO.indexNeighborList(page, pageBaseDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-便民商家 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R indexMerchant(Long communityId) { |
| | | BigScreenMerchantStatisticsInfo statisticsInfo = convenientMerchantDAO.getIndexMerchantBaseData(communityId); |
| | | //资源类型饼图数据(暂无) |
| | | // List<StatisticsCommVO> resourceTypeCircleData; |
| | | //服务类型饼图数据 |
| | | List<StatisticsCommVO> serviceTypeCircleData = convenientMerchantDAO.selectServiceTypeCircleData(communityId); |
| | | statisticsInfo.setServiceTypeCircleData(serviceTypeCircleData); |
| | | if (!serviceTypeCircleData.isEmpty()) { |
| | | //服务类型数 |
| | | statisticsInfo.setServiceTypeNum(serviceTypeCircleData.size()); |
| | | } |
| | | //服务次数(目前暂时使用浏览量)新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> serviceTimesAddPolylineData = convenientMerchantDAO.getServiceTimesAddPolylineData(communityId); |
| | | 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 = serviceTimesAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | serviceTimesAddPolylineData.add(other); |
| | | } |
| | | } |
| | | serviceTimesAddPolylineData = serviceTimesAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsInfo.setServiceTimesAddPolylineData(serviceTimesAddPolylineData); |
| | | //服务次数(目前暂时使用浏览量)累计折线数据 |
| | | List<StatisticsCommVO> serviceTimesTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | serviceTimesAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = convenientMerchantDAO.getServiceTimesTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | serviceTimesTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsInfo.setServiceTimesTotalPolylineData(serviceTimesTotalPolylineData); |
| | | return R.ok(statisticsInfo); |
| | | } |
| | | |
| | | /** |
| | | * 首页二级页面-商家展示列表 |
| | | * @param pageBaseDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | 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)); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |