Commit c57b51d2 authored by 胡建龙's avatar 胡建龙

[fix]完善调整回单下载接口响应解析及文件下载功能

parent 7cef4c6e
......@@ -22,6 +22,7 @@ import com.hand.hap.core.IRequest;
import com.hand.hap.intergration.dto.HapInterfaceHeader;
import com.hand.hap.intergration.service.IHapInterfaceHeaderService;
import com.hand.hap.system.dto.ResponseData;
import com.pingan.openbank.api.sdk.client.ApiClient;
import com.pingan.openbank.api.sdk.common.http.HttpResult;
import com.pingan.openbank.api.sdk.entity.*;
import org.slf4j.Logger;
......@@ -75,28 +76,24 @@ public class PingAnServiceImpl implements PingAnService {
if (Objects.nonNull(result)) {
// 通信成功
if ("200".equals(result.getCode() + "")) {
// todo 不同接口返回不同数据,需要确认返回结果的格式
JSONObject res = JSONObject.parseObject(result.getData());
switch (interfaceName) {
case "bedl/SubAcctMaintenance" :
hlsWsRequests.setFunctionName("pingAn_SubAcctMaintenance");
responseData.put("data",res);
break;
case "bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo" :
hlsWsRequests.setFunctionName("pingAn_recentDetailQuery");
responseData.put("data",res);
break;
case "bedl/DetailReportQueryNew" :
hlsWsRequests.setFunctionName("pingAn_DetailReportQueryNew");
//返回数组类型数据,所以
JSONArray fileArr = JSONArray.parseArray(result.getData());
responseData.put("data",fileArr);
//进行文件下载
dowloadDetailFile(res);
break;
}
responseData.put("data",res);
// 具体业务是否请求成功判定,目前观察成功请求可能没有Code值
if ("000000".equals(res.getString("Code")) || Objects.isNull(res.getString("Code"))){
if ("bedl/DetailReportQueryNew".equals(interfaceName)){
dowloadDetailFile(res);
}
hlsWsRequests.setReturnStatus("s");
responseData.put(Constants.RESP_CODE, "0000");
responseData.put("respMsg", "请求成功");
......@@ -211,8 +208,20 @@ public class PingAnServiceImpl implements PingAnService {
}
//下载回单文件
private boolean dowloadDetailFile(JSONObject data){
return true;
private void dowloadDetailFile(JSONObject data){
JSONArray arr = data.getJSONArray("list");
//转换成orderFile对象
if (Objects.nonNull(arr)) {
List<OrderFile> orderFiles = arr.toJavaList(OrderFile.class);
OrderFileRequest orderFileRequest = new OrderFileRequest();
orderFileRequest.setDownPath("D:\\download\\yqzl");
File file = new File(orderFileRequest.getDownPath());
if (!file.exists()) {
file.mkdirs();
}
orderFileRequest.setOrderFiles(orderFiles);
ApiUtils.getApiClient().orderFileDownload(orderFileRequest);
}
}
/**
......
......@@ -37,4 +37,8 @@ public class ApiUtils {
clone.put("CnsmrSeqNo",today+"000");
return clone;
}
public static ApiClient getApiClient(){
return apiClient;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment