diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 61684ed1..33f92e35 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -25,6 +25,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.*; @@ -285,6 +286,10 @@ public class HighOrderController { return ResponseMsgUtil.success(highOrderService.getOrderById(highOrder.getId())); + } 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("HighOrderController -> addOrder() error!",e); return ResponseMsgUtil.exception(e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java index 2f142663..31a40005 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java @@ -23,6 +23,7 @@ import io.swagger.annotations.ApiOperation; 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.*; @@ -75,6 +76,10 @@ public class HighUserDiscountController { highDiscountUserRelService.receiveDiscount(userInfoModel.getHighUser().getId(), codeId); return ResponseMsgUtil.success("领取成功"); + } 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("HighDiscountController -> receiveDiscount() error!",e); return ResponseMsgUtil.exception(e); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 5aa9a14a..f6157f63 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -20,6 +20,7 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.util.StringUtil; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -92,7 +93,9 @@ public class HighOrderServiceImpl implements HighOrderService { private HighActivityUserLotteryNumService highActivityUserLotteryNumService; @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional( + isolation = Isolation.SERIALIZABLE, + propagation= Propagation.REQUIRES_NEW) public void insertOrder(HighOrder highOrder) throws Exception { highOrderMapper.insert(highOrder); @@ -129,6 +132,7 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setExt1(list.get(0).getExt1()); highChildOrderMapper.updateByPrimaryKey(childOrder); } + if(!childOrder.getGiveawayType()) { // 查看是否需要赠送卡卷 List handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId());