From 3c884ccd7b51edf3b36840bf99de5edaa41a38a7 Mon Sep 17 00:00:00 2001 From: 张天森 <1292933220@qq.com> Date: 星期三, 12 十月 2022 19:05:28 +0800 Subject: [PATCH] 三说会堂事件流程处理 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java | 645 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 637 insertions(+), 8 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java index 35ca3e2..c5c13d4 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java @@ -3,7 +3,7 @@ import static java.util.Objects.isNull; import static java.util.Objects.nonNull; -import java.text.SimpleDateFormat; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; @@ -14,46 +14,82 @@ import javax.annotation.Resource; -import com.panzhihua.common.model.dtos.property.CommonPage; -import com.panzhihua.common.model.vos.community.bigscreen.*; -import com.panzhihua.common.utlis.DateUtils; -import com.panzhihua.service_community.dao.*; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenDpcStatisticsInfo; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; 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.dtos.property.CommonPage; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComActDynVO; import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; +import com.panzhihua.common.model.vos.community.ComActFourMemberVO; +import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO; +import com.panzhihua.common.model.vos.community.ComSwPatrolRecordVO; import com.panzhihua.common.model.vos.community.StatisticsCommVO; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityLine; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenAlarmStatisticsInfo; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCommunityStatisticsVO; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCourtyardStatisticsInfo; 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.BigScreenFiveAssociationsStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenFmsStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenFourMemberStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHatchStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkBaseInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkProjectInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkProjectTypeInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkSocialOrgInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkSocialWorkerInfo; 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.BigScreenPartyBuildIngStatisticsInfo; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenQuestionnaireStatisticsInfo; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenResidentActStatisticsInfo; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerActStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerStatisticsInfo; +import com.panzhihua.common.model.vos.community.bigscreen.EquipmentPointMapDataVO; +import com.panzhihua.common.model.vos.community.bigscreen.FourMemberOrgRelationVO; 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.bigscreen.VolunteerOrgRelationVO; import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; +import com.panzhihua.common.model.vos.community.fms.ComFmsTeamVO; 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.grid.EventVO; +import com.panzhihua.common.model.vos.property.ComPropertyAlarmVO; +import com.panzhihua.common.model.vos.property.ComPropertyEquipmentVO; +import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.service_community.dao.ComActActivityDAO; import com.panzhihua.service_community.dao.ComActCommitteeDao; +import com.panzhihua.service_community.dao.ComActDAO; 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.ComActEnterpriseDAO; +import com.panzhihua.service_community.dao.ComActFourMemberDao; 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.ComActSocialOrgDao; +import com.panzhihua.service_community.dao.ComActSocialOrgHatchDAO; +import com.panzhihua.service_community.dao.ComActSocialProjectDao; +import com.panzhihua.service_community.dao.ComActSocialWorkerDao; import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao; +import com.panzhihua.service_community.dao.ComFmsServiceDAO; import com.panzhihua.service_community.dao.ComMngPopulationDAO; +import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO; import com.panzhihua.service_community.dao.ComPropertyDao; import com.panzhihua.service_community.dao.ConvenientMerchantDAO; +import com.panzhihua.service_community.model.dos.ComActDO; import com.panzhihua.service_community.service.BigScreenStatisticsService; import lombok.extern.slf4j.Slf4j; @@ -115,9 +151,18 @@ @Resource private ComActSocialWorkerDao comActSocialWorkerDao; - @Resource - private ComActActivityDAO comActActivityDAO; + private ComActFourMemberDao comActFourMemberDao; + @Resource + private ComFmsServiceDAO comFmsServiceDAO; + @Resource + private ComMngVolunteerMngDAO comMngVolunteerMngDAO; + @Resource + private ComActSocialOrgHatchDAO comActSocialOrgHatchDAO; + @Resource + private ComActDAO comActDAO; + @Resource + private ComActEnterpriseDAO comActEnterpriseDAO; /** * 大数据分析平台-居民自治 @@ -566,6 +611,11 @@ */ @Override public R indexVolunteerAct(Long communityId) { + BigScreenVolunteerActStatisticsInfo statisticsInfo = getBigScreenVolunteerActStatisticsInfo(communityId); + return R.ok(statisticsInfo); + } + + private BigScreenVolunteerActStatisticsInfo getBigScreenVolunteerActStatisticsInfo(Long communityId) { BigScreenVolunteerActStatisticsInfo statisticsInfo = new BigScreenVolunteerActStatisticsInfo(); List<StatisticsCommVO> actCircleData = comActActivityDAO.getIndexResidentActBaseData(communityId, false); statisticsInfo.setActCircleData(actCircleData); @@ -590,7 +640,7 @@ actTotalPolylineData.add(temp); }); statisticsInfo.setActTotalPolylineData(actTotalPolylineData); - return R.ok(statisticsInfo); + return statisticsInfo; } /** @@ -749,6 +799,585 @@ return R.ok(comActSocialProjectDao.selectType(name,null)); } + /** + * 金沙定制页面-党建引领基础数据 + * @param communityId + * @return + */ + @Override + public R getPartyBuildIngBaseData(Long communityId) { + //基础统计数据查询 + BigScreenPartyBuildIngStatisticsInfo statisticsInfo = comActDynDAO.getPartyBuildIngBaseData(communityId); + statisticsInfo.setAqxTotal(statisticsInfo.getJmxcTotal() + statisticsInfo.getShjdTotal() + statisticsInfo.getXqxcTotal()); + statisticsInfo.setZyxHelpTotal(statisticsInfo.getZyxServiceTotal()); + statisticsInfo.setZyfwTotal(statisticsInfo.getZyxServiceTotal()); + //随手拍治安防控记录列表 + List<ComActEasyPhotoVO> zafkList = comActEasyPhotoDAO.getPartyBuildIngRecord(communityId, pageSize); + statisticsInfo.setZafkList(zafkList); + //居民宣传记录列表 + List<ComActDynVO> JMXCList = comActDynDAO.getPartyBuildIngDynRecord(communityId, pageSize); + statisticsInfo.setJmxcList(JMXCList); + //商户监督记录列表 + + //辖区巡查记录列表 + List<ComSwPatrolRecordVO> XQXCList = comActDynDAO.getPartyBuildIngPatrolRecord(communityId, pageSize); + StringBuilder sb = new StringBuilder(); + XQXCList.forEach(e -> { + String personName = e.getPersonName(); + if (StringUtils.isNotBlank(personName)) { + String[] split = personName.split(","); + for (int i = 0;i < split.length;i++) { + sb.append(split[i].substring(0, 1).concat(split[i].substring(1).replaceAll("\\S", "*"))); + if (i != split.length - 1) { + sb.append(","); + } + } + e.setPersonName(sb.toString()); + sb.delete(0, sb.length()); + } + }); + statisticsInfo.setXqxcList(XQXCList); + return R.ok(statisticsInfo); + } + + /** + * 党员活动展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pagePartyBuildIngAct(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActDynDAO.pagePartyBuildIngAct(page, pageBaseDTO)); + } + + /** + * 议事投票展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pagePartyBuildIngDiscuss(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActDynDAO.pagePartyBuildIngDiscuss(page, pageBaseDTO)); + } + + /** + * 金沙定制页面-四长四员 + * @param communityId + * @return + */ + @Override + public R getFourMemberBaseData(Long communityId) { + //基础统计数据查询 + BigScreenFourMemberStatisticsInfo statisticsInfo = comActFourMemberDao.getFourMemberBaseData(communityId); + //四长四员楼栋组织关系 + List<ComActFourMemberVO> members = comActFourMemberDao.getFourMembers(communityId); + List<FourMemberOrgRelationVO> relations = new ArrayList<>(); + if (!members.isEmpty()) { + members.forEach(e -> e.setJurisdictionContent(e.getJurisdictionContent().replaceAll("\\[|\"|]", ""))); + Map<String, List<ComActFourMemberVO>> collect = members.stream().collect(Collectors.groupingBy(ComActFourMemberVO::getJurisdictionContent)); + for (Map.Entry<String, List<ComActFourMemberVO>> entry : collect.entrySet()) { + FourMemberOrgRelationVO relationVO = new FourMemberOrgRelationVO(); + relationVO.setRelation(entry.getKey()); + relationVO.setMembers(entry.getValue()); + relations.add(relationVO); + } + } + statisticsInfo.setFourMemberOrgList(relations); + //新增解决问题数 + List<StatisticsCommVO> jjwtAddPolylineData = comActFourMemberDao.retrieveJJWTAddPolylineData(communityId); + statisticsInfo.setJjwtAddPolylineData(jjwtAddPolylineData); + //累计解决问题数 + List<StatisticsCommVO> jjwtTotalPolylineData = new ArrayList<>(); + jjwtAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comActFourMemberDao.retrieveJJWTTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + jjwtTotalPolylineData.add(temp); + }); + statisticsInfo.setJjwtTotalPolylineData(jjwtTotalPolylineData); + //新增院落议事数 + List<StatisticsCommVO> ylysAddPolylineData = comActFourMemberDao.retrieveYLYSAddPolylineData(communityId); + statisticsInfo.setYlysAddPolylineData(ylysAddPolylineData); + //累计院落议事数 + List<StatisticsCommVO> ylysTotalPolylineData = new ArrayList<>(); + ylysAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comActFourMemberDao.retrieveYLYSTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + ylysTotalPolylineData.add(temp); + }); + statisticsInfo.setYlysTotalPolylineData(ylysTotalPolylineData); + return R.ok(statisticsInfo); + } + + /** + * 杨家坪定制页面-五微服务 + * @param communityId + * @return + */ + @Override + public R getFmsBaseData(Long communityId) { + BigScreenFmsStatisticsInfo statisticsInfo = comFmsServiceDAO.getFmsBaseData(communityId); + //团队类型占比圆形图 + List<ComFmsTeamVO> preTeamTypeCircleData = comFmsServiceDAO.retrieveTeamTypeCircleData(communityId); + List<StatisticsCommVO> teamTypeCircleData = new ArrayList<>(); + if (!preTeamTypeCircleData.isEmpty()) { + Integer teamCount = preTeamTypeCircleData.size(); + Map<String, List<ComFmsTeamVO>> collect = preTeamTypeCircleData.stream().collect(Collectors.groupingBy(ComFmsTeamVO::getTeamTypeName)); + for (Map.Entry<String, List<ComFmsTeamVO>> entry : collect.entrySet()) { + StatisticsCommVO temp = new StatisticsCommVO(); + int size = entry.getValue().size(); + temp.setFiled(entry.getKey()); + temp.setNum(size); + temp.setPercent(new BigDecimal(size) + .divide(new BigDecimal(teamCount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + teamTypeCircleData.add(temp); + } + } + statisticsInfo.setTeamTypeCircleData(teamTypeCircleData); + //微服务新增折线数据 + List<StatisticsCommVO> serviceAddPolylineData = comFmsServiceDAO.retrieveServiceAddPolylineData(communityId); + statisticsInfo.setServiceAddPolylineData(serviceAddPolylineData); + //微服务累计折线数据 + List<StatisticsCommVO> serviceTotalPolylineData = new ArrayList<>(); + serviceAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comFmsServiceDAO.retrieveServiceTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + serviceTotalPolylineData.add(temp); + }); + statisticsInfo.setServiceTotalPolylineData(serviceTotalPolylineData); + //微调节矛盾类型占比圆形图 + List<EventVO> preAdjustCircleData = comFmsServiceDAO.retrieveAdjustCircleData(communityId); + List<StatisticsCommVO> adjustCircleData = new ArrayList<>(); + if (!preAdjustCircleData.isEmpty()) { + Integer adjustCount = preAdjustCircleData.size(); + Map<String, List<EventVO>> collect = preAdjustCircleData.stream().collect(Collectors.groupingBy(EventVO::getEventClazz)); + for (Map.Entry<String, List<EventVO>> entry : collect.entrySet()) { + StatisticsCommVO temp = new StatisticsCommVO(); + int size = entry.getValue().size(); + temp.setFiled(entry.getKey()); + temp.setNum(size); + temp.setPercent(new BigDecimal(size) + .divide(new BigDecimal(adjustCount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + adjustCircleData.add(temp); + } + } + statisticsInfo.setAdjustCircleData(adjustCircleData); + //新增解决矛盾折线数据 + List<StatisticsCommVO> adjustAddPolylineData = comFmsServiceDAO.retrieveAdjustAddPolylineData(communityId); + statisticsInfo.setAdjustAddPolylineData(adjustAddPolylineData); + //累计解决矛盾折线数据 + List<StatisticsCommVO> adjustTotalPolylineData = new ArrayList<>(); + adjustAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comFmsServiceDAO.retrieveAdjustTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + adjustTotalPolylineData.add(temp); + }); + statisticsInfo.setAdjustTotalPolylineData(adjustTotalPolylineData); + //微防控防控类型占比圆形图 + List<EventVO> preControlCircleData = comFmsServiceDAO.retrieveControlCircleData(communityId); + List<StatisticsCommVO> controlCircleData = new ArrayList<>(); + if (!preControlCircleData.isEmpty()) { + Integer controlCount = preControlCircleData.size(); + Map<String, List<EventVO>> collect = preControlCircleData.stream().collect(Collectors.groupingBy(EventVO::getEventClazz)); + for (Map.Entry<String, List<EventVO>> entry : collect.entrySet()) { + StatisticsCommVO temp = new StatisticsCommVO(); + int size = entry.getValue().size(); + temp.setFiled(entry.getKey()); + temp.setNum(size); + temp.setPercent(new BigDecimal(size) + .divide(new BigDecimal(controlCount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + controlCircleData.add(temp); + } + } + statisticsInfo.setControlCircleData(controlCircleData); + return R.ok(statisticsInfo); + } + + /** + * 杨家坪定制页面-微团队展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageFmsTeam(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comFmsServiceDAO.pageFmsTeam(page, pageBaseDTO)); + } + + /** + * 杨家坪定制页面-居家养老基础数据 + * @param communityId + * @return + */ + @Override + public R getAlarmBaseData(Long communityId) { + BigScreenAlarmStatisticsInfo statisticsInfo = comPropertyDao.getAlarmBaseData(communityId); + //异常报警新增折线数据 + List<StatisticsCommVO> abnormalAddPolylineData = comPropertyDao.retrieveAbnormalAddPolylineData(communityId); + statisticsInfo.setAbnormalAddPolylineData(abnormalAddPolylineData); + //异常报警累计折线数据 + List<StatisticsCommVO> abnormalTotalPolylineData = new ArrayList<>(); + abnormalAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comPropertyDao.retrieveAbnormalTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + abnormalTotalPolylineData.add(temp); + }); + statisticsInfo.setAbnormalTotalPolylineData(abnormalTotalPolylineData); + //一键求助服务新增折线数据 + List<StatisticsCommVO> serviceAddPolylineData = comPropertyDao.retrieveServiceAddPolylineData(communityId); + statisticsInfo.setServiceAddPolylineData(serviceAddPolylineData); + //一键求助服务累计折线数据 + List<StatisticsCommVO> serviceTotalPolylineData = new ArrayList<>(); + serviceAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comPropertyDao.retrieveServiceTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + serviceTotalPolylineData.add(temp); + }); + statisticsInfo.setServiceTotalPolylineData(serviceTotalPolylineData); + return R.ok(statisticsInfo); + } + + /** + * 杨家坪定制页面-报警记录展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageAlarmRecord(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + Integer param3 = pageBaseDTO.getParam3(); + Long communityId = pageBaseDTO.getCommunityId(); + IPage<ComPropertyAlarmVO> abnormalList = null; + switch (param3) { + case 1: + //待处理异常展示列表 + abnormalList = comPropertyDao.getAbnormalList(page,2, 0, communityId); + break; + case 2: + //已处理异常展示列表 + abnormalList = comPropertyDao.getAbnormalList(page,2, 1, communityId); + break; + case 3: + //待服务展示列表 + abnormalList = comPropertyDao.getAbnormalList(page,1, 0, communityId); + break; + case 4: + //已服务展示列表 + abnormalList = comPropertyDao.getAbnormalList(page,1, 1, communityId); + break; + default: + break; + } + return R.ok(abnormalList); + } + + /** + * 杨家坪定制页面-报警设备点位图 + * @param communityId + * @return + */ + @Override + public R getAlarmPointMap(Long communityId) { + List<ComPropertyEquipmentVO> list = comPropertyDao.getAlarmPointMapData(communityId); + List<EquipmentPointMapDataVO> pointMapDataList = new ArrayList<>(); + if (!list.isEmpty()) { + Map<String, List<ComPropertyEquipmentVO>> collect = list.stream().collect(Collectors.groupingBy(e -> "[" + e.getLatitude() + "," + e.getLongitude() + "]")); + for (Map.Entry<String, List<ComPropertyEquipmentVO>> entry : collect.entrySet()) { + EquipmentPointMapDataVO pointMapDataVO = new EquipmentPointMapDataVO(); + List<ComPropertyEquipmentVO> value = entry.getValue(); + pointMapDataVO.setPosition(entry.getKey()); + List<ComPropertyEquipmentVO> sortedList = value.stream() + .sorted(Comparator.comparing(ComPropertyEquipmentVO::getEquipmentStatus)).collect(Collectors.toList()); + pointMapDataVO.setEquipments(sortedList); + pointMapDataVO.setEquipmentNum(value.size()); + boolean isRed = value.stream().anyMatch(e -> e.getEquipmentStatus().equals(1)); + boolean isYellow = value.stream().anyMatch(e -> e.getEquipmentStatus().equals(2)); + pointMapDataVO.setPointColor(isRed ? 1 : (isYellow ? 2 : 3)); + pointMapDataList.add(pointMapDataVO); + } + } + return R.ok(pointMapDataList); + } + + /** + * 杨家坪定制页面-志愿服务 + * @param communityId + * @return + */ + @Override + public R getVolunteerBaseData(Long communityId) { + BigScreenVolunteerStatisticsInfo statisticsInfo = comMngVolunteerMngDAO.getVolunteerBaseData(communityId); + BigScreenVolunteerActStatisticsInfo info = getBigScreenVolunteerActStatisticsInfo(communityId); + BeanUtils.copyProperties(info, statisticsInfo); + //志愿者统计-组织人数直方图 + statisticsInfo.setVolunteerOrgHistogram(comMngVolunteerMngDAO.retrieveVolunteerOrgHistogram(communityId)); + //志愿者服务类型占比圆形图 + List<ComMngVolunteerMngVO> preVolunteerServiceTypeCircleData = comMngVolunteerMngDAO.retrieveVolunteerServiceTypeCircleData(communityId); + List<StatisticsCommVO> volunteerServiceTypeCircleData = new ArrayList<>(); + if (!preVolunteerServiceTypeCircleData.isEmpty()) { + Integer count = preVolunteerServiceTypeCircleData.size(); + Map<String, List<ComMngVolunteerMngVO>> collect = preVolunteerServiceTypeCircleData.stream().collect(Collectors.groupingBy(ComMngVolunteerMngVO::getServiceTypeName)); + for (Map.Entry<String, List<ComMngVolunteerMngVO>> entry : collect.entrySet()) { + StatisticsCommVO temp = new StatisticsCommVO(); + int size = entry.getValue().size(); + temp.setFiled(entry.getKey()); + temp.setNum(size); + temp.setPercent(new BigDecimal(size) + .divide(new BigDecimal(count), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + volunteerServiceTypeCircleData.add(temp); + } + } + statisticsInfo.setVolunteerServiceTypeCircleData(volunteerServiceTypeCircleData); + //志愿者年龄段占比圆形图 + List<StatisticsCommVO> volunteerAgeCircleData = comMngVolunteerMngDAO.retrieveVolunteerAgeCircleData(communityId); + int sum = volunteerAgeCircleData.stream().mapToInt(StatisticsCommVO::getNum).sum(); + volunteerAgeCircleData.forEach(e -> { + if (sum != 0) { + e.setPercent(new BigDecimal(e.getNum()) + .divide(new BigDecimal(sum), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + } else { + e.setPercent(new BigDecimal(0)); + } + }); + statisticsInfo.setVolunteerAgeCircleData(volunteerAgeCircleData); + //志愿者技能占比圆形图 + List<ComMngVolunteerMngVO> preVolunteerSkillCircleData = comMngVolunteerMngDAO.retrieveVolunteerSkillCircleData(communityId); + List<StatisticsCommVO> volunteerSkillCircleData = new ArrayList<>(); + if (!preVolunteerSkillCircleData.isEmpty()) { + Integer count = preVolunteerSkillCircleData.size(); + Map<String, List<ComMngVolunteerMngVO>> collect = preVolunteerSkillCircleData.stream().collect(Collectors.groupingBy(ComMngVolunteerMngVO::getSkillName)); + for (Map.Entry<String, List<ComMngVolunteerMngVO>> entry : collect.entrySet()) { + StatisticsCommVO temp = new StatisticsCommVO(); + int size = entry.getValue().size(); + temp.setFiled(entry.getKey()); + temp.setNum(size); + temp.setPercent(new BigDecimal(size) + .divide(new BigDecimal(count), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(0)); + volunteerSkillCircleData.add(temp); + } + } + statisticsInfo.setVolunteerSkillCircleData(volunteerSkillCircleData); + //志愿者组织数据 + List<VolunteerOrgRelationVO> volunteerOrgRelationList = new ArrayList<>(); + List<ComMngVolunteerMngVO> volunteerData = comMngVolunteerMngDAO.selectVolunteerByCommunityId(communityId); + if (!volunteerData.isEmpty()) { + Map<String, List<ComMngVolunteerMngVO>> collect = volunteerData.stream().collect(Collectors.groupingBy(ComMngVolunteerMngVO::getOrgName)); + for (Map.Entry<String, List<ComMngVolunteerMngVO>> entry : collect.entrySet()) { + VolunteerOrgRelationVO relationVO = new VolunteerOrgRelationVO(); + relationVO.setOrg(entry.getKey()); + relationVO.setOrgPersonNum(entry.getValue().size()); + relationVO.setVolunteers(entry.getValue()); + volunteerOrgRelationList.add(relationVO); + } + } + statisticsInfo.setVolunteerOrgRelationList(volunteerOrgRelationList); + return R.ok(statisticsInfo); + } + + /** + * 金沙定制页面-志愿线展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pagePartyBuildIngMicroWish(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActMicroWishDAO.pagePartyBuildIngMicroWish(page, pageBaseDTO)); + } + + /** + * 金沙定制页面-四长四员解决问题展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageFourMemberResolve(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActMicroWishDAO.pageFourMemberResolve(page, pageBaseDTO)); + } + + /** + * 金沙定制页面-四长四员院落议事展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageCourtyardDiscuss(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActDiscussDAO.pageCourtyardDiscuss(page, pageBaseDTO)); + } + + /** + * 金沙定制页面-院落议事 + * @param communityId + * @return + */ + @Override + public R getCourtyardBaseData(Long communityId) { + BigScreenCourtyardStatisticsInfo statisticsInfo = comActDiscussDAO.getCourtyardBaseData(communityId); + //新增院落议事数 + List<StatisticsCommVO> discussAddPolylineData = comActFourMemberDao.retrieveYLYSAddPolylineData(communityId); + statisticsInfo.setDiscussAddPolylineData(discussAddPolylineData); + //累计院落议事数 + List<StatisticsCommVO> discussTotalPolylineData = new ArrayList<>(); + discussAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comActFourMemberDao.retrieveYLYSTotalPolylineData(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + discussTotalPolylineData.add(temp); + }); + statisticsInfo.setDiscussTotalPolylineData(discussTotalPolylineData); + return R.ok(statisticsInfo); + } + + /** + * 孵化中心-基础数据 + * @param communityId + * @return + */ + @Override + public R getHatchBaseData(Long communityId) { + ComActDO comActDO = comActDAO.selectById(communityId); + BigScreenHatchStatisticsInfo statisticsInfo = comActSocialOrgHatchDAO.getHatchBaseData(communityId, comActDO.getStreetId()); + //孵化进程占比圆形图数据 + List<StatisticsCommVO> hatchScheduleCircleData = comActSocialOrgHatchDAO.getHatchScheduleCircleData(comActDO.getStreetId()); + statisticsInfo.setHatchScheduleCircleData(hatchScheduleCircleData); + //孵化状态占比柱形数据 + List<StatisticsCommVO> hatchStatusColumnData = comActSocialOrgHatchDAO.getHatchStatusColumnData(comActDO.getStreetId()); + statisticsInfo.setHatchStatusColumnData(hatchStatusColumnData); + //街道组织占比柱形数据 + List<StatisticsCommVO> streetOrgColumnData = comActSocialOrgHatchDAO.getStreetOrgColumnData(comActDO.getStreetId()); + if (nonNull(streetOrgColumnData) && !streetOrgColumnData.isEmpty()) { + streetOrgColumnData.forEach(e -> e.setStatisticsCommVOS(comActSocialOrgHatchDAO.getStreetOrgChildData(e.getFiled()))); + } + statisticsInfo.setStreetOrgColumnData(streetOrgColumnData); + return R.ok(statisticsInfo); + } + + /** + * 孵化中心-孵化成果展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageHatchResult(PageBaseDTO pageBaseDTO) { + ComActDO comActDO = comActDAO.selectById(pageBaseDTO.getCommunityId()); + Page page = retrievePage(pageBaseDTO); + return R.ok(comActSocialOrgDao.pageHatchResult(page, pageBaseDTO, comActDO.getStreetId())); + } + + /** + * 孵化中心-孵化进度展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageHatchSchedule(PageBaseDTO pageBaseDTO) { + ComActDO comActDO = comActDAO.selectById(pageBaseDTO.getCommunityId()); + Page page = retrievePage(pageBaseDTO); + return R.ok(comActSocialOrgDao.pageHatchSchedule(page, pageBaseDTO, comActDO.getStreetId())); + } + + /** + * 五社联动基础数据 + * @param communityId + * @return + */ + @Override + public R getFiveAssociationsBaseData(Long communityId) { + ComActDO comActDO = comActDAO.selectById(communityId); + BigScreenFiveAssociationsStatisticsInfo statisticsInfo = comActSocialProjectDao.getFiveAssociationsBaseData(communityId, comActDO.getStreetId()); + //社区企业服务分类占比圆形图数据 + Integer enterpriseNum = statisticsInfo.getEnterpriseNum(); + List<StatisticsCommVO> enterpriseServiceTypeCircleData = comActEnterpriseDAO.getEnterpriseServiceTypeCircleData(communityId); + if (nonNull(enterpriseServiceTypeCircleData) && !enterpriseServiceTypeCircleData.isEmpty() && enterpriseNum > 0) { + enterpriseServiceTypeCircleData.forEach(e -> { + e.setPercent(new BigDecimal(e.getNum()) + .divide(new BigDecimal(enterpriseNum), 2, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(100)).setScale(0)); + }); + } + statisticsInfo.setEnterpriseServiceTypeCircleData(enterpriseServiceTypeCircleData); + //社区工作者年龄段占比圆形图数据 + List<StatisticsCommVO> socialWorkerAgeStageCircleData = comActEnterpriseDAO.getSocialWorkerAgeStageCircleData(communityId); + Integer socialWorkerNum = statisticsInfo.getSocialWorkerNum(); + if (nonNull(socialWorkerAgeStageCircleData) && !socialWorkerAgeStageCircleData.isEmpty() && socialWorkerNum > 0) { + socialWorkerAgeStageCircleData.forEach(e -> { + e.setPercent(new BigDecimal(e.getNum()) + .divide(new BigDecimal(socialWorkerNum), 2, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(100)).setScale(0)); + }); + } + statisticsInfo.setSocialWorkerAgeStageCircleData(socialWorkerAgeStageCircleData); + //社区工作者服务分类占比圆形图数据 + List<StatisticsCommVO> socialWorkerServiceTypeCircleData = comActEnterpriseDAO.getSocialWorkerServiceTypeCircleData(communityId); + if (nonNull(socialWorkerServiceTypeCircleData) && !socialWorkerServiceTypeCircleData.isEmpty() && socialWorkerNum > 0) { + socialWorkerServiceTypeCircleData.forEach(e -> { + e.setPercent(new BigDecimal(e.getNum()) + .divide(new BigDecimal(socialWorkerNum), 2, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(100)).setScale(0)); + }); + } + statisticsInfo.setSocialWorkerServiceTypeCircleData(socialWorkerServiceTypeCircleData); + return R.ok(statisticsInfo); + } + + /** + * 五社联动项目展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageSocialProjectList(PageBaseDTO pageBaseDTO) { + ComActDO comActDO = comActDAO.selectById(pageBaseDTO.getCommunityId()); + Page page = retrievePage(pageBaseDTO); + return R.ok(comActSocialProjectDao.pageSocialProjectList(page, pageBaseDTO, comActDO.getStreetId())); + } + + /** + * 五社联动社会组织展示列表 + * @param pageBaseDTO + * @return + */ + @Override + public R pageSocialOrgList(PageBaseDTO pageBaseDTO) { + ComActDO comActDO = comActDAO.selectById(pageBaseDTO.getCommunityId()); + Page page = retrievePage(pageBaseDTO); + return R.ok(comActSocialOrgDao.pageSocialOrgList(page, pageBaseDTO, comActDO.getStreetId())); + } + + /** + * 人大代表 + * @param communityId + * @return + */ + @Override + public R dpcBase(Long communityId) { + BigScreenDpcStatisticsInfo statisticsInfo = comActEasyPhotoDAO.selectDpcBaseData(communityId); + //随手拍新增折线数据 + List<StatisticsCommVO> easyPhotoAddPolylineData = comActEasyPhotoDAO.getEasyPhotoAddPolylineDataForDpc(communityId); + statisticsInfo.setEasyPhotoAddPolylineData(easyPhotoAddPolylineData); + //随手拍累计折线数据 + List<StatisticsCommVO> easyPhotoTotalPolylineData = new ArrayList<>(); + easyPhotoAddPolylineData.forEach(e -> { + StatisticsCommVO temp = comActEasyPhotoDAO.getEasyPhotoTotalPolylineDateForDpc(communityId, e.getFiled()); + temp.setFiled(e.getFiled()); + easyPhotoTotalPolylineData.add(temp); + }); + statisticsInfo.setEasyPhotoTotalPolylineData(easyPhotoTotalPolylineData); + return R.ok(statisticsInfo); + } + + /** + * 人大代表-随手拍展示列表 + * @return + */ + @Override + public R dpcEasyPhotoList(PageBaseDTO pageBaseDTO) { + Page page = retrievePage(pageBaseDTO); + return R.ok(comActEasyPhotoDAO.dpcEasyPhotoList(page, pageBaseDTO)); + } + private Page retrievePage(PageBaseDTO pageBaseDTO) { Long pageNum = pageBaseDTO.getPageNum(); Long size = pageBaseDTO.getPageSize(); -- Gitblit v1.7.1