fuliqi
2024-11-01 b91945ea32378a71d1e57356af6e16703a1ceaa7
ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -34,12 +34,14 @@
    @Autowired
    private CheckScoreMapper scoreMapper;
    @Autowired
    private ICheckScoreService checkScoreService;
    @Autowired
    private CheckIndexVideoMapper videoMapper;
    @Autowired
    private CheckIndexFaceMapper faceMapper;
    @Autowired
    private CheckIndexCarMapper carMapper;
    //公安部只有视频考核
    public void executeTemplate(Integer templateId) {
        CheckTemplate checkTemplate = templateMapper.selectCheckTemplateById(templateId);
        if (checkTemplate != null) {
@@ -52,7 +54,6 @@
            //查今天的index指标
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            String day = dateFormat.format(new Date());
            //创建score集合方便最后批量存储
            List<CheckScore> scoreList = new ArrayList<>();
            //根据考核类别和考核标签,查不同index表(区分省厅区县)
@@ -87,9 +88,23 @@
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face);
                }
            }
            //查出今天生成score
            List<CheckScore> todays = scoreMapper.selectToday(day);
            //遍历scoreList集合,如果今天生成过补充id
            for (CheckScore result : scoreList) {
                for (CheckScore today : todays) {
                    //根据考核标签、考核种类、部门id查询是否存在今日数据
                    if(result.getExamineTag().equals(today.getExamineTag()) && result.getExamineCategory().equals(today.getExamineCategory()) && result.getDeptId().equals(today.getDeptId())){
                        //补充id,后续根据id saveOrUpdate
                        result.setId(today.getId());
                        result.setPublish(today.getPublish());
                    }
                }
            }
            //储存分数
            if(!CollectionUtils.isEmpty(scoreList)) {
                scoreMapper.saveBatch(scoreList);
            if (!CollectionUtils.isEmpty(scoreList)) {
                checkScoreService.saveOrUpdateBatch(scoreList);
            }
        }
    }