|
@@ -2,6 +2,7 @@ package com.fs.huifuPay.service.impl;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
@@ -51,15 +52,8 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
if (order.getAppId() != null) {
|
|
if (order.getAppId() != null) {
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(order.getAppId());
|
|
|
|
|
- if (fsHfpayConfig != null) {
|
|
|
|
|
- //多汇付支付获取配置
|
|
|
|
|
- doInit(getMerConfig(fsHfpayConfig));
|
|
|
|
|
- } else {
|
|
|
|
|
- //多小程序
|
|
|
|
|
- doInit(getMerConfig(order.getAppId()));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //多小程序
|
|
|
|
|
+ doInit(getMerConfig(order.getAppId()));
|
|
|
} else {
|
|
} else {
|
|
|
doInit(getMerConfig());
|
|
doInit(getMerConfig());
|
|
|
}
|
|
}
|
|
@@ -140,15 +134,8 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
@Override
|
|
@Override
|
|
|
public HuiFuQueryOrderResult queryOrder(V2TradePaymentScanpayQueryRequest request) throws Exception{
|
|
public HuiFuQueryOrderResult queryOrder(V2TradePaymentScanpayQueryRequest request) throws Exception{
|
|
|
if (request.getAppId() != null) {
|
|
if (request.getAppId() != null) {
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(request.getAppId());
|
|
|
|
|
- if (fsHfpayConfig != null) {
|
|
|
|
|
- //多汇付支付获取配置
|
|
|
|
|
- doInit(getMerConfig(fsHfpayConfig));
|
|
|
|
|
- } else {
|
|
|
|
|
- //多小程序
|
|
|
|
|
- doInit(getMerConfig());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //多汇付支付获取配置
|
|
|
|
|
+ doInit(getMerConfig(request.getAppId()));
|
|
|
} else {
|
|
} else {
|
|
|
doInit(getMerConfig());
|
|
doInit(getMerConfig());
|
|
|
}
|
|
}
|
|
@@ -172,16 +159,8 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
public HuiFuRefundResult refund(V2TradePaymentScanpayRefundRequest request) {
|
|
public HuiFuRefundResult refund(V2TradePaymentScanpayRefundRequest request) {
|
|
|
HuiFuRefundResult huiFuRefundResult=null;
|
|
HuiFuRefundResult huiFuRefundResult=null;
|
|
|
try {
|
|
try {
|
|
|
- if (request.getAppId() != null) {
|
|
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(request.getAppId());
|
|
|
|
|
- if (fsHfpayConfig != null) {
|
|
|
|
|
- //多汇付支付获取配置
|
|
|
|
|
- doInit(getMerConfig(fsHfpayConfig));
|
|
|
|
|
- } else {
|
|
|
|
|
- //多小程序
|
|
|
|
|
- doInit(getMerConfig());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(ObjectUtils.isNotNull(request.getAppId())){
|
|
|
|
|
+ doInit(getMerConfig(request.getAppId()));
|
|
|
} else {
|
|
} else {
|
|
|
doInit(getMerConfig());
|
|
doInit(getMerConfig());
|
|
|
}
|
|
}
|
|
@@ -190,6 +169,7 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
String jsonString = JSONObject.toJSONString(response);
|
|
String jsonString = JSONObject.toJSONString(response);
|
|
|
huiFuRefundResult = JSON.parseObject(jsonString, HuiFuRefundResult.class);
|
|
huiFuRefundResult = JSON.parseObject(jsonString, HuiFuRefundResult.class);
|
|
|
} catch (Exception e){
|
|
} catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
throw new CustomException("退款创建失败");
|
|
throw new CustomException("退款创建失败");
|
|
|
}
|
|
}
|
|
|
return huiFuRefundResult;
|
|
return huiFuRefundResult;
|
|
@@ -198,19 +178,7 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public HuiFuRefundResult queryRefundOrder(V2TradePaymentScanpayRefundqueryRequest request)throws Exception {
|
|
public HuiFuRefundResult queryRefundOrder(V2TradePaymentScanpayRefundqueryRequest request)throws Exception {
|
|
|
- if (request.getAppId() != null) {
|
|
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(request.getAppId());
|
|
|
|
|
- if (fsHfpayConfig != null) {
|
|
|
|
|
- //多汇付支付获取配置
|
|
|
|
|
- doInit(getMerConfig(fsHfpayConfig));
|
|
|
|
|
- } else {
|
|
|
|
|
- //多小程序
|
|
|
|
|
- doInit(getMerConfig());
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- doInit(getMerConfig());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ doInit(getMerConfig());
|
|
|
Map<String, Object> extendInfoMap = request.getExtendInfos();
|
|
Map<String, Object> extendInfoMap = request.getExtendInfos();
|
|
|
extendInfoMap.put("notify_url", config.getHfRefundNotifyUrl());
|
|
extendInfoMap.put("notify_url", config.getHfRefundNotifyUrl());
|
|
|
request.setExtendInfo(extendInfoMap);
|
|
request.setExtendInfo(extendInfoMap);
|
|
@@ -325,15 +293,8 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
HuiFuQueryOrderResult result =null;
|
|
HuiFuQueryOrderResult result =null;
|
|
|
try {
|
|
try {
|
|
|
if (order.getAppId() != null) {
|
|
if (order.getAppId() != null) {
|
|
|
- FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
|
|
|
|
|
- FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(order.getAppId());
|
|
|
|
|
- if (fsHfpayConfig != null) {
|
|
|
|
|
- //多汇付支付获取配置
|
|
|
|
|
- doInit(getMerConfig(fsHfpayConfig));
|
|
|
|
|
- } else {
|
|
|
|
|
- //多小程序
|
|
|
|
|
- doInit(getMerConfig());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //多汇付支付获取配置
|
|
|
|
|
+ doInit(getMerConfig(order.getAppId()));
|
|
|
} else {
|
|
} else {
|
|
|
doInit(getMerConfig());
|
|
doInit(getMerConfig());
|
|
|
}
|
|
}
|
|
@@ -396,21 +357,6 @@ public class HuiFuServiceImpl implements HuiFuService {
|
|
|
return merConfig;
|
|
return merConfig;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public MerConfig getMerConfig(FsHfpayConfig fsHfpayConfig) {
|
|
|
|
|
- MerConfig merConfig = new MerConfig();
|
|
|
|
|
- merConfig.setProcutId(fsHfpayConfig.getHfProductId());
|
|
|
|
|
- merConfig.setSysId(fsHfpayConfig.getHfSysId());
|
|
|
|
|
- merConfig.setRsaPrivateKey(fsHfpayConfig.getHfRsaPrivateKey());
|
|
|
|
|
- merConfig.setRsaPublicKey(fsHfpayConfig.getHfRsaPublicKey());
|
|
|
|
|
- merConfig.setHuifuId(fsHfpayConfig.getHuifuId());
|
|
|
|
|
-
|
|
|
|
|
- FsPayConfig fsPayConfig = new FsPayConfig();
|
|
|
|
|
- BeanUtils.copyProperties(fsHfpayConfig,fsPayConfig);
|
|
|
|
|
-
|
|
|
|
|
- config = fsPayConfig;
|
|
|
|
|
- return merConfig;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public MerConfig getMerConfig(String appId) {
|
|
public MerConfig getMerConfig(String appId) {
|
|
|
if (StringUtils.isBlank(appId)) {
|
|
if (StringUtils.isBlank(appId)) {
|
|
|
throw new IllegalArgumentException("appId不能为空");
|
|
throw new IllegalArgumentException("appId不能为空");
|