回调接口测试

This commit is contained in:
lvleigang 2025-06-24 09:41:16 +08:00
parent b9a51e2681
commit 88bcbc1895
7 changed files with 188 additions and 173 deletions

View File

@ -44,6 +44,8 @@ public class FundsAllocationPluginServiceImpl implements IFundsAllocationPluginS
*/ */
@Override @Override
public JsonResultEntity callback(JSONObject requestJson) throws BaseSystemException { public JsonResultEntity callback(JSONObject requestJson) throws BaseSystemException {
logger.error(" 资金拨付流程结束回调:"+requestJson.toJSONString());
String dataSourceCode = requestJson.getString("apiDataSourceCode");//数据源 String dataSourceCode = requestJson.getString("apiDataSourceCode");//数据源
String headerStr = requestJson.getString("headers");//表头 String headerStr = requestJson.getString("headers");//表头
String eventType = requestJson.getString("eventType"); String eventType = requestJson.getString("eventType");
@ -66,6 +68,7 @@ public class FundsAllocationPluginServiceImpl implements IFundsAllocationPluginS
//查询审批意见 //查询审批意见
FundsAllocationEntity fundAllocation = new FundsAllocationEntity(); FundsAllocationEntity fundAllocation = new FundsAllocationEntity();
fundAllocation.setCol_summary_id(summaryId); fundAllocation.setCol_summary_id(summaryId);
fundAllocation.setDataSourceCode(dataSourceCode);
List<FundsAllocationEntity> fundsAllocationList = fundsAllocationService.queryCtpCommentList(fundAllocation); List<FundsAllocationEntity> fundsAllocationList = fundsAllocationService.queryCtpCommentList(fundAllocation);
if (CollectionUtils.isNotEmpty(fundsAllocationList)){ if (CollectionUtils.isNotEmpty(fundsAllocationList)){
fundAllocation = fundsAllocationList.get(0); fundAllocation = fundsAllocationList.get(0);

View File

@ -3,7 +3,7 @@ logging:
#日志级别 指定目录级别 #日志级别 指定目录级别
level: level:
root: INFO root: INFO
encodings: UTF-8 encodings: GBK
file: file:
# 日志保存路径 # 日志保存路径
path: D:\yongansystem\serverV3\log\zs path: D:\yongansystem\serverV3\log\zs
@ -12,7 +12,7 @@ spring:
dynamic: dynamic:
datasource: datasource:
master: master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true url: jdbc:mysql://127.0.0.1:3307/businesscenter_zs?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root username: root
password: bd993088e8a7c3dc5f44441617f9b4bf password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
@ -39,9 +39,9 @@ cbs8:
OA: OA:
data_source_code: yc_oa data_source_code: yc_oa
zt: zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface
file_oa: file_oa:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
#税务pdf附件下载存放路径 #税务pdf附件下载存放路径
invoice_pdf: invoice_pdf:
url: D:\yongansystem\invoice\pdf\ url: D:\yongansystem\invoice\pdf\

View File

@ -18,12 +18,12 @@ spring:
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile: savefile:
# 文件保存路径 # 文件保存路径
path: /home/webservice/zt/file path: D:\yongansystem\serverV3\zt\file
# path: D:\webservice\file # path: D:\webservice\file
# pluginpath: D:\webservice\plugin # pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/zt/plugin pluginpath: D:\yongansystem\serverV3\zt\plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\ # tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/ tomcatpath: D:\yongansystem\serverV3\apache-tomcat-9.0.68_test\webapps\kangarooDataCenterV3\WEB-INF\classes\
cbs8: cbs8:
appId: 1P4AGrpz appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
@ -39,7 +39,17 @@ cbs8:
OA: OA:
data_source_code: yc_oa data_source_code: yc_oa
zt: zt:
url: http://127.0.0.1:10087/kangarooDataCenterV3/entranceController/externalCallInterface url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
file_oa:
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
#税务pdf附件下载存放路径
invoice_pdf:
url: D:\yongansystem\invoice\pdf\
#税务ofd附件下载存放路径
invoice_ofd:
url: D:\yongansystem\invoice\ofd\
invoice_xml:
url: D:\yongansystem\invoice\xml\
zx: zx:
# 测试用这个 这个是银行给的 # 测试用这个 这个是银行给的
privateKey: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgtzMo2o6THK3yLIm+83Ch/560+02l2hjjBSFGieWY/Z6gCgYIKoEcz1UBgi2hRANCAATKhwZX4P3XI8vYTKeCOLMVbanUNbaXjrIEZynshwdOzRVgzRQSiPNWo6OBBkAPvqE+2RS+5ABpS82DSlKl81z0 privateKey: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgtzMo2o6THK3yLIm+83Ch/560+02l2hjjBSFGieWY/Z6gCgYIKoEcz1UBgi2hRANCAATKhwZX4P3XI8vYTKeCOLMVbanUNbaXjrIEZynshwdOzRVgzRQSiPNWo6OBBkAPvqE+2RS+5ABpS82DSlKl81z0

View File

@ -153,15 +153,15 @@ public class temButtom {
} }
@Test //@Test
public void test0111() { //public void test0111() {
//请求token // //请求token
String accessToken = getToken(); // String accessToken = getToken();
//请求分页查询全量进项发票 // //请求分页查询全量进项发票
String data = getdata(accessToken); // String data = getdata(accessToken);
//
//
} //}
@Test @Test
public void youduTest(){ public void youduTest(){
@ -174,133 +174,133 @@ public class temButtom {
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a"); String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
System.out.println("sign"+a); System.out.println("sign"+a);
} }
private String getdata(String accessToken) { //private String getdata(String accessToken) {
String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken; // String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken;
JSONObject dayabody = new JSONObject(); // JSONObject dayabody = new JSONObject();
dayabody.put("accessKey","6X3B526P5HqE6ums"); // dayabody.put("accessKey","6X3B526P5HqE6ums");
long timestamp = System.currentTimeMillis(); // long timestamp = System.currentTimeMillis();
dayabody.put("timestamp",timestamp); // dayabody.put("timestamp",timestamp);
JSONObject queryParams = new JSONObject(); // JSONObject queryParams = new JSONObject();
queryParams.put("page",1); // queryParams.put("page",1);
queryParams.put("size",50); // queryParams.put("size",50);
//queryParams.put("kprqq","2025-04-06"); // //queryParams.put("kprqq","2025-04-06");
//queryParams.put("kprqz","2025-04-06"); // //queryParams.put("kprqz","2025-04-06");
queryParams.put("taxNo","91330110MAC5FPUY2U"); // queryParams.put("taxNo","91330110MAC5FPUY2U");
dayabody.put("queryParams",queryParams); // dayabody.put("queryParams",queryParams);
Map<String, Object> parametersMap = new HashMap<>(); // Map<String, Object> parametersMap = new HashMap<>();
parametersMap.put("accessKey","6X3B526P5HqE6ums"); // parametersMap.put("accessKey","6X3B526P5HqE6ums");
parametersMap.put("timestamp",timestamp); // parametersMap.put("timestamp",timestamp);
//
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a"); // String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
dayabody.put("sign",a); // dayabody.put("sign",a);
//
StringBuilder body = new StringBuilder(); // StringBuilder body = new StringBuilder();
SSLContext sslContext = null; // SSLContext sslContext = null;
try { // try {
sslContext = new SSLContextBuilder() // sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE) // .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build(); // .build();
} catch (Exception e) { // } catch (Exception e) {
//
// }
// CloseableHttpClient closeableHttpClient = HttpClients.custom()
// .setSSLContext(sslContext)
// .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
// .build();
//
// HttpPost post = new HttpPost(url);
// CloseableHttpResponse response = null;
//
// RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
// post.setConfig(requestConfig);//设置请求参数超时时间
// post.setHeader("Content-Type", "application/json; charset=utf-8");
//
// try {
// if (dayabody.toJSONString() != null && !"".equals(dayabody.toJSONString())) {
// ByteArrayEntity entity = new ByteArrayEntity(dayabody.toJSONString().getBytes("UTF-8"));
// entity.setContentType("application/json");
// post.setEntity(entity);
// }
// response = closeableHttpClient.execute(post);
//
// HttpEntity entity = response.getEntity();
// body.append(EntityUtils.toString(entity, "UTF-8"));
// } catch (Exception e) {
// body.append(e.getMessage());
// } finally {
// try {
// // 关闭响应对象
// if (response != null) {
// response.close();
// }
// // 关闭响应对象
// if (closeableHttpClient != null) {
// closeableHttpClient.close();
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
// System.out.println("body"+body);
//
// return body.toString();
//}
} //private String getToken() {
CloseableHttpClient closeableHttpClient = HttpClients.custom() // String url = "http://oapi.nanofintax.com/api/getToken";
.setSSLContext(sslContext) // String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}";
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) // StringBuilder body = new StringBuilder();
.build(); // SSLContext sslContext = null;
// try {
HttpPost post = new HttpPost(url); // sslContext = new SSLContextBuilder()
CloseableHttpResponse response = null; // .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
// .build();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build(); // } catch (Exception e) {
post.setConfig(requestConfig);//设置请求参数超时时间 //
post.setHeader("Content-Type", "application/json; charset=utf-8"); // }
// CloseableHttpClient closeableHttpClient = HttpClients.custom()
try { // .setSSLContext(sslContext)
if (dayabody.toJSONString() != null && !"".equals(dayabody.toJSONString())) { // .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
ByteArrayEntity entity = new ByteArrayEntity(dayabody.toJSONString().getBytes("UTF-8")); // .build();
entity.setContentType("application/json"); //
post.setEntity(entity); // HttpPost post = new HttpPost(url);
} // CloseableHttpResponse response = null;
response = closeableHttpClient.execute(post); //
// RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
HttpEntity entity = response.getEntity(); // post.setConfig(requestConfig);//设置请求参数超时时间
body.append(EntityUtils.toString(entity, "UTF-8")); // post.setHeader("Content-Type", "application/json; charset=utf-8");
} catch (Exception e) { //
body.append(e.getMessage()); // try {
} finally { // if (bodys != null && !"".equals(bodys)) {
try { // ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
// 关闭响应对象 // entity.setContentType("application/json");
if (response != null) { // post.setEntity(entity);
response.close(); // }
} // response = closeableHttpClient.execute(post);
// 关闭响应对象 //
if (closeableHttpClient != null) { // HttpEntity entity = response.getEntity();
closeableHttpClient.close(); // body.append(EntityUtils.toString(entity, "UTF-8"));
} // } catch (Exception e) {
} catch (IOException e) { // body.append(e.getMessage());
e.printStackTrace(); // } finally {
} // try {
// // 关闭响应对象
} // if (response != null) {
System.out.println("body"+body); // response.close();
// }
return body.toString(); // // 关闭响应对象
} // if (closeableHttpClient != null) {
// closeableHttpClient.close();
private String getToken() { // }
String url = "http://oapi.nanofintax.com/api/getToken"; // } catch (IOException e) {
String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}"; // e.printStackTrace();
StringBuilder body = new StringBuilder(); // }
SSLContext sslContext = null; //
try { // }
sslContext = new SSLContextBuilder() // System.out.println("body"+body);
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE) // String accessToken = JSONObject.parseObject(body.toString()).getJSONObject("result").getString("accessToken");
.build(); //
} catch (Exception e) { // return accessToken;
//}
}
CloseableHttpClient closeableHttpClient = HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
HttpPost post = new HttpPost(url);
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000).build();
post.setConfig(requestConfig);//设置请求参数超时时间
post.setHeader("Content-Type", "application/json; charset=utf-8");
try {
if (bodys != null && !"".equals(bodys)) {
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
entity.setContentType("application/json");
post.setEntity(entity);
}
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
body.append(EntityUtils.toString(entity, "UTF-8"));
} catch (Exception e) {
body.append(e.getMessage());
} finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("body"+body);
String accessToken = JSONObject.parseObject(body.toString()).getJSONObject("result").getString("accessToken");
return accessToken;
}
} }

View File

@ -84,6 +84,7 @@
<!--api联查应用表like查询 --> <!--api联查应用表like查询 -->
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis"> <sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
sys_application_api.id, sys_application_api.id,
sys_application.id as app_id,
sys_application.app_id as app_code, sys_application.app_id as app_code,
sys_application_api.api_code, sys_application_api.api_code,
sys_application_api.api_name, sys_application_api.api_name,

View File

@ -91,7 +91,7 @@ public interface ISeeYonInterFace {
* @return * @return
* @throws Exception * @throws Exception
*/ */
JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception; JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType,String summaryId) throws Exception;
JsonResultEntity chengeBody(JSONObject jsonObject) throws Exception; JsonResultEntity chengeBody(JSONObject jsonObject) throws Exception;

View File

@ -244,7 +244,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
JsonResultEntity result = null; JsonResultEntity result = null;
try { try {
//流程事件处理 //流程事件处理
result = colEventPost(jsonStr, formApp, eventType); result = colEventPost(jsonStr, formApp, eventType, summaryId);
} catch (Exception e) { } catch (Exception e) {
return BaseResult.getFailureMessageEntity("传递失败", e.getMessage()); return BaseResult.getFailureMessageEntity("传递失败", e.getMessage());
} }
@ -500,7 +500,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
* @throws Exception * @throws Exception
*/ */
@Override @Override
public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType) throws Exception { public JsonResultEntity colEventPost(String jsonStr, String formAppId, String eventType,String summaryId) throws Exception {
if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) { if (StrUtil.isNotEmpty(jsonStr) && StrUtil.isNotEmpty(formAppId) && StrUtil.isNotEmpty(eventType)) {
SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity(); SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType); sysApplicationApiEntity.setHeaderIn(formAppId + "_" + eventType);
@ -544,6 +544,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
reqJson.put("jsonStr",jsonStr); reqJson.put("jsonStr",jsonStr);
reqJson.put("formAppId",formAppId); reqJson.put("formAppId",formAppId);
reqJson.put("eventType",eventType); reqJson.put("eventType",eventType);
reqJson.put("summaryId",summaryId);
reqJson.put("headers",JSON.toJSONString(headerMap)); reqJson.put("headers",JSON.toJSONString(headerMap));
reqJson.put("apiDataSourceCode",sysApiDatabase.getSourceCode()); reqJson.put("apiDataSourceCode",sysApiDatabase.getSourceCode());
JsonResultEntity result = pluginBaseEntity.executeBusiness(reqJson); JsonResultEntity result = pluginBaseEntity.executeBusiness(reqJson);