排班
This commit is contained in:
parent
72b3e40124
commit
75292374fa
@ -0,0 +1,36 @@
|
|||||||
|
package org.dromara.property.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法定节假日工具类
|
||||||
|
*/
|
||||||
|
public class HolidayUtil {
|
||||||
|
|
||||||
|
public HolidayUtil() throws Exception {
|
||||||
|
// 调用jiejiariapi.com API获取节假日信息
|
||||||
|
String baiduUrl = "https://api.jiejiariapi.com/v1/holidays/2025";
|
||||||
|
JSONObject jiejiariapiResponse = getJsonFromUrl(baiduUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONObject getJsonFromUrl(String urlString) throws Exception {
|
||||||
|
URL url = new URL(urlString);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.connect();
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||||
|
StringBuilder response = new StringBuilder();
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
response.append(line);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
|
||||||
|
return new JSONObject(response.toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user