springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/StatisticsPhotoVO.java
New file @@ -0,0 +1,29 @@ package com.panzhihua.common.model.vos.community; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; /** * @title: StatisticsCommVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: * @author: hans * @date: 2021/12/06 10:51 */ @Data @ApiModel("统计随手拍") public class StatisticsPhotoVO { @ApiModelProperty("数量") private Integer countNum; @ApiModelProperty("类型名称") private String countName; @ApiModelProperty("统计日期") private String statisticsDate; @ApiModelProperty("百分比") private BigDecimal percent = BigDecimal.ZERO; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -11150,5 +11150,16 @@ @PostMapping("pageActivityBigScreen") R pageActivityBigScreen(@RequestBody CommonPage commonPage); /** * 疫情防控 健康码统计 * @return */ @GetMapping("/comActAcidRecord/selectColorMarkGroup") R selectColorMarkGroup(); @GetMapping("easyphoto/selectStatisticsPhoto") R selectStatisticsPhoto(); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java
@@ -930,6 +930,8 @@ // System.out.println(beforeDays); List<String> yearMonths = getYearMonths(); System.out.println(yearMonths); List<String> latest12Month = getLatest12Month(LocalDate.now(), 10); System.out.println(latest12Month); } @@ -1203,4 +1205,17 @@ } return months; } //获取当前12个月 public static List<String> getLatest12Month(LocalDate date,int num){ List<String> monthList = new ArrayList<>(); for(int i = 0;i <= num-1; i++){ LocalDate localDate = date.minusMonths(i); String month = localDate.toString().substring(0,7); monthList.add(month); } return monthList; } } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BasicScreenApi.java
@@ -1,31 +1,23 @@ package com.panzhihua.community_backstage.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenStatisticAgeGenderDTO; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenStatisticPartyActivityDTO; import com.panzhihua.common.model.dtos.community.bigscreen.PageBigScreenStatisticPartyOrg; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO; import com.panzhihua.common.model.dtos.neighbor.DetailNeighborAllCommentByAdminDTO; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComActActivityBigScreenVO; import com.panzhihua.common.model.vos.community.ComBasicDataVo; import com.panzhihua.common.model.vos.community.bigscreen.*; import com.panzhihua.common.model.vos.community.*; import com.panzhihua.common.model.vos.community.acid.ComActAcidColorChartsVO; import com.panzhihua.common.model.vos.neighbor.ActivityAnalysisVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO; import com.panzhihua.common.model.vos.partybuilding.PagePartyOrganizationVO; import com.panzhihua.common.model.vos.partybuilding.PartyBuildingComPbDynVO; import com.panzhihua.common.model.vos.partybuilding.PartyCommitteeVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentByAdminVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.partybuilding.PartyBuildingService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * @ClasssName BasicScreenApi @@ -46,6 +38,7 @@ /** * 查询统计基础数据 * * @return */ @GetMapping("selectBasicData") @@ -56,6 +49,7 @@ /** * 统计在职干部特长 * * @return */ @GetMapping("statisticsPbMemberType") @@ -68,8 +62,7 @@ /** * 统计大屏查询清单列表 * * @param comActNeighborCircleAdminDTO * 请求参数 * @param comActNeighborCircleAdminDTO 请求参数 * @return 邻里圈列表 */ @PostMapping("pageNeighborByAdmin") @@ -80,6 +73,7 @@ /** * 单位统计 * * @return */ @GetMapping("selectUnitByNatureName") @@ -90,6 +84,7 @@ /** * 大屏-社区活动分页 * * @return */ @PostMapping("pageActivityBigScreen") @@ -97,6 +92,7 @@ public R pageActivityBigScreen(@RequestBody CommonPage commonPage){ return communityService.pageActivityBigScreen(commonPage); } @ApiOperation(value = "单位活动统计 range,year", response = ActivityAnalysisVO.class) @GetMapping("activity/analysis") public R activityUnitAnalysis(@RequestParam(value = "year", required = false) Integer year, @@ -110,4 +106,57 @@ return communityService.institutionalUnitServiceAnalysis(year, type, range, communityId, page, size, belongTo, unitId, this.getLoginUserInfo().getAccount()); } /** * 疫情防控 健康码统计 * * @return */ @GetMapping("selectColorMarkGroup") @ApiOperation(value = "疫情防控 健康码统计", response = ComActAcidColorChartsVO.class) public R selectColorMarkGroup() { return communityService.selectColorMarkGroup(); } @ApiOperation(value = "清单详情接口", response = ComActNeighborCircleAdminVO.class) @GetMapping("/neighbor/detail") public R neighborDetail(@RequestParam("id") Long id) { return communityService.detailNeighborByAdmin(id); } @ApiOperation(value = "清单详情的所有评论接口", response = ComActNeighborCommentByAdminVO.class) @PostMapping("/neighbor/detail/comment") public R detailNeighborAllCommentByAdmin(@RequestBody DetailNeighborAllCommentByAdminDTO dto) { return communityService.detailNeighborAllCommentByAdmin(dto); } @ApiOperation(value = "活动详情", response = ComActActivityVO.class) @GetMapping("detailactivity") public R detailActivity(@RequestParam("id") Long id, @RequestParam(value = "pageNum", required = false) Long pageNum, @RequestParam(value = "pageSize", required = false) Long pageSize) { return communityService.detailActivity(id, null, pageNum, pageSize); } @ApiOperation(value = "网格治理", response = StatisticsPhotoVO.class) @GetMapping("easyphoto/selectStatisticsPhoto") public R selectStatisticsPhoto() { return communityService.selectStatisticsPhoto(); } @ApiOperation(value = "分页展示社区随手拍", response = ComActEasyPhotoVO.class) @PostMapping("pageeasyphoto") public R pageEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); if (loginUserInfo != null) { comActEasyPhotoVO.setCommunityId(loginUserInfo.getCommunityId()); comActEasyPhotoVO.setLogInUserId(loginUserInfo.getUserId()); comActEasyPhotoVO.setIsDpcMember(loginUserInfo.getIsDpcMember()); } return communityService.pageEasyPhotoApplets(comActEasyPhotoVO); } @ApiOperation(value = "随手拍详情", response = ComActEasyPhotoVO.class) @GetMapping("easyphoto") public R detailEasyPhoto(@RequestParam("id") Long id) { Long userId = this.getUserId(); return communityService.detailEasyPhoto(id, userId); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActAcidRecordApi.java
@@ -182,4 +182,9 @@ public R checkCommit(@RequestParam(value = "userId",required = false)Long userId){ return this.comActAcidRecordService.checkCommit(userId); } @GetMapping("/selectColorMarkGroup") public R selectColorMarkGroup(){ return this.comActAcidRecordService.selectColorMarkGroup(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -2807,4 +2807,9 @@ return comActActivityService.pageActivityBigScreen(commonPage); } @GetMapping("easyphoto/selectStatisticsPhoto") public R selectStatisticsPhoto() { return comActEasyPhotoService.selectStatisticsPhoto(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java
@@ -7,6 +7,7 @@ import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; import com.panzhihua.common.model.vos.community.StatisticsCommVO; import com.panzhihua.common.model.vos.community.StatisticsPhotoVO; import com.panzhihua.common.model.vos.community.TodoEventsVO; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenDpcStatisticsInfo; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenEasyPhotoStatisticsInfo; @@ -459,4 +460,16 @@ * */ List<BannerVO> getBanner(@Param("communityId") Long communityId); /** * 统计所有随手拍,分状态 * @return */ List<StatisticsPhotoVO> selectPhotoAll(); /** * 统计所有随手拍,分状态 * @return */ List<StatisticsPhotoVO> selectPhotoByMonth(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActAcidRecordService.java
@@ -118,4 +118,10 @@ R batchCheck(BatchCheckAcidRecordDTO batchCheckAcidRecordDTO); R checkCommit(Long userId); /** * 疫情防控 健康码统计 * @return */ R selectColorMarkGroup(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActEasyPhotoService.java
@@ -233,4 +233,10 @@ * 获取社区置顶动态banner * */ R getUserRewardNew(Long userId, Long communityId); /** * 统计随手拍 * @return */ R selectStatisticsPhoto(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java
@@ -626,17 +626,40 @@ comActAcidColorChartsVO.setPercent(percent); } } Map<String, ComActAcidColorChartsVO> circleMap = comActAcidColorChartsVOS.stream().collect(Collectors.toMap(ComActAcidColorChartsVO::getCountName, Function.identity())); Map<String, ComActAcidColorChartsVO> circleMap = comActAcidColorChartsVOS .stream() .collect(Collectors.toMap(ComActAcidColorChartsVO::getCountName, Function.identity())); //月份 List<ComActAcidColorChartsVO> comActAcidColorChartsVOS1 = this.baseMapper.selectColorMarkGroupByMonth(); Map<String, List<ComActAcidColorChartsVO>> colorMap = comActAcidColorChartsVOS1.stream().collect(Collectors.groupingBy(ComActAcidColorChartsVO::getColorMark)); //按颜色分组求和 Map<String, IntSummaryStatistics> colorCollect = comActAcidColorChartsVOS1 .stream() .collect(Collectors.groupingBy(ComActAcidColorChartsVO::getColorMark, Collectors.summarizingInt(ComActAcidColorChartsVO::getCountNum))); for (ComActAcidColorChartsVO comActAcidColorChartsVO : comActAcidColorChartsVOS1) { String colorMark = comActAcidColorChartsVO.getColorMark(); if (colorCollect.containsKey(colorMark)){ IntSummaryStatistics intSummaryStatistics = colorCollect.get(colorMark); long sum = intSummaryStatistics.getSum(); if (0L!=sum) { BigDecimal countNum = new BigDecimal(comActAcidColorChartsVO.getCountNum()); BigDecimal sumDecimal = new BigDecimal(sum); BigDecimal percent = countNum.divide(sumDecimal, 2, BigDecimal.ROUND_HALF_DOWN); comActAcidColorChartsVO.setPercent(percent); } } } Map<String, Map<String, ComActAcidColorChartsVO>> chartMap = comActAcidColorChartsVOS1 .stream() .collect(Collectors.groupingBy(ComActAcidColorChartsVO::getCountName, Collectors.toMap(ComActAcidColorChartsVO::getColorMark, Function.identity()))); Map<String,Object> retMap = new HashMap<>(); retMap.put("circleMap",circleMap); retMap.put("chartMap",chartMap); return R.ok(); return R.ok(retMap); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -1,9 +1,10 @@ package com.panzhihua.service_community.service.impl; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; import java.time.LocalDate; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import javax.annotation.Resource; @@ -11,6 +12,7 @@ import cn.hutool.core.util.DesensitizedUtil; import com.panzhihua.common.model.dtos.common.PageComActEasyPhotoEvaluateDto; import com.panzhihua.common.model.vos.common.ComActEasyPhotoHandlerVo; import com.panzhihua.common.model.vos.community.acid.ComActAcidColorChartsVO; import com.panzhihua.common.model.vos.community.easyPhoto.BannerVO; import com.panzhihua.service_community.entity.ComActEasyPhotoEvaluate; import com.panzhihua.service_community.entity.ComActEasyPhotoHandler; @@ -1093,4 +1095,69 @@ return R.ok(easyPhotoRewardVO); } @Override public R selectStatisticsPhoto(){ //所有分组 List<StatisticsPhotoVO> statisticsPhotoVOS = this.baseMapper.selectPhotoAll(); int all = statisticsPhotoVOS.stream().mapToInt(StatisticsPhotoVO::getCountNum).sum(); for (StatisticsPhotoVO statisticsPhotoVO : statisticsPhotoVOS) { if (0!=all){ BigDecimal countNum = new BigDecimal(statisticsPhotoVO.getCountNum()); BigDecimal allDecimal = new BigDecimal(all); BigDecimal percent = countNum.divide(allDecimal,2, BigDecimal.ROUND_HALF_DOWN); statisticsPhotoVO.setPercent(percent); } } Map<String, StatisticsPhotoVO> circleMap = statisticsPhotoVOS .stream() .collect(Collectors.toMap(StatisticsPhotoVO::getCountName, Function.identity())); //按月份查询 List<StatisticsPhotoVO> statisticsPhotoVOS1 = this.baseMapper.selectPhotoByMonth(); //按类型分组求和 Map<String, IntSummaryStatistics> statusCollect = statisticsPhotoVOS1 .stream() .collect(Collectors.groupingBy(StatisticsPhotoVO::getCountName, Collectors.summarizingInt(StatisticsPhotoVO::getCountNum))); for (StatisticsPhotoVO statisticsPhotoVO : statisticsPhotoVOS1) { String countName = statisticsPhotoVO.getCountName(); if (statusCollect.containsKey(countName)){ IntSummaryStatistics intSummaryStatistics = statusCollect.get(countName); long sum = intSummaryStatistics.getSum(); if (0L!=sum) { BigDecimal countNum = new BigDecimal(statisticsPhotoVO.getCountNum()); BigDecimal sumDecimal = new BigDecimal(sum); BigDecimal percent = countNum.divide(sumDecimal, 2, BigDecimal.ROUND_HALF_DOWN); statisticsPhotoVO.setPercent(percent); } } } Map<String, Map<String, StatisticsPhotoVO>> chartMap = statisticsPhotoVOS1.stream().collect(Collectors.groupingBy(StatisticsPhotoVO::getStatisticsDate, Collectors.toMap(StatisticsPhotoVO::getCountName, Function.identity()))); // 状态 1待处理 2进行中 3已驳回 4待评价 5.已完成 String[] statusArr = {"dcl","jxz","ybh","dpj","ywc"}; List<String> latest12Month = DateUtils.getLatest12Month(LocalDate.now(), 10); for (String month : latest12Month) { Map<String, StatisticsPhotoVO> map1; if(chartMap.containsKey(month)){ map1 = chartMap.get(month); }else { map1 = new HashMap<>(); } for (String status : statusArr) { if (!map1.containsKey(status)){ StatisticsPhotoVO statisticsPhotoVO = new StatisticsPhotoVO(); statisticsPhotoVO.setCountNum(0); statisticsPhotoVO.setStatisticsDate(month); statisticsPhotoVO.setCountName(status); map1.put(status,statisticsPhotoVO); } } chartMap.put(month,map1); } return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml
@@ -610,5 +610,13 @@ <select id="getBanner" resultType="com.panzhihua.common.model.vos.community.easyPhoto.BannerVO"> select * from com_act_dyn where type=1 AND on_top=1 </select> <select id="selectPhotoAll" resultType="com.panzhihua.common.model.vos.community.StatisticsPhotoVO"> SELECT count(1) count_num,(case `status` when 1 THEN 'dcl' WHEN 2 THEN 'jxz' WHEN 3 THEN 'ybh' WHEN 4 THEN 'dpj' WHEN 5 THEN 'ywc' ELSE 'qt' END) count_name FROM `com_act_easy_photo` where del_tag = 0 GROUP BY `status` </select> <select id="selectPhotoByMonth" resultType="com.panzhihua.common.model.vos.community.StatisticsPhotoVO"> SELECT count(1) count_num,(case `status` when 1 THEN 'dcl' WHEN 2 THEN 'jxz' WHEN 3 THEN 'ybh' WHEN 4 THEN 'dpj' WHEN 5 THEN 'ywc' ELSE 'qt' END) count_name,date_format(create_at,'%Y-%m') as statistics_date FROM `com_act_easy_photo` WHERE date_format(create_at,'%Y-%m') >= date_format(date_sub(now(), INTERVAL 10 MONTH),'%Y-%m') and del_tag = 0 GROUP BY statistics_date, `status` </select> </mapper>