From 691efec9f7395c596edf1725f11204b1fa6509f1 Mon Sep 17 00:00:00 2001
From: Loki <654612@qq.com>
Date: Tue, 20 Dec 2022 11:27:44 +0800
Subject: [PATCH] =?UTF-8?q?:+1:=20=E5=A2=9E=E5=8A=A0=E5=B9=82=E7=AD=89?=
=?UTF-8?q?=E6=80=A7=E7=9A=84=E9=AA=8C=E8=AF=81=EF=BC=8C=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=A0=E7=94=A8=E7=9A=84=E6=B3=A8=E8=A7=A3?=
=?UTF-8?q?=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/DefaultIdempotentKeyResolver.java | 3 +-
zsw-bxg/pom.xml | 4 ++
.../co/yixiang/app/common/bean/LocalUser.java | 2 +-
.../interceptor/PermissionInterceptor.java | 5 +--
.../rest/AppStoreBargainController.java | 5 ++-
.../cart/rest/StoreCartController.java | 5 ++-
.../modules/coupon/rest/CouponController.java | 3 +-
.../rest/AppStoreEvaluationController.java | 5 ++-
.../order/rest/AppStoreOrderController.java | 15 ++++---
.../rest/AppStoreProductController.java | 7 +--
.../user/rest/LetterAppUserController.java | 3 +-
.../{api => exception}/BusinessException.java | 2 +-
.../{api => exception}/DaoException.java | 2 +-
.../UnAuthenticatedException.java | 2 +-
.../java/co/yixiang/mapper/EntityMapper.java | 43 -------------------
.../rest/StoreCombinationController.java | 2 +
.../activity/rest/StoreCouponController.java | 2 +
.../rest/StoreCouponIssueController.java | 2 +
.../activity/rest/StoreSeckillController.java | 2 +
.../modules/aop/ForbidSubmitAspect.java | 3 +-
.../modules/mp/service/WeixinPayService.java | 2 +-
.../service/impl/YxStoreOrderServiceImpl.java | 3 +-
.../product/rest/StoreProductController.java | 3 +-
.../impl/YxStoreProductAttrServiceImpl.java | 2 +-
.../store/rest/YxStoreBrandController.java | 3 ++
.../impl/YxShippingTemplatesServiceImpl.java | 2 +-
.../user/service/impl/YxUserServiceImpl.java | 2 +-
27 files changed, 55 insertions(+), 79 deletions(-)
rename zsw-bxg/src/main/java/co/yixiang/{api => exception}/BusinessException.java (96%)
rename zsw-bxg/src/main/java/co/yixiang/{api => exception}/DaoException.java (96%)
rename zsw-bxg/src/main/java/co/yixiang/{api => exception}/UnAuthenticatedException.java (96%)
delete mode 100644 zsw-bxg/src/main/java/co/yixiang/mapper/EntityMapper.java
diff --git a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java
index 56856993..60b35cc2 100644
--- a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java
+++ b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.idempotent.core.keyresolver.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
+import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.idempotent.core.keyresolver.IdempotentKeyResolver;
import org.aspectj.lang.JoinPoint;
@@ -18,7 +19,7 @@ public class DefaultIdempotentKeyResolver implements IdempotentKeyResolver {
@Override
public String resolver(JoinPoint joinPoint, Idempotent idempotent) {
String methodName = joinPoint.getSignature().toString();
- String argsStr = StrUtil.join(",", joinPoint.getArgs());
+ String argsStr = StrUtil.join(",", JSONUtil.toJsonStr(joinPoint.getArgs()));
return SecureUtil.md5(methodName + argsStr);
}
diff --git a/zsw-bxg/pom.xml b/zsw-bxg/pom.xml
index 1a0d6e2d..dd57a6d5 100644
--- a/zsw-bxg/pom.xml
+++ b/zsw-bxg/pom.xml
@@ -207,6 +207,10 @@
jsoup
1.14.2
+
+ cn.iocoder.boot
+ yudao-spring-boot-starter-protection
+
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/common/bean/LocalUser.java b/zsw-bxg/src/main/java/co/yixiang/app/common/bean/LocalUser.java
index 2cccd6b4..b1906377 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/common/bean/LocalUser.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/common/bean/LocalUser.java
@@ -10,7 +10,7 @@ package co.yixiang.app.common.bean;
import cn.iocoder.yudao.framework.common.exception.ApiCode;
-import co.yixiang.api.UnAuthenticatedException;
+import co.yixiang.exception.UnAuthenticatedException;
import co.yixiang.app.common.util.JwtToken;
import co.yixiang.app.common.util.RequestUtils;
import co.yixiang.modules.user.domain.YxUser;
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java b/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java
index 41b6fc90..c6074a9f 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java
@@ -12,13 +12,11 @@ package co.yixiang.app.common.interceptor;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import cn.iocoder.yudao.framework.common.exception.ApiCode;
-import co.yixiang.api.UnAuthenticatedException;
+import co.yixiang.exception.UnAuthenticatedException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.common.util.JwtToken;
-import co.yixiang.constant.ShopConstants;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.modules.user.service.YxUserService;
-import co.yixiang.utils.RedisUtils;
import com.auth0.jwt.interfaces.Claim;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +24,6 @@ import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java
index 69260379..1c2ffab3 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java
@@ -13,6 +13,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.ShopException;
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.activity.param.BargainShareParam;
@@ -158,7 +159,7 @@ public class AppStoreBargainController {
* 参与砍价
*/
@AppLog(value = "参与砍价", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/bargain/start")
@ApiOperation(value = "参与砍价",notes = "参与砍价")
@@ -176,7 +177,7 @@ public class AppStoreBargainController {
* 帮助好友砍价
*/
@AppLog(value = "帮助好友砍价", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/bargain/help")
@ApiOperation(value = "帮助好友砍价",notes = "帮助好友砍价")
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/cart/rest/StoreCartController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/cart/rest/StoreCartController.java
index 025dcc61..e34415d7 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/modules/cart/rest/StoreCartController.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/cart/rest/StoreCartController.java
@@ -8,6 +8,7 @@
*/
package co.yixiang.app.modules.cart.rest;
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import co.yixiang.annotation.Limit;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.app.common.aop.NoRepeatSubmit;
@@ -66,7 +67,7 @@ public class StoreCartController {
* 购物车 添加
*/
@AppLog(value = "购物车 添加", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/cart/add")
@ApiOperation(value = "添加购物车",notes = "添加购物车")
@@ -110,7 +111,7 @@ public class StoreCartController {
* 购物车删除产品
*/
@AppLog(value = "购物车删除产品", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/cart/del")
@ApiOperation(value = "购物车删除产品",notes = "购物车删除产品")
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
index 10b1b741..aad345d3 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
@@ -12,6 +12,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.ShopException;
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
@@ -93,7 +94,7 @@ public class CouponController {
* 领取优惠券
*/
@AppLog(value = "领取优惠券", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/coupon/receive")
@ApiOperation(value = "领取优惠券",notes = "领取优惠券")
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java
index 94241971..d5d145a8 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java
@@ -11,6 +11,7 @@ package co.yixiang.app.modules.evaluation.rest;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.app.common.aop.NoRepeatSubmit;
@@ -73,7 +74,7 @@ public class AppStoreEvaluationController {
* 添加收藏
*/
@AppLog(value = "添加收藏", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/collectEvaluation/add")
@ApiOperation(value = "添加收藏",notes = "添加收藏")
@@ -90,7 +91,7 @@ public class AppStoreEvaluationController {
* 取消收藏
*/
@AppLog(value = "取消收藏", type = 1)
- @NoRepeatSubmit
+ @Idempotent
@AuthCheck
@PostMapping("/collectEvaluation/del")
@ApiOperation(value = "取消收藏",notes = "取消收藏")
diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
index ed260885..da4782b9 100644
--- a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
+++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
@@ -13,6 +13,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.ShopException;
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.order.param.*;
@@ -133,7 +134,7 @@ public class AppStoreOrderController {
*/
@AppLog(value = "订单创建", type = 1)
@AuthCheck
- @NoRepeatSubmit
+ @Idempotent
@PostMapping("/order/create/{key}")
@ApiOperation(value = "订单创建", notes = "订单创建")
public ApiResult