回调接口测试

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

View File

@ -3,7 +3,7 @@ logging:
#日志级别 指定目录级别
level:
root: INFO
encodings: UTF-8
encodings: GBK
file:
# 日志保存路径
path: D:\yongansystem\serverV3\log\zs
@ -12,17 +12,17 @@ spring:
dynamic:
datasource:
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
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /home/webservice/zt/file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/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/
cbs8:
appId: 1P4AGrpz
@ -39,9 +39,9 @@ cbs8:
OA:
data_source_code: yc_oa
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface
file_oa:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterfacefileUpload
#税务pdf附件下载存放路径
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可省略此配置
savefile:
# 文件保存路径
path: /home/webservice/zt/file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/zt/plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/
path: D:\yongansystem\serverV3\zt\file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: D:\yongansystem\serverV3\zt\plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: D:\yongansystem\serverV3\apache-tomcat-9.0.68_test\webapps\kangarooDataCenterV3\WEB-INF\classes\
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
@ -39,7 +39,17 @@ cbs8:
OA:
data_source_code: yc_oa
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:
# 测试用这个 这个是银行给的
privateKey: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgtzMo2o6THK3yLIm+83Ch/560+02l2hjjBSFGieWY/Z6gCgYIKoEcz1UBgi2hRANCAATKhwZX4P3XI8vYTKeCOLMVbanUNbaXjrIEZynshwdOzRVgzRQSiPNWo6OBBkAPvqE+2RS+5ABpS82DSlKl81z0

View File

@ -153,15 +153,15 @@ public class temButtom {
}
@Test
public void test0111() {
//请求token
String accessToken = getToken();
//请求分页查询全量进项发票
String data = getdata(accessToken);
}
//@Test
//public void test0111() {
// //请求token
// String accessToken = getToken();
// //请求分页查询全量进项发票
// String data = getdata(accessToken);
//
//
//}
@Test
public void youduTest(){
@ -174,133 +174,133 @@ public class temButtom {
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
System.out.println("sign"+a);
}
private String getdata(String accessToken) {
String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken;
JSONObject dayabody = new JSONObject();
dayabody.put("accessKey","6X3B526P5HqE6ums");
long timestamp = System.currentTimeMillis();
dayabody.put("timestamp",timestamp);
JSONObject queryParams = new JSONObject();
queryParams.put("page",1);
queryParams.put("size",50);
//queryParams.put("kprqq","2025-04-06");
//queryParams.put("kprqz","2025-04-06");
queryParams.put("taxNo","91330110MAC5FPUY2U");
dayabody.put("queryParams",queryParams);
Map<String, Object> parametersMap = new HashMap<>();
parametersMap.put("accessKey","6X3B526P5HqE6ums");
parametersMap.put("timestamp",timestamp);
//private String getdata(String accessToken) {
// String url = "http://oapi.nanofintax.com/api/invoice_receive/fp/v1/query?accessToken="+accessToken;
// JSONObject dayabody = new JSONObject();
// dayabody.put("accessKey","6X3B526P5HqE6ums");
// long timestamp = System.currentTimeMillis();
// dayabody.put("timestamp",timestamp);
// JSONObject queryParams = new JSONObject();
// queryParams.put("page",1);
// queryParams.put("size",50);
// //queryParams.put("kprqq","2025-04-06");
// //queryParams.put("kprqz","2025-04-06");
// queryParams.put("taxNo","91330110MAC5FPUY2U");
// dayabody.put("queryParams",queryParams);
// Map<String, Object> parametersMap = new HashMap<>();
// parametersMap.put("accessKey","6X3B526P5HqE6ums");
// parametersMap.put("timestamp",timestamp);
//
// String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
// dayabody.put("sign",a);
//
// StringBuilder body = new StringBuilder();
// SSLContext sslContext = null;
// try {
// sslContext = new SSLContextBuilder()
// .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
// .build();
// } 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();
//}
String a = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
dayabody.put("sign",a);
StringBuilder body = new StringBuilder();
SSLContext sslContext = null;
try {
sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build();
} 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() {
String url = "http://oapi.nanofintax.com/api/getToken";
String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}";
StringBuilder body = new StringBuilder();
SSLContext sslContext = null;
try {
sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build();
} 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 (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;
}
//private String getToken() {
// String url = "http://oapi.nanofintax.com/api/getToken";
// String bodys = "{\"accessKey\":\"6X3B526P5HqE6ums\",\"accessSecret\":\"34e5fc32ac894a2ba2ade8c3852c7a0a\"}";
// StringBuilder body = new StringBuilder();
// SSLContext sslContext = null;
// try {
// sslContext = new SSLContextBuilder()
// .loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
// .build();
// } 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 (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

@ -83,25 +83,26 @@
</sql>
<!--api联查应用表like查询 -->
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
sys_application_api.id,
sys_application.app_id as app_code,
sys_application_api.api_code,
sys_application_api.api_name,
sys_application_api.api_remark,
sys_application_api.destination_address,
sys_application_api.header_in,
sys_application_api.query_in,
sys_application_api.body_in_type,
sys_application_api.body_in,
sys_application_api.body_out,
sys_application_api.body_in_type,
sys_application_api.sorts,
sys_application_api.bean_name,
sys_application_api.fun_name,
sys_application_api.extension_api,
sys_application_api.return_success_field,
sys_application_api.return_success_value,
sys_application_api.return_msg
sys_application_api.id,
sys_application.id as app_id,
sys_application.app_id as app_code,
sys_application_api.api_code,
sys_application_api.api_name,
sys_application_api.api_remark,
sys_application_api.destination_address,
sys_application_api.header_in,
sys_application_api.query_in,
sys_application_api.body_in_type,
sys_application_api.body_in,
sys_application_api.body_out,
sys_application_api.body_in_type,
sys_application_api.sorts,
sys_application_api.bean_name,
sys_application_api.fun_name,
sys_application_api.extension_api,
sys_application_api.return_success_field,
sys_application_api.return_success_value,
sys_application_api.return_msg
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysApplicationApiEntity-result">

View File

@ -91,7 +91,7 @@ public interface ISeeYonInterFace {
* @return
* @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;

View File

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