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 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 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.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.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.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.service_community.service.BigScreenStatisticsService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @title: BigScreenStatisticsServiceImpl
|
* @projectName: 成都呐喊信息技术有限公司-智慧社区项目
|
* @description: 大屏统计服务实现类
|
* @author: hans
|
* @date: 2021/12/06 9:56
|
*/
|
@Service
|
@Slf4j
|
public class BigScreenStatisticsServiceImpl implements BigScreenStatisticsService {
|
|
private static final Integer pageSize = 100;
|
|
@Resource
|
private ComActEasyPhotoDAO comActEasyPhotoDAO;
|
|
@Resource
|
private ComActMicroWishDAO comActMicroWishDAO;
|
|
@Resource
|
private ComActDiscussDAO comActDiscussDAO;
|
|
@Resource
|
private ComActNeighborCircleDAO comActNeighborCircleDAO;
|
|
@Resource
|
private ComPropertyDao comPropertyDao;
|
|
@Resource
|
private ComActWarehouseDonatesDao comActWarehouseDonatesDao;
|
|
@Resource
|
private ComMngPopulationDAO comMngPopulationDAO;
|
|
@Resource
|
private ConvenientMerchantDAO convenientMerchantDAO;
|
|
@Resource
|
private ComActQuestnaireDAO comActQuestnaireDAO;
|
|
@Resource
|
private ComActDynDAO comActDynDAO;
|
|
@Resource
|
private ComActActivityDAO comActActivityDAO;
|
|
@Resource
|
private ComActCommitteeDao comActCommitteeDao;
|
|
@Resource
|
private ComActSocialProjectDao comActSocialProjectDao;
|
|
@Resource
|
private ComActSocialOrgDao comActSocialOrgDao;
|
|
@Resource
|
private ComActSocialWorkerDao comActSocialWorkerDao;
|
|
@Resource
|
private ComActActivityDAO comActActivityDAO;
|
|
/**
|
* 大数据分析平台-居民自治
|
* @param communityId
|
* @return
|
*/
|
@Override
|
public R getResidentAutonomy(Long communityId) {
|
ResidentAutonomyStatisticsVO statisticsVO = comActEasyPhotoDAO.selectResidentAutonomyStatistics(communityId);
|
if (isNull(statisticsVO)) {
|
statisticsVO = new ResidentAutonomyStatisticsVO();
|
}
|
List<StatisticsCommVO> easyPhotoHistogram = comActEasyPhotoDAO.selectStatisticsList(communityId);
|
//随手拍总数
|
Integer easyPhotoTotalCount = 0;
|
//随手拍柱状统计
|
if (Objects.nonNull(easyPhotoHistogram) && !easyPhotoHistogram.isEmpty()) {
|
easyPhotoTotalCount = easyPhotoHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
|
}
|
statisticsVO.setEasyPhotoTotalCount(easyPhotoTotalCount);
|
statisticsVO.setEasyPhotoHistogram(easyPhotoHistogram);
|
|
//待实现&已实现数目及占比
|
List<StatisticsCommVO> microWishRealizePercent = comActMicroWishDAO.selectRealizePercent(communityId);
|
statisticsVO.setMicroWishRealizePercent(microWishRealizePercent);
|
//微心愿图片
|
List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, 20);
|
statisticsVO.setMicroWishImages(microWishImages);
|
|
//议事投票类型占比
|
List<StatisticsCommVO> discussTypePercent = comActDiscussDAO.selectTypePercent(communityId);
|
statisticsVO.setDiscussTypePercent(discussTypePercent);
|
//议事标题
|
List<String> discussTitles = comActDiscussDAO.getTitles(1, communityId, pageSize);
|
statisticsVO.setDiscussTitles(discussTitles);
|
//投票标题
|
List<String> voteTitles = comActDiscussDAO.getTitles(2, communityId, pageSize);
|
statisticsVO.setVoteTitles(voteTitles);
|
|
//邻里圈图片
|
List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, 20);
|
statisticsVO.setNeighborImages(neighborImages);
|
//邻里圈文本内容
|
List<String> neighborContents = comActNeighborCircleDAO.getContents(communityId, pageSize);
|
statisticsVO.setNeighborContents(neighborContents);
|
|
//报事报修新增折线数据
|
List<StatisticsCommVO> repairAddPolylineData = comPropertyDao.getRepairPolylineDate(communityId);
|
statisticsVO.setRepairAddPolylineData(repairAddPolylineData);
|
//报事报修累计折线数据
|
List<StatisticsCommVO> repairTotalPolylineData = new ArrayList<>();
|
repairAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comPropertyDao.getRepairTotalPolylineDate(communityId, e.getFiled());
|
temp.setFiled(e.getFiled());
|
repairTotalPolylineData.add(temp);
|
});
|
statisticsVO.setRepairTotalPolylineData(repairTotalPolylineData);
|
|
//捐赠记录
|
List<String> warehouseDonateRecords = comActWarehouseDonatesDao.getWarehouseDonateRecords(communityId, pageSize);
|
statisticsVO.setWarehouseDonateRecords(warehouseDonateRecords);
|
//爱心传递
|
List<String> warehouseLoveTransfer = comActWarehouseDonatesDao.getWarehouseLoveTransfer(communityId, pageSize);
|
statisticsVO.setWarehouseLoveTransfer(warehouseLoveTransfer);
|
//捐赠图片
|
List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, 20);
|
statisticsVO.setWarehouseImages(warehouseImages);
|
|
//居民活动柱状统计
|
List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true);
|
//居民活动新增数据
|
List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true);
|
//居民活动发布总数
|
int residentActTotalCount = 0;
|
if (!residentActHistogram.isEmpty()) {
|
residentActTotalCount = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
|
}
|
statisticsVO.setResidentActTotalCount(residentActTotalCount);
|
statisticsVO.setResidentActHistogram(actAddPolylineData);
|
//业主委员会党员占比
|
List<StatisticsCommVO> committeePartyPercent = comActCommitteeDao.selectCommitteePartyPercent(communityId);
|
statisticsVO.setCommitteePartyPercent(committeePartyPercent);
|
return R.ok(statisticsVO);
|
}
|
|
/**
|
* 大数据分析平台-清网治格
|
* @param communityId
|
* @return
|
*/
|
@Override
|
public R getGridsGovernance(Long communityId) {
|
GridsGovernanceStatisticsVO statisticsVO = comActEasyPhotoDAO.selectGridsGovernance(communityId);
|
if (isNull(statisticsVO)) {
|
statisticsVO = new GridsGovernanceStatisticsVO();
|
}
|
// 查询网格数据
|
List<EventGridStatisticsVO> gridStatisticsList = comMngPopulationDAO.getEventScreenGridData(communityId);
|
statisticsVO.setGridStatisticsList(gridStatisticsList);
|
|
// 查询小区列表
|
List<CivilVillageStatisticsVO> villageStatisticsList = comMngPopulationDAO.getCivilScreenVillageList(communityId);
|
if (!villageStatisticsList.isEmpty()) {
|
villageStatisticsList.forEach(village -> {
|
CivilVillageStatisticsVO villageStatisticsVO =
|
comMngPopulationDAO.getCivilScreenVillageStatistics(village.getVillageId());
|
if (villageStatisticsVO != null) {
|
village.setPeopleNum(villageStatisticsVO.getPeopleNum());
|
village.setHouseNum(villageStatisticsVO.getHouseNum());
|
village.setRegisterNum(villageStatisticsVO.getRegisterNum());
|
village.setFlowNum(villageStatisticsVO.getFlowNum());
|
// BeanUtils.copyProperties(villageStatisticsVO,village);
|
}
|
});
|
}
|
statisticsVO.setVillageStatisticsList(villageStatisticsList);
|
//事件分析新增折线数据
|
List<StatisticsCommVO> eventAddPolylineData = comPropertyDao.getEventAddPolylineData(communityId);
|
statisticsVO.setEventAddPolylineData(eventAddPolylineData);
|
//事件分析累计折线数据
|
List<StatisticsCommVO> eventTotalPolylineData = new ArrayList<>();
|
eventAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comPropertyDao.getEventTotalPolylineDate(communityId, e.getFiled());
|
temp.setFiled(e.getFiled());
|
eventTotalPolylineData.add(temp);
|
});
|
statisticsVO.setEventTotalPolylineData(eventTotalPolylineData);
|
statisticsVO.generateStatisticsData();
|
return R.ok(statisticsVO);
|
}
|
|
/**
|
* 大数据分析平台-社区服务
|
* @param communityId
|
* @return
|
*/
|
@Override
|
public R getCommunityServiceStatistics(Long communityId) {
|
BigScreenCommunityStatisticsVO statisticsVO = new BigScreenCommunityStatisticsVO();
|
// 查询网格数据
|
List<EventGridStatisticsVO> gridStatisticsList = comMngPopulationDAO.getEventScreenGridData(communityId);
|
statisticsVO.setGridStatisticsList(gridStatisticsList);
|
// 查询小区列表
|
List<CivilVillageStatisticsVO> villageStatisticsList = comMngPopulationDAO.getCivilScreenVillageList(communityId);
|
if (!villageStatisticsList.isEmpty()) {
|
villageStatisticsList.forEach(village -> {
|
CivilVillageStatisticsVO villageStatisticsVO =
|
comMngPopulationDAO.getCivilScreenVillageStatistics(village.getVillageId());
|
if (villageStatisticsVO != null) {
|
village.setPeopleNum(villageStatisticsVO.getPeopleNum());
|
village.setHouseNum(villageStatisticsVO.getHouseNum());
|
village.setRegisterNum(villageStatisticsVO.getRegisterNum());
|
village.setFlowNum(villageStatisticsVO.getFlowNum());
|
}
|
});
|
}
|
statisticsVO.setVillageStatisticsList(villageStatisticsList);
|
//商家地图点位数据
|
List<ConvenientMerchantVO> merchantVOList = convenientMerchantDAO.selectMerchantListByCommunity(communityId);
|
statisticsVO.setMerchantMapDataList(merchantVOList);
|
return R.ok(statisticsVO);
|
}
|
|
/**
|
* 分页获取热度排行商家
|
* @param pagePopularMerchantDTO
|
* @return
|
*/
|
@Override
|
public R getScreenPopularMerchants(PagePopularMerchantDTO pagePopularMerchantDTO) {
|
Page page = new Page<>();
|
page.setSize(pagePopularMerchantDTO.getPageSize());
|
page.setCurrent(pagePopularMerchantDTO.getPageNum());
|
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);
|
statisticsInfo.setMicroWishAddPolylineData(microWishAddPolylineData);
|
//微心愿累计折线数据
|
List<StatisticsCommVO> microWishTotalPolylineData = new ArrayList<>();
|
microWishAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActMicroWishDAO.getMicroWishTotalPolylineDate(communityId, 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);
|
statisticsInfo.setEasyPhotoAddPolylineData(easyPhotoAddPolylineData);
|
//随手拍累计折线数据
|
List<StatisticsCommVO> easyPhotoTotalPolylineData = new ArrayList<>();
|
easyPhotoAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActEasyPhotoDAO.getEasyPhotoTotalPolylineDate(communityId, 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);
|
//社区问卷新增折线数据
|
List<StatisticsCommVO> questionnaireAddPolylineData = comActQuestnaireDAO.getQuestionnaireAddPolylineData(communityId);
|
statisticsInfo.setQuestionnaireAddPolylineData(questionnaireAddPolylineData);
|
//社区问卷累计折线数据
|
List<StatisticsCommVO> questionnaireTotalPolylineData = new ArrayList<>();
|
questionnaireAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActQuestnaireDAO.getQuestionnaireTotalPolylineDate(communityId, 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());
|
}
|
//社区动态新增折线数据
|
List<StatisticsCommVO> dynAddPolylineData = comActDynDAO.getDynAddPolylineData(communityId);
|
statisticsInfo.setDynAddPolylineData(dynAddPolylineData);
|
//社区动态累计折线数据
|
List<StatisticsCommVO> dynTotalPolylineData = new ArrayList<>();
|
dynAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActDynDAO.getDynTotalPolylineDate(communityId, 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.stream().filter(e -> !"无话题".equals(e.getFiled())).collect(Collectors.toList()).size());
|
}
|
//邻里圈新增折线数据
|
List<StatisticsCommVO> neighborAddPolylineData = comActNeighborCircleDAO.getNeighborAddPolylineData(communityId);
|
statisticsInfo.setNeighborAddPolylineData(neighborAddPolylineData);
|
//邻里圈累计折线数据
|
List<StatisticsCommVO> neighborTotalPolylineData = new ArrayList<>();
|
neighborAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActNeighborCircleDAO.getNeighborTotalPolylineDate(communityId, 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());
|
}
|
//服务次数(目前暂时使用浏览量)新增折线数据
|
List<StatisticsCommVO> serviceTimesAddPolylineData = convenientMerchantDAO.getServiceTimesAddPolylineData(communityId);
|
statisticsInfo.setServiceTimesAddPolylineData(serviceTimesAddPolylineData);
|
//服务次数(目前暂时使用浏览量)累计折线数据
|
List<StatisticsCommVO> serviceTimesTotalPolylineData = new ArrayList<>();
|
serviceTimesAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = convenientMerchantDAO.getServiceTimesTotalPolylineDate(communityId, 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));
|
}
|
|
/**
|
* 首页二级页面-居民活动
|
* @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);
|
//居民活动新增折线数据
|
List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true);
|
statisticsInfo.setActAddPolylineData(actAddPolylineData);
|
//居民活动累计折线数据
|
List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>();
|
actAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, true, 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);
|
//志愿者活动新增折线数据
|
List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, false);
|
statisticsInfo.setActAddPolylineData(actAddPolylineData);
|
//志愿者活动累计折线数据
|
List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>();
|
actAddPolylineData.forEach(e -> {
|
StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, false, 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));
|
}
|
|
/**
|
* 清网治格-根据事件分类获取近1月的社区事件数据
|
* @param type
|
* @param communityId
|
* @return
|
*/
|
@Override
|
public R getEventList(Integer type, Long communityId) {
|
// 查询社区事件列表
|
List<EventGridIncidentStatisticsVO> gridIncidentList = comMngPopulationDAO.getGridsGovernanceEventList(communityId);
|
List<EventGridIncidentStatisticsVO> returnGridIncidentList = new ArrayList<>();
|
if (!gridIncidentList.isEmpty()) {
|
gridIncidentList.forEach(e -> {
|
if (e.getEventType().equals(2)) {
|
String[] lngLatString = e.getLatLng().split(",");
|
e.setLatLng(lngLatString[1] + "," + lngLatString[0]);
|
}
|
});
|
returnGridIncidentList = gridIncidentList.stream().filter(e -> type.equals(e.getType())).collect(Collectors.toList());
|
}
|
return R.ok(returnGridIncidentList);
|
}
|
|
/**
|
* 清网治格-社区事件数据分页
|
* @param pageBaseDTO
|
* @return
|
*/
|
@Override
|
public R pageEventList(PageBaseDTO pageBaseDTO) {
|
Page page = retrievePage(pageBaseDTO);
|
IPage<EventGridIncidentStatisticsVO> iPage = comMngPopulationDAO.pageEventList(page, pageBaseDTO);
|
List<EventGridIncidentStatisticsVO> gridIncidentList = iPage.getRecords();
|
if (!gridIncidentList.isEmpty()) {
|
gridIncidentList.forEach(e -> {
|
if (e.getEventType().equals(2)) {
|
String[] lngLatString = e.getLatLng().split(",");
|
e.setLatLng(lngLatString[1] + "," + lngLatString[0]);
|
}
|
});
|
}
|
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));
|
}
|
|
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;
|
}
|
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;
|
}
|
}
|