|
|
|
@@ -863,37 +863,36 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) { |
|
|
|
// //B端操作,需要生成cUser |
|
|
|
// CreateUser cUser = null; |
|
|
|
// try { |
|
|
|
// cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo); |
|
|
|
// } catch (Exception e1) { |
|
|
|
// logger.error("创建C端用户失败: " ,e1); |
|
|
|
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage()); |
|
|
|
// } |
|
|
|
// //如果用户是会员,则用会员ID, 如果没有,则用渠道用户ID(如wxCuser,支付宝user) |
|
|
|
// Long cUserId = null; |
|
|
|
// if (cUser.isBasicInfo()) { |
|
|
|
// cUserId = cUser.getBasicUserId(); |
|
|
|
// }else { |
|
|
|
// cUserId = cUser.getCUserId(); |
|
|
|
// } |
|
|
|
//扫码支付的会员固定 |
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(1L); |
|
|
|
if (null == basicInfo) { |
|
|
|
basicInfo = new WxCUserBasicInfo(); |
|
|
|
basicInfo.setId(1L); |
|
|
|
basicInfo.setPhone("11111111111"); |
|
|
|
basicInfo.setNickName("商场["+record.getTenantId()+"]B端扫C端码支付专用账户"); |
|
|
|
basicInfo.undateFinalTenantId(record); |
|
|
|
basicInfo.setCreateDate(new Date()); |
|
|
|
int count = wxCUserBasicInfoMapper.insert(basicInfo); |
|
|
|
if (count <=0 ) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加会员用户失败"); |
|
|
|
} |
|
|
|
//userCreate = true; |
|
|
|
} |
|
|
|
CreateUser cUser = null; |
|
|
|
try { |
|
|
|
cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).getCUserAfterPay(result, appInfo); |
|
|
|
} catch (Exception e1) { |
|
|
|
logger.error("创建C端用户失败: " ,e1); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage()); |
|
|
|
} |
|
|
|
//如果用户是会员,则用会员ID, 如果没有,则用渠道用户ID(如wxCuser,支付宝user) |
|
|
|
Long basicUserId = null; |
|
|
|
if (null != cUser && cUser.isBasicInfo()) { |
|
|
|
basicUserId = cUser.getBasicUserId(); |
|
|
|
}else { |
|
|
|
//扫码支付的会员固定 |
|
|
|
basicUserId = Long.parseLong(record.getTenantId()+"0001"); |
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(basicUserId); |
|
|
|
if (null == basicInfo) { |
|
|
|
basicInfo = new WxCUserBasicInfo(); |
|
|
|
basicInfo.setId(basicUserId); |
|
|
|
basicInfo.setPhone("11111111111"); |
|
|
|
basicInfo.setNickName("商场["+record.getTenantId()+"]B端扫C端码支付专用账户"); |
|
|
|
basicInfo.undateFinalTenantId(record); |
|
|
|
basicInfo.setCreateDate(new Date()); |
|
|
|
int count = wxCUserBasicInfoMapper.insert(basicInfo); |
|
|
|
if (count <=0 ) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加会员用户失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
WxPayOrderServiceImpl proxy = (WxPayOrderServiceImpl) AopContext.currentProxy(); |
|
|
|
WxOrder order = proxy.handler(record,transcationId,basicInfo.getId()); |
|
|
|
WxOrder order = proxy.handler(record,transcationId,basicUserId); |
|
|
|
if (null == order) { |
|
|
|
return; |
|
|
|
} |
|
|
|
@@ -930,7 +929,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
|
} |
|
|
|
|
|
|
|
// 修改订单状态 |
|
|
|
order.setCUserId(basicInfo.getId()); |
|
|
|
order.setCUserId(basicUserId); |
|
|
|
try { |
|
|
|
int _count = wxOrderService.microPayOrderSuccess(order); |
|
|
|
if (_count > 1) { |
|
|
|
|