From 2caa56a5c122d9ff88a49495c2f9d2d5b6c9a9ca Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Thu, 16 Nov 2023 16:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=20=E5=8A=A0=E8=A7=A3?= =?UTF-8?q?=E5=AF=86=E7=B3=BB=E7=BB=9F=20=E6=B5=8B=E8=AF=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=20scope=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jero/modules/laws/common/util/IntekeyUtils.java | 6 ++++-- .../laws/home/controller/LawsHomeSearchController.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java b/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java index f98eda71..90b7d74d 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java @@ -26,18 +26,20 @@ public class IntekeyUtils { /** * 解密文件,返回InputStream,供excel使用 * + * * @param url * @param multipartFile * @return */ - public static InputStream DecryptFile(String url, String appCode, String secretKey, MultipartFile multipartFile) { + //todo 这个方法需要写在laws-modules-docking 里面 可以新建一个文件夹是encrypt + public static InputStream DecryptFile(String url, String appCode, String secretKey, String scope, MultipartFile multipartFile) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); logger.info("解密时间:" + format.format(new Date())); //设置校验 Long time = System.currentTimeMillis(); String sign = DigestUtils.md5DigestAsHex((secretKey + time).getBytes()); - url = url + "?appCode=" + appCode + "&time=" + time + "&sign=" + sign; + url = url + "?appCode=" + appCode + "&time=" + time + "&sign=" + sign + "&scope=" + scope; File file = transferToFile(multipartFile); RestTemplate restTemplate = new RestTemplate(); //设置请求头 diff --git a/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java b/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java index 4b1ce9f4..03ceaeb8 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java @@ -87,8 +87,8 @@ public class LawsHomeSearchController { * */ @PostMapping(value = "/download") - public void view(MultipartFile file,String url, String appCode, String secretKey, HttpServletResponse response) { - try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, file); + public void view(MultipartFile file,String url, String appCode, String secretKey, String scope, HttpServletResponse response) { + try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, scope, file); OutputStream outputStream = response.getOutputStream() ) { byte[] buf = new byte[1024];