From 28386f9b996c48a338b751da69e3610917b3e1bf Mon Sep 17 00:00:00 2001 From: zainali5120 <512061637@qq.com> Date: Wed, 14 Oct 2020 15:15:47 +0800 Subject: [PATCH] ROC重复提交修复 --- src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java | 10 ++++++---- src/main/resources/application-prod.yml | 2 +- src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml | 2 +- src/main/resources/application.yml | 2 +- src/main/resources/application-prodapp.yml | 2 +- 5 files changed, 10 insertions(+), 8 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 f033e03..f7f4596 100644 --- a/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java +++ b/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java @@ -3,6 +3,7 @@ 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; @@ -51,18 +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.debug("#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.debug("#mid : {}, flag : {}#", mId, flag); + log.info("#mid : {}, flag : {}#", mId, flag); if (flag) { Object result = joinPoint.proceed(); redisUtil.del(key); diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 5519fb9..ec6c4d6 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -50,7 +50,7 @@ ## Redis数据库索引(默认为0) database: 1 ## Redis服务器地址 - host: 47.114.114.219 + host: 127.0.0.1 ## Redis服务器连接端口 port: 6379 ## Redis服务器连接密码(默认为空) diff --git a/src/main/resources/application-prodapp.yml b/src/main/resources/application-prodapp.yml index 0c57f69..c00282c 100644 --- a/src/main/resources/application-prodapp.yml +++ b/src/main/resources/application-prodapp.yml @@ -50,7 +50,7 @@ ## Redis数据库索引(默认为0) database: 1 ## Redis服务器地址 - host: 47.114.114.219 + host: 127.0.0.1 ## Redis服务器连接端口 port: 6379 ## Redis服务器连接密码(默认为空) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d7ba143..e7a865f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,7 +5,7 @@ spring: profiles: - active: test + active: prodapp datasource: url: jdbc:mysql://rm-bp1i2g5rg5dubo9s40o.mysql.rds.aliyuncs.com:3306/db_roc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8 username: roc_user diff --git a/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml b/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml index 1c5733f..b443d3d 100644 --- a/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml +++ b/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml @@ -8,7 +8,7 @@ </select> <select id="findCoinOrderListByMemberIdAndSysmbol" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity"> - SELECT (select sum(symbol_cnt) from coins_order_deal where order_id = a.id) as deal_cnt, a.create_by,a.create_time, a.update_by, a.update_time, a.version id, a.member_id, a.order_no, a.order_type, a.symbol, a.mark_price, a.entrust_cnt, a.entrust_price, a.deal_price, a.deal_amount, a.order_status, a.trade_type, a.fee_amount, a.entrust_amount + SELECT (select sum(symbol_cnt) from coins_order_deal where order_id = a.id) as deal_cnt, a.create_by,a.create_time, a.update_by, a.update_time, a.version,a.id, a.member_id, a.order_no, a.order_type, a.symbol, a.mark_price, a.entrust_cnt, a.entrust_price, a.deal_price, a.deal_amount, a.order_status, a.trade_type, a.fee_amount, a.entrust_amount FROM coins_order a where a.member_id= #{memberId} and a.order_status = #{status} <if test="symbol != null and symbol !=''"> and a.symbol = #{symbol} -- Gitblit v1.9.1