From 36be00e0f3cbe0d559c646fd2977e6e3a74aa6f9 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 30 Sep 2024 16:57:22 +0800
Subject: [PATCH] Merge branch 'bea' of http://120.27.238.55:7000/r/exchange into bea

---
 src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java b/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
index 9d00c82..44ca818 100644
--- a/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
+++ b/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
@@ -1,7 +1,13 @@
 package com.xcong.excoin.common.aop;
 
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.asymmetric.KeyType;
+import cn.hutool.crypto.asymmetric.RSA;
+import com.xcong.excoin.common.LoginUserUtils;
 import com.xcong.excoin.common.annotations.SubmitRepeat;
+import com.xcong.excoin.common.contants.AppContants;
 import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.configurations.properties.SecurityProperties;
 import com.xcong.excoin.utils.MessageSourceUtils;
 import com.xcong.excoin.utils.RedisUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -27,6 +33,8 @@
 
     @Resource
     private RedisUtils redisUtil;
+    @Resource
+    private SecurityProperties securityProperties;
 
     private String key;
 
@@ -44,13 +52,19 @@
         ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         HttpServletRequest request = attributes.getRequest();
 
-        String token = request.getHeader("token");
+       //String token = request.getHeader("token");
+        String bearerToken = request.getHeader(AppContants.TOKEN_HEADER);
+        String rsaToken = bearerToken.replace(AppContants.TOKEN_START_WITH, "");
+        RSA rsa = new RSA(securityProperties.getPrivateKey(), null);
+        String[] tokens = StrUtil.split(rsa.decryptStr(rsaToken, KeyType.PrivateKey), "_");
+        String token = tokens[0];
         String uri = request.getRequestURI();
-        String mId = (String) redisUtil.get(token);
-        log.info("#token : {}, uri : {}, mId : {}#", token, uri, mId);
+        Long mId = LoginUserUtils.getAppLoginUser().getId();
+        //String mId = (String) redisUtil.get(token);
+        //log.info("#token : {}, uri : {}, mId : {}#", token, uri, mId);
         key = mId + "_" + uri;
         boolean flag = redisUtil.setNotExist(key, "1", 5);
-        log.info("#mid : {}, flag : {}#", mId, flag);
+        //log.info("#mid : {}, flag : {}#", mId, flag);
         if (flag) {
             Object result = joinPoint.proceed();
             redisUtil.del(key);

--
Gitblit v1.9.1