|
@@ -1987,7 +1987,7 @@ public class ReportController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/getWorkDays")
|
|
|
- public HttpRespMsg getWorkDays(String startDate, String endDate) {
|
|
|
+ public HttpRespMsg getWorkDays(String startDate, String endDate, String userId) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
if (token == null) {
|
|
@@ -2018,6 +2018,20 @@ public class ReportController {
|
|
|
//msg.setError("日期间隔不得超过365天");
|
|
|
msg.setError(MessageUtils.message("date.dateThan365"));
|
|
|
} else {
|
|
|
+ //如果传了人,需要按照人员的入职离职日期来过滤
|
|
|
+ if (userId != null) {
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ if (user != null) {
|
|
|
+ LocalDate entryDate = user.getInductionDate();
|
|
|
+ LocalDate leaveDate = user.getInactiveDate();
|
|
|
+ if (entryDate != null && entryDate.isAfter(localStartDate)) {
|
|
|
+ startDate = dateTimeFormatter.format(entryDate);
|
|
|
+ }
|
|
|
+ if (user.getIsActive() == 0 && leaveDate != null && leaveDate.isBefore(localEndDate)) {
|
|
|
+ endDate = dateTimeFormatter.format(leaveDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
msg.data = WorkDayCalculateUtils.getWorkDaysCountInRange(startDate, endDate, timeType.getIncludeWeekends());
|
|
|
}
|
|
|
}
|