本文目录一览:
日常开发中,难免会用到判断今天是工作日、周末、法定节假日、节假日调休补班做一些业务处理,例如:仅在上班时间给用户推送消息。本文记录调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据
API介绍/d/file/gt/2024-03/2ha1clemkz3 这个API是在知乎(/d/file/gt/2024-03/qpboaanv21x /d/file/gt/2024-03/txdyogtf5ow,查询全年节假日、调休
这个API是在简书(https://www.jianshu/p/1e05e72b41fd)上看到的,官网是这个:http://timor/api/holiday
代码编写HolidayVo
/** * 节假日Vo */@Datapublic class HolidayVo { private String data;//日期 private String status;//状态:0工作日/1周末/2法定节假日/3节假日调休补班 private String msg;//描述}
HolidayUtil
/** * 节假日工具类 */public class HolidayUtil { /** * 发送get请求 */ private static String get(String url){ StringBuilder inputLine = new StringBuilder(); String read; try { HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); urlConnection.setReadTimeout(30 * 1000); urlConnection.setConnectTimeout(30 * 1000); urlConnection.setRequestProperty("Charset", "UTF-8"); urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36)"); BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StandardCharsets.UTF_8)); while ((read = in.readLine()) != null) { inputLineend(read); } in.close(); } catch (IOException e) { e.printStackTrace(); } return inputLine.toString(); } /** * 调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据 * 1、调用 /d/file/gt/2024-03/modi2mc24io 查询全年日历(含周末) * 2、调用 /d/file/gt/2024-03/txdyogtf5ow 查询全年节假日、调休 */ public static ArrayList<HolidayVo> getAllHolidayByYear(String year) throws IOException { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); ArrayList<HolidayVo> holidayVoList = new ArrayList<>(); HashMap<String,HolidayVo> hashMap = new HashMap<>(); //查询全年日历包含周末 String allDayJson = HolidayUtil.get("/d/file/gt/2024-03/dpnivvmmiam ObjectMapper mapper = new ObjectMapper(); Map allDayMap = mapper.readValue(allDayJson,Map.class); Map allDayData = (Map)allDayMap.get("data"); List allDayDataList = (List)allDayData.get("list"); allDayDataList.forEach((value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String YEAR = value1.get("year").toString(); String MONTH = value1.get("month").toString().replace(YEAR,""); String DAY = value1.get("date").toString().replace(YEAR+MONTH,""); holidayVo.setData(YEAR + "-" + MONTH + "-" + DAY); String STATUS = "0"; String msg = "工作日"; if("1".equals(value1.get("weekend").toString())){ STATUS = "1"; msg = "周末"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.put(holidayVo.getData(),holidayVo); }); //查询全年节假日、调休 String holidayJson = HolidayUtil.get("/d/file/gt/2024-03/0adrj0wmjjt + "/"); Map holidayMap = mapper.readValue(holidayJson,Map.class); LinkedHashMap holidayList = (LinkedHashMap)holidayMap.get("holiday"); holidayList.forEach((key,value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String dateTime = value1.get("date").toString(); holidayVo.setData(dateTime); String STATUS = "2"; String msg = "法定节假日("+value1.get("name").toString()+")"; if(value.toString()ntains("调休")){ STATUS = "3"; msg = "节假日调休补班("+value1.get("target").toString()+")"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.replace(holidayVo.getData(),holidayVo); }); for (String key : hashMap.keySet()) { holidayVoList.add(hashMap.get(key)); } //排序 holidayVoListrt((a,b)->{ try { return sf.parse(a.getData())pareTo(sf.parse(b.getData())); } catch (ParseException e) { e.printStackTrace(); } return 1; }); return holidayVoList; }} main测试
public static void main(String[] args) { try { ArrayList<HolidayVo> HolidayVoList = HolidayUtil.getAllHolidayByYear("2021"); System.err.println("全年完整数据:"); for (HolidayVo HolidayVo : HolidayVoList) { System.err.println(HolidayVo); } } catch (IOException e) { e.printStackTrace(); } } 效果
全年数据可存库,这样每年调用一次同步数据即可
HolidayVo(data=2021-01-01, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-02, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-03, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-04, status=0, msg=工作日)HolidayVo(data=2021-01-05, status=0, msg=工作日)HolidayVo(data=2021-01-06, status=0, msg=工作日)HolidayVo(data=2021-01-07, status=0, msg=工作日)HolidayVo(data=2021-01-08, status=0, msg=工作日)HolidayVo(data=2021-01-09, status=1, msg=周末)HolidayVo(data=2021-01-10, status=1, msg=周末)HolidayVo(data=2021-01-11, status=0, msg=工作日)HolidayVo(data=2021-01-12, status=0, msg=工作日)HolidayVo(data=2021-01-13, status=0, msg=工作日)HolidayVo(data=2021-01-14, status=0, msg=工作日)HolidayVo(data=2021-01-15, status=0, msg=工作日)HolidayVo(data=2021-01-16, status=1, msg=周末)HolidayVo(data=2021-01-17, status=1, msg=周末)HolidayVo(data=2021-01-18, status=0, msg=工作日)HolidayVo(data=2021-01-19, status=0, msg=工作日)HolidayVo(data=2021-01-20, status=0, msg=工作日)HolidayVo(data=2021-01-21, status=0, msg=工作日)HolidayVo(data=2021-01-22, status=0, msg=工作日)HolidayVo(data=2021-01-23, status=1, msg=周末)HolidayVo(data=2021-01-24, status=1, msg=周末)HolidayVo(data=2021-01-25, status=0, msg=工作日)HolidayVo(data=2021-01-26, status=0, msg=工作日)HolidayVo(data=2021-01-27, status=0, msg=工作日)HolidayVo(data=2021-01-28, status=0, msg=工作日)HolidayVo(data=2021-01-29, status=0, msg=工作日)HolidayVo(data=2021-01-30, status=1, msg=周末)HolidayVo(data=2021-01-31, status=1, msg=周末)HolidayVo(data=2021-02-01, status=0, msg=工作日)HolidayVo(data=2021-02-02, status=0, msg=工作日)HolidayVo(data=2021-02-03, status=0, msg=工作日)HolidayVo(data=2021-02-04, status=0, msg=工作日)HolidayVo(data=2021-02-05, status=0, msg=工作日)HolidayVo(data=2021-02-06, status=1, msg=周末)HolidayVo(data=2021-02-07, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-08, status=0, msg=工作日)HolidayVo(data=2021-02-09, status=0, msg=工作日)HolidayVo(data=2021-02-10, status=0, msg=工作日)HolidayVo(data=2021-02-11, status=2, msg=法定节假日(除夕))HolidayVo(data=2021-02-12, status=2, msg=法定节假日(初一))HolidayVo(data=2021-02-13, status=2, msg=法定节假日(初二))HolidayVo(data=2021-02-14, status=2, msg=法定节假日(初三))HolidayVo(data=2021-02-15, status=2, msg=法定节假日(初四))HolidayVo(data=2021-02-16, status=2, msg=法定节假日(初五))HolidayVo(data=2021-02-17, status=2, msg=法定节假日(初六))HolidayVo(data=2021-02-18, status=0, msg=工作日)HolidayVo(data=2021-02-19, status=0, msg=工作日)HolidayVo(data=2021-02-20, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-21, status=1, msg=周末)HolidayVo(data=2021-02-22, status=0, msg=工作日)HolidayVo(data=2021-02-23, status=0, msg=工作日)HolidayVo(data=2021-02-24, status=0, msg=工作日)HolidayVo(data=2021-02-25, status=0, msg=工作日)HolidayVo(data=2021-02-26, status=0, msg=工作日)HolidayVo(data=2021-02-27, status=1, msg=周末)HolidayVo(data=2021-02-28, status=1, msg=周末)HolidayVo(data=2021-03-01, status=0, msg=工作日)HolidayVo(data=2021-03-02, status=0, msg=工作日)HolidayVo(data=2021-03-03, status=0, msg=工作日)HolidayVo(data=2021-03-04, status=0, msg=工作日)HolidayVo(data=2021-03-05, status=0, msg=工作日)HolidayVo(data=2021-03-06, status=1, msg=周末)HolidayVo(data=2021-03-07, status=1, msg=周末)HolidayVo(data=2021-03-08, status=0, msg=工作日)HolidayVo(data=2021-03-09, status=0, msg=工作日)HolidayVo(data=2021-03-10, status=0, msg=工作日)HolidayVo(data=2021-03-11, status=0, msg=工作日)HolidayVo(data=2021-03-12, status=0, msg=工作日)HolidayVo(data=2021-03-13, status=1, msg=周末)HolidayVo(data=2021-03-14, status=1, msg=周末)HolidayVo(data=2021-03-15, status=0, msg=工作日)HolidayVo(data=2021-03-16, status=0, msg=工作日)HolidayVo(data=2021-03-17, status=0, msg=工作日)HolidayVo(data=2021-03-18, status=0, msg=工作日)HolidayVo(data=2021-03-19, status=0, msg=工作日)HolidayVo(data=2021-03-20, status=1, msg=周末)HolidayVo(data=2021-03-21, status=1, msg=周末)HolidayVo(data=2021-03-22, status=0, msg=工作日)HolidayVo(data=2021-03-23, status=0, msg=工作日)HolidayVo(data=2021-03-24, status=0, msg=工作日)HolidayVo(data=2021-03-25, status=0, msg=工作日)HolidayVo(data=2021-03-26, status=0, msg=工作日)HolidayVo(data=2021-03-27, status=1, msg=周末)HolidayVo(data=2021-03-28, status=1, msg=周末)HolidayVo(data=2021-03-29, status=0, msg=工作日)HolidayVo(data=2021-03-30, status=0, msg=工作日)HolidayVo(data=2021-03-31, status=0, msg=工作日)HolidayVo(data=2021-04-01, status=0, msg=工作日)HolidayVo(data=2021-04-02, status=0, msg=工作日)HolidayVo(data=2021-04-03, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-04, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-05, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-06, status=0, msg=工作日)HolidayVo(data=2021-04-07, status=0, msg=工作日)HolidayVo(data=2021-04-08, status=0, msg=工作日)HolidayVo(data=2021-04-09, status=0, msg=工作日)HolidayVo(data=2021-04-10, status=1, msg=周末)HolidayVo(data=2021-04-11, status=1, msg=周末)HolidayVo(data=2021-04-12, status=0, msg=工作日)HolidayVo(data=2021-04-13, status=0, msg=工作日)HolidayVo(data=2021-04-14, status=0, msg=工作日)HolidayVo(data=2021-04-15, status=0, msg=工作日)HolidayVo(data=2021-04-16, status=0, msg=工作日)HolidayVo(data=2021-04-17, status=1, msg=周末)HolidayVo(data=2021-04-18, status=1, msg=周末)HolidayVo(data=2021-04-19, status=0, msg=工作日)HolidayVo(data=2021-04-20, status=0, msg=工作日)HolidayVo(data=2021-04-21, status=0, msg=工作日)HolidayVo(data=2021-04-22, status=0, msg=工作日)HolidayVo(data=2021-04-23, status=0, msg=工作日)HolidayVo(data=2021-04-24, status=1, msg=周末)HolidayVo(data=2021-04-25, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-04-26, status=0, msg=工作日)HolidayVo(data=2021-04-27, status=0, msg=工作日)HolidayVo(data=2021-04-28, status=0, msg=工作日)HolidayVo(data=2021-04-29, status=0, msg=工作日)HolidayVo(data=2021-04-30, status=0, msg=工作日)HolidayVo(data=2021-05-01, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-02, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-03, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-04, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-05, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-06, status=0, msg=工作日)HolidayVo(data=2021-05-07, status=0, msg=工作日)HolidayVo(data=2021-05-08, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-05-09, status=1, msg=周末)HolidayVo(data=2021-05-10, status=0, msg=工作日)HolidayVo(data=2021-05-11, status=0, msg=工作日)HolidayVo(data=2021-05-12, status=0, msg=工作日)HolidayVo(data=2021-05-13, status=0, msg=工作日)HolidayVo(data=2021-05-14, status=0, msg=工作日)HolidayVo(data=2021-05-15, status=1, msg=周末)HolidayVo(data=2021-05-16, status=1, msg=周末)HolidayVo(data=2021-05-17, status=0, msg=工作日)HolidayVo(data=2021-05-18, status=0, msg=工作日)HolidayVo(data=2021-05-19, status=0, msg=工作日)HolidayVo(data=2021-05-20, status=0, msg=工作日)HolidayVo(data=2021-05-21, status=0, msg=工作日)HolidayVo(data=2021-05-22, status=1, msg=周末)HolidayVo(data=2021-05-23, status=1, msg=周末)HolidayVo(data=2021-05-24, status=0, msg=工作日)HolidayVo(data=2021-05-25, status=0, msg=工作日)HolidayVo(data=2021-05-26, status=0, msg=工作日)HolidayVo(data=2021-05-27, status=0, msg=工作日)HolidayVo(data=2021-05-28, status=0, msg=工作日)HolidayVo(data=2021-05-29, status=1, msg=周末)HolidayVo(data=2021-05-30, status=1, msg=周末)HolidayVo(data=2021-05-31, status=0, msg=工作日)HolidayVo(data=2021-06-01, status=0, msg=工作日)HolidayVo(data=2021-06-02, status=0, msg=工作日)HolidayVo(data=2021-06-03, status=0, msg=工作日)HolidayVo(data=2021-06-04, status=0, msg=工作日)HolidayVo(data=2021-06-05, status=1, msg=周末)HolidayVo(data=2021-06-06, status=1, msg=周末)HolidayVo(data=2021-06-07, status=0, msg=工作日)HolidayVo(data=2021-06-08, status=0, msg=工作日)HolidayVo(data=2021-06-09, status=0, msg=工作日)HolidayVo(data=2021-06-10, status=0, msg=工作日)HolidayVo(data=2021-06-11, status=0, msg=工作日)HolidayVo(data=2021-06-12, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-13, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-14, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-15, status=0, msg=工作日)HolidayVo(data=2021-06-16, status=0, msg=工作日)HolidayVo(data=2021-06-17, status=0, msg=工作日)HolidayVo(data=2021-06-18, status=0, msg=工作日)HolidayVo(data=2021-06-19, status=1, msg=周末)HolidayVo(data=2021-06-20, status=1, msg=周末)HolidayVo(data=2021-06-21, status=0, msg=工作日)HolidayVo(data=2021-06-22, status=0, msg=工作日)HolidayVo(data=2021-06-23, status=0, msg=工作日)HolidayVo(data=2021-06-24, status=0, msg=工作日)HolidayVo(data=2021-06-25, status=0, msg=工作日)HolidayVo(data=2021-06-26, status=1, msg=周末)HolidayVo(data=2021-06-27, status=1, msg=周末)HolidayVo(data=2021-06-28, status=0, msg=工作日)HolidayVo(data=2021-06-29, status=0, msg=工作日)HolidayVo(data=2021-06-30, status=0, msg=工作日)HolidayVo(data=2021-07-01, status=0, msg=工作日)HolidayVo(data=2021-07-02, status=0, msg=工作日)HolidayVo(data=2021-07-03, status=1, msg=周末)HolidayVo(data=2021-07-04, status=1, msg=周末)HolidayVo(data=2021-07-05, status=0, msg=工作日)HolidayVo(data=2021-07-06, status=0, msg=工作日)HolidayVo(data=2021-07-07, status=0, msg=工作日)HolidayVo(data=2021-07-08, status=0, msg=工作日)HolidayVo(data=2021-07-09, status=0, msg=工作日)HolidayVo(data=2021-07-10, status=1, msg=周末)HolidayVo(data=2021-07-11, status=1, msg=周末)HolidayVo(data=2021-07-12, status=0, msg=工作日)HolidayVo(data=2021-07-13, status=0, msg=工作日)HolidayVo(data=2021-07-14, status=0, msg=工作日)HolidayVo(data=2021-07-15, status=0, msg=工作日)HolidayVo(data=2021-07-16, status=0, msg=工作日)HolidayVo(data=2021-07-17, status=1, msg=周末)HolidayVo(data=2021-07-18, status=1, msg=周末)HolidayVo(data=2021-07-19, status=0, msg=工作日)HolidayVo(data=2021-07-20, status=0, msg=工作日)HolidayVo(data=2021-07-21, status=0, msg=工作日)HolidayVo(data=2021-07-22, status=0, msg=工作日)HolidayVo(data=2021-07-23, status=0, msg=工作日)HolidayVo(data=2021-07-24, status=1, msg=周末)HolidayVo(data=2021-07-25, status=1, msg=周末)HolidayVo(data=2021-07-26, status=0, msg=工作日)HolidayVo(data=2021-07-27, status=0, msg=工作日)HolidayVo(data=2021-07-28, status=0, msg=工作日)HolidayVo(data=2021-07-29, status=0, msg=工作日)HolidayVo(data=2021-07-30, status=0, msg=工作日)HolidayVo(data=2021-07-31, status=1, msg=周末)HolidayVo(data=2021-08-01, status=1, msg=周末)HolidayVo(data=2021-08-02, status=0, msg=工作日)HolidayVo(data=2021-08-03, status=0, msg=工作日)HolidayVo(data=2021-08-04, status=0, msg=工作日)HolidayVo(data=2021-08-05, status=0, msg=工作日)HolidayVo(data=2021-08-06, status=0, msg=工作日)HolidayVo(data=2021-08-07, status=1, msg=周末)HolidayVo(data=2021-08-08, status=1, msg=周末)HolidayVo(data=2021-08-09, status=0, msg=工作日)HolidayVo(data=2021-08-10, status=0, msg=工作日)HolidayVo(data=2021-08-11, status=0, msg=工作日)HolidayVo(data=2021-08-12, status=0, msg=工作日)HolidayVo(data=2021-08-13, status=0, msg=工作日)HolidayVo(data=2021-08-14, status=1, msg=周末)HolidayVo(data=2021-08-15, status=1, msg=周末)HolidayVo(data=2021-08-16, status=0, msg=工作日)HolidayVo(data=2021-08-17, status=0, msg=工作日)HolidayVo(data=2021-08-18, status=0, msg=工作日)HolidayVo(data=2021-08-19, status=0, msg=工作日)HolidayVo(data=2021-08-20, status=0, msg=工作日)HolidayVo(data=2021-08-21, status=1, msg=周末)HolidayVo(data=2021-08-22, status=1, msg=周末)HolidayVo(data=2021-08-23, status=0, msg=工作日)HolidayVo(data=2021-08-24, status=0, msg=工作日)HolidayVo(data=2021-08-25, status=0, msg=工作日)HolidayVo(data=2021-08-26, status=0, msg=工作日)HolidayVo(data=2021-08-27, status=0, msg=工作日)HolidayVo(data=2021-08-28, status=1, msg=周末)HolidayVo(data=2021-08-29, status=1, msg=周末)HolidayVo(data=2021-08-30, status=0, msg=工作日)HolidayVo(data=2021-08-31, status=0, msg=工作日)HolidayVo(data=2021-09-01, status=0, msg=工作日)HolidayVo(data=2021-09-02, status=0, msg=工作日)HolidayVo(data=2021-09-03, status=0, msg=工作日)HolidayVo(data=2021-09-04, status=1, msg=周末)HolidayVo(data=2021-09-05, status=1, msg=周末)HolidayVo(data=2021-09-06, status=0, msg=工作日)HolidayVo(data=2021-09-07, status=0, msg=工作日)HolidayVo(data=2021-09-08, status=0, msg=工作日)HolidayVo(data=2021-09-09, status=0, msg=工作日)HolidayVo(data=2021-09-10, status=0, msg=工作日)HolidayVo(data=2021-09-11, status=1, msg=周末)HolidayVo(data=2021-09-12, status=1, msg=周末)HolidayVo(data=2021-09-13, status=0, msg=工作日)HolidayVo(data=2021-09-14, status=0, msg=工作日)HolidayVo(data=2021-09-15, status=0, msg=工作日)HolidayVo(data=2021-09-16, status=0, msg=工作日)HolidayVo(data=2021-09-17, status=0, msg=工作日)HolidayVo(data=2021-09-18, status=3, msg=节假日调休补班(中秋节))HolidayVo(data=2021-09-19, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-20, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-21, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-22, status=0, msg=工作日)HolidayVo(data=2021-09-23, status=0, msg=工作日)HolidayVo(data=2021-09-24, status=0, msg=工作日)HolidayVo(data=2021-09-25, status=1, msg=周末)HolidayVo(data=2021-09-26, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-09-27, status=0, msg=工作日)HolidayVo(data=2021-09-28, status=0, msg=工作日)HolidayVo(data=2021-09-29, status=0, msg=工作日)HolidayVo(data=2021-09-30, status=0, msg=工作日)HolidayVo(data=2021-10-01, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-02, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-03, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-04, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-05, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-06, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-07, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-08, status=0, msg=工作日)HolidayVo(data=2021-10-09, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-10-10, status=1, msg=周末)HolidayVo(data=2021-10-11, status=0, msg=工作日)HolidayVo(data=2021-10-12, status=0, msg=工作日)HolidayVo(data=2021-10-13, status=0, msg=工作日)HolidayVo(data=2021-10-14, status=0, msg=工作日)HolidayVo(data=2021-10-15, status=0, msg=工作日)HolidayVo(data=2021-10-16, status=1, msg=周末)HolidayVo(data=2021-10-17, status=1, msg=周末)HolidayVo(data=2021-10-18, status=0, msg=工作日)HolidayVo(data=2021-10-19, status=0, msg=工作日)HolidayVo(data=2021-10-20, status=0, msg=工作日)HolidayVo(data=2021-10-21, status=0, msg=工作日)HolidayVo(data=2021-10-22, status=0, msg=工作日)HolidayVo(data=2021-10-23, status=1, msg=周末)HolidayVo(data=2021-10-24, status=1, msg=周末)HolidayVo(data=2021-10-25, status=0, msg=工作日)HolidayVo(data=2021-10-26, status=0, msg=工作日)HolidayVo(data=2021-10-27, status=0, msg=工作日)HolidayVo(data=2021-10-28, status=0, msg=工作日)HolidayVo(data=2021-10-29, status=0, msg=工作日)HolidayVo(data=2021-10-30, status=1, msg=周末)HolidayVo(data=2021-10-31, status=1, msg=周末)HolidayVo(data=2021-11-01, status=0, msg=工作日)HolidayVo(data=2021-11-02, status=0, msg=工作日)HolidayVo(data=2021-11-03, status=0, msg=工作日)HolidayVo(data=2021-11-04, status=0, msg=工作日)HolidayVo(data=2021-11-05, status=0, msg=工作日)HolidayVo(data=2021-11-06, status=1, msg=周末)HolidayVo(data=2021-11-07, status=1, msg=周末)HolidayVo(data=2021-11-08, status=0, msg=工作日)HolidayVo(data=2021-11-09, status=0, msg=工作日)HolidayVo(data=2021-11-10, status=0, msg=工作日)HolidayVo(data=2021-11-11, status=0, msg=工作日)HolidayVo(data=2021-11-12, status=0, msg=工作日)HolidayVo(data=2021-11-13, status=1, msg=周末)HolidayVo(data=2021-11-14, status=1, msg=周末)HolidayVo(data=2021-11-15, status=0, msg=工作日)HolidayVo(data=2021-11-16, status=0, msg=工作日)HolidayVo(data=2021-11-17, status=0, msg=工作日)HolidayVo(data=2021-11-18, status=0, msg=工作日)HolidayVo(data=2021-11-19, status=0, msg=工作日)HolidayVo(data=2021-11-20, status=1, msg=周末)HolidayVo(data=2021-11-21, status=1, msg=周末)HolidayVo(data=2021-11-22, status=0, msg=工作日)HolidayVo(data=2021-11-23, status=0, msg=工作日)HolidayVo(data=2021-11-24, status=0, msg=工作日)HolidayVo(data=2021-11-25, status=0, msg=工作日)HolidayVo(data=2021-11-26, status=0, msg=工作日)HolidayVo(data=2021-11-27, status=1, msg=周末)HolidayVo(data=2021-11-28, status=1, msg=周末)HolidayVo(data=2021-11-29, status=0, msg=工作日)HolidayVo(data=2021-11-30, status=0, msg=工作日)HolidayVo(data=2021-12-01, status=0, msg=工作日)HolidayVo(data=2021-12-02, status=0, msg=工作日)HolidayVo(data=2021-12-03, status=0, msg=工作日)HolidayVo(data=2021-12-04, status=1, msg=周末)HolidayVo(data=2021-12-05, status=1, msg=周末)HolidayVo(data=2021-12-06, status=0, msg=工作日)HolidayVo(data=2021-12-07, status=0, msg=工作日)HolidayVo(data=2021-12-08, status=0, msg=工作日)HolidayVo(data=2021-12-09, status=0, msg=工作日)HolidayVo(data=2021-12-10, status=0, msg=工作日)HolidayVo(data=2021-12-11, status=1, msg=周末)HolidayVo(data=2021-12-12, status=1, msg=周末)HolidayVo(data=2021-12-13, status=0, msg=工作日)HolidayVo(data=2021-12-14, status=0, msg=工作日)HolidayVo(data=2021-12-15, status=0, msg=工作日)HolidayVo(data=2021-12-16, status=0, msg=工作日)HolidayVo(data=2021-12-17, status=0, msg=工作日)HolidayVo(data=2021-12-18, status=1, msg=周末)HolidayVo(data=2021-12-19, status=1, msg=周末)HolidayVo(data=2021-12-20, status=0, msg=工作日)HolidayVo(data=2021-12-21, status=0, msg=工作日)HolidayVo(data=2021-12-22, status=0, msg=工作日)HolidayVo(data=2021-12-23, status=0, msg=工作日)HolidayVo(data=2021-12-24, status=0, msg=工作日)HolidayVo(data=2021-12-25, status=1, msg=周末)HolidayVo(data=2021-12-26, status=1, msg=周末)HolidayVo(data=2021-12-27, status=0, msg=工作日)HolidayVo(data=2021-12-28, status=0, msg=工作日)HolidayVo(data=2021-12-29, status=0, msg=工作日)HolidayVo(data=2021-12-30, status=0, msg=工作日)HolidayVo(data=2021-12-31, status=0, msg=工作日) 代码开源
注:数据库文件在resources/static/sql目录下面
代码已经开源、托管到我的GitHub、码云:
GitHub:https://github/huanzi-qch/base-admin
码云:https://gitee/huanzi-qch/base-admin
版权声明作者:huanzi-qch
出处:https://wwwblogs/huanzi-qch
若标题中有“转载”字样,则本文版权归原作者所有。若无转载字样,本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利.
日常开发中,难免会用到判断今天是工作日、周末、法定节假日、节假日调休补班做一些业务处理,例如:仅在上班时间给用户推送消息。本文记录调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据
API介绍/d/file/gt/2024-03/2ha1clemkz3 这个API是在知乎(/d/file/gt/2024-03/qpboaanv21x /d/file/gt/2024-03/txdyogtf5ow,查询全年节假日、调休
这个API是在简书(https://www.jianshu/p/1e05e72b41fd)上看到的,官网是这个:http://timor/api/holiday
代码编写HolidayVo
/** * 节假日Vo */@Datapublic class HolidayVo { private String data;//日期 private String status;//状态:0工作日/1周末/2法定节假日/3节假日调休补班 private String msg;//描述}
HolidayUtil
/** * 节假日工具类 */public class HolidayUtil { /** * 发送get请求 */ private static String get(String url){ StringBuilder inputLine = new StringBuilder(); String read; try { HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); urlConnection.setReadTimeout(30 * 1000); urlConnection.setConnectTimeout(30 * 1000); urlConnection.setRequestProperty("Charset", "UTF-8"); urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36)"); BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StandardCharsets.UTF_8)); while ((read = in.readLine()) != null) { inputLineend(read); } in.close(); } catch (IOException e) { e.printStackTrace(); } return inputLine.toString(); } /** * 调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据 * 1、调用 /d/file/gt/2024-03/modi2mc24io 查询全年日历(含周末) * 2、调用 /d/file/gt/2024-03/txdyogtf5ow 查询全年节假日、调休 */ public static ArrayList<HolidayVo> getAllHolidayByYear(String year) throws IOException { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); ArrayList<HolidayVo> holidayVoList = new ArrayList<>(); HashMap<String,HolidayVo> hashMap = new HashMap<>(); //查询全年日历包含周末 String allDayJson = HolidayUtil.get("/d/file/gt/2024-03/dpnivvmmiam ObjectMapper mapper = new ObjectMapper(); Map allDayMap = mapper.readValue(allDayJson,Map.class); Map allDayData = (Map)allDayMap.get("data"); List allDayDataList = (List)allDayData.get("list"); allDayDataList.forEach((value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String YEAR = value1.get("year").toString(); String MONTH = value1.get("month").toString().replace(YEAR,""); String DAY = value1.get("date").toString().replace(YEAR+MONTH,""); holidayVo.setData(YEAR + "-" + MONTH + "-" + DAY); String STATUS = "0"; String msg = "工作日"; if("1".equals(value1.get("weekend").toString())){ STATUS = "1"; msg = "周末"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.put(holidayVo.getData(),holidayVo); }); //查询全年节假日、调休 String holidayJson = HolidayUtil.get("/d/file/gt/2024-03/0adrj0wmjjt + "/"); Map holidayMap = mapper.readValue(holidayJson,Map.class); LinkedHashMap holidayList = (LinkedHashMap)holidayMap.get("holiday"); holidayList.forEach((key,value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String dateTime = value1.get("date").toString(); holidayVo.setData(dateTime); String STATUS = "2"; String msg = "法定节假日("+value1.get("name").toString()+")"; if(value.toString()ntains("调休")){ STATUS = "3"; msg = "节假日调休补班("+value1.get("target").toString()+")"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.replace(holidayVo.getData(),holidayVo); }); for (String key : hashMap.keySet()) { holidayVoList.add(hashMap.get(key)); } //排序 holidayVoListrt((a,b)->{ try { return sf.parse(a.getData())pareTo(sf.parse(b.getData())); } catch (ParseException e) { e.printStackTrace(); } return 1; }); return holidayVoList; }} main测试
public static void main(String[] args) { try { ArrayList<HolidayVo> HolidayVoList = HolidayUtil.getAllHolidayByYear("2021"); System.err.println("全年完整数据:"); for (HolidayVo HolidayVo : HolidayVoList) { System.err.println(HolidayVo); } } catch (IOException e) { e.printStackTrace(); } } 效果
全年数据可存库,这样每年调用一次同步数据即可
HolidayVo(data=2021-01-01, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-02, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-03, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-04, status=0, msg=工作日)HolidayVo(data=2021-01-05, status=0, msg=工作日)HolidayVo(data=2021-01-06, status=0, msg=工作日)HolidayVo(data=2021-01-07, status=0, msg=工作日)HolidayVo(data=2021-01-08, status=0, msg=工作日)HolidayVo(data=2021-01-09, status=1, msg=周末)HolidayVo(data=2021-01-10, status=1, msg=周末)HolidayVo(data=2021-01-11, status=0, msg=工作日)HolidayVo(data=2021-01-12, status=0, msg=工作日)HolidayVo(data=2021-01-13, status=0, msg=工作日)HolidayVo(data=2021-01-14, status=0, msg=工作日)HolidayVo(data=2021-01-15, status=0, msg=工作日)HolidayVo(data=2021-01-16, status=1, msg=周末)HolidayVo(data=2021-01-17, status=1, msg=周末)HolidayVo(data=2021-01-18, status=0, msg=工作日)HolidayVo(data=2021-01-19, status=0, msg=工作日)HolidayVo(data=2021-01-20, status=0, msg=工作日)HolidayVo(data=2021-01-21, status=0, msg=工作日)HolidayVo(data=2021-01-22, status=0, msg=工作日)HolidayVo(data=2021-01-23, status=1, msg=周末)HolidayVo(data=2021-01-24, status=1, msg=周末)HolidayVo(data=2021-01-25, status=0, msg=工作日)HolidayVo(data=2021-01-26, status=0, msg=工作日)HolidayVo(data=2021-01-27, status=0, msg=工作日)HolidayVo(data=2021-01-28, status=0, msg=工作日)HolidayVo(data=2021-01-29, status=0, msg=工作日)HolidayVo(data=2021-01-30, status=1, msg=周末)HolidayVo(data=2021-01-31, status=1, msg=周末)HolidayVo(data=2021-02-01, status=0, msg=工作日)HolidayVo(data=2021-02-02, status=0, msg=工作日)HolidayVo(data=2021-02-03, status=0, msg=工作日)HolidayVo(data=2021-02-04, status=0, msg=工作日)HolidayVo(data=2021-02-05, status=0, msg=工作日)HolidayVo(data=2021-02-06, status=1, msg=周末)HolidayVo(data=2021-02-07, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-08, status=0, msg=工作日)HolidayVo(data=2021-02-09, status=0, msg=工作日)HolidayVo(data=2021-02-10, status=0, msg=工作日)HolidayVo(data=2021-02-11, status=2, msg=法定节假日(除夕))HolidayVo(data=2021-02-12, status=2, msg=法定节假日(初一))HolidayVo(data=2021-02-13, status=2, msg=法定节假日(初二))HolidayVo(data=2021-02-14, status=2, msg=法定节假日(初三))HolidayVo(data=2021-02-15, status=2, msg=法定节假日(初四))HolidayVo(data=2021-02-16, status=2, msg=法定节假日(初五))HolidayVo(data=2021-02-17, status=2, msg=法定节假日(初六))HolidayVo(data=2021-02-18, status=0, msg=工作日)HolidayVo(data=2021-02-19, status=0, msg=工作日)HolidayVo(data=2021-02-20, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-21, status=1, msg=周末)HolidayVo(data=2021-02-22, status=0, msg=工作日)HolidayVo(data=2021-02-23, status=0, msg=工作日)HolidayVo(data=2021-02-24, status=0, msg=工作日)HolidayVo(data=2021-02-25, status=0, msg=工作日)HolidayVo(data=2021-02-26, status=0, msg=工作日)HolidayVo(data=2021-02-27, status=1, msg=周末)HolidayVo(data=2021-02-28, status=1, msg=周末)HolidayVo(data=2021-03-01, status=0, msg=工作日)HolidayVo(data=2021-03-02, status=0, msg=工作日)HolidayVo(data=2021-03-03, status=0, msg=工作日)HolidayVo(data=2021-03-04, status=0, msg=工作日)HolidayVo(data=2021-03-05, status=0, msg=工作日)HolidayVo(data=2021-03-06, status=1, msg=周末)HolidayVo(data=2021-03-07, status=1, msg=周末)HolidayVo(data=2021-03-08, status=0, msg=工作日)HolidayVo(data=2021-03-09, status=0, msg=工作日)HolidayVo(data=2021-03-10, status=0, msg=工作日)HolidayVo(data=2021-03-11, status=0, msg=工作日)HolidayVo(data=2021-03-12, status=0, msg=工作日)HolidayVo(data=2021-03-13, status=1, msg=周末)HolidayVo(data=2021-03-14, status=1, msg=周末)HolidayVo(data=2021-03-15, status=0, msg=工作日)HolidayVo(data=2021-03-16, status=0, msg=工作日)HolidayVo(data=2021-03-17, status=0, msg=工作日)HolidayVo(data=2021-03-18, status=0, msg=工作日)HolidayVo(data=2021-03-19, status=0, msg=工作日)HolidayVo(data=2021-03-20, status=1, msg=周末)HolidayVo(data=2021-03-21, status=1, msg=周末)HolidayVo(data=2021-03-22, status=0, msg=工作日)HolidayVo(data=2021-03-23, status=0, msg=工作日)HolidayVo(data=2021-03-24, status=0, msg=工作日)HolidayVo(data=2021-03-25, status=0, msg=工作日)HolidayVo(data=2021-03-26, status=0, msg=工作日)HolidayVo(data=2021-03-27, status=1, msg=周末)HolidayVo(data=2021-03-28, status=1, msg=周末)HolidayVo(data=2021-03-29, status=0, msg=工作日)HolidayVo(data=2021-03-30, status=0, msg=工作日)HolidayVo(data=2021-03-31, status=0, msg=工作日)HolidayVo(data=2021-04-01, status=0, msg=工作日)HolidayVo(data=2021-04-02, status=0, msg=工作日)HolidayVo(data=2021-04-03, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-04, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-05, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-06, status=0, msg=工作日)HolidayVo(data=2021-04-07, status=0, msg=工作日)HolidayVo(data=2021-04-08, status=0, msg=工作日)HolidayVo(data=2021-04-09, status=0, msg=工作日)HolidayVo(data=2021-04-10, status=1, msg=周末)HolidayVo(data=2021-04-11, status=1, msg=周末)HolidayVo(data=2021-04-12, status=0, msg=工作日)HolidayVo(data=2021-04-13, status=0, msg=工作日)HolidayVo(data=2021-04-14, status=0, msg=工作日)HolidayVo(data=2021-04-15, status=0, msg=工作日)HolidayVo(data=2021-04-16, status=0, msg=工作日)HolidayVo(data=2021-04-17, status=1, msg=周末)HolidayVo(data=2021-04-18, status=1, msg=周末)HolidayVo(data=2021-04-19, status=0, msg=工作日)HolidayVo(data=2021-04-20, status=0, msg=工作日)HolidayVo(data=2021-04-21, status=0, msg=工作日)HolidayVo(data=2021-04-22, status=0, msg=工作日)HolidayVo(data=2021-04-23, status=0, msg=工作日)HolidayVo(data=2021-04-24, status=1, msg=周末)HolidayVo(data=2021-04-25, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-04-26, status=0, msg=工作日)HolidayVo(data=2021-04-27, status=0, msg=工作日)HolidayVo(data=2021-04-28, status=0, msg=工作日)HolidayVo(data=2021-04-29, status=0, msg=工作日)HolidayVo(data=2021-04-30, status=0, msg=工作日)HolidayVo(data=2021-05-01, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-02, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-03, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-04, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-05, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-06, status=0, msg=工作日)HolidayVo(data=2021-05-07, status=0, msg=工作日)HolidayVo(data=2021-05-08, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-05-09, status=1, msg=周末)HolidayVo(data=2021-05-10, status=0, msg=工作日)HolidayVo(data=2021-05-11, status=0, msg=工作日)HolidayVo(data=2021-05-12, status=0, msg=工作日)HolidayVo(data=2021-05-13, status=0, msg=工作日)HolidayVo(data=2021-05-14, status=0, msg=工作日)HolidayVo(data=2021-05-15, status=1, msg=周末)HolidayVo(data=2021-05-16, status=1, msg=周末)HolidayVo(data=2021-05-17, status=0, msg=工作日)HolidayVo(data=2021-05-18, status=0, msg=工作日)HolidayVo(data=2021-05-19, status=0, msg=工作日)HolidayVo(data=2021-05-20, status=0, msg=工作日)HolidayVo(data=2021-05-21, status=0, msg=工作日)HolidayVo(data=2021-05-22, status=1, msg=周末)HolidayVo(data=2021-05-23, status=1, msg=周末)HolidayVo(data=2021-05-24, status=0, msg=工作日)HolidayVo(data=2021-05-25, status=0, msg=工作日)HolidayVo(data=2021-05-26, status=0, msg=工作日)HolidayVo(data=2021-05-27, status=0, msg=工作日)HolidayVo(data=2021-05-28, status=0, msg=工作日)HolidayVo(data=2021-05-29, status=1, msg=周末)HolidayVo(data=2021-05-30, status=1, msg=周末)HolidayVo(data=2021-05-31, status=0, msg=工作日)HolidayVo(data=2021-06-01, status=0, msg=工作日)HolidayVo(data=2021-06-02, status=0, msg=工作日)HolidayVo(data=2021-06-03, status=0, msg=工作日)HolidayVo(data=2021-06-04, status=0, msg=工作日)HolidayVo(data=2021-06-05, status=1, msg=周末)HolidayVo(data=2021-06-06, status=1, msg=周末)HolidayVo(data=2021-06-07, status=0, msg=工作日)HolidayVo(data=2021-06-08, status=0, msg=工作日)HolidayVo(data=2021-06-09, status=0, msg=工作日)HolidayVo(data=2021-06-10, status=0, msg=工作日)HolidayVo(data=2021-06-11, status=0, msg=工作日)HolidayVo(data=2021-06-12, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-13, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-14, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-15, status=0, msg=工作日)HolidayVo(data=2021-06-16, status=0, msg=工作日)HolidayVo(data=2021-06-17, status=0, msg=工作日)HolidayVo(data=2021-06-18, status=0, msg=工作日)HolidayVo(data=2021-06-19, status=1, msg=周末)HolidayVo(data=2021-06-20, status=1, msg=周末)HolidayVo(data=2021-06-21, status=0, msg=工作日)HolidayVo(data=2021-06-22, status=0, msg=工作日)HolidayVo(data=2021-06-23, status=0, msg=工作日)HolidayVo(data=2021-06-24, status=0, msg=工作日)HolidayVo(data=2021-06-25, status=0, msg=工作日)HolidayVo(data=2021-06-26, status=1, msg=周末)HolidayVo(data=2021-06-27, status=1, msg=周末)HolidayVo(data=2021-06-28, status=0, msg=工作日)HolidayVo(data=2021-06-29, status=0, msg=工作日)HolidayVo(data=2021-06-30, status=0, msg=工作日)HolidayVo(data=2021-07-01, status=0, msg=工作日)HolidayVo(data=2021-07-02, status=0, msg=工作日)HolidayVo(data=2021-07-03, status=1, msg=周末)HolidayVo(data=2021-07-04, status=1, msg=周末)HolidayVo(data=2021-07-05, status=0, msg=工作日)HolidayVo(data=2021-07-06, status=0, msg=工作日)HolidayVo(data=2021-07-07, status=0, msg=工作日)HolidayVo(data=2021-07-08, status=0, msg=工作日)HolidayVo(data=2021-07-09, status=0, msg=工作日)HolidayVo(data=2021-07-10, status=1, msg=周末)HolidayVo(data=2021-07-11, status=1, msg=周末)HolidayVo(data=2021-07-12, status=0, msg=工作日)HolidayVo(data=2021-07-13, status=0, msg=工作日)HolidayVo(data=2021-07-14, status=0, msg=工作日)HolidayVo(data=2021-07-15, status=0, msg=工作日)HolidayVo(data=2021-07-16, status=0, msg=工作日)HolidayVo(data=2021-07-17, status=1, msg=周末)HolidayVo(data=2021-07-18, status=1, msg=周末)HolidayVo(data=2021-07-19, status=0, msg=工作日)HolidayVo(data=2021-07-20, status=0, msg=工作日)HolidayVo(data=2021-07-21, status=0, msg=工作日)HolidayVo(data=2021-07-22, status=0, msg=工作日)HolidayVo(data=2021-07-23, status=0, msg=工作日)HolidayVo(data=2021-07-24, status=1, msg=周末)HolidayVo(data=2021-07-25, status=1, msg=周末)HolidayVo(data=2021-07-26, status=0, msg=工作日)HolidayVo(data=2021-07-27, status=0, msg=工作日)HolidayVo(data=2021-07-28, status=0, msg=工作日)HolidayVo(data=2021-07-29, status=0, msg=工作日)HolidayVo(data=2021-07-30, status=0, msg=工作日)HolidayVo(data=2021-07-31, status=1, msg=周末)HolidayVo(data=2021-08-01, status=1, msg=周末)HolidayVo(data=2021-08-02, status=0, msg=工作日)HolidayVo(data=2021-08-03, status=0, msg=工作日)HolidayVo(data=2021-08-04, status=0, msg=工作日)HolidayVo(data=2021-08-05, status=0, msg=工作日)HolidayVo(data=2021-08-06, status=0, msg=工作日)HolidayVo(data=2021-08-07, status=1, msg=周末)HolidayVo(data=2021-08-08, status=1, msg=周末)HolidayVo(data=2021-08-09, status=0, msg=工作日)HolidayVo(data=2021-08-10, status=0, msg=工作日)HolidayVo(data=2021-08-11, status=0, msg=工作日)HolidayVo(data=2021-08-12, status=0, msg=工作日)HolidayVo(data=2021-08-13, status=0, msg=工作日)HolidayVo(data=2021-08-14, status=1, msg=周末)HolidayVo(data=2021-08-15, status=1, msg=周末)HolidayVo(data=2021-08-16, status=0, msg=工作日)HolidayVo(data=2021-08-17, status=0, msg=工作日)HolidayVo(data=2021-08-18, status=0, msg=工作日)HolidayVo(data=2021-08-19, status=0, msg=工作日)HolidayVo(data=2021-08-20, status=0, msg=工作日)HolidayVo(data=2021-08-21, status=1, msg=周末)HolidayVo(data=2021-08-22, status=1, msg=周末)HolidayVo(data=2021-08-23, status=0, msg=工作日)HolidayVo(data=2021-08-24, status=0, msg=工作日)HolidayVo(data=2021-08-25, status=0, msg=工作日)HolidayVo(data=2021-08-26, status=0, msg=工作日)HolidayVo(data=2021-08-27, status=0, msg=工作日)HolidayVo(data=2021-08-28, status=1, msg=周末)HolidayVo(data=2021-08-29, status=1, msg=周末)HolidayVo(data=2021-08-30, status=0, msg=工作日)HolidayVo(data=2021-08-31, status=0, msg=工作日)HolidayVo(data=2021-09-01, status=0, msg=工作日)HolidayVo(data=2021-09-02, status=0, msg=工作日)HolidayVo(data=2021-09-03, status=0, msg=工作日)HolidayVo(data=2021-09-04, status=1, msg=周末)HolidayVo(data=2021-09-05, status=1, msg=周末)HolidayVo(data=2021-09-06, status=0, msg=工作日)HolidayVo(data=2021-09-07, status=0, msg=工作日)HolidayVo(data=2021-09-08, status=0, msg=工作日)HolidayVo(data=2021-09-09, status=0, msg=工作日)HolidayVo(data=2021-09-10, status=0, msg=工作日)HolidayVo(data=2021-09-11, status=1, msg=周末)HolidayVo(data=2021-09-12, status=1, msg=周末)HolidayVo(data=2021-09-13, status=0, msg=工作日)HolidayVo(data=2021-09-14, status=0, msg=工作日)HolidayVo(data=2021-09-15, status=0, msg=工作日)HolidayVo(data=2021-09-16, status=0, msg=工作日)HolidayVo(data=2021-09-17, status=0, msg=工作日)HolidayVo(data=2021-09-18, status=3, msg=节假日调休补班(中秋节))HolidayVo(data=2021-09-19, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-20, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-21, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-22, status=0, msg=工作日)HolidayVo(data=2021-09-23, status=0, msg=工作日)HolidayVo(data=2021-09-24, status=0, msg=工作日)HolidayVo(data=2021-09-25, status=1, msg=周末)HolidayVo(data=2021-09-26, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-09-27, status=0, msg=工作日)HolidayVo(data=2021-09-28, status=0, msg=工作日)HolidayVo(data=2021-09-29, status=0, msg=工作日)HolidayVo(data=2021-09-30, status=0, msg=工作日)HolidayVo(data=2021-10-01, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-02, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-03, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-04, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-05, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-06, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-07, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-08, status=0, msg=工作日)HolidayVo(data=2021-10-09, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-10-10, status=1, msg=周末)HolidayVo(data=2021-10-11, status=0, msg=工作日)HolidayVo(data=2021-10-12, status=0, msg=工作日)HolidayVo(data=2021-10-13, status=0, msg=工作日)HolidayVo(data=2021-10-14, status=0, msg=工作日)HolidayVo(data=2021-10-15, status=0, msg=工作日)HolidayVo(data=2021-10-16, status=1, msg=周末)HolidayVo(data=2021-10-17, status=1, msg=周末)HolidayVo(data=2021-10-18, status=0, msg=工作日)HolidayVo(data=2021-10-19, status=0, msg=工作日)HolidayVo(data=2021-10-20, status=0, msg=工作日)HolidayVo(data=2021-10-21, status=0, msg=工作日)HolidayVo(data=2021-10-22, status=0, msg=工作日)HolidayVo(data=2021-10-23, status=1, msg=周末)HolidayVo(data=2021-10-24, status=1, msg=周末)HolidayVo(data=2021-10-25, status=0, msg=工作日)HolidayVo(data=2021-10-26, status=0, msg=工作日)HolidayVo(data=2021-10-27, status=0, msg=工作日)HolidayVo(data=2021-10-28, status=0, msg=工作日)HolidayVo(data=2021-10-29, status=0, msg=工作日)HolidayVo(data=2021-10-30, status=1, msg=周末)HolidayVo(data=2021-10-31, status=1, msg=周末)HolidayVo(data=2021-11-01, status=0, msg=工作日)HolidayVo(data=2021-11-02, status=0, msg=工作日)HolidayVo(data=2021-11-03, status=0, msg=工作日)HolidayVo(data=2021-11-04, status=0, msg=工作日)HolidayVo(data=2021-11-05, status=0, msg=工作日)HolidayVo(data=2021-11-06, status=1, msg=周末)HolidayVo(data=2021-11-07, status=1, msg=周末)HolidayVo(data=2021-11-08, status=0, msg=工作日)HolidayVo(data=2021-11-09, status=0, msg=工作日)HolidayVo(data=2021-11-10, status=0, msg=工作日)HolidayVo(data=2021-11-11, status=0, msg=工作日)HolidayVo(data=2021-11-12, status=0, msg=工作日)HolidayVo(data=2021-11-13, status=1, msg=周末)HolidayVo(data=2021-11-14, status=1, msg=周末)HolidayVo(data=2021-11-15, status=0, msg=工作日)HolidayVo(data=2021-11-16, status=0, msg=工作日)HolidayVo(data=2021-11-17, status=0, msg=工作日)HolidayVo(data=2021-11-18, status=0, msg=工作日)HolidayVo(data=2021-11-19, status=0, msg=工作日)HolidayVo(data=2021-11-20, status=1, msg=周末)HolidayVo(data=2021-11-21, status=1, msg=周末)HolidayVo(data=2021-11-22, status=0, msg=工作日)HolidayVo(data=2021-11-23, status=0, msg=工作日)HolidayVo(data=2021-11-24, status=0, msg=工作日)HolidayVo(data=2021-11-25, status=0, msg=工作日)HolidayVo(data=2021-11-26, status=0, msg=工作日)HolidayVo(data=2021-11-27, status=1, msg=周末)HolidayVo(data=2021-11-28, status=1, msg=周末)HolidayVo(data=2021-11-29, status=0, msg=工作日)HolidayVo(data=2021-11-30, status=0, msg=工作日)HolidayVo(data=2021-12-01, status=0, msg=工作日)HolidayVo(data=2021-12-02, status=0, msg=工作日)HolidayVo(data=2021-12-03, status=0, msg=工作日)HolidayVo(data=2021-12-04, status=1, msg=周末)HolidayVo(data=2021-12-05, status=1, msg=周末)HolidayVo(data=2021-12-06, status=0, msg=工作日)HolidayVo(data=2021-12-07, status=0, msg=工作日)HolidayVo(data=2021-12-08, status=0, msg=工作日)HolidayVo(data=2021-12-09, status=0, msg=工作日)HolidayVo(data=2021-12-10, status=0, msg=工作日)HolidayVo(data=2021-12-11, status=1, msg=周末)HolidayVo(data=2021-12-12, status=1, msg=周末)HolidayVo(data=2021-12-13, status=0, msg=工作日)HolidayVo(data=2021-12-14, status=0, msg=工作日)HolidayVo(data=2021-12-15, status=0, msg=工作日)HolidayVo(data=2021-12-16, status=0, msg=工作日)HolidayVo(data=2021-12-17, status=0, msg=工作日)HolidayVo(data=2021-12-18, status=1, msg=周末)HolidayVo(data=2021-12-19, status=1, msg=周末)HolidayVo(data=2021-12-20, status=0, msg=工作日)HolidayVo(data=2021-12-21, status=0, msg=工作日)HolidayVo(data=2021-12-22, status=0, msg=工作日)HolidayVo(data=2021-12-23, status=0, msg=工作日)HolidayVo(data=2021-12-24, status=0, msg=工作日)HolidayVo(data=2021-12-25, status=1, msg=周末)HolidayVo(data=2021-12-26, status=1, msg=周末)HolidayVo(data=2021-12-27, status=0, msg=工作日)HolidayVo(data=2021-12-28, status=0, msg=工作日)HolidayVo(data=2021-12-29, status=0, msg=工作日)HolidayVo(data=2021-12-30, status=0, msg=工作日)HolidayVo(data=2021-12-31, status=0, msg=工作日) 代码开源
注:数据库文件在resources/static/sql目录下面
代码已经开源、托管到我的GitHub、码云:
GitHub:https://github/huanzi-qch/base-admin
码云:https://gitee/huanzi-qch/base-admin
版权声明作者:huanzi-qch
出处:https://wwwblogs/huanzi-qch
若标题中有“转载”字样,则本文版权归原作者所有。若无转载字样,本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利.
日常开发中,难免会用到判断今天是工作日、周末、法定节假日、节假日调休补班做一些业务处理,例如:仅在上班时间给用户推送消息。本文记录调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据
API介绍/d/file/gt/2024-03/2ha1clemkz3 这个API是在知乎(/d/file/gt/2024-03/qpboaanv21x /d/file/gt/2024-03/txdyogtf5ow,查询全年节假日、调休
这个API是在简书(https://www.jianshu/p/1e05e72b41fd)上看到的,官网是这个:http://timor/api/holiday
代码编写HolidayVo
/** * 节假日Vo */@Datapublic class HolidayVo { private String data;//日期 private String status;//状态:0工作日/1周末/2法定节假日/3节假日调休补班 private String msg;//描述}
HolidayUtil
/** * 节假日工具类 */public class HolidayUtil { /** * 发送get请求 */ private static String get(String url){ StringBuilder inputLine = new StringBuilder(); String read; try { HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); urlConnection.setReadTimeout(30 * 1000); urlConnection.setConnectTimeout(30 * 1000); urlConnection.setRequestProperty("Charset", "UTF-8"); urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36)"); BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StandardCharsets.UTF_8)); while ((read = in.readLine()) != null) { inputLineend(read); } in.close(); } catch (IOException e) { e.printStackTrace(); } return inputLine.toString(); } /** * 调用免费API查询全年工作日、周末、法定节假日、节假日调休补班数据 * 1、调用 /d/file/gt/2024-03/modi2mc24io 查询全年日历(含周末) * 2、调用 /d/file/gt/2024-03/txdyogtf5ow 查询全年节假日、调休 */ public static ArrayList<HolidayVo> getAllHolidayByYear(String year) throws IOException { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); ArrayList<HolidayVo> holidayVoList = new ArrayList<>(); HashMap<String,HolidayVo> hashMap = new HashMap<>(); //查询全年日历包含周末 String allDayJson = HolidayUtil.get("/d/file/gt/2024-03/dpnivvmmiam ObjectMapper mapper = new ObjectMapper(); Map allDayMap = mapper.readValue(allDayJson,Map.class); Map allDayData = (Map)allDayMap.get("data"); List allDayDataList = (List)allDayData.get("list"); allDayDataList.forEach((value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String YEAR = value1.get("year").toString(); String MONTH = value1.get("month").toString().replace(YEAR,""); String DAY = value1.get("date").toString().replace(YEAR+MONTH,""); holidayVo.setData(YEAR + "-" + MONTH + "-" + DAY); String STATUS = "0"; String msg = "工作日"; if("1".equals(value1.get("weekend").toString())){ STATUS = "1"; msg = "周末"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.put(holidayVo.getData(),holidayVo); }); //查询全年节假日、调休 String holidayJson = HolidayUtil.get("/d/file/gt/2024-03/0adrj0wmjjt + "/"); Map holidayMap = mapper.readValue(holidayJson,Map.class); LinkedHashMap holidayList = (LinkedHashMap)holidayMap.get("holiday"); holidayList.forEach((key,value) -> { HolidayVo holidayVo = new HolidayVo(); Map value1 = (Map) value; String dateTime = value1.get("date").toString(); holidayVo.setData(dateTime); String STATUS = "2"; String msg = "法定节假日("+value1.get("name").toString()+")"; if(value.toString()ntains("调休")){ STATUS = "3"; msg = "节假日调休补班("+value1.get("target").toString()+")"; } holidayVo.setStatus(STATUS); holidayVo.setMsg(msg); hashMap.replace(holidayVo.getData(),holidayVo); }); for (String key : hashMap.keySet()) { holidayVoList.add(hashMap.get(key)); } //排序 holidayVoListrt((a,b)->{ try { return sf.parse(a.getData())pareTo(sf.parse(b.getData())); } catch (ParseException e) { e.printStackTrace(); } return 1; }); return holidayVoList; }} main测试
public static void main(String[] args) { try { ArrayList<HolidayVo> HolidayVoList = HolidayUtil.getAllHolidayByYear("2021"); System.err.println("全年完整数据:"); for (HolidayVo HolidayVo : HolidayVoList) { System.err.println(HolidayVo); } } catch (IOException e) { e.printStackTrace(); } } 效果
全年数据可存库,这样每年调用一次同步数据即可
HolidayVo(data=2021-01-01, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-02, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-03, status=2, msg=法定节假日(元旦))HolidayVo(data=2021-01-04, status=0, msg=工作日)HolidayVo(data=2021-01-05, status=0, msg=工作日)HolidayVo(data=2021-01-06, status=0, msg=工作日)HolidayVo(data=2021-01-07, status=0, msg=工作日)HolidayVo(data=2021-01-08, status=0, msg=工作日)HolidayVo(data=2021-01-09, status=1, msg=周末)HolidayVo(data=2021-01-10, status=1, msg=周末)HolidayVo(data=2021-01-11, status=0, msg=工作日)HolidayVo(data=2021-01-12, status=0, msg=工作日)HolidayVo(data=2021-01-13, status=0, msg=工作日)HolidayVo(data=2021-01-14, status=0, msg=工作日)HolidayVo(data=2021-01-15, status=0, msg=工作日)HolidayVo(data=2021-01-16, status=1, msg=周末)HolidayVo(data=2021-01-17, status=1, msg=周末)HolidayVo(data=2021-01-18, status=0, msg=工作日)HolidayVo(data=2021-01-19, status=0, msg=工作日)HolidayVo(data=2021-01-20, status=0, msg=工作日)HolidayVo(data=2021-01-21, status=0, msg=工作日)HolidayVo(data=2021-01-22, status=0, msg=工作日)HolidayVo(data=2021-01-23, status=1, msg=周末)HolidayVo(data=2021-01-24, status=1, msg=周末)HolidayVo(data=2021-01-25, status=0, msg=工作日)HolidayVo(data=2021-01-26, status=0, msg=工作日)HolidayVo(data=2021-01-27, status=0, msg=工作日)HolidayVo(data=2021-01-28, status=0, msg=工作日)HolidayVo(data=2021-01-29, status=0, msg=工作日)HolidayVo(data=2021-01-30, status=1, msg=周末)HolidayVo(data=2021-01-31, status=1, msg=周末)HolidayVo(data=2021-02-01, status=0, msg=工作日)HolidayVo(data=2021-02-02, status=0, msg=工作日)HolidayVo(data=2021-02-03, status=0, msg=工作日)HolidayVo(data=2021-02-04, status=0, msg=工作日)HolidayVo(data=2021-02-05, status=0, msg=工作日)HolidayVo(data=2021-02-06, status=1, msg=周末)HolidayVo(data=2021-02-07, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-08, status=0, msg=工作日)HolidayVo(data=2021-02-09, status=0, msg=工作日)HolidayVo(data=2021-02-10, status=0, msg=工作日)HolidayVo(data=2021-02-11, status=2, msg=法定节假日(除夕))HolidayVo(data=2021-02-12, status=2, msg=法定节假日(初一))HolidayVo(data=2021-02-13, status=2, msg=法定节假日(初二))HolidayVo(data=2021-02-14, status=2, msg=法定节假日(初三))HolidayVo(data=2021-02-15, status=2, msg=法定节假日(初四))HolidayVo(data=2021-02-16, status=2, msg=法定节假日(初五))HolidayVo(data=2021-02-17, status=2, msg=法定节假日(初六))HolidayVo(data=2021-02-18, status=0, msg=工作日)HolidayVo(data=2021-02-19, status=0, msg=工作日)HolidayVo(data=2021-02-20, status=3, msg=节假日调休补班(春节))HolidayVo(data=2021-02-21, status=1, msg=周末)HolidayVo(data=2021-02-22, status=0, msg=工作日)HolidayVo(data=2021-02-23, status=0, msg=工作日)HolidayVo(data=2021-02-24, status=0, msg=工作日)HolidayVo(data=2021-02-25, status=0, msg=工作日)HolidayVo(data=2021-02-26, status=0, msg=工作日)HolidayVo(data=2021-02-27, status=1, msg=周末)HolidayVo(data=2021-02-28, status=1, msg=周末)HolidayVo(data=2021-03-01, status=0, msg=工作日)HolidayVo(data=2021-03-02, status=0, msg=工作日)HolidayVo(data=2021-03-03, status=0, msg=工作日)HolidayVo(data=2021-03-04, status=0, msg=工作日)HolidayVo(data=2021-03-05, status=0, msg=工作日)HolidayVo(data=2021-03-06, status=1, msg=周末)HolidayVo(data=2021-03-07, status=1, msg=周末)HolidayVo(data=2021-03-08, status=0, msg=工作日)HolidayVo(data=2021-03-09, status=0, msg=工作日)HolidayVo(data=2021-03-10, status=0, msg=工作日)HolidayVo(data=2021-03-11, status=0, msg=工作日)HolidayVo(data=2021-03-12, status=0, msg=工作日)HolidayVo(data=2021-03-13, status=1, msg=周末)HolidayVo(data=2021-03-14, status=1, msg=周末)HolidayVo(data=2021-03-15, status=0, msg=工作日)HolidayVo(data=2021-03-16, status=0, msg=工作日)HolidayVo(data=2021-03-17, status=0, msg=工作日)HolidayVo(data=2021-03-18, status=0, msg=工作日)HolidayVo(data=2021-03-19, status=0, msg=工作日)HolidayVo(data=2021-03-20, status=1, msg=周末)HolidayVo(data=2021-03-21, status=1, msg=周末)HolidayVo(data=2021-03-22, status=0, msg=工作日)HolidayVo(data=2021-03-23, status=0, msg=工作日)HolidayVo(data=2021-03-24, status=0, msg=工作日)HolidayVo(data=2021-03-25, status=0, msg=工作日)HolidayVo(data=2021-03-26, status=0, msg=工作日)HolidayVo(data=2021-03-27, status=1, msg=周末)HolidayVo(data=2021-03-28, status=1, msg=周末)HolidayVo(data=2021-03-29, status=0, msg=工作日)HolidayVo(data=2021-03-30, status=0, msg=工作日)HolidayVo(data=2021-03-31, status=0, msg=工作日)HolidayVo(data=2021-04-01, status=0, msg=工作日)HolidayVo(data=2021-04-02, status=0, msg=工作日)HolidayVo(data=2021-04-03, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-04, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-05, status=2, msg=法定节假日(清明节))HolidayVo(data=2021-04-06, status=0, msg=工作日)HolidayVo(data=2021-04-07, status=0, msg=工作日)HolidayVo(data=2021-04-08, status=0, msg=工作日)HolidayVo(data=2021-04-09, status=0, msg=工作日)HolidayVo(data=2021-04-10, status=1, msg=周末)HolidayVo(data=2021-04-11, status=1, msg=周末)HolidayVo(data=2021-04-12, status=0, msg=工作日)HolidayVo(data=2021-04-13, status=0, msg=工作日)HolidayVo(data=2021-04-14, status=0, msg=工作日)HolidayVo(data=2021-04-15, status=0, msg=工作日)HolidayVo(data=2021-04-16, status=0, msg=工作日)HolidayVo(data=2021-04-17, status=1, msg=周末)HolidayVo(data=2021-04-18, status=1, msg=周末)HolidayVo(data=2021-04-19, status=0, msg=工作日)HolidayVo(data=2021-04-20, status=0, msg=工作日)HolidayVo(data=2021-04-21, status=0, msg=工作日)HolidayVo(data=2021-04-22, status=0, msg=工作日)HolidayVo(data=2021-04-23, status=0, msg=工作日)HolidayVo(data=2021-04-24, status=1, msg=周末)HolidayVo(data=2021-04-25, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-04-26, status=0, msg=工作日)HolidayVo(data=2021-04-27, status=0, msg=工作日)HolidayVo(data=2021-04-28, status=0, msg=工作日)HolidayVo(data=2021-04-29, status=0, msg=工作日)HolidayVo(data=2021-04-30, status=0, msg=工作日)HolidayVo(data=2021-05-01, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-02, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-03, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-04, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-05, status=2, msg=法定节假日(劳动节))HolidayVo(data=2021-05-06, status=0, msg=工作日)HolidayVo(data=2021-05-07, status=0, msg=工作日)HolidayVo(data=2021-05-08, status=3, msg=节假日调休补班(劳动节))HolidayVo(data=2021-05-09, status=1, msg=周末)HolidayVo(data=2021-05-10, status=0, msg=工作日)HolidayVo(data=2021-05-11, status=0, msg=工作日)HolidayVo(data=2021-05-12, status=0, msg=工作日)HolidayVo(data=2021-05-13, status=0, msg=工作日)HolidayVo(data=2021-05-14, status=0, msg=工作日)HolidayVo(data=2021-05-15, status=1, msg=周末)HolidayVo(data=2021-05-16, status=1, msg=周末)HolidayVo(data=2021-05-17, status=0, msg=工作日)HolidayVo(data=2021-05-18, status=0, msg=工作日)HolidayVo(data=2021-05-19, status=0, msg=工作日)HolidayVo(data=2021-05-20, status=0, msg=工作日)HolidayVo(data=2021-05-21, status=0, msg=工作日)HolidayVo(data=2021-05-22, status=1, msg=周末)HolidayVo(data=2021-05-23, status=1, msg=周末)HolidayVo(data=2021-05-24, status=0, msg=工作日)HolidayVo(data=2021-05-25, status=0, msg=工作日)HolidayVo(data=2021-05-26, status=0, msg=工作日)HolidayVo(data=2021-05-27, status=0, msg=工作日)HolidayVo(data=2021-05-28, status=0, msg=工作日)HolidayVo(data=2021-05-29, status=1, msg=周末)HolidayVo(data=2021-05-30, status=1, msg=周末)HolidayVo(data=2021-05-31, status=0, msg=工作日)HolidayVo(data=2021-06-01, status=0, msg=工作日)HolidayVo(data=2021-06-02, status=0, msg=工作日)HolidayVo(data=2021-06-03, status=0, msg=工作日)HolidayVo(data=2021-06-04, status=0, msg=工作日)HolidayVo(data=2021-06-05, status=1, msg=周末)HolidayVo(data=2021-06-06, status=1, msg=周末)HolidayVo(data=2021-06-07, status=0, msg=工作日)HolidayVo(data=2021-06-08, status=0, msg=工作日)HolidayVo(data=2021-06-09, status=0, msg=工作日)HolidayVo(data=2021-06-10, status=0, msg=工作日)HolidayVo(data=2021-06-11, status=0, msg=工作日)HolidayVo(data=2021-06-12, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-13, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-14, status=2, msg=法定节假日(端午节))HolidayVo(data=2021-06-15, status=0, msg=工作日)HolidayVo(data=2021-06-16, status=0, msg=工作日)HolidayVo(data=2021-06-17, status=0, msg=工作日)HolidayVo(data=2021-06-18, status=0, msg=工作日)HolidayVo(data=2021-06-19, status=1, msg=周末)HolidayVo(data=2021-06-20, status=1, msg=周末)HolidayVo(data=2021-06-21, status=0, msg=工作日)HolidayVo(data=2021-06-22, status=0, msg=工作日)HolidayVo(data=2021-06-23, status=0, msg=工作日)HolidayVo(data=2021-06-24, status=0, msg=工作日)HolidayVo(data=2021-06-25, status=0, msg=工作日)HolidayVo(data=2021-06-26, status=1, msg=周末)HolidayVo(data=2021-06-27, status=1, msg=周末)HolidayVo(data=2021-06-28, status=0, msg=工作日)HolidayVo(data=2021-06-29, status=0, msg=工作日)HolidayVo(data=2021-06-30, status=0, msg=工作日)HolidayVo(data=2021-07-01, status=0, msg=工作日)HolidayVo(data=2021-07-02, status=0, msg=工作日)HolidayVo(data=2021-07-03, status=1, msg=周末)HolidayVo(data=2021-07-04, status=1, msg=周末)HolidayVo(data=2021-07-05, status=0, msg=工作日)HolidayVo(data=2021-07-06, status=0, msg=工作日)HolidayVo(data=2021-07-07, status=0, msg=工作日)HolidayVo(data=2021-07-08, status=0, msg=工作日)HolidayVo(data=2021-07-09, status=0, msg=工作日)HolidayVo(data=2021-07-10, status=1, msg=周末)HolidayVo(data=2021-07-11, status=1, msg=周末)HolidayVo(data=2021-07-12, status=0, msg=工作日)HolidayVo(data=2021-07-13, status=0, msg=工作日)HolidayVo(data=2021-07-14, status=0, msg=工作日)HolidayVo(data=2021-07-15, status=0, msg=工作日)HolidayVo(data=2021-07-16, status=0, msg=工作日)HolidayVo(data=2021-07-17, status=1, msg=周末)HolidayVo(data=2021-07-18, status=1, msg=周末)HolidayVo(data=2021-07-19, status=0, msg=工作日)HolidayVo(data=2021-07-20, status=0, msg=工作日)HolidayVo(data=2021-07-21, status=0, msg=工作日)HolidayVo(data=2021-07-22, status=0, msg=工作日)HolidayVo(data=2021-07-23, status=0, msg=工作日)HolidayVo(data=2021-07-24, status=1, msg=周末)HolidayVo(data=2021-07-25, status=1, msg=周末)HolidayVo(data=2021-07-26, status=0, msg=工作日)HolidayVo(data=2021-07-27, status=0, msg=工作日)HolidayVo(data=2021-07-28, status=0, msg=工作日)HolidayVo(data=2021-07-29, status=0, msg=工作日)HolidayVo(data=2021-07-30, status=0, msg=工作日)HolidayVo(data=2021-07-31, status=1, msg=周末)HolidayVo(data=2021-08-01, status=1, msg=周末)HolidayVo(data=2021-08-02, status=0, msg=工作日)HolidayVo(data=2021-08-03, status=0, msg=工作日)HolidayVo(data=2021-08-04, status=0, msg=工作日)HolidayVo(data=2021-08-05, status=0, msg=工作日)HolidayVo(data=2021-08-06, status=0, msg=工作日)HolidayVo(data=2021-08-07, status=1, msg=周末)HolidayVo(data=2021-08-08, status=1, msg=周末)HolidayVo(data=2021-08-09, status=0, msg=工作日)HolidayVo(data=2021-08-10, status=0, msg=工作日)HolidayVo(data=2021-08-11, status=0, msg=工作日)HolidayVo(data=2021-08-12, status=0, msg=工作日)HolidayVo(data=2021-08-13, status=0, msg=工作日)HolidayVo(data=2021-08-14, status=1, msg=周末)HolidayVo(data=2021-08-15, status=1, msg=周末)HolidayVo(data=2021-08-16, status=0, msg=工作日)HolidayVo(data=2021-08-17, status=0, msg=工作日)HolidayVo(data=2021-08-18, status=0, msg=工作日)HolidayVo(data=2021-08-19, status=0, msg=工作日)HolidayVo(data=2021-08-20, status=0, msg=工作日)HolidayVo(data=2021-08-21, status=1, msg=周末)HolidayVo(data=2021-08-22, status=1, msg=周末)HolidayVo(data=2021-08-23, status=0, msg=工作日)HolidayVo(data=2021-08-24, status=0, msg=工作日)HolidayVo(data=2021-08-25, status=0, msg=工作日)HolidayVo(data=2021-08-26, status=0, msg=工作日)HolidayVo(data=2021-08-27, status=0, msg=工作日)HolidayVo(data=2021-08-28, status=1, msg=周末)HolidayVo(data=2021-08-29, status=1, msg=周末)HolidayVo(data=2021-08-30, status=0, msg=工作日)HolidayVo(data=2021-08-31, status=0, msg=工作日)HolidayVo(data=2021-09-01, status=0, msg=工作日)HolidayVo(data=2021-09-02, status=0, msg=工作日)HolidayVo(data=2021-09-03, status=0, msg=工作日)HolidayVo(data=2021-09-04, status=1, msg=周末)HolidayVo(data=2021-09-05, status=1, msg=周末)HolidayVo(data=2021-09-06, status=0, msg=工作日)HolidayVo(data=2021-09-07, status=0, msg=工作日)HolidayVo(data=2021-09-08, status=0, msg=工作日)HolidayVo(data=2021-09-09, status=0, msg=工作日)HolidayVo(data=2021-09-10, status=0, msg=工作日)HolidayVo(data=2021-09-11, status=1, msg=周末)HolidayVo(data=2021-09-12, status=1, msg=周末)HolidayVo(data=2021-09-13, status=0, msg=工作日)HolidayVo(data=2021-09-14, status=0, msg=工作日)HolidayVo(data=2021-09-15, status=0, msg=工作日)HolidayVo(data=2021-09-16, status=0, msg=工作日)HolidayVo(data=2021-09-17, status=0, msg=工作日)HolidayVo(data=2021-09-18, status=3, msg=节假日调休补班(中秋节))HolidayVo(data=2021-09-19, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-20, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-21, status=2, msg=法定节假日(中秋节))HolidayVo(data=2021-09-22, status=0, msg=工作日)HolidayVo(data=2021-09-23, status=0, msg=工作日)HolidayVo(data=2021-09-24, status=0, msg=工作日)HolidayVo(data=2021-09-25, status=1, msg=周末)HolidayVo(data=2021-09-26, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-09-27, status=0, msg=工作日)HolidayVo(data=2021-09-28, status=0, msg=工作日)HolidayVo(data=2021-09-29, status=0, msg=工作日)HolidayVo(data=2021-09-30, status=0, msg=工作日)HolidayVo(data=2021-10-01, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-02, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-03, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-04, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-05, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-06, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-07, status=2, msg=法定节假日(国庆节))HolidayVo(data=2021-10-08, status=0, msg=工作日)HolidayVo(data=2021-10-09, status=3, msg=节假日调休补班(国庆节))HolidayVo(data=2021-10-10, status=1, msg=周末)HolidayVo(data=2021-10-11, status=0, msg=工作日)HolidayVo(data=2021-10-12, status=0, msg=工作日)HolidayVo(data=2021-10-13, status=0, msg=工作日)HolidayVo(data=2021-10-14, status=0, msg=工作日)HolidayVo(data=2021-10-15, status=0, msg=工作日)HolidayVo(data=2021-10-16, status=1, msg=周末)HolidayVo(data=2021-10-17, status=1, msg=周末)HolidayVo(data=2021-10-18, status=0, msg=工作日)HolidayVo(data=2021-10-19, status=0, msg=工作日)HolidayVo(data=2021-10-20, status=0, msg=工作日)HolidayVo(data=2021-10-21, status=0, msg=工作日)HolidayVo(data=2021-10-22, status=0, msg=工作日)HolidayVo(data=2021-10-23, status=1, msg=周末)HolidayVo(data=2021-10-24, status=1, msg=周末)HolidayVo(data=2021-10-25, status=0, msg=工作日)HolidayVo(data=2021-10-26, status=0, msg=工作日)HolidayVo(data=2021-10-27, status=0, msg=工作日)HolidayVo(data=2021-10-28, status=0, msg=工作日)HolidayVo(data=2021-10-29, status=0, msg=工作日)HolidayVo(data=2021-10-30, status=1, msg=周末)HolidayVo(data=2021-10-31, status=1, msg=周末)HolidayVo(data=2021-11-01, status=0, msg=工作日)HolidayVo(data=2021-11-02, status=0, msg=工作日)HolidayVo(data=2021-11-03, status=0, msg=工作日)HolidayVo(data=2021-11-04, status=0, msg=工作日)HolidayVo(data=2021-11-05, status=0, msg=工作日)HolidayVo(data=2021-11-06, status=1, msg=周末)HolidayVo(data=2021-11-07, status=1, msg=周末)HolidayVo(data=2021-11-08, status=0, msg=工作日)HolidayVo(data=2021-11-09, status=0, msg=工作日)HolidayVo(data=2021-11-10, status=0, msg=工作日)HolidayVo(data=2021-11-11, status=0, msg=工作日)HolidayVo(data=2021-11-12, status=0, msg=工作日)HolidayVo(data=2021-11-13, status=1, msg=周末)HolidayVo(data=2021-11-14, status=1, msg=周末)HolidayVo(data=2021-11-15, status=0, msg=工作日)HolidayVo(data=2021-11-16, status=0, msg=工作日)HolidayVo(data=2021-11-17, status=0, msg=工作日)HolidayVo(data=2021-11-18, status=0, msg=工作日)HolidayVo(data=2021-11-19, status=0, msg=工作日)HolidayVo(data=2021-11-20, status=1, msg=周末)HolidayVo(data=2021-11-21, status=1, msg=周末)HolidayVo(data=2021-11-22, status=0, msg=工作日)HolidayVo(data=2021-11-23, status=0, msg=工作日)HolidayVo(data=2021-11-24, status=0, msg=工作日)HolidayVo(data=2021-11-25, status=0, msg=工作日)HolidayVo(data=2021-11-26, status=0, msg=工作日)HolidayVo(data=2021-11-27, status=1, msg=周末)HolidayVo(data=2021-11-28, status=1, msg=周末)HolidayVo(data=2021-11-29, status=0, msg=工作日)HolidayVo(data=2021-11-30, status=0, msg=工作日)HolidayVo(data=2021-12-01, status=0, msg=工作日)HolidayVo(data=2021-12-02, status=0, msg=工作日)HolidayVo(data=2021-12-03, status=0, msg=工作日)HolidayVo(data=2021-12-04, status=1, msg=周末)HolidayVo(data=2021-12-05, status=1, msg=周末)HolidayVo(data=2021-12-06, status=0, msg=工作日)HolidayVo(data=2021-12-07, status=0, msg=工作日)HolidayVo(data=2021-12-08, status=0, msg=工作日)HolidayVo(data=2021-12-09, status=0, msg=工作日)HolidayVo(data=2021-12-10, status=0, msg=工作日)HolidayVo(data=2021-12-11, status=1, msg=周末)HolidayVo(data=2021-12-12, status=1, msg=周末)HolidayVo(data=2021-12-13, status=0, msg=工作日)HolidayVo(data=2021-12-14, status=0, msg=工作日)HolidayVo(data=2021-12-15, status=0, msg=工作日)HolidayVo(data=2021-12-16, status=0, msg=工作日)HolidayVo(data=2021-12-17, status=0, msg=工作日)HolidayVo(data=2021-12-18, status=1, msg=周末)HolidayVo(data=2021-12-19, status=1, msg=周末)HolidayVo(data=2021-12-20, status=0, msg=工作日)HolidayVo(data=2021-12-21, status=0, msg=工作日)HolidayVo(data=2021-12-22, status=0, msg=工作日)HolidayVo(data=2021-12-23, status=0, msg=工作日)HolidayVo(data=2021-12-24, status=0, msg=工作日)HolidayVo(data=2021-12-25, status=1, msg=周末)HolidayVo(data=2021-12-26, status=1, msg=周末)HolidayVo(data=2021-12-27, status=0, msg=工作日)HolidayVo(data=2021-12-28, status=0, msg=工作日)HolidayVo(data=2021-12-29, status=0, msg=工作日)HolidayVo(data=2021-12-30, status=0, msg=工作日)HolidayVo(data=2021-12-31, status=0, msg=工作日) 代码开源
注:数据库文件在resources/static/sql目录下面
代码已经开源、托管到我的GitHub、码云:
GitHub:https://github/huanzi-qch/base-admin
码云:https://gitee/huanzi-qch/base-admin
版权声明作者:huanzi-qch
出处:https://wwwblogs/huanzi-qch
若标题中有“转载”字样,则本文版权归原作者所有。若无转载字样,本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利.
网页功能界面
2./d/file/gt/2024-03/3gm2qya1dgj使用方式同工具1大同小异。
网页功能界面
2016年白羊座六月运势怎么样 2016年白羊座六月运势及运程 摩羯座本周爱情运势 摩羯座2021爱情运势完整版 摩羯座爱情运势占卜 李居明2021年猴年运势及运程 属牛的2020年感情运势如何 属牛的2020年感情运势怎么样 属牛的2020年感情运势及运程 2016属龙的感情运势及运程如何 2016属龙的感情运势及运程详解 2016属龙的感情运势及运程怎么样 2016狮子座运势三月运势 2016狮子座运势三月出生 狮子座2021年3月16日运势 生辰八字算命2023年运势 生辰八字算命2023年运势免费 摩羯座16日运势如何 摩羯座20216月运势 水瓶座2021年8月16日运势 2016年水瓶座运势
copyright © 2022 一生命运网 版权所有 辽ICP备2022007116号-4
法律声明:本站文章来自网友投稿,不代表本站观点,版权归原创者所有,如果侵犯了你的权益,请通知我们,我们会及时删除侵权内容!