mashengyi il y a 19 heures
Parent
commit
d5c33ce97c

+ 2 - 1
src/main/java/com/jkcredit/invoice/util/LogUtils.java

@@ -165,7 +165,8 @@ public class LogUtils {
     public static void main(String[] args) throws Exception {
         String a = "{\"id_number\":\"36042919960907151X\",\"bank_card_number\":\"6214680048545055\",\"name\":\"刘玺\",\"mobile\":\"13875012909\",\"sign\":\"a93471e386fed0427c68bd6e9967011b\"}";
         System.out.println(encode(a));
-        //String b = "{\"sign\":\"a93471e386fed0427c68bd6e9967011b\",\"id_number\":\"NjEyMzIzMTk5MjA5MDg0ODcy\",\"name\":\"5YiY5466\",\"bank_card_number\":\"NjIxNDY4MDA0ODU0NTA1NQ==\",\"mobile\":\"MTU4NzMwNTI4MzY=\"}";
+        String b = "{\"sign\":\"a93471e386fed0427c68bd6e9967011b\",\"id_number\":\"nzJWETbb5o7owivoUsg/TQ==\",\"name\":\"5YiY5466\",\"bank_card_number\":\"NjIxNDY4MDA0ODU0NTA1NQ==\",\"mobile\":\"MTU4NzMwNTI4MzY=\"}";
         System.out.println(decode(encode(a)));
+        System.out.println(decode(b));
     }
 }

+ 25 - 5
src/main/java/com/jkcredit/invoice/util/QueryDemoTest.java

@@ -6,6 +6,7 @@ import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.methods.PostMethod;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -19,17 +20,22 @@ public class QueryDemoTest {
     /**
      * 测试地址
      */
-    private static final String URL = "http://127.0.0.1:18081/api/rest";
+    private static final String URL = "http://192.168.50.13:18081/api/rest";
 
     /**
      * 分配的appKey
      */
-    private static final String APP_KEY = "jkxy";
+    private static final String APP_KEY = "data_test1";
 
     /**
      * 分配的appSecret
      */
-    private static final String APP_SECRET = "7697CE9BB1D5AC46CFDDA238328AD34EA33E483G";
+    private static final String APP_SECRET = "C1C2693835F1D2371085C044B5D25E624876BF39";
+
+    static String filename = "/Users/mashengyi/Downloads/";
+    static String logname = "test.pdf";
+
+    File filePath = new File(filename + logname);
 
 
     /**
@@ -95,7 +101,7 @@ public class QueryDemoTest {
          */
         JSONObject paramJsonObj = new JSONObject();
         //CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
-        paramJsonObj.put("api", "WAYBILL_OPERATORSENDCODE");
+        paramJsonObj.put("api", "WAY_BILL_START");
         paramJsonObj.put("appKey", APP_KEY);
         paramJsonObj.put("appSecret", APP_SECRET);
 
@@ -113,7 +119,21 @@ public class QueryDemoTest {
          * 具体业务参数放在data中
          */
         JSONObject dataJson = new JSONObject();
-        dataJson.put("taxplayerCode", "91110105MA01BCJJ7U");
+        dataJson.put("num", "Zy202498118100211002");
+        dataJson.put("plateNumber", "川X73516");
+        dataJson.put("plateColor", "1");
+        dataJson.put("taxplayerCode", "91370982MABXNWQ48P");
+
+        dataJson.put("startTime", "2024-12-15T08:00:00");
+        dataJson.put("sourceAddr", "北京朝阳区衡山路街道");
+        dataJson.put("destAddr", "北京海淀区周山路街道");
+        dataJson.put("predictEndTime", "2024-12-15T18:00:00");
+        dataJson.put("fee", 2001);
+        dataJson.put("titleType", 1);
+        dataJson.put("base64Str", Base64Utils.fileToBase64Str(filePath));
+        dataJson.put("waybillFileName", "test.pdf");
+        dataJson.put("contractType", 1);
+
 
         return dataJson;
     }

+ 9 - 7
src/main/java/com/jkcredit/invoice/util/QueryDemoTest1.java

@@ -19,22 +19,22 @@ public class QueryDemoTest1 {
     /**
      * 测试地址
      */
-    private static final String URL = "http://etc.jkcredit.com:9999/api/rest";
+    private static final String URL = "http://api.jkcredit.com:58080/gateway?api=credit.sec.data";
 
     /**
      * 分配的appKey
      */
-    private static final String APP_KEY = "wycl";
+    private static final String APP_KEY = "dzka";
 
     /**
      * 分配的appSecret
      */
-    private static final String APP_SECRET = "8EDEE739B81EFF37820A1921DEFC0ABE39FF137A";
+    private static final String APP_SECRET = "0551954004ED4EED99B40E0E5023E7966AC084DB";
 
     /**
      * 企业编号
      */
-    private static final String COMPANY_NUM = "11174796";
+    private static final String COMPANY_NUM = "11194852";
 
     /**
      * 方法入口
@@ -99,7 +99,7 @@ public class QueryDemoTest1 {
          */
         JSONObject paramJsonObj = new JSONObject();
         //CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
-        paramJsonObj.put("api", "VEHICLE_REGISTER");
+        paramJsonObj.put("api", "B2B_QUERY_TRADE_APPLY_V1");
         paramJsonObj.put("appKey", APP_KEY);
         paramJsonObj.put("appSecret", APP_SECRET);
 
@@ -117,8 +117,10 @@ public class QueryDemoTest1 {
          * 具体业务参数放在data中
          */
         JSONObject dataJson = new JSONObject();
-        dataJson.put("plateNumber", "冀DK1957");
-        dataJson.put("plateColor", "1");
+        dataJson.put("companyNum", COMPANY_NUM);
+        dataJson.put("cardId", "33012308230220077349");
+        dataJson.put("tradeId", "G150331002002040100302024090308000210");
+
         return dataJson;
     }
 

+ 169 - 0
src/main/java/com/jkcredit/invoice/util/QueryDemoTest_end.java

@@ -0,0 +1,169 @@
+package com.jkcredit.invoice.util;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+/**
+ * @author mashengyi
+ */
+public class QueryDemoTest_end {
+
+    /**
+     * 测试地址
+     */
+    private static final String URL = "http://192.168.50.13:18081/api/rest";
+
+    /**
+     * 分配的appKey
+     */
+    private static final String APP_KEY = "data_test1";
+
+    /**
+     * 分配的appSecret
+     */
+    private static final String APP_SECRET = "C1C2693835F1D2371085C044B5D25E624876BF39";
+
+    static String filename = "/Users/mashengyi/Downloads/";
+    static String logname = "test.pdf";
+
+    File filePath = new File(filename + logname);
+
+
+    /**
+     * 方法入口
+     *
+     * @param args
+     */
+    public static void main(String[] args) throws Exception {
+        QueryDemoTest_end demo = new QueryDemoTest_end();
+        demo.runMainService();
+    }
+
+    /**
+     * 流转字符串
+     *
+     * @param is
+     * @return
+     */
+    public static String convertStreamToString(InputStream is) {
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+        StringBuilder builder = new StringBuilder();
+        String line = null;
+        try {
+            while ((line = reader.readLine()) != null) {
+                builder.append(line + "\n");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return builder.toString();
+    }
+
+    /**
+     * 调用主接口
+     */
+    public void runMainService() {
+        try {
+            /**
+             * 实名demo
+             */
+            JSONObject paramJsonObj = initParamJsonObjRealname();
+            String ret = postClient(URL, paramJsonObj);
+            System.out.println(ret);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 整合参数
+     *
+     * @return
+     */
+    public JSONObject initParamJsonObjRealname() {
+        /**
+         * 基本参数
+         */
+        JSONObject paramJsonObj = new JSONObject();
+        //CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
+        paramJsonObj.put("api", "WAY_BILL_END");
+        paramJsonObj.put("appKey", APP_KEY);
+        paramJsonObj.put("appSecret", APP_SECRET);
+
+
+        /**
+         * 业务参数
+         */
+        JSONObject dataJson = initMainServiceParamJsonObjRealname();
+        paramJsonObj.put("data", dataJson);
+        return paramJsonObj;
+    }
+
+    public JSONObject initMainServiceParamJsonObjRealname() {
+        /**
+         * 具体业务参数放在data中
+         */
+        JSONObject dataJson = new JSONObject();
+        dataJson.put("num", "Zy20240918100211001");
+        dataJson.put("realDestAddr", "北京海淀区周山路街道");
+
+        dataJson.put("endTime", "2024-12-16T09:18:22");
+
+
+        return dataJson;
+    }
+
+    /**
+     * 实现http post请求 注意编码 UTF-8
+     *
+     * @param url
+     * @param paramObj
+     * @return
+     */
+    public String postClient(String url, JSONObject paramObj) {
+        String str = "";
+        HttpClient client = null;
+        PostMethod method = null;
+        try {
+            client = new HttpClient();
+            method = new PostMethod(url);
+            method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
+            NameValuePair[] param = new NameValuePair[paramObj.size()];
+            @SuppressWarnings("unchecked")
+            Iterator<String> keys = paramObj.keys();
+            int i = 0;
+            while (keys.hasNext()) {
+                String key = keys.next();
+                String value = paramObj.getString(key);
+                param[i] = new NameValuePair(key, value);
+                i++;
+            }
+            method.setRequestBody(param);
+            client.executeMethod(method);
+            str = convertStreamToString(method.getResponseBodyAsStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+        return str;
+    }
+
+}

+ 166 - 0
src/main/java/com/jkcredit/invoice/util/QueryDemoTest_time.java

@@ -0,0 +1,166 @@
+package com.jkcredit.invoice.util;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+/**
+ * @author mashengyi
+ */
+public class QueryDemoTest_time {
+
+    /**
+     * 测试地址
+     */
+    private static final String URL = "http://114.242.29.79:20000/api/rest";
+
+    /**
+     * 分配的appKey
+     */
+    private static final String APP_KEY = "data_test1";
+
+    /**
+     * 分配的appSecret
+     */
+    private static final String APP_SECRET = "C1C2693835F1D2371085C044B5D25E624876BF39";
+
+    static String filename = "/Users/mashengyi/Downloads/";
+    static String logname = "test.pdf";
+
+    File filePath = new File(filename + logname);
+
+
+    /**
+     * 方法入口
+     *
+     * @param args
+     */
+    public static void main(String[] args) throws Exception {
+        QueryDemoTest_time demo = new QueryDemoTest_time();
+        demo.runMainService();
+    }
+
+    /**
+     * 流转字符串
+     *
+     * @param is
+     * @return
+     */
+    public static String convertStreamToString(InputStream is) {
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+        StringBuilder builder = new StringBuilder();
+        String line = null;
+        try {
+            while ((line = reader.readLine()) != null) {
+                builder.append(line + "\n");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return builder.toString();
+    }
+
+    /**
+     * 调用主接口
+     */
+    public void runMainService() {
+        try {
+            /**
+             * 实名demo
+             */
+            JSONObject paramJsonObj = initParamJsonObjRealname();
+            String ret = postClient(URL, paramJsonObj);
+            System.out.println(ret);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 整合参数
+     *
+     * @return
+     */
+    public JSONObject initParamJsonObjRealname() {
+        /**
+         * 基本参数
+         */
+        JSONObject paramJsonObj = new JSONObject();
+        //CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
+        paramJsonObj.put("api", "WAY_BILL_NUM_FIND_INVOICE");
+        paramJsonObj.put("appKey", APP_KEY);
+        paramJsonObj.put("appSecret", APP_SECRET);
+
+
+        /**
+         * 业务参数
+         */
+        JSONObject dataJson = initMainServiceParamJsonObjRealname();
+        paramJsonObj.put("data", dataJson);
+        return paramJsonObj;
+    }
+
+    public JSONObject initMainServiceParamJsonObjRealname() {
+        /**
+         * 具体业务参数放在data中
+         */
+        JSONObject dataJson = new JSONObject();
+        dataJson.put("num", "Zy202498118100211002");
+
+
+        return dataJson;
+    }
+
+    /**
+     * 实现http post请求 注意编码 UTF-8
+     *
+     * @param url
+     * @param paramObj
+     * @return
+     */
+    public String postClient(String url, JSONObject paramObj) {
+        String str = "";
+        HttpClient client = null;
+        PostMethod method = null;
+        try {
+            client = new HttpClient();
+            method = new PostMethod(url);
+            method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
+            NameValuePair[] param = new NameValuePair[paramObj.size()];
+            @SuppressWarnings("unchecked")
+            Iterator<String> keys = paramObj.keys();
+            int i = 0;
+            while (keys.hasNext()) {
+                String key = keys.next();
+                String value = paramObj.getString(key);
+                param[i] = new NameValuePair(key, value);
+                i++;
+            }
+            method.setRequestBody(param);
+            client.executeMethod(method);
+            str = convertStreamToString(method.getResponseBodyAsStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+        return str;
+    }
+
+}

+ 3 - 3
src/main/java/com/jkcredit/invoice/util/QueryDemo_3rd.java

@@ -23,12 +23,12 @@ public class QueryDemo_3rd {
     /**
      * 测试地址
      */
-    private static final String URL = "http://127.0.0.1:18081/api/rest";
+    private static final String URL = "http://192.168.50.13:18081/api/rest";
 
     /**
      * 分配的appKey
      */
-    private static final String appKey = "jkxy";
+    private static final String appKey = "data_test1";
 
     static String filename = "/Users/mashengyi/Downloads/";
     static String logname = "请求参数.txt";
@@ -184,7 +184,7 @@ public class QueryDemo_3rd {
         paramJsonObj.put("api", "WAY_BILL_START");
         paramJsonObj.put("appKey", appKey);
         paramJsonObj.put("appSecret",
-                "7697CE9BB1D5AC46CFDDA238328AD34EA33E483G");
+                "C1C2693835F1D2371085C044B5D25E624876BF39");
 
 
         /**

+ 8 - 6
src/main/java/com/jkcredit/invoice/util/QueryDemo_Test.java

@@ -28,7 +28,7 @@ public class QueryDemo_Test {
     //	private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
     //private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
     //private static final String URL = "http://192.168.50.4:18080/gateway?api=credit.sec.data";//北京节点
-    private static final String URL = "https://credit.h11.site/gateway?api=credit.sec.data";
+    private static final String URL = "http://192.168.1.86/gateway?api=credit.sec.data";
     //	  private static final String URL = "http://127.0.0.1:18080/gateway?api=credit.sec.data";
     //	private static final String URL = "http://110.88.150.68:8000/gateway?api=credit.sec.data";
     //	private static final String URL = "http://110.88.150.72:8000/gateway?api=credit.sec.data_test";
@@ -84,14 +84,16 @@ public class QueryDemo_Test {
          *	 基本参数
          */
         JSONObject paramJsonObj = new JSONObject();
-        paramJsonObj.put("api", "CMCC_STATUS_CHECK_V7");//CMCC_3RD_DETAIL_V15//CMCC_2ND_V27G//CMCC_3RD_DETAIL_V32B//CMCC_ONLINE_CHECK_V8//CMCC_STATUS_CHECK_V7
+        //CMCC_IDCARD_V1//CMCC_IDCARD_V27MC//CMCC_IDCARD_V9//CMCC_IDCARD_V27T//CMCC_3RD_DETAIL_V9
+        //CTCC_3RD_V9//CTCC_3RD_V9B//CTCC_3RD_DETAIL_V13//CTCC_3RD_DETAIL_V17
+        //CUCC_SIMPLE_V2
+        paramJsonObj.put("api", "CTCC_3RD_DETAIL_V17");
         paramJsonObj.put("appKey", appKey);
         paramJsonObj.put("appSecret",
                 //		"D78C393359BF128715C65D91C67051478A4DFC13");
                 "C41DF125F0C23FBBB83E461F5045A30ACB3FF55A");
 
 
-
         /**
          * 	业务参数
          */
@@ -113,9 +115,9 @@ public class QueryDemo_Test {
          * 具体业务参数放在data中
          */
         JSONObject dataJson = new JSONObject();
-	      dataJson.put("name","陈春灵");
-	      dataJson.put("mobile","19846930551");
-        dataJson.put("id_number","372926198502202847");
+        dataJson.put("name", "王智伟");
+        dataJson.put("mobile", "18137386741");
+        dataJson.put("id_number", "411121200207187054");
 
         return dataJson;
     }