Commit 8bdaaf13 authored by 胡建龙's avatar 胡建龙

[fix]文件下载返回数据转实体类

parent 1c7a39e8
......@@ -284,9 +284,18 @@ public class PingAnServiceImpl implements PingAnService {
//下载回单文件
private void dowloadDetailFile(JSONObject data) {
JSONArray arr = data.getJSONArray("list");
List<OrderFile> orderFiles = new ArrayList<>();
//转换成orderFile对象
if (Objects.nonNull(arr)) {
List<OrderFile> orderFiles = arr.toJavaList(OrderFile.class);
//手动转换,因为返回字段首字母均为大写,与实体类不对应。
for (int i = 0; i < arr.size() ; i++) {
JSONObject item = arr.getJSONObject(i);
OrderFile orderFile = new OrderFile();
orderFile.setDocId(item.getString("DocId"));
orderFile.setFileName(item.getString("FileName"));
orderFile.setFileSize(item.getString("FileSize"));
orderFiles.add(orderFile);
}
OrderFileRequest orderFileRequest = new OrderFileRequest();
orderFileRequest.setDownPath("D:\\download\\yqzl");
File file = new File(orderFileRequest.getDownPath());
......
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