Pārlūkot izejas kodu

消息提醒调整

dzx 1 gadu atpakaļ
vecāks
revīzija
217f304d01

+ 21 - 0
src/main/java/com/xjrsoft/module/job/AttenDanceWarnNoticeTask.java

@@ -12,6 +12,8 @@ import com.xjrsoft.module.attendance.entity.AttendanceUserRelation;
 import com.xjrsoft.module.attendance.mapper.AttendanceUserRelationMapper;
 import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
 import com.xjrsoft.module.concat.service.IXjrUserService;
+import com.xjrsoft.module.holiday.entity.HolidayDate;
+import com.xjrsoft.module.holiday.service.IHolidayDateService;
 import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
 import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.teacher.entity.XjrUser;
@@ -55,6 +57,9 @@ public class AttenDanceWarnNoticeTask {
     @Autowired
     private WeChatUtil weChatUtil;
 
+    @Autowired
+    private IHolidayDateService holidayDateService;
+
     @Scheduled(cron = "0 */1 * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
@@ -95,6 +100,22 @@ public class AttenDanceWarnNoticeTask {
             return;
         }
 
+        HolidayDate holidayDate = holidayDateService.getOne(
+                new QueryWrapper<HolidayDate>().lambda()
+                        .eq(HolidayDate::getDate, now.toLocalDate())
+        );
+        //查询到了数据,且当天不是“普通工作日”或“需要补班的工作日”
+        if(holidayDate != null && holidayDate.getWay() != null && holidayDate.getWay() != 0 && holidayDate.getWay() != 2){
+            log.info("非工作日,不需要提醒");
+            return;
+        }
+        //未查询到数据
+        String dayOfWeek = now.getDayOfWeek().name();
+        if(holidayDate == null || "SUNDAY".equals(dayOfWeek) || "SATURDAY".equals(dayOfWeek)){
+            log.info("非工作日,不需要提醒");
+            return;
+        }
+
         //获取最近的时间
         LocalDateTime recentlyTime = getRecentlyTime(ruleDetailsList, now);
         long minute = Math.abs(ChronoUnit.MINUTES.between(now, recentlyTime));