|
|
@@ -34,6 +34,8 @@ import com.iformall.service.order.entity.WxComposeOrder; |
|
|
import com.iformall.service.order.util.OrderHelper; |
|
|
import com.iformall.service.order.util.OrderHelper; |
|
|
|
|
|
|
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
|
|
|
import com.iformall.service.pay.entity.PayExtraParam; |
|
|
|
|
|
import com.iformall.service.pay.service.pay.entity.PayAdapterResult; |
|
|
import com.iformall.utils.*; |
|
|
import com.iformall.utils.*; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
@@ -914,7 +916,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
* |
|
|
* |
|
|
* @param user |
|
|
* @param user |
|
|
* @param coupon |
|
|
* @param coupon |
|
|
* @param couponIdStr |
|
|
|
|
|
|
|
|
* @param |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
public StockReduceResult stockReduce(boolean allowUnPayOrder,WxCUserBasicInfo user, WxCoupon coupon, WxCouponChannel couponChannel,int number) { |
|
|
public StockReduceResult stockReduce(boolean allowUnPayOrder,WxCUserBasicInfo user, WxCoupon coupon, WxCouponChannel couponChannel,int number) { |
|
|
@@ -2770,7 +2772,8 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
RedisTemplate<String, WxCUserBasicInfo> cUserBasicInfoRedisTemplate; |
|
|
RedisTemplate<String, WxCUserBasicInfo> cUserBasicInfoRedisTemplate; |
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
public WxComposeOrder savePlatPushOrderForCoupon(TenantEntity tenantEntity,boolean allowUnPayOrder,EnumComposeOrder composeOrderType,WxCUserBasicInfo user,String allExtParam,List<PlatPushOrderSaveDto> platPushOrderList,EnumPayWay payWay) { |
|
|
|
|
|
|
|
|
public WxComposeOrder savePlatPushOrderForCoupon(TenantEntity tenantEntity,boolean allowUnPayOrder,EnumComposeOrder composeOrderType, |
|
|
|
|
|
WxCUserBasicInfo user,String allExtParam,List<PlatPushOrderSaveDto> platPushOrderList,EnumPayWay payWay) throws Exception { |
|
|
WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); |
|
|
WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); |
|
|
// 防止同一用户重复下单,1秒内 |
|
|
// 防止同一用户重复下单,1秒内 |
|
|
String key = new StringBuilder().append("savePlatPushOrder:").append(user.getId()).toString(); |
|
|
String key = new StringBuilder().append("savePlatPushOrder:").append(user.getId()).toString(); |
|
|
@@ -2786,9 +2789,11 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
WxComposeOrder composeOrder = orderAdapterService.createDBMainOrderByPushOrder(tenantEntity,user, allExtParam,platPushOrderList, payWay); |
|
|
WxComposeOrder composeOrder = orderAdapterService.createDBMainOrderByPushOrder(tenantEntity,user, allExtParam,platPushOrderList, payWay); |
|
|
Date orderDate = new Date(); |
|
|
Date orderDate = new Date(); |
|
|
WxOrder lastOrder = null; |
|
|
WxOrder lastOrder = null; |
|
|
|
|
|
WxCoupon lastCoupon = null; |
|
|
for (int i = 0 ; i < platPushOrderList.size(); i ++) { |
|
|
for (int i = 0 ; i < platPushOrderList.size(); i ++) { |
|
|
PlatPushOrderSaveDto orderdto = platPushOrderList.get(i); |
|
|
PlatPushOrderSaveDto orderdto = platPushOrderList.get(i); |
|
|
|
|
|
|
|
|
|
|
|
lastCoupon = orderdto.getWxCoupon(); |
|
|
|
|
|
|
|
|
Map<Long,WxCouponChannel> couponChannelMap = composeOrder.getCouponChannelMap(); |
|
|
Map<Long,WxCouponChannel> couponChannelMap = composeOrder.getCouponChannelMap(); |
|
|
Long couponChannelId = orderdto.getCouponChannelId(); |
|
|
Long couponChannelId = orderdto.getCouponChannelId(); |
|
|
WxCouponChannel couponChannel = couponChannelMap.get(couponChannelId); |
|
|
WxCouponChannel couponChannel = couponChannelMap.get(couponChannelId); |
|
|
@@ -2824,7 +2829,19 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
if (EnumComposeOrder.isSingle(composeOrderType.getCode())) { |
|
|
if (EnumComposeOrder.isSingle(composeOrderType.getCode())) { |
|
|
composeOrder.setSingleOrder(lastOrder); |
|
|
composeOrder.setSingleOrder(lastOrder); |
|
|
} |
|
|
} |
|
|
return composeOrder; |
|
|
|
|
|
|
|
|
WxPayOrder record = new WxPayOrder(); |
|
|
|
|
|
record.updateTenantInfo(tenantEntity); |
|
|
|
|
|
record.setOrderId(composeOrder.getMainOrderId()); |
|
|
|
|
|
record.setComposeOrder(composeOrder.getComposeOrderType()); |
|
|
|
|
|
record.setOpenId((String) composeOrder.getMainOrder().getExpParamValue("open_id")); |
|
|
|
|
|
String productName = orderAdapterService.getPayProductName(lastCoupon); |
|
|
|
|
|
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, payWay.getPlat()); |
|
|
|
|
|
PayAdapterResult payResult = wxPayOrderService.createPayOrder(cAppInfo, user, record,composeOrder,productName, payWay, new PayExtraParam("openId",record.getOpenId()),false); |
|
|
|
|
|
if(payResult.isSuccess()){ |
|
|
|
|
|
return composeOrder; |
|
|
|
|
|
}else{ |
|
|
|
|
|
throw new Exception(payResult.getMsg()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|