查看评分详情
parent
f196358465
commit
8ef24e5320
|
|
@ -12,6 +12,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述: 考核评分详情
|
* 描述: 考核评分详情
|
||||||
|
|
@ -40,9 +41,15 @@ public class AssessTeamRatingController extends AbstractCommonFileController{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "我的待办/已办-查看评分详情")
|
@Operation(summary = "我的待办/已办-查看评分详情")
|
||||||
@GetMapping("/detail/{teamId}")
|
@GetMapping("/do/detail/{teamId}")
|
||||||
public R<List<AssessRatingVo>> detail(@Schema(name = "teamId") @PathVariable("teamId") Long teamId) {
|
public R<List<AssessRatingVo>> doDetail(@Schema(name = "teamId") @PathVariable("teamId") Long teamId) {
|
||||||
return R.ok(service.detail(teamId));
|
return R.ok(service.doDetail(teamId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "考核任务清单-查看评分详情")
|
||||||
|
@GetMapping("/scoreDetail/{objectId}")
|
||||||
|
public R<Map<Long,List<AssessRatingVo>>> scoreDetail(@Schema(name = "objectId") @PathVariable("objectId") Long objectId) {
|
||||||
|
return R.ok(service.scoreDetail(objectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,11 @@ public class AssessRatingVo extends AssessTeamRating{
|
||||||
@Schema(description="标准分数")
|
@Schema(description="标准分数")
|
||||||
private Integer standardScore;
|
private Integer standardScore;
|
||||||
|
|
||||||
|
@Schema(description="考核成员id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long teamUserId;
|
||||||
|
|
||||||
|
@Schema(description="考核成员")
|
||||||
|
private String teamUserName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
|
||||||
and t.start_date <![CDATA[>=]]> #{obj.dateRangeSo.start}
|
and t.start_date <![CDATA[>=]]> #{obj.dateRangeSo.start}
|
||||||
</if>
|
</if>
|
||||||
<if test="obj.dateRangeSo != null and obj.dateRangeSo.end != null">
|
<if test="obj.dateRangeSo != null and obj.dateRangeSo.end != null">
|
||||||
and t.end_date <![CDATA[<=]]> #{obj.dateRangeSo.end}
|
and t.start_date <![CDATA[<=]]> #{obj.dateRangeSo.end}
|
||||||
</if>
|
</if>
|
||||||
<if test="obj.status != null">
|
<if test="obj.status != null">
|
||||||
and t.status = #{obj.status}
|
and t.status = #{obj.status}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
|
||||||
|
|
||||||
@Select("""
|
@Select("""
|
||||||
<script>
|
<script>
|
||||||
select t1.*,t2.indicator_name,t2.category_id,t3.name as categoryName from public.assess_team_rating t1
|
select t1.*,t2.indicator_name,t2.category_id,t3.name from public.assess_team_rating 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
|
||||||
left join public.assess_category t3 on t2.category_id = t3.id
|
left join public.assess_category t3 on t2.category_id = t3.id
|
||||||
where t1.team_id = #{teamId}
|
where t1.team_id = #{teamId}
|
||||||
|
|
@ -27,4 +27,16 @@ public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
List<AssessRatingVo> scoreDetail(@Param("teamId") Long teamId);
|
List<AssessRatingVo> scoreDetail(@Param("teamId") Long teamId);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t1.*,t2.indicator_name,t2.category_id,t3.name,t4.team_user_id,t4.team_user_name from public.assess_team_rating t1
|
||||||
|
left join public.assess_indicator t2 on t1.indicator_id = t2.id
|
||||||
|
left join public.assess_category t3 on t2.category_id = t3.id
|
||||||
|
left join public.assess_team t4 on t1.team_id = t4.id
|
||||||
|
where t1.team_id in (select id from public.assess_team where object_id = #{objectId})
|
||||||
|
order by t2.order_index
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<AssessRatingVo> scoreByObjectId(@Param("objectId") Long objectId);
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
|
||||||
queryWrapper.ge(AssessTask::getStartDate,page.getDateRangeSo().getStart());
|
queryWrapper.ge(AssessTask::getStartDate,page.getDateRangeSo().getStart());
|
||||||
}
|
}
|
||||||
if(page.getDateRangeSo() != null && page.getDateRangeSo().getEnd() != null){
|
if(page.getDateRangeSo() != null && page.getDateRangeSo().getEnd() != null){
|
||||||
queryWrapper.le(AssessTask::getEndDate,page.getDateRangeSo().getEnd());
|
queryWrapper.le(AssessTask::getStartDate,page.getDateRangeSo().getEnd());
|
||||||
}
|
}
|
||||||
return this.page(page.getPageSo().toPage(),queryWrapper);
|
return this.page(page.getPageSo().toPage(),queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -99,12 +99,8 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
|
||||||
List<AssessTeam> finishTeams = teams.stream().filter(o -> o.getStatus() == 2).collect(Collectors.toList());
|
List<AssessTeam> finishTeams = teams.stream().filter(o -> o.getStatus() == 2).collect(Collectors.toList());
|
||||||
if(teams.size() == finishTeams.size()){
|
if(teams.size() == finishTeams.size()){
|
||||||
Integer scoreWay = task.getScoreWay();
|
Integer scoreWay = task.getScoreWay();
|
||||||
BigDecimal assessScore;
|
List<Long> teamIds = finishTeams.stream().map(AssessTeam::getId).collect(Collectors.toList());
|
||||||
if(scoreWay == 1){
|
BigDecimal assessScore = calcScore(scoreWay,teamIds);
|
||||||
assessScore = finishTeams.stream().min(Comparator.comparing(AssessTeam::getAssessScore)).get().getAssessScore();
|
|
||||||
}else {
|
|
||||||
assessScore = finishTeams.stream().map(AssessTeam::getAssessScore).reduce(BigDecimal.ZERO,BigDecimal::add).divide(BigDecimal.valueOf(finishTeams.size()),2, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
Integer level = calcLevel(template, assessScore);
|
Integer level = calcLevel(template, assessScore);
|
||||||
AssessObject object = objectMapper.selectById(objectId);
|
AssessObject object = objectMapper.selectById(objectId);
|
||||||
object.setStatus(2);
|
object.setStatus(2);
|
||||||
|
|
@ -120,11 +116,26 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BigDecimal calcScore(Integer scoreWay, List<Long> teamIds) {
|
||||||
|
BigDecimal score = new BigDecimal(0);
|
||||||
|
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.entrySet().forEach(o->{
|
||||||
|
List<BigDecimal> value = o.getValue();
|
||||||
|
if (scoreWay == 1){
|
||||||
|
score.add(value.stream().min(BigDecimal::compareTo).get());
|
||||||
|
}else{
|
||||||
|
score.add(value.stream().reduce(BigDecimal.ZERO,BigDecimal::add).divide(BigDecimal.valueOf(value.size()),2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGroupId() {
|
public String getGroupId() {
|
||||||
return "assessTeamRating";
|
return "assessTeamRating";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AssessRatingVo> detail(Long teamId) {
|
public List<AssessRatingVo> doDetail(Long teamId) {
|
||||||
List<AssessRatingVo> list = this.baseMapper.scoreDetail(teamId);
|
List<AssessRatingVo> list = this.baseMapper.scoreDetail(teamId);
|
||||||
for (AssessRatingVo vo : list){
|
for (AssessRatingVo vo : list){
|
||||||
if(vo.getIsNeedRectify() == 1){
|
if(vo.getIsNeedRectify() == 1){
|
||||||
|
|
@ -146,6 +157,11 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
|
||||||
teamMapper.updateById(assessTeam);
|
teamMapper.updateById(assessTeam);
|
||||||
return this.saveBatch(ratings);
|
return this.saveBatch(ratings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Long,List<AssessRatingVo>> scoreDetail(Long objectId) {
|
||||||
|
List<AssessRatingVo> list = this.baseMapper.scoreByObjectId(objectId);
|
||||||
|
return list.stream().collect(Collectors.groupingBy(AssessTeamRating::getIndicatorId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue