lidongdong
2024-07-11 eef6d2bcdb29348efe4ef17bc45a4c6886b487b1
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -10,6 +10,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.DesensitizedUtil;
import com.alibaba.fastjson.JSONObject;
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;
@@ -150,6 +151,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);
    }
    /**
     * 随手拍详情
     *
@@ -184,7 +230,8 @@
        // }
        // 查询反馈信息
        List<ComActEasyPhotoFeedbackVO> photoFeedbackList = comActEasyPhotoFeedbackMapper.getPhotoFeedbackList(id);
        List<ComActEasyPhotoFeedbackVO> photoFeedbackList =
                comActEasyPhotoFeedbackMapper.getPhotoFeedbackList(id);
        if (!photoFeedbackList.isEmpty()) {
            comActEasyPhotoVO.setPhotoFeedbackList(photoFeedbackList);
        }
@@ -297,7 +344,9 @@
        }
        int insert = comActEasyPhotoDAO.insert(comActEasyPhotoDO);
        if (insert > 0) {
            return R.ok();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("id",comActEasyPhotoDO.getId());
            return R.ok(jsonObject);
        }
        return R.fail();
    }
@@ -362,6 +411,7 @@
            case 1:
                if (!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)) {
                    return R.fail("该随手拍已处理,不可重复操作");
//                    return R.ok();
                }
                cmActEasyPhotoDO.setStatus(2);// 进行中
                cmActEasyPhotoDO.setIsNeedFeedBack(1);
@@ -1104,13 +1154,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 +1179,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 +1205,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);
    }
}