fuliqi
2024-09-20 9ca86187d65db0180f6d23b8efd13136b6db394c
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -10,6 +10,7 @@
import com.ycl.platform.domain.dto.CheckScoreIndexDTO;
import com.ycl.platform.domain.dto.ScoreIndexDTO;
import com.ycl.platform.domain.entity.*;
import com.ycl.platform.domain.query.DashboardQuery;
import com.ycl.platform.domain.vo.*;
import com.ycl.platform.mapper.CheckRuleMapper;
import com.ycl.platform.mapper.CheckScoreMapper;
@@ -174,8 +175,8 @@
            }
        }
        //分数保留一位小数
        checkScores.stream().forEach(item ->item.setScore(item.getScore().setScale(1,RoundingMode.HALF_UP)));
        return  checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId));
        checkScores.stream().forEach(item -> item.setScore(item.getScore().setScale(1, RoundingMode.HALF_UP)));
        return checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId));
    }
    private void getCheckScore(CheckScore checkScore, Calendar calendar) {
@@ -220,7 +221,7 @@
        }
        List<CheckScore> checkScores = scoreMapper.selectCheckScoreList(checkScore);
        //分数保留一位小数
        checkScores.stream().forEach(item ->item.setScore(item.getScore().setScale(1,RoundingMode.HALF_UP)));
        checkScores.stream().forEach(item -> item.setScore(item.getScore().setScale(1, RoundingMode.HALF_UP)));
        return checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId));
    }
@@ -236,7 +237,7 @@
        //区县只能看已发布
        roleControl(checkScore);
        List<CheckScore> scoreList = scoreMapper.selectCheckScoreList(checkScore);
        scoreList.stream().forEach(item ->item.setScore(item.getScore().setScale(1,RoundingMode.HALF_UP)));
        scoreList.stream().forEach(item -> item.setScore(item.getScore().setScale(1, RoundingMode.HALF_UP)));
        return scoreList;
    }
@@ -318,10 +319,16 @@
        checkIndexCar.setQuarter(exportDTO.getQuarter());
        checkIndexCar.setDeptId(exportDTO.getDeptId());
        checkIndexCar.setDeptIds(exportDTO.getDeptIds());
        checkIndexCar.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexCar);
        List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar);
        List<CheckIndexCar> checkIndexCars = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexCar.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexCar.setExamineTagQuery(1);
            }
            checkIndexCars.addAll(indexCarService.selectCheckIndexCarList(checkIndexCar));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexCars)) {
            //先区分考核标签,再区分区县
@@ -360,10 +367,16 @@
        checkIndexFace.setQuarter(exportDTO.getQuarter());
        checkIndexFace.setDeptId(exportDTO.getDeptId());
        checkIndexFace.setDeptIds(exportDTO.getDeptIds());
        checkIndexFace.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexFace);
        List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace);
        List<CheckIndexFace> checkIndexFaces = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexFace.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexFace.setExamineTagQuery(1);
            }
            checkIndexFaces.addAll(indexFaceService.selectCheckIndexFaceList(checkIndexFace));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexFaces)) {
            //先区分考核标签,再区分区县
@@ -402,10 +415,16 @@
        checkIndexVideo.setQuarter(exportDTO.getQuarter());
        checkIndexVideo.setDeptId(exportDTO.getDeptId());
        checkIndexVideo.setDeptIds(exportDTO.getDeptIds());
        checkIndexVideo.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexVideo);
        List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo);
        List<CheckIndexVideo> checkIndexVideos = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexVideo.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexVideo.setExamineTagQuery(1);
            }
            checkIndexVideos.addAll(indexVideoService.selectCheckIndexVideoList(checkIndexVideo));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexVideos)) {
            //先区分考核标签,再区分区县
@@ -506,6 +525,28 @@
        return scoreMapper.calculate(startDate, endDate, category);
    }
    //大屏展示考核得分
    @Override
    //TODO:考虑limit bug
    public Map<String, List<Map<String, Object>>> dashboard(DashboardQuery dashboardQuery) {
        List<CheckScore> dashboard = scoreMapper.dashboard(dashboardQuery);
        Map<String, List<Map<String, Object>>> resultMap = new HashMap<>();
        for (CheckScore checkScore : dashboard) {
            List<Map<String, Object>> list = new ArrayList<>();
            Map<String, Object> map = new HashMap<>();
            map.put("value", checkScore.getScore());
            if (dashboardQuery.getDataScope() == 1) {
                map.put("name", "省厅得分");
            } else {
                map.put("name", "区县得分");
            }
            list.add(map);
            resultMap.put(checkScore.getDeptName(), list);
        }
        return resultMap;
    }
    //    /**
//     * 新增考核积分
//     *