Przeglądaj źródła

fix press

release_toaliyun_real
lin 3 lat temu
rodzic
commit
bf8b535eac
4 zmienionych plików z 20 dodań i 13 usunięć
  1. +1
    -0
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java
  3. +5
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  4. +13
    -11
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java

+ 1
- 0
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Wyświetl plik

@@ -13,6 +13,7 @@ public enum ErrorCode{
* 系统级别 * 系统级别
* 1000-1999 * 1000-1999
*/ */
SYS_TRANSCATION_NO_BACK(999,"事务无需回滚异常"),
SYS_SERVER_ERROR(1000, "系统繁忙"), SYS_SERVER_ERROR(1000, "系统繁忙"),
SYS_PARAMETER_ERROR(1001, "参数不合法"), SYS_PARAMETER_ERROR(1001, "参数不合法"),
SYS_PARAMETER_NOT_NULL(1002, "参数不能为空"), SYS_PARAMETER_NOT_NULL(1002, "参数不能为空"),


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/helper/WxOrderServiceHelper.java Wyświetl plik

@@ -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) { if (isChannelStockReduce) {
try { try {
wxCouponChannelService.reduceChannelStock(coupon,couponChannelId,number); wxCouponChannelService.reduceChannelStock(coupon,couponChannelId,number);


+ 5
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Wyświetl plik

@@ -1110,7 +1110,11 @@ public class WxOrderServiceImpl implements WxOrderService {
isReduceStock = false; isReduceStock = false;
} }
if (isReduceStock) { 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.setChannelStockReduce(isChannelStockReduce);
reduceResult.setCurrentPrice(currentPrice); reduceResult.setCurrentPrice(currentPrice);


+ 13
- 11
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java Wyświetl plik

@@ -49,6 +49,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;


import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
@@ -177,10 +178,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
//处理其他信息 //处理其他信息
try { try {
WxCoupon wxCoupon = wxCouponMapper.selectById(composeOrder.getSingleOrder().getProductId(),composeOrder.getSingleOrder().getTenantId()); 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) { }catch(Exception e) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
} }
@@ -189,10 +190,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
for (WxOrder o : orderList) { for (WxOrder o : orderList) {
try { try {
WxCoupon wxCoupon = wxCouponMapper.selectById(o.getProductId(),o.getTenantId()); 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) { }catch(Exception e) {
logger.error("handleSuccessOrder error.",e); logger.error("handleSuccessOrder error.",e);
} }
@@ -202,10 +203,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
//处理其他信息 //处理其他信息
try { try {
WxCoupon wxCoupon = wxCouponMapper.selectById(composeOrder.getSingleOrder().getProductId(),composeOrder.getSingleOrder().getTenantId()); 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) { if (isSuccess) {
proxy.handleOrderPaySingleOrderSuccess(wxCoupon,composeOrder.getSingleOrder(),oldRecord, transactionId,isScheduleTask); proxy.handleOrderPaySingleOrderSuccess(wxCoupon,composeOrder.getSingleOrder(),oldRecord, transactionId,isScheduleTask);
} }
}catch(Exception e) { }catch(Exception e) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); 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() if (null != coupon && coupon.getType().intValue() == EnumCouponType.COUPON_PRESS.getCode().intValue()
&& null != coupon.getPressPayReduceStock() && coupon.getPressPayReduceStock().intValue() == EnumYesOrNo.YES.getCode().intValue()) { && null != coupon.getPressPayReduceStock() && coupon.getPressPayReduceStock().intValue() == EnumYesOrNo.YES.getCode().intValue()) {


Ładowanie…
Anuluj
Zapisz