团队统计

This commit is contained in:
aikai 2024-05-30 18:08:40 +08:00
parent cd8bcd203b
commit 628682bb8d
2 changed files with 17 additions and 1 deletions

View File

@ -29,11 +29,15 @@ public class TeamAttendanceStatisticsByCycleVO {
@Schema(description = "外勤")
private List<TeamAttendancePunchStatisticsVO> fieldServiceList;
@Schema(description = "顶部")
private TeamAttendanceStatisticsNumVO teamAttendanceStatisticsNumVO;
@Data
@Accessors(chain = true)
public static class TeamAttendanceStatisticsNumVO {
@Schema(description = "平均工时")
private BigDecimal averageWorkingHours;
private Long averageWorkingHours;
@Schema(description = "迟到次数")
private Integer beLateNum;

View File

@ -687,12 +687,24 @@ public class AttendanceServiceImpl implements AttendanceService {
fieldServiceList.add(averageWorkingHourVO.setTop(calculateNum.getTotalFieldServiceNumber() + "").setDown(""));
}
}
vo.setAverageWorkingHoursList(averageWorkingHours);
vo.setBeLateList(beLateList);
vo.setLeaveEarlyList(leaveEarlyList);
vo.setMissingCardList(missingCardList);
vo.setAbsenteeismList(absenteeismList);
vo.setFieldServiceList(fieldServiceList);
int sum = averageWorkingHours.stream().mapToInt(a -> a.getCalculateNum().getTotalAttendanceDays()).sum();
vo.setTeamAttendanceStatisticsNumVO(new TeamAttendanceStatisticsByCycleVO.TeamAttendanceStatisticsNumVO()
.setAverageWorkingHours(
sum == 0 ? 0 : averageWorkingHours.stream().mapToLong(a -> a.getCalculateNum().getTotalWorkingHours()).sum() / sum
)
.setBeLateNum(beLateList.stream().mapToInt(a -> a.getCalculateNum().getTotalLateArrivalsNumber()).sum())
.setLeaveEarlyNum(leaveEarlyList.stream().mapToInt(a -> a.getCalculateNum().getTotalEarlyDeparturesNumber()).sum())
.setMissingCardNum(missingCardList.stream().mapToInt(a -> a.getCalculateNum().getTotalMissingCardsNumber()).sum())
.setAbsenteeismNum(absenteeismList.stream().mapToInt(a -> a.getCalculateNum().getTotalMinerDays()).sum())
.setFieldServiceNum(fieldServiceList.stream().mapToInt(a -> a.getCalculateNum().getTotalFieldServiceNumber()).sum())
);
return vo;
}