yanghui
2022-12-08 5e7892cd0921111dfbaf84196f2593f8045d1c11
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -1104,13 +1104,14 @@
            if (0!=all){
                BigDecimal countNum = new BigDecimal(statisticsPhotoVO.getCountNum());
                BigDecimal allDecimal = new BigDecimal(all);
                BigDecimal percent = countNum.divide(allDecimal,2, BigDecimal.ROUND_HALF_DOWN);
                BigDecimal percent = countNum.divide(allDecimal,4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(100));
                statisticsPhotoVO.setPercent(percent);
            }
        }
        Map<String, StatisticsPhotoVO> circleMap = statisticsPhotoVOS
                .stream()
                .collect(Collectors.toMap(StatisticsPhotoVO::getCountName, Function.identity()));
//        Map<String, StatisticsPhotoVO> circleMap = statisticsPhotoVOS
//                .stream()
//                .collect(Collectors.toMap(StatisticsPhotoVO::getCountName, Function.identity()));
        //按月份查询
        List<StatisticsPhotoVO> statisticsPhotoVOS1 = this.baseMapper.selectPhotoByMonth();
@@ -1128,15 +1129,18 @@
                if (0L!=sum) {
                    BigDecimal countNum = new BigDecimal(statisticsPhotoVO.getCountNum());
                    BigDecimal sumDecimal = new BigDecimal(sum);
                    BigDecimal percent = countNum.divide(sumDecimal, 2, BigDecimal.ROUND_HALF_DOWN);
                    BigDecimal percent = countNum.divide(sumDecimal, 4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(100));
                    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"};
        String[] statusArr = {"待处理","进行中","已驳回","待评价","已完成"};
        List<String> latest12Month = DateUtils.getLatest12Month(LocalDate.now(), 10);
        for (String month : latest12Month) {
            Map<String, StatisticsPhotoVO> map1;
@@ -1151,13 +1155,23 @@
                    statisticsPhotoVO.setCountNum(0);
                    statisticsPhotoVO.setStatisticsDate(month);
                    statisticsPhotoVO.setCountName(status);
                    statisticsPhotoVOS1.add(statisticsPhotoVO);
                    map1.put(status,statisticsPhotoVO);
                }
            }
            chartMap.put(month,map1);
        }
        Map<String, List<StatisticsPhotoVO>> stringListMap = statisticsPhotoVOS1
                .stream()
                .sorted(Comparator.comparing(StatisticsPhotoVO::getStatisticsDate))
                .collect(Collectors.groupingBy(StatisticsPhotoVO::getCountName));
        return R.ok();
        Map<String,Object> retMap = new HashMap<>();
        retMap.put("statisticsPhotoVOS",statisticsPhotoVOS);
        retMap.put("monthMap",stringListMap);
        return R.ok(retMap);
    }
}