|
@@ -736,12 +736,26 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
|
|
// 查询订单状态
|
|
// 查询订单状态
|
|
UserPaymentOrderWrapper.UserPaymentOrder userPaymentOrder = userPaymentOrderService.getUserPaymentOrderByUserId(Long.parseLong(reqConfig.getUserId()),
|
|
UserPaymentOrderWrapper.UserPaymentOrder userPaymentOrder = userPaymentOrderService.getUserPaymentOrderByUserId(Long.parseLong(reqConfig.getUserId()),
|
|
reqConfig.getMerOrderNo());
|
|
reqConfig.getMerOrderNo());
|
|
|
|
+
|
|
|
|
+ // 默认支付三方
|
|
|
|
+ if (StringUtils.isNotEmpty(reqConfig.getPaymentVendor())
|
|
|
|
+ && !reqConfig.getPaymentVendor().equals(userPaymentOrder.getPaymentVendor())) {
|
|
|
|
+ // 原生支付拉起支付时,可以切换支付渠道
|
|
|
|
+ UserPaymentOrderWrapper.UserPaymentOrder update = UserPaymentOrderWrapper.UserPaymentOrder
|
|
|
|
+ .builder()
|
|
|
|
+ .id(userPaymentOrder.getId())
|
|
|
|
+ .paymentVendor(reqConfig.getPaymentVendor())
|
|
|
|
+ .build();
|
|
|
|
+ userPaymentOrderService.updateById(update);
|
|
|
|
+
|
|
|
|
+ // 重置支付三方渠道
|
|
|
|
+ userPaymentOrder.setPaymentVendor(reqConfig.getPaymentVendor());
|
|
|
|
+ }
|
|
|
|
+
|
|
if (Objects.isNull(userPaymentOrder)) {
|
|
if (Objects.isNull(userPaymentOrder)) {
|
|
throw new BizException("订单不存在");
|
|
throw new BizException("订单不存在");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 订单支付已完成
|
|
// 订单支付已完成
|
|
switch (userPaymentOrder.getStatus()) {
|
|
switch (userPaymentOrder.getStatus()) {
|
|
case PAID:
|
|
case PAID:
|
|
@@ -1045,11 +1059,33 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
|
|
}
|
|
}
|
|
|
|
|
|
// 结算给机构的,检测机构的主账户,没有主账户的,查询-1的主账户
|
|
// 结算给机构的,检测机构的主账户,没有主账户的,查询-1的主账户
|
|
- PaymentMerchantConfig merchantConfig = paymentMerchantConfigService.getByPaymentVendor(paymentServiceContext.getProperties().getDefaultService());
|
|
|
|
- if (Objects.isNull(merchantConfig)) {
|
|
|
|
- throw new BizException("平台主账户信息不存在");
|
|
|
|
|
|
+ String defaultService = paymentServiceContext.getProperties().getDefaultService();
|
|
|
|
+ if (EPayerType.ORIGINAL.getCode().toLowerCase().equals(defaultService)) {
|
|
|
|
+ // 微信、支付宝原生支付
|
|
|
|
+ if (Objects.isNull(payTypeReq.getClientType())) {
|
|
|
|
+ throw new BizException("支付客户端类型不能为空");
|
|
|
|
+ }
|
|
|
|
+ List<PaymentMerchantConfig> configs = paymentMerchantConfigService.lambdaQuery()
|
|
|
|
+ .eq(PaymentMerchantConfig::getPayerType, EPayerType.ORIGINAL.getCode())
|
|
|
|
+ .eq(PaymentMerchantConfig::getPaymentClient, payTypeReq.getClientType().getCode())
|
|
|
|
+ .eq(PaymentMerchantConfig::getStatus, true)
|
|
|
|
+ .list();
|
|
|
|
+ if (CollectionUtils.isEmpty(configs)) {
|
|
|
|
+ throw new BizException("平台主账户信息不存在");
|
|
|
|
+ }
|
|
|
|
+ // 默认支付服务
|
|
|
|
+ resp.setPaymentVendor(configs.get(0).getPaymentVendor());
|
|
|
|
+
|
|
|
|
+ // 设置支付服务渠道
|
|
|
|
+ resp.setPaymentChannels(configs.stream().map(PaymentMerchantConfig::getPaymentVendor).distinct().collect(Collectors.toList()));
|
|
|
|
+ } else {
|
|
|
|
+ // 易宝,汇付三方支付
|
|
|
|
+ PaymentMerchantConfig merchantConfig = paymentMerchantConfigService.getByPaymentVendor(defaultService);
|
|
|
|
+ if (Objects.isNull(merchantConfig)) {
|
|
|
|
+ throw new BizException("平台主账户信息不存在");
|
|
|
|
+ }
|
|
|
|
+ resp.setPaymentVendor(merchantConfig.getPaymentVendor());
|
|
}
|
|
}
|
|
- resp.setPaymentVendor(merchantConfig.getPaymentVendor());
|
|
|
|
return resp;
|
|
return resp;
|
|
}
|
|
}
|
|
|
|
|