兼容一下数科的发票类型

beta-prop-all^2
kk 2 years ago
parent 5f006eb41b
commit 0dfc65ef43
  1. 2
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java
  2. 21
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiZhongQiServiceImpl.java

@ -330,7 +330,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService {
// 平台解密 // 平台解密
try { try {
// TODO: 2023/9/20 // TODO: 2023/9/20wozheb
order = AisinoInvoiceDecryptUtil.decrypt(order, JKey); order = AisinoInvoiceDecryptUtil.decrypt(order, JKey);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

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