合并代码

dev-discount
袁野 3 years ago
commit aa6f91aa43
  1. 5
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 1
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  3. 1
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  4. 2
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java

@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -553,6 +554,10 @@ public class HighCouponAgentController {
return ResponseMsgUtil.success("操作成功"); 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) { } catch (Exception e) {
log.error("HighCouponAgentController --> pushGzSinopec() error!", e); log.error("HighCouponAgentController --> pushGzSinopec() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -26,6 +26,7 @@ public enum ErrorCode {
WECHAT_LOGIN_ERROR("3002","微信登录失败"), WECHAT_LOGIN_ERROR("3002","微信登录失败"),
WECHAT_LOGIN_TEACHER_ERROR("3003","当前微信用户不是老师,请联系管理员"), WECHAT_LOGIN_TEACHER_ERROR("3003","当前微信用户不是老师,请联系管理员"),
SERVER_BUSY_ERROR("3004","服务器繁忙,请稍后重试"), SERVER_BUSY_ERROR("3004","服务器繁忙,请稍后重试"),
FREQUENT_REQUESTS("3005","服务器繁忙,请稍后重试"),
//////////////////业务异常///////////// //////////////////业务异常/////////////
COMMON_ERROR("2000",""), COMMON_ERROR("2000",""),

@ -575,6 +575,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
} }
@Override @Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public Map<String, Object> pushGzSinopec(Long couponAgentRelId, String phone, String remark) throws Exception { public Map<String, Object> pushGzSinopec(Long couponAgentRelId, String phone, String remark) throws Exception {
// 查询兑换码 // 查询兑换码
HighCouponAgentCode convertCode = getCodeById(couponAgentRelId); HighCouponAgentCode convertCode = getCodeById(couponAgentRelId);

@ -74,7 +74,7 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if (!discount.getStatus().equals(2)) { if (!discount.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期"); 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, "优惠券已达到上线"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已达到上线");
} }

Loading…
Cancel
Save