|
|
@ -2,11 +2,14 @@ package com.fkzy.warn.common.util; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.fkzy.warn.common.constants.EntityConstants; |
|
|
import com.fkzy.warn.common.constants.LawResearchUrlConstants; |
|
|
import com.fkzy.warn.common.constants.LawResearchUrlConstants; |
|
|
|
|
|
import com.fkzy.warn.model.InvocationRecord; |
|
|
import org.springframework.http.*; |
|
|
import org.springframework.http.*; |
|
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.FileNotFoundException; |
|
|
import java.io.FileNotFoundException; |
|
|
import java.io.PrintWriter; |
|
|
import java.io.PrintWriter; |
|
|
@ -25,6 +28,9 @@ public class LawResearchUtil { |
|
|
// code 3001 请求失败 |
|
|
// code 3001 请求失败 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 司法模型 |
|
|
* 司法模型 |
|
|
* |
|
|
* |
|
|
@ -34,7 +40,7 @@ public class LawResearchUtil { |
|
|
* @author zhangjing |
|
|
* @author zhangjing |
|
|
* @create 2024/9/19 |
|
|
* @create 2024/9/19 |
|
|
**/ |
|
|
**/ |
|
|
public String querySssxxg(String name, String creditCode) { |
|
|
|
|
|
|
|
|
public InvocationRecord querySssxxg(String name, String creditCode) { |
|
|
|
|
|
|
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (name == null) { |
|
|
if (name == null) { |
|
|
@ -54,10 +60,11 @@ public class LawResearchUtil { |
|
|
array, null, null, |
|
|
array, null, null, |
|
|
"AmL92u2kCHjcCwcF", |
|
|
"AmL92u2kCHjcCwcF", |
|
|
"Pv+mA1v2LRkgsZWqg2mAQDYM1hToAr3JmDZRYQRhZ07tHXJ2wSYEnFTWRp2ly+" |
|
|
"Pv+mA1v2LRkgsZWqg2mAQDYM1hToAr3JmDZRYQRhZ07tHXJ2wSYEnFTWRp2ly+" |
|
|
|
|
|
,null |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
//-------------------------------新接口-------------------- |
|
|
//-------------------------------新接口-------------------- |
|
|
public static String querySxx(String name, String creditCode) { |
|
|
|
|
|
|
|
|
public static InvocationRecord querySxx(String name, String creditCode) { |
|
|
|
|
|
|
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (name == null) { |
|
|
if (name == null) { |
|
|
@ -84,11 +91,12 @@ public class LawResearchUtil { |
|
|
return getData(LawResearchUrlConstants.BASE_URL + LawResearchUrlConstants.QUERY_SXX, |
|
|
return getData(LawResearchUrlConstants.BASE_URL + LawResearchUrlConstants.QUERY_SXX, |
|
|
array, null, null, |
|
|
array, null, null, |
|
|
"AmL92u2kCHjcCwcF", |
|
|
"AmL92u2kCHjcCwcF", |
|
|
"Pv+mA1v2LRkgsZWqg2mAQDYM1hToAr3JmDZRYQRhZ07tHXJ2wSYEnFTWRp2Iy+OI" |
|
|
|
|
|
|
|
|
"Pv+mA1v2LRkgsZWqg2mAQDYM1hToAr3JmDZRYQRhZ07tHXJ2wSYEnFTWRp2Iy+OI", |
|
|
|
|
|
"司法模型" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String queryDishonest(String companyName, String fromDate, String legalPersionName, String creditcode) { |
|
|
|
|
|
|
|
|
public InvocationRecord queryDishonest(String companyName, String fromDate, String legalPersionName, String creditcode) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
JSONArray array = new JSONArray(); |
|
|
JSONArray array = new JSONArray(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
@ -112,11 +120,12 @@ public class LawResearchUtil { |
|
|
return getData(LawResearchUrlConstants.BASE_URL + LawResearchUrlConstants.QUERY_DISHONEST, |
|
|
return getData(LawResearchUrlConstants.BASE_URL + LawResearchUrlConstants.QUERY_DISHONEST, |
|
|
array, null, null |
|
|
array, null, null |
|
|
,"xsXnjpCBbwKYU1d5" |
|
|
,"xsXnjpCBbwKYU1d5" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQJPn6o18VQagRlJny8DmuavlIoK6ZY6SG9CFBpFX0Ce5" |
|
|
|
|
|
|
|
|
,"Pv+mA1v2LRkgsZWqg2mAQJPn6o18VQagRlJny8DmuavlIoK6ZY6SG9CFBpFX0Ce5", |
|
|
|
|
|
"失信" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String queryLimitConsumption(String companyName, String fromDate, String legalPersionName, String creditcode) { |
|
|
|
|
|
|
|
|
public InvocationRecord queryLimitConsumption(String companyName, String fromDate, String legalPersionName, String creditcode) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (companyName == null) { |
|
|
if (companyName == null) { |
|
|
companyName = "恒大集团有限公司"; |
|
|
companyName = "恒大集团有限公司"; |
|
|
@ -131,6 +140,7 @@ public class LawResearchUtil { |
|
|
array, null, null |
|
|
array, null, null |
|
|
,"Ju000$LbdkX@tjTK" |
|
|
,"Ju000$LbdkX@tjTK" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQONIs4+TPrj8Zi7WRB8+xjBfG5HByVFpyzjoWwn0Wsi6" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQONIs4+TPrj8Zi7WRB8+xjBfG5HByVFpyzjoWwn0Wsi6" |
|
|
|
|
|
, "限高" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -728,7 +738,7 @@ public class LawResearchUtil { |
|
|
* @author zhangjing |
|
|
* @author zhangjing |
|
|
* @create 2024/9/19 |
|
|
* @create 2024/9/19 |
|
|
**/ |
|
|
**/ |
|
|
public String addpublic(String name) { |
|
|
|
|
|
|
|
|
public InvocationRecord addpublic(String name) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (name == null) { |
|
|
if (name == null) { |
|
|
name = "平凉市宏建煤炭有限责任公司"; |
|
|
name = "平凉市宏建煤炭有限责任公司"; |
|
|
@ -742,6 +752,7 @@ public class LawResearchUtil { |
|
|
array, null, null |
|
|
array, null, null |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
|
|
|
, "监控名单添加接口" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -752,7 +763,7 @@ public class LawResearchUtil { |
|
|
* @author zhangjing |
|
|
* @author zhangjing |
|
|
* @create 2024/9/19 |
|
|
* @create 2024/9/19 |
|
|
**/ |
|
|
**/ |
|
|
public String delcompany(String name) { |
|
|
|
|
|
|
|
|
public InvocationRecord delcompany(String name) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (name == null) { |
|
|
if (name == null) { |
|
|
// name = "小米科技有限责任公司"; |
|
|
// name = "小米科技有限责任公司"; |
|
|
@ -767,6 +778,7 @@ public class LawResearchUtil { |
|
|
array, null, null |
|
|
array, null, null |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
|
|
|
, "监控名单删除接口" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -778,7 +790,7 @@ public class LawResearchUtil { |
|
|
* @author zhangjing |
|
|
* @author zhangjing |
|
|
* @create 2024/9/19 |
|
|
* @create 2024/9/19 |
|
|
**/ |
|
|
**/ |
|
|
public String monitorQuery(Integer pageIndex,Integer pageSize) { |
|
|
|
|
|
|
|
|
public InvocationRecord monitorQuery(Integer pageIndex,Integer pageSize) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (pageIndex == null) { |
|
|
if (pageIndex == null) { |
|
|
pageIndex = 1; |
|
|
pageIndex = 1; |
|
|
@ -791,6 +803,7 @@ public class LawResearchUtil { |
|
|
null, jsonObject, null |
|
|
null, jsonObject, null |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
|
|
|
, "监控名单查询接口" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -803,7 +816,7 @@ public class LawResearchUtil { |
|
|
* @author zhangjing |
|
|
* @author zhangjing |
|
|
* @create 2024/9/19 |
|
|
* @create 2024/9/19 |
|
|
**/ |
|
|
**/ |
|
|
public static String queryMonitorCases(String queryDate,Integer pageIndex,Integer pageSize) { |
|
|
|
|
|
|
|
|
public static InvocationRecord queryMonitorCases(String queryDate,Integer pageIndex,Integer pageSize) { |
|
|
//默认测试数据 |
|
|
//默认测试数据 |
|
|
if (queryDate == null) { |
|
|
if (queryDate == null) { |
|
|
// queryDate="2022-07-06"; |
|
|
// queryDate="2022-07-06"; |
|
|
@ -819,6 +832,7 @@ public class LawResearchUtil { |
|
|
null, jsonObject,null |
|
|
null, jsonObject,null |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Cdi9CIzt0AnWucOe" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
,"Pv+mA1v2LRkgsZWqg2mAQL/te4UiH52wshn/McsdLfmn+SBZ3LV86JM1jNjZIxqv" |
|
|
|
|
|
, "监控信息获取" |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -999,9 +1013,21 @@ public class LawResearchUtil { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String getData(String apiUrl, JSONArray array, JSONObject jsonObject, String method, |
|
|
|
|
|
String key,String ticket |
|
|
|
|
|
|
|
|
private static InvocationRecord getData(String apiUrl, JSONArray array, JSONObject jsonObject, String method, |
|
|
|
|
|
String key,String ticket,String apiName |
|
|
) { |
|
|
) { |
|
|
|
|
|
InvocationRecord invocationRecord = new InvocationRecord(); |
|
|
|
|
|
invocationRecord.setApiKey(key); |
|
|
|
|
|
invocationRecord.setApiTicket(ticket); |
|
|
|
|
|
invocationRecord.setApiUrl(apiUrl); |
|
|
|
|
|
if (array!=null){ |
|
|
|
|
|
invocationRecord.setInputArr(array.toJSONString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (jsonObject!=null){ |
|
|
|
|
|
invocationRecord.setInputObj(jsonObject.toJSONString()); |
|
|
|
|
|
} |
|
|
|
|
|
invocationRecord.setApiName(apiName); |
|
|
|
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
HttpComponentsClientHttpRequestFactory requestFactory |
|
|
HttpComponentsClientHttpRequestFactory requestFactory |
|
|
= new HttpComponentsClientHttpRequestFactory(); |
|
|
= new HttpComponentsClientHttpRequestFactory(); |
|
|
@ -1030,18 +1056,21 @@ public class LawResearchUtil { |
|
|
String resultData=null; |
|
|
String resultData=null; |
|
|
try (PrintWriter writer = new PrintWriter(new File(filePath))) { |
|
|
try (PrintWriter writer = new PrintWriter(new File(filePath))) { |
|
|
//接收到返回结果需要进行 aes 解密 |
|
|
//接收到返回结果需要进行 aes 解密 |
|
|
|
|
|
invocationRecord.setIsSuccess(0); |
|
|
resultData = AES.aesDecrypt(result.getBody(), key); |
|
|
resultData = AES.aesDecrypt(result.getBody(), key); |
|
|
//写入内容 |
|
|
//写入内容 |
|
|
writer.println(resultData); |
|
|
writer.println(resultData); |
|
|
|
|
|
|
|
|
|
|
|
invocationRecord.setIsSuccess(1); |
|
|
|
|
|
invocationRecord.setApiResult(resultData); |
|
|
// 自动关闭,因为使用了 try-with-resources 语句 |
|
|
// 自动关闭,因为使用了 try-with-resources 语句 |
|
|
} catch (FileNotFoundException e) { |
|
|
} catch (FileNotFoundException e) { |
|
|
System.err.println("文件未找到: " + e.getMessage()); |
|
|
System.err.println("文件未找到: " + e.getMessage()); |
|
|
} |
|
|
} |
|
|
return resultData; |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
|
|
|
} finally { |
|
|
|
|
|
return invocationRecord; |
|
|
} |
|
|
} |
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |