From 0057c0495254d07ce9f0963bc69dd15cefb47945 Mon Sep 17 00:00:00 2001 From: yefei Date: Mon, 17 Apr 2023 09:24:36 +0800 Subject: [PATCH] =?UTF-8?q?ariesy=20=E8=A7=A3=E5=86=B3=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dxhy-common/pom.xml | 1 + .../com/dxhy/core/thread/PoolAddTaxThread.java | 3 ++- .../dxhy/erp/controller/InterfaceController.java | 15 ++++++++++----- .../java/com/dxhy/erp/utils/HmacSHA1Util.java | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dxhy-common/pom.xml b/dxhy-common/pom.xml index 4c792cc9..0da3bf18 100644 --- a/dxhy-common/pom.xml +++ b/dxhy-common/pom.xml @@ -78,6 +78,7 @@ com.alibaba easyexcel + 3.2.1 com.alibaba diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java index f3d784a5..ba3ceaa9 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java @@ -246,7 +246,7 @@ public class PoolAddTaxThread extends BaseThread { this.cicleExport(pramsMap, default_curr, excelFile.toString(), out, writer); this.detailCicleExport(pramsMap, default_curr, excelFile.toString(), out, writer); - writer.finish(); +// writer.finish(); // FTP文件存储路径 String[] toDay = DateUtil.today().split("-"); String ftpFilePath = fileService.getPathPrefix() + userName + "/" + "excelFile/" + toDay[0] + "/" @@ -275,6 +275,7 @@ public class PoolAddTaxThread extends BaseThread { // 记录导出出错状态 exportLogService.updateFail(id, errmsg, dbName); } finally { + writer.finish(); // 发送导出消息到mq String responseResult = JsonResponseUtils.responseResult(msg); sender.sendToMsg(responseResult); diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java b/dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java index 672c43ea..c49e1762 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java @@ -105,6 +105,8 @@ public class InterfaceController extends AbstractController { private VoucherRecordService voucherRecordService; @Resource private BaseIReceiptInvoiceService baseIReceiptInvoiceService; + @Value("${erp.ipUrl}") + private String ipUrl; /** * @@ -119,7 +121,7 @@ public class InterfaceController extends AbstractController { @PathVariable("version") String version, @PathVariable("interfaceName") String interfaceName, @ApiParam(name = "requestParam", value = "业务报文", required = true) @RequestBody String content) { - log.info("{} SDK对外接口请求,version:{},interfaceName:{},content:{}",LOGGER_MSG,version,interfaceName,content); + log.info("{} SDK对外接口请求,version:{},interfaceName:{},content:{},请求url={}",LOGGER_MSG,version,interfaceName,content,request.getRequestURL().toString()); DxhyInterfaceResponse dxhyInterfaceResponse = new DxhyInterfaceResponse(RespStatusEnum.FAIL2); long startTime = System.currentTimeMillis(); try { @@ -148,7 +150,7 @@ public class InterfaceController extends AbstractController { /** * 鉴权 */ - result = authV5(request, dxhyInterfaceRequest,secretKey); + result = authV5(version+"/"+interfaceName,request, dxhyInterfaceRequest,secretKey); long end1 = System.currentTimeMillis(); log.debug("{}鉴权耗时{}毫秒", LOGGER_MSG, end1 - begin1); if (!ConfigurerInfo.SUCCSSCODE.equals(result.getCode())) { @@ -293,14 +295,18 @@ public class InterfaceController extends AbstractController { return result; } - private CheckResult authV5(HttpServletRequest request, DxhyInterfaceRequest dxhyInterfaceRequest,String secretKey) { + private CheckResult authV5(String url,HttpServletRequest request, DxhyInterfaceRequest dxhyInterfaceRequest,String secretKey) { CheckResult checkResult = new CheckResult(RespStatusEnum.AUTHFAIL); String reqUrl = request.getRequestURL().toString(); if (reqUrl.contains(ConfigureConstant.STRING_WH)) { reqUrl = reqUrl.substring(ConfigureConstant.INT_0, reqUrl.indexOf(ConfigureConstant.STRING_WH)); } + + log.debug("{}请求路径:{}", LOGGER_MSG, reqUrl); + //获取鉴权URL - String signUrl = getAuthUrl(reqUrl, request.getMethod()); +// String signUrl = getAuthUrl(reqUrl, request.getMethod()); + String signUrl = ipUrl+url+"?"; TreeMap sortMap = new TreeMap<>(); sortMap.put(ConfigurerInfo.SECRETID, dxhyInterfaceRequest.getSecretId()); sortMap.put(ConfigurerInfo.DATA_EXCHANGE_ID, dxhyInterfaceRequest.getDataExchangeId()); @@ -323,7 +329,6 @@ public class InterfaceController extends AbstractController { return checkResult; } - public String commonDecrypt(String zipCode, String encryptCode, String content,String secretKey) { String result = ""; byte[] de = content.getBytes(); diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/utils/HmacSHA1Util.java b/dxhy-erp/src/main/java/com/dxhy/erp/utils/HmacSHA1Util.java index 0b29ffe2..ff11e925 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/utils/HmacSHA1Util.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/utils/HmacSHA1Util.java @@ -121,6 +121,7 @@ public class HmacSHA1Util { * @throws Exception */ public static String genSign(String url, TreeMap signMap, String secretKey) { + log.debug("请求生成签名的url={},signMap={}",url,signMap); boolean flag = Boolean.TRUE; StringBuilder keyVal = new StringBuilder(); for (Map.Entry entry : signMap.entrySet()) {