From f79bb90c66de4468019ef0dfeffb9581867258bb Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Wed, 28 Jan 2026 05:32:08 +0000
Subject: [PATCH] Merge branch 'wcd-2411-update' into wcd

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
index 52cd160..29071ea 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
@@ -40,6 +40,7 @@
 import me.zhengjie.modules.treatment.domain.UserLevelWage;
 import me.zhengjie.modules.treatment.repository.UserInsuranceRepository;
 import me.zhengjie.modules.treatment.repository.UserLevelWageRepository;
+import me.zhengjie.utils.DateUtil;
 import me.zhengjie.utils.QueryHelp;
 import me.zhengjie.utils.StringUtils;
 import me.zhengjie.modules.weixin.cp.api.WxCpOaWeDocSmartsheetService;
@@ -117,7 +118,7 @@
             // 用户列表
             List<User> userList = new ArrayList<>();
             // 获取企业微信考勤白名单
-            List<String> excludeList = dictDetailService.getDictByName("wecom_exclude_list").stream().map(i -> i.getValue()).collect(Collectors.toList());
+            List<String> excludeList = dictDetailService.getDictByName(Constant.DICT_WECOM_EXCLUDE_LIST).stream().map(i -> i.getValue()).collect(Collectors.toList());
             // 参数用户不为空(考勤按钮调用)
             if (ObjectUtils.isNotEmpty(attUser)) {
                 // 用户列表
@@ -219,7 +220,7 @@
             // 用户列表
             List<User> userList;
             // 获取企业微信考勤白名单
-            List<String> excludeList = dictDetailService.getDictByName("wecom_exclude_list").stream().map(i -> i.getValue()).collect(Collectors.toList());
+            List<String> excludeList = dictDetailService.getDictByName(Constant.DICT_WECOM_EXCLUDE_LIST).stream().map(i -> i.getValue()).collect(Collectors.toList());
             // 参数用户不为空(考勤按钮调用)
             if (ObjectUtils.isNotEmpty(attUser)) {
                 // 用户列表
@@ -367,7 +368,7 @@
             // 用户列表
             List<User> userList;
             // 获取企业微信考勤白名单
-            List<String> excludeList = dictDetailService.getDictByName("wecom_exclude_list").stream().map(i -> i.getValue()).collect(Collectors.toList());
+            List<String> excludeList = dictDetailService.getDictByName(Constant.DICT_WECOM_EXCLUDE_LIST).stream().map(i -> i.getValue()).collect(Collectors.toList());
             // 参数用户不为空(考勤按钮调用)
             if (ObjectUtils.isNotEmpty(attUser)) {
                 // 用户列表
@@ -519,7 +520,7 @@
             }
         }
         // 查询外出表
-        List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(), attendance.getRosteringWorkStartTime().toLocalDateTime(), attendance.getRosteringWorkEndTime().toLocalDateTime());
+        List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(), DateUtil.parseAttStartTime(attendance.getRosteringWorkStartTime().toLocalDateTime()), DateUtil.parseAttEndTime(attendance.getRosteringWorkEndTime().toLocalDateTime()));
         for (AttendanceGoOut attendanceGoOut : attendanceGoOutList) {
             // 上午/下午
             if (attendanceGoOut.getOutStartTime().toLocalDateTime().isBefore(attendance.getRosteringLunchStartTime().toLocalDateTime()) && attendanceGoOut.getOutEndTime().toLocalDateTime().compareTo(attendance.getRosteringLunchStartTime().toLocalDateTime()) <= 0) {
@@ -546,9 +547,9 @@
         // 查询考勤请假表
         List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.findByUserIdAndDate(user.getId(), startDate.toLocalDateTime(), endDate.toLocalDateTime());
         // 查询考勤出差表
-        List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.findByUserAndSEDate(user.getId(), attendance.getAttendanceDate().toLocalDateTime().withHour(0).withMinute(0).withSecond(0).withNano(0), attendance.getAttendanceDate().toLocalDateTime().withHour(23).withMinute(59).withSecond(59).withNano(999));
+        List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.findByUserAndSEDate(user.getId(), attendance.getAttendanceDate().toLocalDateTime().withHour(0).withMinute(0).withSecond(0).withNano(0), attendance.getAttendanceDate().toLocalDateTime().withHour(23).withMinute(59).withSecond(59).withNano(0));
         // 查询考勤外出表
-        List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(), attendance.getAttendanceDate().toLocalDateTime().withHour(0).withMinute(0).withSecond(0).withNano(0), attendance.getAttendanceDate().toLocalDateTime().withHour(23).withMinute(59).withSecond(59).withNano(999));
+        List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(), DateUtil.parseAttStartTime(attendance.getAttendanceDate().toLocalDateTime()), DateUtil.parseAttEndTime(attendance.getAttendanceDate().toLocalDateTime()));
 
         Double outStartDuration = new Double(0.00); // 上午时长
         Double outEndDuration = new Double(0.00); // 下午时长
@@ -815,16 +816,16 @@
             } else {
                 // 上午
                 if (day) {
-                    // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
-                    if (duration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+                    // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+                    if (duration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                         attendance.setStartClockResults(type);
                         attendance.setStartLocationResults(null);
                     } else {
                         attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME);
                     }
                 } else {
-                    // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
-                    if (duration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+                    // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+                    if (duration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                         attendance.setEndClockResults(type);
                         attendance.setEndLocationResults(null);
                     } else {
@@ -846,16 +847,16 @@
             } else {
                 //打卡的情况,修改考勤状态
                 if (day) {
-                    // TODO:20250805修改 排除休息日情况
-                    if ((duration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+                    // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+                    if ((duration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                         attendance.setStartClockResults(type);
                         attendance.setStartLocationResults(null);
                     } else {
                         attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME);
                     }
                 } else {
-                    // TODO:20250805修改 排除休息日情况
-                    if ((duration + noonResult1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+                    // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+                    if ((duration + noonResult1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                         attendance.setEndClockResults(type);
                         attendance.setEndLocationResults(null);
                     } else {
@@ -974,8 +975,8 @@
      */
     public void setAttendance(Double sDuration, Double eDuration, Double result, Double noonResult, Attendance attendance, String type) {
         if (ObjectUtils.isEmpty(eDuration) && ObjectUtils.isEmpty(noonResult)) {
-            // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
-            if (sDuration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+            // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+            if (sDuration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                 attendance.setStartClockResults(type);
                 attendance.setStartLocationResults(null);
             } else {
@@ -983,8 +984,8 @@
             }
         }
         if (ObjectUtils.isEmpty(sDuration) && ObjectUtils.isEmpty(result)) {
-            // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
-            if (eDuration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+            // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+            if (eDuration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                 attendance.setEndClockResults(type);
                 attendance.setEndLocationResults(null);
             } else {
@@ -1005,8 +1006,8 @@
      */
     public void setAttendanceStart(Double sDuration, Double eDuration, Double result1, Double result, Double noonResult, Attendance attendance, String type) {
         if (ObjectUtils.isEmpty(eDuration) && sDuration > 0) {
-            // TODO:20250805修改 排除休息日情况
-            if ((sDuration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+            // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+            if ((sDuration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                 attendance.setStartClockResults(type);
                 attendance.setStartLocationResults(null);
             } else {
@@ -1014,8 +1015,8 @@
             }
         }
         if (ObjectUtils.isEmpty(sDuration) && eDuration > 0) {
-            // TODO:20250805修改 排除休息日情况
-            if ((eDuration + result1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
+            // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环)
+            if ((eDuration + result1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) {
                 attendance.setEndClockResults(type);
                 attendance.setEndLocationResults(null);
             } else {

--
Gitblit v1.9.3