diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java index 5645137b..c904232d 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java @@ -20,6 +20,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.*; @@ -64,9 +65,15 @@ public class HighCouponAgentController { log.error("HighCouponAgentController -> queryConvertCode() error!","兑换码已被使用"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用"); } - + if (convertCode.getCouponCodeId() != null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用"); + } return ResponseMsgUtil.success(highCouponAgentService.useConvertCode(body.getString("code"))); + } catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) { + log.error("HighActivityController -> userLottery() error!", "服务器繁忙"); + return ResponseMsgUtil.builderResponse(ErrorCode.SERVER_BUSY_ERROR.getCode(),ErrorCode.SERVER_BUSY_ERROR.getMsg(),null); + } catch (Exception e) { log.error("HighCouponAgentController --> useConvertCode() error!", e); return ResponseMsgUtil.exception(e); 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 89e1dd80..4e2fa5ee 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 @@ -382,6 +382,9 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { if (convertCode.getStatus() == 3) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用"); } + if (convertCode.getCouponCodeId() != null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用"); + } // 查询未销售的卡券 List codeList = highCouponCodeService.getNoSaleCode(convertCode.getCouponId()); if (codeList.size() == 0) {