【update】 加解密系统 测试接口增加 scope 字段
This commit is contained in:
@@ -26,18 +26,20 @@ public class IntekeyUtils {
|
|||||||
/**
|
/**
|
||||||
* 解密文件,返回InputStream,供excel使用
|
* 解密文件,返回InputStream,供excel使用
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* @param multipartFile
|
* @param multipartFile
|
||||||
* @return
|
* @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");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
logger.info("解密时间:" + format.format(new Date()));
|
logger.info("解密时间:" + format.format(new Date()));
|
||||||
//设置校验
|
//设置校验
|
||||||
Long time = System.currentTimeMillis();
|
Long time = System.currentTimeMillis();
|
||||||
|
|
||||||
String sign = DigestUtils.md5DigestAsHex((secretKey + time).getBytes());
|
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);
|
File file = transferToFile(multipartFile);
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
//设置请求头
|
//设置请求头
|
||||||
|
|||||||
+2
-2
@@ -87,8 +87,8 @@ public class LawsHomeSearchController {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/download")
|
@PostMapping(value = "/download")
|
||||||
public void view(MultipartFile file,String url, String appCode, String secretKey, HttpServletResponse response) {
|
public void view(MultipartFile file,String url, String appCode, String secretKey, String scope, HttpServletResponse response) {
|
||||||
try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, file);
|
try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, scope, file);
|
||||||
OutputStream outputStream = response.getOutputStream()
|
OutputStream outputStream = response.getOutputStream()
|
||||||
) {
|
) {
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
|
|||||||
Reference in New Issue
Block a user