| | |
| | | //获取年假剩余(新)
|
| | | Double surplusYearTime = new Double(0.00);
|
| | |
|
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndApprovalStatus(userId, Constant.OVERTIME_PASS);
|
| | | if (attendanceOvertimeList.size() > 0) {
|
| | | LocalDate localDateStart = LocalDate.now().withDayOfMonth(1).minusMonths(2);
|
| | | LocalDate localDateEnd = LocalDate.now().plusDays(1);
|
| | |
|
| | |
|
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndDate(userId, localDateStart.atStartOfDay(), localDateEnd.atStartOfDay());
|
| | | if (!attendanceOvertimeList.isEmpty()) {
|
| | | surplusYearTime = attendanceOvertimeList.stream()
|
| | | .filter(attendanceOvertime -> !attendanceOvertime.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))
|
| | | .map(attendanceOvertime -> attendanceOvertime.getOvertimeDuration()).reduce(0.0, (o1, o2) -> o1 + o2);
|
| | | Double usedTime = attendanceLeaveRepository.sumLeaveDurationByUserIdAndLeaveType(userId, Constant.LEAVE_TYPE_REPLACE);
|
| | | if (usedTime != null) {
|
| | | Double usedTime = attendanceLeaveRepository.findByUserIdAndDateAndLeaveType(userId, localDateStart.atStartOfDay(), localDateEnd.atStartOfDay(), Constant.LEAVE_TYPE_REPLACE).stream().mapToDouble(AttendanceLeave::getLeaveDuration).sum();
|
| | | if (usedTime > 0) {
|
| | | surplusYearTime = surplusYearTime - usedTime;
|
| | | }
|
| | | }
|
| | | return surplusYearTime;
|
| | | if (surplusYearTime <= 0.0) {
|
| | | return 0.0;
|
| | | }
|
| | | return BigDecimal.valueOf(surplusYearTime).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户调休假结算时长
|
| | | */
|
| | | @Override
|
| | | public Double getOverTimeCloseLength(Long userId) {
|
| | | //获取年假剩余(新)
|
| | | Double surplusYearTime = new Double(0.00);
|
| | |
|
| | | LocalDate localDateStart = LocalDate.now().withDayOfMonth(1).minusMonths(3);
|
| | | LocalDate localDateEnd = LocalDate.now().plusDays(1);
|
| | |
|
| | |
|
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndDate(userId, localDateStart.atStartOfDay(), localDateStart.plusMonths(1).withDayOfMonth(1).atStartOfDay());
|
| | | if (!attendanceOvertimeList.isEmpty()) {
|
| | | surplusYearTime = attendanceOvertimeList.stream()
|
| | | .filter(attendanceOvertime -> !attendanceOvertime.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))
|
| | | .map(attendanceOvertime -> attendanceOvertime.getOvertimeDuration()).reduce(0.0, (o1, o2) -> o1 + o2);
|
| | | Double usedTime = attendanceLeaveRepository.findByUserIdAndDateAndLeaveType(userId, localDateStart.atStartOfDay(), localDateEnd.atStartOfDay(), Constant.LEAVE_TYPE_REPLACE).stream().mapToDouble(AttendanceLeave::getLeaveDuration).sum();
|
| | | if (usedTime > 0) {
|
| | | surplusYearTime = surplusYearTime - usedTime;
|
| | | }
|
| | | }
|
| | | if (surplusYearTime <= 0.0) {
|
| | | return 0.0;
|
| | | }
|
| | | return BigDecimal.valueOf(surplusYearTime).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
| | | }
|
| | |
|
| | | /**
|