Browse Source

判断节假日是否要补班

wuweihao 2 years ago
parent
commit
102acde6ef

File diff suppressed because it is too large
+ 1 - 0
gis_application/src/main/resources/static/holiday.json


+ 14 - 2
gis_dingtalk/src/main/java/com/gis/dingtalk/util/HolidayUtil.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.time.DayOfWeek;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 
 
 /**
 /**
@@ -67,8 +68,17 @@ public class HolidayUtil {
         }
         }
 
 
         // 是否法定假期
         // 是否法定假期
-         if (holiday.contains(now + "")){
-             return true;
+        String nowStr = now + "";
+         if (holiday.contains(nowStr)){
+
+             // 判断是否要节后补班
+             String dayKey = now.format(DateTimeFormatter.ofPattern("MM-dd"));
+             log.info("dayKey:{}", dayKey);
+             JSONObject resJson = JSONObject.parseObject(holiday);
+             // 2023-06-25
+             JSONObject dayJson = resJson.getJSONObject("holiday").getJSONObject(dayKey);
+             log.info("{}今天详情:{}", now, dayJson);
+             return dayJson.getBooleanValue("holiday");
          }
          }
 
 
          // 是否周末
          // 是否周末
@@ -98,6 +108,8 @@ public class HolidayUtil {
         // 获取当前日期
         // 获取当前日期
         LocalDate date = LocalDate.now();
         LocalDate date = LocalDate.now();
 
 
+        System.out.println(date.format(DateTimeFormatter.ofPattern("MM-dd")));
+
         DayOfWeek dayOfWeek = date.getDayOfWeek();
         DayOfWeek dayOfWeek = date.getDayOfWeek();
 
 
         System.out.println("11111111111111111");
         System.out.println("11111111111111111");