eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceLeaveService.java
@@ -23,6 +23,7 @@ import org.springframework.data.domain.Pageable; import java.text.ParseException; import java.time.LocalDateTime; import java.util.Map; import java.util.List; import java.io.IOException; @@ -97,13 +98,13 @@ * @return * @throws ParseException */ Double getOverTimeLength(Long userId) throws ParseException; Double getOverTimeLength(Long userId, LocalDateTime localDateTime) throws ParseException; Double getOverTimeLength(Long userId, String yearMonth) throws ParseException; Double getOverTimeCloseLength(Long userId); Double getOverTimeCloseLength(Long userId, LocalDateTime localDateTime); Double getOverTimeCurrentCloseLength(Long userId); Double getOverTimeCurrentCloseLength(Long userId, LocalDateTime localDateTime); /** * 审核功能 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceLeaveServiceImpl.java
@@ -537,8 +537,7 @@ * 获取用户调休假剩余时长 */ @Override public Double getOverTimeLength(Long userId) { LocalDateTime localDateTime = LocalDateTime.now(); public Double getOverTimeLength(Long userId, LocalDateTime localDateTime) { LocalDateTime startLocalDateTime = localDateTime.minusMonths(2L).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0); LocalDateTime endLocalDateTime = localDateTime.withDayOfMonth(1).plusMonths(1).minusDays(1).withHour(23).withMinute(59).withSecond(59); @@ -583,8 +582,7 @@ * 获取用户待结算(下月即将结算)调休假时长 */ @Override public Double getOverTimeCloseLength(Long userId) { LocalDateTime localDateTime = LocalDateTime.now(); public Double getOverTimeCloseLength(Long userId, LocalDateTime localDateTime) { LocalDateTime startLocalDateTime = localDateTime.minusMonths(2L).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0); LocalDateTime endLocalDateTime = localDateTime.minusMonths(1L).withDayOfMonth(1).minusDays(1).withHour(23).withMinute(59).withSecond(59); @@ -602,8 +600,7 @@ * 获取用户当月结算调休假时长 */ @Override public Double getOverTimeCurrentCloseLength(Long userId) { LocalDateTime localDateTime = LocalDateTime.now(); public Double getOverTimeCurrentCloseLength(Long userId, LocalDateTime localDateTime) { LocalDateTime startLocalDateTime = localDateTime.minusMonths(3L).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0); LocalDateTime endLocalDateTime = localDateTime.minusMonths(2L).withDayOfMonth(1).minusDays(1).withHour(23).withMinute(59).withSecond(59); eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthServiceImpl.java
@@ -43,6 +43,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.time.LocalDateTime; import java.util.*; import java.io.IOException; import javax.servlet.http.HttpServletResponse; @@ -318,7 +319,7 @@ Double yearTime = attendanceLeaveService.getYearTimeLength(attendanceMonth.getUserId()); map.put("剩余年假", yearTime); Double overTime = attendanceLeaveService.getOverTimeLength(attendanceMonth.getUserId()); Double overTime = attendanceLeaveService.getOverTimeLength(attendanceMonth.getUserId(), LocalDateTime.now()); map.put("剩余调休假", overTime); map.put("上班缺卡次数", attendanceMonth.getOnCardNumber()); eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/AttendanceMonthTalkServiceImpl.java
@@ -228,7 +228,7 @@ Double yearTime = attendanceLeaveService.getYearTimeLength(insertData.get(i).getUserId()); attendanceMonthLeave.setSurplusDuration(yearTime); } else if (leaveTpeList.get(i2).equals(Constant.LEAVE_TYPE_LACTATION_LEAVE)) { Double yearTime = attendanceLeaveService.getOverTimeLength(insertData.get(i).getUserId()); Double yearTime = attendanceLeaveService.getOverTimeLength(insertData.get(i).getUserId(), LocalDateTime.now()); attendanceMonthLeave.setSurplusDuration(yearTime); } attendanceMonthLeaveRepository.save(attendanceMonthLeave); eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -80,6 +80,7 @@ import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; @@ -1058,16 +1059,18 @@ }).sum(); returnData.put("leaveTimeHours", BigDecimal.valueOf(leaveTimeHours).setScale(2, RoundingMode.HALF_UP).doubleValue()); LocalDateTime targetDateTime = yearMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().withDayOfMonth(1).atStartOfDay(); // 换休剩余时长 Double overTime = attendanceLeaveService.getOverTimeLength(userId); Double overTime = attendanceLeaveService.getOverTimeLength(userId, targetDateTime); returnData.put("overTime", overTime); // 待结算(下月即将结算)换休时长 Double overTimeClose = attendanceLeaveService.getOverTimeCloseLength(userId); Double overTimeClose = attendanceLeaveService.getOverTimeCloseLength(userId, targetDateTime); returnData.put("overTimeClose", overTimeClose); // 本月结算换休时长 Double overTimeCurrentClose = attendanceLeaveService.getOverTimeCurrentCloseLength(userId); Double overTimeCurrentClose = attendanceLeaveService.getOverTimeCurrentCloseLength(userId, targetDateTime); returnData.put("overTimeCurrentClose", overTimeCurrentClose); // 出差天数 eladmin-master/eladmin-system/src/test/java/me/zhengjie/UserTest.java
@@ -518,7 +518,7 @@ @Test public void test100() throws ParseException { System.out.println(attendanceLeaveService.getOverTimeLength(60L)); System.out.println(attendanceLeaveService.getOverTimeLength(60L, LocalDateTime.now())); } @Test