解决未评分时考核任务清单中查看评分详情报错

master
wany 2024-09-13 13:58:59 +08:00
parent 1a88af49dd
commit fe1cda6c67
3 changed files with 20 additions and 3 deletions

View File

@ -24,7 +24,7 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
@Select(""" @Select("""
<script> <script>
select t1.indicator_id,t2.standard_score from public.assess_template_indicator_rel t1 select t1.id,t2.standard_score from public.assess_template_indicator_rel t1
left join public.assess_indicator t2 on t1.indicator_id = t2.id left join public.assess_indicator t2 on t1.indicator_id = t2.id
where t1.template_id = #{templateId} where t1.template_id = #{templateId}
</script> </script>

View File

@ -119,7 +119,6 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
List<AssessTeam> teams = assessObjectService.getTeam(id); List<AssessTeam> teams = assessObjectService.getTeam(id);
teams.stream().forEach(o->o.setStatus(1)); teams.stream().forEach(o->o.setStatus(1));
assessObjectService.updateTeams(teams); assessObjectService.updateTeams(teams);
//考核指标 //考核指标
List<AssessTeamRating> ratings = new ArrayList<>(); List<AssessTeamRating> ratings = new ArrayList<>();
List<AssessIndicator> indicatorIds = this.baseMapper.queryIndicators(task.getTemplateId()); List<AssessIndicator> indicatorIds = this.baseMapper.queryIndicators(task.getTemplateId());
@ -134,6 +133,19 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
} }
} }
teamRatingService.saveBatch(ratings); teamRatingService.saveBatch(ratings);
List<AssessObjectRating> list = new ArrayList<>();
for(AssessObject object : objects){
for(AssessIndicator indicator : indicatorIds){
AssessObjectRating objectRating = new AssessObjectRating();
objectRating.setId(IdWorker.getId());
objectRating.setObjectId(object.getId());
objectRating.setIndicatorId(indicator.getId());
objectRating.setStandardScore(indicator.getStandardScore());
list.add(objectRating);
}
}
teamRatingService.saveObjectRating(list);
return "启动成功"; return "启动成功";
} }

View File

@ -140,6 +140,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
} }
private BigDecimal calcScore(Integer scoreWay, List<Long> teamIds,Long objectId) { private BigDecimal calcScore(Integer scoreWay, List<Long> teamIds,Long objectId) {
assessObjectRatingService.remove(new QueryWrapper<AssessObjectRating>().eq("object_id",objectId));
final BigDecimal[] score = {new BigDecimal(0)}; final BigDecimal[] score = {new BigDecimal(0)};
List<AssessTeamRating> ratings = this.list(new QueryWrapper<AssessTeamRating>().in("team_id",teamIds)); List<AssessTeamRating> ratings = this.list(new QueryWrapper<AssessTeamRating>().in("team_id",teamIds));
Map<Long, List<BigDecimal>> map = ratings.stream().collect(Collectors.groupingBy(AssessTeamRating::getIndicatorId,Collectors.mapping(AssessTeamRating::getAssessScore,Collectors.toList()))); Map<Long, List<BigDecimal>> map = ratings.stream().collect(Collectors.groupingBy(AssessTeamRating::getIndicatorId,Collectors.mapping(AssessTeamRating::getAssessScore,Collectors.toList())));
@ -167,6 +168,10 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
return score[0]; return score[0];
} }
public void saveObjectRating(List<AssessObjectRating> list){
assessObjectRatingService.saveBatch(list);
}
public String getGroupId() { public String getGroupId() {
return "assessTeamRating"; return "assessTeamRating";
} }
@ -198,7 +203,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
Map<Long, List<AssessIndicatorRating>> map = relList.stream().collect(Collectors.groupingBy(AssessIndicatorRating::getIndicatorId)); Map<Long, List<AssessIndicatorRating>> map = relList.stream().collect(Collectors.groupingBy(AssessIndicatorRating::getIndicatorId));
for (AssessRatingVo vo : list){ for (AssessRatingVo vo : list){
vo.setIndicatorRatings(map.get(vo.getIndicatorId())); vo.setIndicatorRatings(map.get(vo.getIndicatorId()));
if(vo.getIsNeedRectify() == 1){ if(vo.getIsNeedRectify() != null && vo.getIsNeedRectify() == 1){
vo.setFiles(fileService.queryFileList(vo.getId().toString(),getGroupId(),getScoreType())); vo.setFiles(fileService.queryFileList(vo.getId().toString(),getGroupId(),getScoreType()));
} }
} }