回调接口测试

This commit is contained in:
lvleigang 2025-06-25 10:01:26 +08:00
parent 88bcbc1895
commit 1fad877c34
2 changed files with 31 additions and 8 deletions

View File

@ -64,7 +64,9 @@ public class FundsAllocationPluginServiceImpl implements IFundsAllocationPluginS
String field0061 = formmainData.getString("field0061");
//司库系统批次号
String field0063 = formmainData.getString("field0063");
if (StrUtil.isNotEmpty(field0061) || StrUtil.isNotEmpty(field0063)){
//资金归集
String field0062 = formmainData.getString("field0062");
if (StrUtil.isNotEmpty(field0061) || StrUtil.isNotEmpty(field0063) || StrUtil.isNotEmpty(field0062)){
//查询审批意见
FundsAllocationEntity fundAllocation = new FundsAllocationEntity();
fundAllocation.setCol_summary_id(summaryId);
@ -110,6 +112,25 @@ public class FundsAllocationPluginServiceImpl implements IFundsAllocationPluginS
JSONObject jsonData = new JSONObject();
jsonData.put("data",encrypt);
param = jsonData.toJSONString();
}else if (StrUtil.isNotEmpty(field0062)){
appId = "800058";
apiCode = "8000580004";
//司库
JSONObject jsonObject = new JSONObject();
jsonObject.put("batchNo",field0062);
jsonObject.put("reason",fundAllocation.getContent());
if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
jsonObject.put("status","APPROVED");
}else if (ColEventTypeEnum.ONSTOP.getType().equals(eventType)){//审批终止
jsonObject.put("status","REJECTION");
}
JSONObject objectData = new JSONObject();
objectData.put("data",jsonObject);
logger.info("资金归集审批回调司库请求参数明文:{}",objectData.toJSONString());
String encrypt = SM2Util.encrypt(objectData.toJSONString(),publicKey);
JSONObject jsonData = new JSONObject();
jsonData.put("data",encrypt);
param = jsonData.toJSONString();
}
if (StrUtil.isNotEmpty(appId) && StrUtil.isNotEmpty(apiCode) && StrUtil.isNotEmpty(param)){
logger.info("回调有度/司库请求apiCode{},报文:{}",apiCode,param);

View File

@ -100,13 +100,12 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
//Integer size = 50;
boolean flags = false;
String uploadBalanceTableUrl = "http://122.9.186.182:30887/open/api/uploadBalanceTable";
String cbUrl = "http://122.9.186.182:30887/open/api/uploadFinancialReport";
String dataUrl = "https://workbench.test.htszny.com/oapi/invoice_rec/standing/book/queryList";//全量发票数据
String uploadBalanceTableUrl = "http://10.0.2.15:30887/open/api/uploadBalanceTable";
String cbUrl = "http://10.0.2.15:30887/open/api/uploadFinancialReport";
String dataUrl = "https://10.0.2.15:30889/oapi/invoice_rec/standing/book/queryList";//全量发票数据
String tokenUrl = "http://oapi.nanofintax.com/api/getToken";
String accessKey = "6X3B526P5HqE6ums";
String accessSecret = "34e5fc32ac894a2ba2ade8c3852c7a0a";
String taxNo = "91330110MAC5FPUY2U";
Integer size = 50;
@Resource
private TaskExecutor taskExecutor;
@ -133,7 +132,10 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
//2调用接口获取数据
Integer queryCursor = 1;
JSONArray datalist = new JSONArray();
sendBusinessData(datalist, access_token, queryCursor,times);
sendBusinessData(datalist, access_token, queryCursor,times,"91330328MABX16X17N");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MAC5FPUY2U");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MAD4PEK57L");
sendBusinessData(datalist, access_token, queryCursor,times,"91330110MADYHCEW89");
if(datalist != null && datalist.size() > 0){
for (int i = 0; i < datalist.size(); i++) {
@ -272,7 +274,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
* @param dataTime
* @return void
**/
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String dataTime) {
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String dataTime, String taxNo) {
String url = dataUrl+access_token;
JSONObject dayabody = new JSONObject();
long timestamp = System.currentTimeMillis();
@ -308,7 +310,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
JSONArray businessList = data.getJSONArray("data");
if(data.getInteger("total") > queryCursor*size){
queryCursor = queryCursor+1;
sendBusinessData(datalist, access_token, queryCursor, dataTime);
sendBusinessData(datalist, access_token, queryCursor, dataTime,taxNo);
}
if(businessList != null && businessList.size() > 0){
datalist.addAll(businessList);