diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index f3e92d8a3..8764fa57a 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -13,6 +13,7 @@ public enum ErrorCode{ * 系统级别 * 1000-1999 */ + SYS_TRANSCATION_NO_BACK(999,"事务无需回滚异常"), SYS_SERVER_ERROR(1000, "系统繁忙"), SYS_PARAMETER_ERROR(1001, "参数不合法"), SYS_PARAMETER_NOT_NULL(1002, "参数不能为空"), diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java index 1a28ed923..5fdafb22b 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java @@ -34,7 +34,7 @@ public class WxOrderServiceHelper { /** * 微信订单是否可以支付 */ - public void reduceStock(boolean isChannelStockReduce, WxCoupon coupon,Long couponChannelId,int number) { + public void reduceStock(boolean isChannelStockReduce, WxCoupon coupon,Long couponChannelId,int number) throws Exception{ if (isChannelStockReduce) { try { wxCouponChannelService.reduceChannelStock(coupon,couponChannelId,number); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index be55cd1bf..af168ec2a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -1110,7 +1110,11 @@ public class WxOrderServiceImpl implements WxOrderService { isReduceStock = false; } if (isReduceStock) { - wxOrderServiceHelper.reduceStock(isChannelStockReduce,coupon,couponChannelId, number); + try { + wxOrderServiceHelper.reduceStock(isChannelStockReduce,coupon,couponChannelId, number); + }catch (Exception e) { + throw new MallinkException(ErrorCode.DB_FAIL.getCode(),e.getMessage()); + } } reduceResult.setChannelStockReduce(isChannelStockReduce); reduceResult.setCurrentPrice(currentPrice); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java index 711f6be25..02d61778e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java @@ -49,6 +49,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.text.ParseException; import java.util.*; @@ -177,10 +178,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { //处理其他信息 try { WxCoupon wxCoupon = wxCouponMapper.selectById(composeOrder.getSingleOrder().getProductId(),composeOrder.getSingleOrder().getTenantId()); - boolean isSuccess = proxy.handelPress(wxCoupon, composeOrder.getSingleOrder()); - if (isSuccess) { - proxy.handleOrderPaySingleOrderSuccess(wxCoupon,composeOrder.getSingleOrder(),oldRecord, transactionId,isScheduleTask); - } + boolean isSuccess = proxy.handelPress(wxCoupon, composeOrder.getSingleOrder()); + if (isSuccess) { + proxy.handleOrderPaySingleOrderSuccess(wxCoupon,composeOrder.getSingleOrder(),oldRecord, transactionId,isScheduleTask); + } }catch(Exception e) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); } @@ -189,10 +190,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { for (WxOrder o : orderList) { try { WxCoupon wxCoupon = wxCouponMapper.selectById(o.getProductId(),o.getTenantId()); - boolean isSuccess = proxy.handelPress(wxCoupon, o); - if (isSuccess) { - proxy.handleOrderPaySingleOrderSuccess(wxCoupon,o,oldRecord, transactionId, isScheduleTask); - } + boolean isSuccess = proxy.handelPress(wxCoupon, o); + if (isSuccess) { + proxy.handleOrderPaySingleOrderSuccess(wxCoupon,o,oldRecord, transactionId, isScheduleTask); + } }catch(Exception e) { logger.error("handleSuccessOrder error.",e); } @@ -202,10 +203,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { //处理其他信息 try { WxCoupon wxCoupon = wxCouponMapper.selectById(composeOrder.getSingleOrder().getProductId(),composeOrder.getSingleOrder().getTenantId()); - boolean isSuccess = proxy.handelPress(wxCoupon, composeOrder.getSingleOrder()); + boolean isSuccess = proxy.handelPress(wxCoupon, composeOrder.getSingleOrder()); if (isSuccess) { proxy.handleOrderPaySingleOrderSuccess(wxCoupon,composeOrder.getSingleOrder(),oldRecord, transactionId,isScheduleTask); } + }catch(Exception e) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); } @@ -215,8 +217,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { } } - @Transactional(propagation = Propagation.NESTED, readOnly = false, rollbackFor = {Exception.class}) - public boolean handelPress(WxCoupon coupon,WxOrder order) { + @Transactional(propagation = Propagation.NOT_SUPPORTED,noRollbackFor = {Exception.class}) + public boolean handelPress(WxCoupon coupon,WxOrder order) { //如果是砍价,并且是付款扣库存 if (null != coupon && coupon.getType().intValue() == EnumCouponType.COUPON_PRESS.getCode().intValue() && null != coupon.getPressPayReduceStock() && coupon.getPressPayReduceStock().intValue() == EnumYesOrNo.YES.getCode().intValue()) {