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];