From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期一, 09 六月 2025 11:54:00 +0800 Subject: [PATCH] 6.9新增登录失败冻结逻辑 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java | 805 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 761 insertions(+), 44 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 ddf1531..03d420c 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 @@ -1,58 +1,38 @@ package com.panzhihua.service_community.service.impl; -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - +import cn.hutool.core.util.IdcardUtil; 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.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.BigScreenResidentActStatisticsInfo; -import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerActStatisticsInfo; -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.*; +import com.panzhihua.common.model.vos.community.bigscreen.*; 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.service_community.dao.ComActActivityDAO; -import com.panzhihua.service_community.dao.ComActCommitteeDao; -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.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.*; +import com.panzhihua.service_community.model.dos.ComActDO; import com.panzhihua.service_community.service.BigScreenStatisticsService; - import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; /** * @title: BigScreenStatisticsServiceImpl @@ -102,6 +82,27 @@ @Resource private ComActCommitteeDao comActCommitteeDao; + + @Resource + private ComActSocialProjectDao comActSocialProjectDao; + + @Resource + private ComActSocialOrgDao comActSocialOrgDao; + + @Resource + private ComActSocialWorkerDao comActSocialWorkerDao; + @Resource + private ComActFourMemberDao comActFourMemberDao; + @Resource + private ComFmsServiceDAO comFmsServiceDAO; + @Resource + private ComMngVolunteerMngDAO comMngVolunteerMngDAO; + @Resource + private ComActSocialOrgHatchDAO comActSocialOrgHatchDAO; + @Resource + private ComActDAO comActDAO; + @Resource + private ComActEnterpriseDAO comActEnterpriseDAO; /** * 大数据分析平台-居民自治 @@ -171,7 +172,7 @@ statisticsVO.setWarehouseImages(warehouseImages); //居民活动柱状统计 - List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true); + List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, false); //居民活动新增数据 List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true); //居民活动发布总数 @@ -550,6 +551,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); @@ -574,7 +580,7 @@ actTotalPolylineData.add(temp); }); statisticsInfo.setActTotalPolylineData(actTotalPolylineData); - return R.ok(statisticsInfo); + return statisticsInfo; } /** @@ -632,6 +638,705 @@ return R.ok(iPage); } + @Override + public R hmkBaseInfo(CommonPage commonPage) { + BigScreenHmkBaseInfo bigScreenHmkBaseInfo=comActSocialProjectDao.selectIndexBaseInfo(); + //项目数据 + BigScreenHmkProjectInfo bigScreenHmkProjectInfo=comActSocialProjectDao.selectBaseInfo(commonPage.getCommunityId()); + List<BigScreenHmkProjectTypeInfo> typeInfo=comActSocialProjectDao.selectType(null,commonPage.getCommunityId()); + if(bigScreenHmkProjectInfo.getCount()>0){ + typeInfo.forEach(bigScreenHmkProjectTypeInfo -> { + bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/bigScreenHmkProjectInfo.getCount()); + }); + } + bigScreenHmkProjectInfo.setTypeInfoList(typeInfo); + //活动数据 + Integer countAll=comActSocialProjectDao.selectActivity(0,commonPage.getCommunityId()); + BigScreenHmkProjectTypeInfo jm=new BigScreenHmkProjectTypeInfo(); + jm.setName("居民活动"); + jm.setCount(comActSocialProjectDao.selectActivity(2,commonPage.getCommunityId())); + if(countAll>0){ + jm.setPercent(jm.getCount()/countAll); + } + BigScreenHmkProjectTypeInfo zyz=new BigScreenHmkProjectTypeInfo(); + zyz.setName("志愿者活动"); + zyz.setCount(comActSocialProjectDao.selectActivity(1,commonPage.getCommunityId())); + if(countAll>0){ + zyz.setPercent(zyz.getCount()/countAll); + } + List<BigScreenHmkProjectTypeInfo> activityList=new ArrayList<>(); + activityList.add(jm); + activityList.add(zyz); + bigScreenHmkProjectInfo.setActivityTypeInfoList(activityList); + //社会组织数据 + BigScreenHmkSocialOrgInfo bigScreenHmkSocialOrgInfo=comActSocialOrgDao.selectInfo(commonPage.getCommunityId()); + List<BigScreenHmkProjectTypeInfo> typeInfoList= comActSocialOrgDao.selectType(commonPage.getCommunityId()); + if(bigScreenHmkSocialOrgInfo.getCount()>0){ + typeInfoList.forEach(bigScreenHmkProjectTypeInfo -> { + bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/bigScreenHmkSocialOrgInfo.getCount()); + }); + } + bigScreenHmkSocialOrgInfo.setTypeInfoList(typeInfoList); + bigScreenHmkBaseInfo.setBigScreenHmkSocialOrgInfo(bigScreenHmkSocialOrgInfo); + //社工数据 + BigScreenHmkSocialWorkerInfo bigScreenHmkSocialWorkerInfo=new BigScreenHmkSocialWorkerInfo(); + List<BigScreenHmkProjectTypeInfo> socialWorkerList=new ArrayList<>(); + Integer socialAll=comActSocialWorkerDao.selectType(0,commonPage.getCommunityId()); + BigScreenHmkProjectTypeInfo ss=new BigScreenHmkProjectTypeInfo(); + ss.setName("30岁以下"); + ss.setCount(comActSocialWorkerDao.selectType(1,commonPage.getCommunityId())); + if(socialAll>0){ + ss.setPercent(ss.getCount()/socialAll); + } + BigScreenHmkProjectTypeInfo wj=new BigScreenHmkProjectTypeInfo(); + wj.setName("30-59岁"); + wj.setCount(comActSocialWorkerDao.selectType(2,commonPage.getCommunityId())); + if(socialAll>0){ + wj.setPercent(wj.getCount()/socialAll); + } + BigScreenHmkProjectTypeInfo ls=new BigScreenHmkProjectTypeInfo(); + ls.setName("60岁以上"); + ls.setCount(comActSocialWorkerDao.selectType(3,commonPage.getCommunityId())); + if(socialAll>0){ + ls.setPercent(ls.getCount()/socialAll); + } + socialWorkerList.add(ss); + socialWorkerList.add(wj); + socialWorkerList.add(ls); + bigScreenHmkSocialWorkerInfo.setSocialWorkerAge(socialWorkerList); + List<BigScreenHmkProjectTypeInfo> socialWorkerSkill=comActSocialWorkerDao.selectSkillType(commonPage.getCommunityId()); + if(socialAll>0){ + socialWorkerSkill.forEach(bigScreenHmkProjectTypeInfo -> { + bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/socialAll); + }); + } + bigScreenHmkSocialWorkerInfo.setSocialWorkerSkill(socialWorkerSkill); + bigScreenHmkBaseInfo.setBigScreenHmkSocialWorkerInfo(bigScreenHmkSocialWorkerInfo); + bigScreenHmkBaseInfo.setBigScreenHmkProjectInfo(bigScreenHmkProjectInfo); + return R.ok(bigScreenHmkBaseInfo); + } + + @Override + public R partyProjectActivityLine() { + List<BigScreenActivityLine> bigScreenActivityLines=this.getPastMonth(); + bigScreenActivityLines.forEach(bigScreenActivityLine -> { + BigScreenActivityLine bigScreenActivityLine1=comActSocialProjectDao.selectActivityCountMonth(bigScreenActivityLine.getX(),bigScreenActivityLine.getYear()); + bigScreenActivityLine.setY(bigScreenActivityLine1.getY()); + bigScreenActivityLine.setCountY(bigScreenActivityLine1.getCountY()); + bigScreenActivityLine.setX(bigScreenActivityLine.getYear().substring(2,4)+"-"+bigScreenActivityLine.getX()); + }); + + return R.ok(bigScreenActivityLines); + } + + @Override + public R projectActivityProject(CommonPage commonPage) { + return R.ok(comActActivityDAO.selectProjectActivity(new Page(commonPage.getPage(),commonPage.getSize()))); + } + + @Override + public R projectType(String name) { + 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!=null && volunteerData.size()>0) + { + for (ComMngVolunteerMngVO ent:volunteerData) + { + if(!StringUtils.isEmpty(ent.getIdCard())) + { + try { + Integer age = IdcardUtil.getAgeByIdCard(ent.getIdCard()); + ent.setAge(age); + } + catch (Exception e) + { + log.error("身份证号码转换年龄失败,人员id:" + ent.getId()); + } + } + } + } + + 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(); @@ -645,4 +1350,16 @@ } return page; } + public List<BigScreenActivityLine> getPastMonth(){ + List<BigScreenActivityLine> bigScreenActivityLines=new ArrayList<>(); + for(int i=11;i>=0;i--){ + BigScreenActivityLine bigScreenActivityLine=new BigScreenActivityLine(); + String date=DateUtils.getDateFormatString(DateUtils.addMonth(new Date(),-i),"MM"); + String year=DateUtils.getDateFormatString(DateUtils.addMonth(new Date(),-i),"yyyy"); + bigScreenActivityLine.setX(date); + bigScreenActivityLine.setYear(year); + bigScreenActivityLines.add(bigScreenActivityLine); + } + return bigScreenActivityLines; + } } -- Gitblit v1.7.1