From 835d70b12626b458d84101e448e94a7e321cad43 Mon Sep 17 00:00:00 2001 From: fl <3098731433@qq.com> Date: Wed, 19 Feb 2025 13:59:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=8E=A8=E9=80=81=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../att/controller/AttHisPullController.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttHisPullController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttHisPullController.java index b154cf2..c0caa28 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttHisPullController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttHisPullController.java @@ -20,8 +20,12 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; /** * 考勤数据拉取控制层 @@ -46,6 +50,7 @@ public class AttHisPullController extends BaseController { public AjaxResult getAttTempData(AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); + Collections.reverse(dateList); for (String date : dateList) { attTask.insertAttDateHistory(date); attTask.insertAttTempData(date, 2); @@ -66,6 +71,7 @@ public class AttHisPullController extends BaseController { public AjaxResult getAttDataPull( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); + Collections.reverse(dateList); for (String date : dateList) { attTask.getAttendanceData(date,2); attTask.updateAttData(date,2); @@ -86,6 +92,7 @@ public class AttHisPullController extends BaseController { public AjaxResult getAbsenteeismData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); + Collections.reverse(dateList); for (String date : dateList) { attTask.updateAbsenteeismData(date,2); } @@ -105,6 +112,7 @@ public class AttHisPullController extends BaseController { public AjaxResult getLegalHolidayData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); + Collections.reverse(dateList); for (String date : dateList) { attTask.updateLegalHolidayData(date); } @@ -117,16 +125,15 @@ public class AttHisPullController extends BaseController { /** * 请假数据应用--请假 - * 每天更新两次上午8点,下午18点(45天前数据) + * 每天更新两次上午8点,下午18点(15天前数据) */ @GetMapping("/getLeaveData") @Log(title = "考勤数据拉取->请假数据应用--请假", businessType = BusinessType.QUERY) public AjaxResult getLeaveData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); - for (String date : dateList) { - attTask.updateLeaveData(date); - } + String lastDate = dateList.get(dateList.size() - 1); + attTask.updateLeaveData(lastDate); return toAjax(true); }catch (Exception e){ log.error(e.toString(),e); @@ -143,6 +150,7 @@ public class AttHisPullController extends BaseController { public AjaxResult insertDayReportData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); + Collections.reverse(dateList); for (String date : dateList) { attTask.insertDayReportData(date); } @@ -162,7 +170,12 @@ public class AttHisPullController extends BaseController { public AjaxResult insertMonthReportTempData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); - for (String date : dateList) { + List monthList = dateList.stream() + .map(LocalDate::parse) + .map(localDate -> localDate.format(DateTimeFormatter.ofPattern("yyyy-MM"))) + .distinct() + .collect(Collectors.toList()); + for (String date : monthList) { attTask.insertMonthReportTempData(date); } return toAjax(true); @@ -173,7 +186,7 @@ public class AttHisPullController extends BaseController { } /** - * 报表数据生成--月报表 + * 报表数据更新--月报表 * 每日数据变化修改之后修改 */ @GetMapping("/updateMonthReportData") @@ -181,7 +194,12 @@ public class AttHisPullController extends BaseController { public AjaxResult updateMonthReportData( AttDataDetailsBean bean) { try{ List dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate()); - for (String date : dateList) { + List monthList = dateList.stream() + .map(LocalDate::parse) + .map(localDate -> localDate.format(DateTimeFormatter.ofPattern("yyyy-MM"))) + .distinct() + .collect(Collectors.toList()); + for (String date : monthList) { attTask.updateMonthReportData(date); } return toAjax(true);