| | |
| | | AtomicInteger maternityLeaveCount = new AtomicInteger(0);//产假天数 |
| | | AtomicInteger attendanceDayCount = new AtomicInteger(0);//出勤天数 |
| | | AtomicDouble attendanceWorkHourCount = new AtomicDouble(0D);//出勤总时间 |
| | | for (int j = 0; j < shiftMapDtos.size(); j++) { |
| | | PerformanceShiftMapDto shiftMapDto = shiftMapDtos.get(j); |
| | | //统计各假期和公差的天数 |
| | | if(StringUtils.contains(shiftMapDto.getShiftName(),holidayLeaveKeyword)){ |
| | | holidayCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),personalLeaveKeyword)){ |
| | | personalLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),annualLeaveKeyword)){ |
| | | annualLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),officialTripKeyword)){ |
| | | officialTripCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),marriageLeaveKeyword)){ |
| | | marriageLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),bereavementLeaveKeyword)){ |
| | | bereavementLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){ |
| | | sickLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){ |
| | | maternityLeaveCount.getAndIncrement(); |
| | | } |
| | | if(StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){ |
| | | shiftList.add(shiftMapDto.getShiftName()); |
| | | }else{ |
| | | //过滤当前人员的班次信息 |
| | | StaffAttendanceVO vo = attendanceRecords.stream().filter(f->StringUtils.isNotBlank(f.getPersonCode())).filter(f -> StringUtils.equals(f.getPersonCode(), shiftMapDto.getPersonCode()) && f.getSwingDate().isEqual(shiftMapDto.getWorkTime())).findFirst().orElse(null); |
| | | if(ObjectUtils.isEmpty(vo)){ |
| | | shiftList.add(""); |
| | | for (int j = 0; j < attendanceDateList.size(); j++) { |
| | | LocalDate localDate = attendanceDateList.get(j); |
| | | PerformanceShiftMapDto shiftMapDto = shiftMapDtos.stream().filter(f -> f.getWorkTime().toLocalDate().equals(localDate)).findFirst().orElse(null); |
| | | if(Objects.nonNull(shiftMapDto)){ |
| | | //统计各假期和公差的天数 |
| | | if(StringUtils.contains(shiftMapDto.getShiftName(),holidayLeaveKeyword)){ |
| | | holidayCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),personalLeaveKeyword)){ |
| | | personalLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),annualLeaveKeyword)){ |
| | | annualLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),officialTripKeyword)){ |
| | | officialTripCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),marriageLeaveKeyword)){ |
| | | marriageLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),bereavementLeaveKeyword)){ |
| | | bereavementLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){ |
| | | sickLeaveCount.getAndIncrement(); |
| | | }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){ |
| | | maternityLeaveCount.getAndIncrement(); |
| | | } |
| | | if(StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){ |
| | | shiftList.add(shiftMapDto.getShiftName()); |
| | | }else{ |
| | | String actualWorkHours = Objects.toString(vo.getActualWorkHours(), ""); |
| | | Double diffHour = ObjectUtils.defaultIfNull(vo.getDiffHour(), 0D); |
| | | if (StringUtils.isBlank(actualWorkHours)) { |
| | | //过滤当前人员的班次信息 |
| | | StaffAttendanceVO vo = attendanceRecords.stream().filter(f->StringUtils.isNotBlank(f.getPersonCode())).filter(f -> StringUtils.equals(f.getPersonCode(), shiftMapDto.getPersonCode()) && f.getSwingDate().isEqual(shiftMapDto.getWorkTime())).findFirst().orElse(null); |
| | | if(ObjectUtils.isEmpty(vo)){ |
| | | shiftList.add(""); |
| | | } else { |
| | | shiftList.add(Double.compare(diffHour, 0D) < 0 ? "-" + actualWorkHours : actualWorkHours); |
| | | attendanceDayCount.getAndIncrement(); |
| | | attendanceWorkHourCount.getAndAdd(Double.parseDouble(actualWorkHours)); |
| | | }else{ |
| | | String actualWorkHours = Objects.toString(vo.getActualWorkHours(), ""); |
| | | Double diffHour = ObjectUtils.defaultIfNull(vo.getDiffHour(), 0D); |
| | | if (StringUtils.isBlank(actualWorkHours)) { |
| | | shiftList.add(""); |
| | | } else { |
| | | shiftList.add(Double.compare(diffHour, 0D) < 0 ? "-" + actualWorkHours : actualWorkHours); |
| | | attendanceDayCount.getAndIncrement(); |
| | | attendanceWorkHourCount.getAndAdd(Double.parseDouble(actualWorkHours)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //月度统计才插入批注数据 |
| | | if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){ |
| | | if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){ |
| | | annotationTextList.add(new StaffAttendanceAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText())); |
| | | //月度统计才插入批注数据 |
| | | if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){ |
| | | if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){ |
| | | annotationTextList.add(new StaffAttendanceAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText())); |
| | | } |
| | | } |
| | | }else{ |
| | | shiftList.add(""); |
| | | } |
| | | } |
| | | if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){ |