|
|
@ -2,14 +2,11 @@ package com.base.springcloud.service.imp; |
|
|
|
|
|
|
|
|
import com.base.springcloud.bo.MerchantConfigBO; |
|
|
import com.base.springcloud.bo.MerchantConfigBO; |
|
|
import com.base.springcloud.bo.OrderBO; |
|
|
import com.base.springcloud.bo.OrderBO; |
|
|
import com.base.springcloud.constant.PaymentConstant; |
|
|
|
|
|
import com.base.springcloud.dao.MerchantConfigMapper; |
|
|
import com.base.springcloud.dao.MerchantConfigMapper; |
|
|
import com.base.springcloud.entity.MerchantConfig; |
|
|
import com.base.springcloud.entity.MerchantConfig; |
|
|
import com.base.springcloud.entity.WxpayTradeVo; |
|
|
|
|
|
import com.base.springcloud.service.MerchantService; |
|
|
import com.base.springcloud.service.MerchantService; |
|
|
import com.base.springcloud.util.FtpUtil; |
|
|
import com.base.springcloud.util.FtpUtil; |
|
|
import com.base.springcloud.util.WxpayUtils; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -60,6 +57,11 @@ public class MerchantServiceImp implements MerchantService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void removeMerchantConfig(String mchId) { |
|
|
public void removeMerchantConfig(String mchId) { |
|
|
|
|
|
// 查询商户支付信息配置记录
|
|
|
|
|
|
MerchantConfig merchantConfig = merchantConfigMapper.claimMerchantConfig(mchId); |
|
|
|
|
|
// 删除证书文件
|
|
|
|
|
|
delWecWindow(merchantConfig.getCertPath()); |
|
|
|
|
|
// 删除商户支付信息配置记录
|
|
|
int count = merchantConfigMapper.removeMerchantConfig(mchId); |
|
|
int count = merchantConfigMapper.removeMerchantConfig(mchId); |
|
|
if(count > 0) return; |
|
|
if(count > 0) return; |
|
|
// TODO 抛业务异常
|
|
|
// TODO 抛业务异常
|
|
|
@ -72,10 +74,10 @@ public class MerchantServiceImp implements MerchantService { |
|
|
@Override |
|
|
@Override |
|
|
public void updateMerchantConfig(MerchantConfigBO merchantConfigBO) { |
|
|
public void updateMerchantConfig(MerchantConfigBO merchantConfigBO) { |
|
|
// 证书上传服务器
|
|
|
// 证书上传服务器
|
|
|
//String certPath = uplodWecPayCert(merchantConfigBO.getMerchantId(),merchantConfigBO.getCertFile());
|
|
|
String certPath = uplodWecWindow(merchantConfigBO.getMchId(),merchantConfigBO.getCertFile()); |
|
|
// 商户支付信息保存
|
|
|
// 商户支付信息保存
|
|
|
MerchantConfig merchantConfig = new MerchantConfig(); |
|
|
MerchantConfig merchantConfig = new MerchantConfig(); |
|
|
//merchantConfig.setCertPath(certPath);
|
|
|
merchantConfig.setCertPath(certPath); |
|
|
BeanUtils.copyProperties(merchantConfigBO,merchantConfig); |
|
|
BeanUtils.copyProperties(merchantConfigBO,merchantConfig); |
|
|
merchantConfig.setUpdateTime(new Date()); |
|
|
merchantConfig.setUpdateTime(new Date()); |
|
|
int count = merchantConfigMapper.updateMerchantConfig(merchantConfig); |
|
|
int count = merchantConfigMapper.updateMerchantConfig(merchantConfig); |
|
|
@ -139,6 +141,23 @@ public class MerchantServiceImp implements MerchantService { |
|
|
return "文件上传失败!"; |
|
|
return "文件上传失败!"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 测试文件删除 |
|
|
|
|
|
* @param filePath |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Boolean delWecWindow(String filePath){ |
|
|
|
|
|
if(StringUtils.isEmpty(filePath)){ |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
File file = new File(filePath); |
|
|
|
|
|
if(file.exists()) { |
|
|
|
|
|
file.delete(); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 证书上传服务器 |
|
|
* 证书上传服务器 |
|
|
* @param mchId |
|
|
* @param mchId |
|
|
|