Browse Source

feat 0 支付工程

devlop
yang_shj 4 years ago
parent
commit
6f85eea135
  1. 29
      payment-base-app/src/main/java/com/base/springcloud/constant/ErrorConstant.java
  2. 39
      payment-base-app/src/main/java/com/base/springcloud/service/imp/MerchantServiceImp.java

29
payment-base-app/src/main/java/com/base/springcloud/constant/ErrorConstant.java

@ -14,19 +14,22 @@ public enum ErrorConstant {
USER_LOCKING("RBS00009","账号已被锁定,请联系管理员!"),
TOKEN_EXPIRATION_DATE("RBS00010","TOKEN已失效,请重新登录!"),
MERCHANT_CONFIGURE_FAIL("RBS00011","商户支付信息配置失败!"),
USER_DEPART_RELATION_NEED("RBS00012","请用户先关联部门信息!"),
SAVE_PAY_DEPART_CONFIG_FAIL("RBS00013","添加部门商户支付配置信息失败!"),
SALE_BILL_INVALID("RBS00014","无有效销售单据!"),
MERCHANT_PAY_CERT_READ_FAIL("RBS00015","支付证书读取失败!"),
PAY_ORDER_NOT_FOUND("RBS00016","无有效支付订单!"),
ORDER_STATE_NOT_SUPPORT_REFUND("RBS00017","订单状态不支持退款!"),
REGISTER_REFUND_FAIL("RBS00018","退款订单登记失败!"),
SYNC_WEC_REFUND_STATE_FAIL("RBS00019","同步微信退款状态失败!"),
BILL_COMPLETE_PAYMENT("RBS00020","销售单据已完成付款!"),
ALL_BILL_COMPLETE_PAYMENT("RBS00021","所有销售单据已完成付款!"),
MISTAKE_TARGET("RBS00022","要提供的对象不是数组!"),
SUPER_REFUND_ORDER_COUNT_FAL("RBS00023","退款订单次数累计失败!"),
SUPER_PAY_ORDER_COUNT_FAL("RBS00024","支付订单次数累计失败!");
MERCHANT_CONFIGURE_UPD_FAIL("RBS00012","商户支付信息修改失败!"),
MERCHANT_CONFIGURE_DEL_FAIL("RBS00013","商户支付信息删除失败!"),
MERCHANT_CONFIGURE_INVALID("RBS00014","无效商户支付信息配置修改!"),
USER_DEPART_RELATION_NEED("RBS00015","请用户先关联部门信息!"),
SAVE_PAY_DEPART_CONFIG_FAIL("RBS00016","添加部门商户支付配置信息失败!"),
SALE_BILL_INVALID("RBS00017","无有效销售单据!"),
MERCHANT_PAY_CERT_READ_FAIL("RBS00018","支付证书读取失败!"),
PAY_ORDER_NOT_FOUND("RBS00019","无有效支付订单!"),
ORDER_STATE_NOT_SUPPORT_REFUND("RBS00020","订单状态不支持退款!"),
REGISTER_REFUND_FAIL("RBS00021","退款订单登记失败!"),
SYNC_WEC_REFUND_STATE_FAIL("RBS00022","同步微信退款状态失败!"),
BILL_COMPLETE_PAYMENT("RBS00023","销售单据已完成付款!"),
ALL_BILL_COMPLETE_PAYMENT("RBS00024","所有销售单据已完成付款!"),
MISTAKE_TARGET("RBS00025","要提供的对象不是数组!"),
SUPER_REFUND_ORDER_COUNT_FAL("RBS00026","退款订单次数累计失败!"),
SUPER_PAY_ORDER_COUNT_FAL("RBS00027","支付订单次数累计失败!");
private String code;
private String message;

39
payment-base-app/src/main/java/com/base/springcloud/service/imp/MerchantServiceImp.java

@ -85,12 +85,14 @@ public class MerchantServiceImp implements MerchantService {
public void removeMerchantConfig(String mchId) {
// 查询商户支付信息配置记录
MerchantConfig merchantConfig = merchantConfigMapper.claimMerchantConfig(mchId);
// 删除证书文件
delWecWindow(merchantConfig.getCertPath());
if(!Optional.ofNullable(merchantConfig).isPresent())
throw new BusinessException(ErrorConstant.MERCHANT_CONFIGURE_INVALID);
// 删除原证书
removeCertificate(merchantConfig.getCertPath());
// 删除商户支付信息配置记录
int count = merchantConfigMapper.removeMerchantConfig(mchId);
if(count > 0) return;
// TODO 抛业务异常
throw new BusinessException(ErrorConstant.BILL_AMOUNT_ERR);
}
/**
@ -99,16 +101,35 @@ public class MerchantServiceImp implements MerchantService {
*/
@Override
public void updateMerchantConfig(MerchantConfigBO merchantConfigBO) {
// 证书上传服务器
//String certPath = uplodWecWindow(merchantConfigBO.getMchId(),merchantConfigBO.getCertFile());
String mchId = merchantConfigBO.getMchId();
if(StringUtils.isBlank(mchId))
throw new BusinessException(ErrorConstant.NULL_OBJ);
// 查询商户信息
MerchantConfig merchantConfig = merchantConfigMapper.claimMerchantConfig(mchId);
if(!Optional.ofNullable(merchantConfig).isPresent())
throw new BusinessException(ErrorConstant.MERCHANT_CONFIGURE_INVALID);
// 删除原证书
removeCertificate(merchantConfig.getCertPath());
// 新证书上传服务器
String certPath = uploadCertificate(merchantConfigBO.getCertFile());
// 商户支付信息保存
MerchantConfig merchantConfig = new MerchantConfig();
//merchantConfig.setCertPath(certPath);
BeanUtils.copyProperties(merchantConfigBO,merchantConfig);
MerchantConfig updateConfig = new MerchantConfig();
BeanUtils.copyProperties(merchantConfigBO,updateConfig);
merchantConfig.setCertPath(certPath);
merchantConfig.setUpdateTime(new Date());
int count = merchantConfigMapper.updateMerchantConfig(merchantConfig);
if(count > 0) return;
// TODO 抛业务异常
throw new BusinessException(ErrorConstant.MERCHANT_CONFIGURE_UPD_FAIL);
}
/**
* 移除原证书
* @param certPath
*/
private void removeCertificate(String certPath) {
if(StringUtils.isBlank(certPath))
return;
OssBootUtil.deleteUrl(certPath);
}
/**

Loading…
Cancel
Save