From a44dde62c5650e7b49ac7de65f9c912ebab8edf8 Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期一, 26 六月 2023 16:36:58 +0800 Subject: [PATCH] 修改三资查询新增报错 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 52 insertions(+), 4 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java index 637855c..0e4dcf0 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java @@ -150,6 +150,51 @@ return R.ok(iPage); } + @Override + public R pageEasyPhotoAdminLC(Long pageNum,Long pageSize) { + Page page = new Page<>(); + if (null == pageNum || 0 == pageNum) { + pageNum = 1l; + } + if (null == pageSize || 0 == pageSize) { + pageSize = 10l; + } + page.setSize(pageSize); + page.setCurrent(pageNum); + IPage<ComActEasyPhotoVO> iPage = comActEasyPhotoDAO.pageEasyPhotoAdminLC(page); + List<ComActEasyPhotoVO> records = iPage.getRecords(); + if (!ObjectUtils.isEmpty(records)) { + records.forEach(comActEasyPhotoVO1 -> { + Long id = comActEasyPhotoVO1.getId(); + + if (comActEasyPhotoVO1.getActivityId() != null + && comActEasyPhotoVO1.getStatus().equals(ComActEasyPhotoDO.status.dpj)) { + // 查询随手拍活动 + ComActEasyPhotoActivityDO photoActivityDO = + comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO1.getActivityId()); + if (photoActivityDO != null) { + if (comActEasyPhotoVO1.getActivityType() != null) { + if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)) { + comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getGoodReward()); + } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)) { + comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getExcellentReward()); + } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)) { + comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getOrdinaryReward()); + } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)) { + comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getCommonlyReward()); + } else if (comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.wu)) { + comActEasyPhotoVO1.setActivityMoney(BigDecimal.ZERO); + } + } + } + } + }); + iPage.setRecords(records); + } + return R.ok(iPage); + } + + /** * 随手拍详情 * @@ -1104,7 +1149,7 @@ 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); } } @@ -1129,7 +1174,7 @@ 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); } } @@ -1161,14 +1206,17 @@ } chartMap.put(month,map1); } - Map<String, List<StatisticsPhotoVO>> stringListMap = statisticsPhotoVOS1.stream().collect(Collectors.groupingBy(StatisticsPhotoVO::getCountName)); + Map<String, List<StatisticsPhotoVO>> stringListMap = statisticsPhotoVOS1 + .stream() + .sorted(Comparator.comparing(StatisticsPhotoVO::getStatisticsDate)) + .collect(Collectors.groupingBy(StatisticsPhotoVO::getCountName)); Map<String,Object> retMap = new HashMap<>(); retMap.put("statisticsPhotoVOS",statisticsPhotoVOS); retMap.put("monthMap",stringListMap); - return R.ok(); + return R.ok(retMap); } } -- Gitblit v1.7.1