提交代码

dev-discount
胡锐 3 years ago
parent 4709bbfe98
commit 04d91110c9
  1. 9
      hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java
  2. 3
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.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);

@ -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<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(convertCode.getCouponId());
if (codeList.size() == 0) {

Loading…
Cancel
Save