|
@@ -2,28 +2,32 @@ package com.miaxis.test;
|
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.io.OutputStream;
|
|
|
-import java.io.OutputStreamWriter;
|
|
|
+import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.MalformedURLException;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
public class Test03 {
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
- //test1();
|
|
|
+ // test1();
|
|
|
|
|
|
- String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImIzZjQ2MjgwLTA0OTAtNGI5Zi1iNGI1LTE3NzU5OTJlYTQ1YiJ9.5-Ho3p7WH2LOVLo5KVquos26obPQMf3xtMGYAm60jSAelg4QibTWbhfReppL-RrG4M3NLunlCy9WXMjZn8ePjQ";
|
|
|
-
|
|
|
-
|
|
|
- test2("12023021514503529883838685788487",token);
|
|
|
+ String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6Ijc1MzRjZGI3LTcyZGMtNGExZi1hYTc1LWFhYjlmYmYzMGI5YyJ9.iKl7-pr-mrkKNf-YRoSC86uRoZHCapTtM94PMvOz7mQAaSV32FsPqBdusA73p0jkn6HZMrZDcXTmKFmY-_9PAg";
|
|
|
+ test4();
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 登录接口
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
public static void test1() throws IOException {
|
|
|
URL url = new URL("https://jsjp-admin1.zzxcx.net/jsjp-admin/login/noCode");
|
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
@@ -80,4 +84,78 @@ public class Test03 {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static void test3(String token) throws IOException {
|
|
|
+
|
|
|
+ Map<String,Object> param = new HashMap<String,Object>();
|
|
|
+ param.put("dqbh", URLEncoder.encode(String.valueOf(3501), "UTF-8"));
|
|
|
+ param.put("startTime", URLEncoder.encode(String.valueOf("2023-02-01 00:00:00"), "UTF-8"));
|
|
|
+ param.put("endTime", URLEncoder.encode(String.valueOf("2023-02-28 23:59:59"), "UTF-8"));
|
|
|
+ param.put("isShare", 1);
|
|
|
+ param.put("tradeType", 1);
|
|
|
+
|
|
|
+
|
|
|
+ String urls = "https://jsjp-admin1.zzxcx.net/jsjp-admin/order/info/school/list";
|
|
|
+ StringBuffer paramBuffer = new StringBuffer();
|
|
|
+
|
|
|
+ if(param!=null) {
|
|
|
+ int i = 0;
|
|
|
+ for (String key : param.keySet()) {
|
|
|
+ if (i == 0) {
|
|
|
+ paramBuffer.append("?");
|
|
|
+ } else {
|
|
|
+ paramBuffer.append("&");
|
|
|
+ }
|
|
|
+ paramBuffer.append(key).append("=").append(param.get(key));
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ urls += paramBuffer;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ URL url = new URL(urls);
|
|
|
+ System.out.println(url.toString());
|
|
|
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
+ conn.setRequestMethod("GET");
|
|
|
+ conn.setRequestProperty("Authorization", token);
|
|
|
+ conn.connect();
|
|
|
+ int responseCode = conn.getResponseCode();
|
|
|
+ System.out.println("Response Code: " + responseCode);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
|
|
+ String inputLine;
|
|
|
+ StringBuilder response = new StringBuilder();
|
|
|
+ while ((inputLine = in.readLine()) != null) {
|
|
|
+ response.append(inputLine);
|
|
|
+ }
|
|
|
+ in.close();
|
|
|
+
|
|
|
+ System.out.println("Response Body: " + response.toString());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void test4() {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.add(Calendar.MONTH, -1);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ Date startOfMonth = calendar.getTime();
|
|
|
+
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
+ calendar.set(Calendar.MINUTE, 59);
|
|
|
+ calendar.set(Calendar.SECOND, 59);
|
|
|
+ Date endOfMonth = calendar.getTime();
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ System.out.println("Start of Month: " + sdf.format(startOfMonth));
|
|
|
+ System.out.println("End of Month: " + sdf.format(endOfMonth));
|
|
|
+ }
|
|
|
+
|
|
|
}
|