|
|
|
@@ -79,6 +79,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxProfitSharingOrderService wxProfitSharingOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxPayOrderMapper wxPayOrderMapper; |
|
|
|
@@ -343,6 +346,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); |
|
|
|
} |
|
|
|
|
|
|
|
private WxAppinfo getAppinfo(TenantEntity tenantEntity,Integer payWay) { |
|
|
|
WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.getEnum(payWay)); |
|
|
|
if (wxAppinfo == null) |
|
|
|
throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); |
|
|
|
|
|
|
|
return wxAppinfo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public WxCouponOrder verify(WxCouponOrder couponOrder, WxMerchantBUser bUser) { |
|
|
|
@@ -381,6 +392,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
logger.error("券已被预核销: couponOrder-" + couponOrder.getId()); |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_PRE_VERIFY); |
|
|
|
} |
|
|
|
|
|
|
|
//如果开启了分账,就必须要配置分账账号 |
|
|
|
WxAppinfo appInfo = getAppinfo(couponOrder,couponOrder.getPayVendor()); |
|
|
|
WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); |
|
|
|
WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); |
|
|
|
psReceiverQ.updateTenantInfo(payAccount); |
|
|
|
psReceiverQ.setMerchantId(bUser.getMerchantId()); |
|
|
|
psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(couponOrder.getPayVendor()).getProfitSharingType()); |
|
|
|
psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); |
|
|
|
List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); |
|
|
|
if (null != payAccount.getShare() && EnumPayShare.YES.getCode().intValue() == payAccount.getShare().intValue() && psReceiverList.size() == 0) { |
|
|
|
throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int num = 0; |
|
|
|
try { |
|
|
|
couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 |
|
|
|
|