新增:对时间空值的判断

master
yangzhe123 2025-11-10 17:16:26 +08:00
parent 133c595733
commit 15d4a2bf89
5 changed files with 39 additions and 7 deletions

View File

@ -109,8 +109,12 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
<script>
select t.* from public.assess_task t
where t.status = 3
<if test = "obj.start != null">
and date_trunc('MONTH', t.start_date) <![CDATA[>=]]> #{obj.start}
</if>
<if test = "obj.end != null">
and date_trunc('MONTH', t.start_date) <![CDATA[<=]]> #{obj.end}
</if>
order by t.start_date
</script>
""")

View File

@ -84,8 +84,12 @@ public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
left join public.assess_team t1 on t.team_id = t1.id
left join public.assess_task t5 on t1.task_id = t5.id
where t.is_need_rectify = 1 and t5.status = 3
<if test ="obj.start !=null">
and date_trunc('MONTH', t5.start_date) <![CDATA[>=]]> #{obj.start}
</if>
<if test="obj.end !=null">
and date_trunc('MONTH', t5.start_date) <![CDATA[<=]]> #{obj.end}
</if>
</script>
""")
List<AssessTeamRating> rectifyStat(@Param("obj") MonthRangeSo monthRangeSo);

View File

@ -81,7 +81,7 @@ public class AssessObject implements Serializable {
* 1 2 3
*/
@TableField(value="assess_level")
@Schema(description="考核等级1优秀 2良好 3合格")
@Schema(description="考核等级1优秀 2良好 3合格 4不合格")
private Integer assessLevel;
/**

View File

@ -248,7 +248,24 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
return new HashMap<>();
}
List<AssessObject> objectList = list.stream().map(AssessTask::getAssessObjects).flatMap(List::stream).collect(Collectors.toList());
return objectList.stream().collect(Collectors.groupingBy(AssessObject::getAssessLevel,Collectors.counting()));
Map<Integer, Long> collect = objectList.stream().collect(Collectors.groupingBy(AssessObject::getAssessLevel, Collectors.counting()));
if(!collect.containsKey(1)){
//表示优秀的为0
collect.put(1,0L);
}
if(!collect.containsKey(2)){
//表示良好的为0
collect.put(2,0L);
}
if(!collect.containsKey(3)){
//表示合格的为0
collect.put(3,0L);
}
if(!collect.containsKey(4)){
//表示不合格的为0
collect.put(4,0L);
}
return collect;
}
}

View File

@ -239,7 +239,14 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
public Map<Integer, Long> rectifyStat(MonthRangeSo monthRangeSo) {
List<AssessTeamRating> list = this.baseMapper.rectifyStat(monthRangeSo);
return list.stream().collect(Collectors.groupingBy(AssessTeamRating::getRectifyStatus, Collectors.counting()));
Map<Integer, Long> collect = list.stream().collect(Collectors.groupingBy(AssessTeamRating::getRectifyStatus, Collectors.counting()));
if(!collect.containsKey(0)){
collect.put(0,0L);
}
if(!collect.containsKey(1)){
collect.put(1,0L);
}
return collect;
}
}