From c159e505e2aaea6ad1863b90c97a19f75a0df771 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 14 Jul 2022 10:24:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hai/service/impl/HighCouponAgentServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 8b3569c9..1c4cec5b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -574,6 +574,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { } @Override + @Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW) public Map pushGzSinopec(Long couponAgentRelId, String phone, String remark) throws Exception { // 查询兑换码 HighCouponAgentCode convertCode = getCodeById(couponAgentRelId); From 4bccb94f0cc545090a402a3cae12cfba69ea16b8 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 14 Jul 2022 10:28:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/bweb/controller/HighCouponAgentController.java | 5 +++++ .../src/main/java/com/hai/common/exception/ErrorCode.java | 1 + 2 files changed, 6 insertions(+) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index 220551ad..7da0f4ff 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DeadlockLoserDataAccessException; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -553,6 +554,10 @@ public class HighCouponAgentController { return ResponseMsgUtil.success("操作成功"); + } catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) { + log.error("HighActivityController -> userLottery() error!", "请求过于频繁"); + return ResponseMsgUtil.builderResponse(ErrorCode.FREQUENT_REQUESTS.getCode(),ErrorCode.FREQUENT_REQUESTS.getMsg(),null); + } catch (Exception e) { log.error("HighCouponAgentController --> pushGzSinopec() error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index 861a9056..8ca10f21 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -26,6 +26,7 @@ public enum ErrorCode { WECHAT_LOGIN_ERROR("3002","微信登录失败"), WECHAT_LOGIN_TEACHER_ERROR("3003","当前微信用户不是老师,请联系管理员"), SERVER_BUSY_ERROR("3004","服务器繁忙,请稍后重试"), + FREQUENT_REQUESTS("3005","服务器繁忙,请稍后重试"), //////////////////业务异常///////////// COMMON_ERROR("2000",""), From 456525cfbcd7e45b4e4ceed33de6d5c8ed3e003e Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 14 Jul 2022 16:29:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hai/service/impl/HighDiscountUserRelServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java index 84dfc3e0..822fa1b1 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java @@ -74,7 +74,7 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic if (!discount.getStatus().equals(2)) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期"); } - if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) < discount.getReceiveNumber()) { + if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()).intValue() >= discount.getReceiveNumber().intValue()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已达到上线"); }