|
|
|
@ -1380,6 +1380,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer |
|
|
|
|
// String fileStream = null;
|
|
|
|
|
InputStream inputStream = null; |
|
|
|
|
File file = null; |
|
|
|
|
FileInputStream fileInputStream = null; |
|
|
|
|
try { |
|
|
|
|
// fileStream = HttpUtil.get(downloadUrl + href);
|
|
|
|
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
|
|
|
@ -1402,6 +1403,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer |
|
|
|
|
return new HXResponse("9999", "重汽推送制单人未设置!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 调用重汽的推送接口
|
|
|
|
|
HashMap<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
paramMap.put("file", file); |
|
|
|
@ -1419,15 +1421,24 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer |
|
|
|
|
// String result = HttpUtil.post(pushUrl.getValue(), paramMap);
|
|
|
|
|
String result = HttpRequest.post(pushUrl.getValue()) |
|
|
|
|
.form(paramMap)//表单内容
|
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
|
.timeout(60000)//超时,毫秒
|
|
|
|
|
.execute().body(); |
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(result); |
|
|
|
|
|
|
|
|
|
// log.info("【机动车加密接口推送】返回,{}", result);
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(result); |
|
|
|
|
retCode = jsonObject.get("retCode") != null ? jsonObject.get("retCode").toString() : ""; |
|
|
|
|
retMsg = jsonObject.get("retMsg") != null ? jsonObject.get("retMsg").toString() : ""; |
|
|
|
|
log.info("【机动车加密接口推送】返回解析,retCode={},retMsg={}", retCode,retMsg); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("【机动车加密接口推送】超时,{}", e); |
|
|
|
|
return new HXResponse("9999", "推送接口超时!"); |
|
|
|
|
log.info("【机动车加密接口推送】异常,{}", e); |
|
|
|
|
return new HXResponse("9999", "推送接口异常!"); |
|
|
|
|
}finally { |
|
|
|
|
file.delete(); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
fileInputStream.close(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.info("【机动车加密接口推送】文件流关闭失败,{}", e); |
|
|
|
|
} |
|
|
|
|
// 重汽返回接口信息
|
|
|
|
|
return new HXResponse(retCode, retMsg); |
|
|
|
@ -1449,7 +1460,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer |
|
|
|
|
* @return: 机动车加密导出-文件转化本地 |
|
|
|
|
*/ |
|
|
|
|
public static File stream2file(InputStream in) throws IOException { |
|
|
|
|
final File tempFile = File.createTempFile(PREFIX, SUFFIX); |
|
|
|
|
final File tempFile = File.createTempFile(PREFIX, ".dat"); |
|
|
|
|
tempFile.deleteOnExit(); |
|
|
|
|
try (FileOutputStream out = new FileOutputStream(tempFile)) { |
|
|
|
|
IOUtils.copy(in, out); |
|
|
|
|