## Feat - 京东银行卡支付(member/sale/third)
This commit is contained in:
parent
3ae29d435c
commit
4b201e7421
|
@ -0,0 +1,9 @@
|
||||||
|
package com.hzs.third.pay;
|
||||||
|
|
||||||
|
import com.hzs.common.core.domain.R;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
|
|
||||||
|
public interface ITOnlinePaymentServiceApi {
|
||||||
|
R<TOnlinePayment> getOnlinePayment(String orderNo);
|
||||||
|
R<String> refund(String orderNo, Long userId);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.hzs.member.base.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.hzs.activity.pick.IAcPickServiceApi;
|
import com.hzs.activity.pick.IAcPickServiceApi;
|
||||||
import com.hzs.bonus.settle.IMemberSettleBonusApi;
|
import com.hzs.bonus.settle.IMemberSettleBonusApi;
|
||||||
|
@ -40,6 +41,7 @@ import com.hzs.common.domain.sale.ext.SaOrderExt;
|
||||||
import com.hzs.common.domain.sale.order.SaOrder;
|
import com.hzs.common.domain.sale.order.SaOrder;
|
||||||
import com.hzs.common.domain.system.config.BdAccount;
|
import com.hzs.common.domain.system.config.BdAccount;
|
||||||
import com.hzs.common.domain.system.config.BdAwards;
|
import com.hzs.common.domain.system.config.BdAwards;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
import com.hzs.common.util.TransactionUtils;
|
import com.hzs.common.util.TransactionUtils;
|
||||||
import com.hzs.member.account.dto.BusinessCommissionDTO;
|
import com.hzs.member.account.dto.BusinessCommissionDTO;
|
||||||
import com.hzs.member.account.service.ICuMemberAccountService;
|
import com.hzs.member.account.service.ICuMemberAccountService;
|
||||||
|
@ -63,6 +65,7 @@ import com.hzs.system.config.IAwardsServiceApi;
|
||||||
import com.hzs.system.config.IGradeServiceApi;
|
import com.hzs.system.config.IGradeServiceApi;
|
||||||
import com.hzs.system.config.dto.AreaCurrencyDTO;
|
import com.hzs.system.config.dto.AreaCurrencyDTO;
|
||||||
import com.hzs.system.config.dto.GradeDTO;
|
import com.hzs.system.config.dto.GradeDTO;
|
||||||
|
import com.hzs.third.pay.ITOnlinePaymentServiceApi;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -125,7 +128,8 @@ public class CuMemberBusinessServiceImpl implements ICuMemberBusinessService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICuMemberSettlePeriodService iCuMemberSettlePeriodService;
|
private ICuMemberSettlePeriodService iCuMemberSettlePeriodService;
|
||||||
|
|
||||||
|
@DubboReference
|
||||||
|
private ITOnlinePaymentServiceApi itOnlinePaymentServiceApi;
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateCuMember(CuMember cuMember) {
|
public void updateCuMember(CuMember cuMember) {
|
||||||
|
@ -772,8 +776,16 @@ public class CuMemberBusinessServiceImpl implements ICuMemberBusinessService {
|
||||||
List<CuMemberTradeDetail> cuMemberTradeDetailList = new ArrayList<>();
|
List<CuMemberTradeDetail> cuMemberTradeDetailList = new ArrayList<>();
|
||||||
CuMemberAccount updateMemberAccount = new CuMemberAccount();
|
CuMemberAccount updateMemberAccount = new CuMemberAccount();
|
||||||
List<CuMemberTrade> cuMemberTradeList = packageCancelOrderCuMemberTrades(pkApprove, saOrder, payMemberAccount, newCuMemberTradeBonusList, cuMemberTradeDetailList, updateMemberAccount);
|
List<CuMemberTrade> cuMemberTradeList = packageCancelOrderCuMemberTrades(pkApprove, saOrder, payMemberAccount, newCuMemberTradeBonusList, cuMemberTradeDetailList, updateMemberAccount);
|
||||||
if (newCuMemberTradeBonusList.size() > 0) {
|
R<TOnlinePayment> onlinePaymentR = itOnlinePaymentServiceApi.getOnlinePayment(saOrder.getOrderCode());
|
||||||
iCuMemberTradeBonusService.batchInsertCuMemberTradeBonus(newCuMemberTradeBonusList);
|
TOnlinePayment onlinePayment = null;
|
||||||
|
if(ObjectUtil.isNotEmpty(onlinePaymentR)){
|
||||||
|
onlinePayment = onlinePaymentR.getData();
|
||||||
|
}
|
||||||
|
// 2025年7月2日 在线支付无视现金流水明细
|
||||||
|
if(ObjectUtil.isEmpty(onlinePayment)){
|
||||||
|
if (newCuMemberTradeBonusList.size() > 0) {
|
||||||
|
iCuMemberTradeBonusService.batchInsertCuMemberTradeBonus(newCuMemberTradeBonusList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 根据 newCuMemberTradeBonusList 更新 cu_member_trade_detail
|
// 根据 newCuMemberTradeBonusList 更新 cu_member_trade_detail
|
||||||
iCuMemberTradeDetailService.updateAddCuMemberTradeDetail(cuMemberTradeDetailList);
|
iCuMemberTradeDetailService.updateAddCuMemberTradeDetail(cuMemberTradeDetailList);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.hzs.sale.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -20,6 +21,7 @@ import com.hzs.common.core.service.RedisService;
|
||||||
import com.hzs.common.core.utils.*;
|
import com.hzs.common.core.utils.*;
|
||||||
import com.hzs.common.core.utils.reflect.ReflectUtils;
|
import com.hzs.common.core.utils.reflect.ReflectUtils;
|
||||||
import com.hzs.common.domain.member.account.CuMemberAccount;
|
import com.hzs.common.domain.member.account.CuMemberAccount;
|
||||||
|
import com.hzs.common.domain.member.account.CuMemberTrade;
|
||||||
import com.hzs.common.domain.member.base.CuMember;
|
import com.hzs.common.domain.member.base.CuMember;
|
||||||
import com.hzs.common.domain.member.base.CuMemberRegister;
|
import com.hzs.common.domain.member.base.CuMemberRegister;
|
||||||
import com.hzs.common.domain.member.base.CuMemberShare;
|
import com.hzs.common.domain.member.base.CuMemberShare;
|
||||||
|
@ -35,6 +37,7 @@ import com.hzs.common.domain.sale.wares.BdWares;
|
||||||
import com.hzs.common.domain.system.base.BdCountry;
|
import com.hzs.common.domain.system.base.BdCountry;
|
||||||
import com.hzs.common.domain.system.base.ext.BdProductStorehouseExt;
|
import com.hzs.common.domain.system.base.ext.BdProductStorehouseExt;
|
||||||
import com.hzs.common.domain.system.config.BdAwards;
|
import com.hzs.common.domain.system.config.BdAwards;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
import com.hzs.common.security.service.UserTokenService;
|
import com.hzs.common.security.service.UserTokenService;
|
||||||
import com.hzs.common.security.utils.SecurityUtils;
|
import com.hzs.common.security.utils.SecurityUtils;
|
||||||
import com.hzs.common.util.TransactionUtils;
|
import com.hzs.common.util.TransactionUtils;
|
||||||
|
@ -76,6 +79,7 @@ import com.hzs.system.sys.IApprovalServiceApi;
|
||||||
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
|
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
|
||||||
import com.hzs.system.sys.dto.ApprovalSubmitDTO;
|
import com.hzs.system.sys.dto.ApprovalSubmitDTO;
|
||||||
import com.hzs.system.sys.dto.LoginUser;
|
import com.hzs.system.sys.dto.LoginUser;
|
||||||
|
import com.hzs.third.pay.ITOnlinePaymentServiceApi;
|
||||||
import com.hzs.third.sms.ISmsServiceApi;
|
import com.hzs.third.sms.ISmsServiceApi;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
@ -131,6 +135,9 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
||||||
@DubboReference
|
@DubboReference
|
||||||
ICuMemberAgreementWhiteApi cuMemberAgreementWhiteApi;
|
ICuMemberAgreementWhiteApi cuMemberAgreementWhiteApi;
|
||||||
|
|
||||||
|
@DubboReference
|
||||||
|
private ITOnlinePaymentServiceApi itOnlinePaymentServiceApi;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBdWaresService iBdWaresService;
|
private IBdWaresService iBdWaresService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -2293,7 +2300,18 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
|
||||||
public void selfRevokeOrder(Long pkApprove, MyOrderVO myOrderVO) {
|
public void selfRevokeOrder(Long pkApprove, MyOrderVO myOrderVO) {
|
||||||
SaOrderExt saOrderExt = myOrderVO.getSaOrderExt();
|
SaOrderExt saOrderExt = myOrderVO.getSaOrderExt();
|
||||||
BusinessCommissionDTO businessCommissionDTO = null;
|
BusinessCommissionDTO businessCommissionDTO = null;
|
||||||
if (saOrderExt != null) {
|
R<TOnlinePayment> onlinePaymentR = itOnlinePaymentServiceApi.getOnlinePayment(saOrderExt.getOrderCode());
|
||||||
|
TOnlinePayment onlinePayment = null;
|
||||||
|
if(ObjectUtil.isNotEmpty(onlinePaymentR)){
|
||||||
|
onlinePayment = onlinePaymentR.getData();
|
||||||
|
if(ObjectUtil.isNotEmpty(onlinePayment)){
|
||||||
|
R result = itOnlinePaymentServiceApi.refund(saOrderExt.getOrderCode(), SecurityUtils.getUserId());
|
||||||
|
if(!result.isSuccess()){
|
||||||
|
throw new ServiceException(result.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(saOrderExt)) {
|
||||||
// 删除订单
|
// 删除订单
|
||||||
saOrderExt.setDelFlag(EDelFlag.DELETE.getValue());
|
saOrderExt.setDelFlag(EDelFlag.DELETE.getValue());
|
||||||
Date currentDate = DateUtils.currentDateTime();
|
Date currentDate = DateUtils.currentDateTime();
|
||||||
|
|
|
@ -122,4 +122,9 @@ public class TOnlinePayment extends BaseEntity {
|
||||||
@TableField("PAY_SOURCE")
|
@TableField("PAY_SOURCE")
|
||||||
private Integer paySource;
|
private Integer paySource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付-前端回调页面的扩展参数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String extParam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,9 @@ public class TOnlinePaymentSepAcc extends BaseEntity {
|
||||||
@TableField("TRADE_AMOUNT")
|
@TableField("TRADE_AMOUNT")
|
||||||
private BigDecimal tradeAmount;
|
private BigDecimal tradeAmount;
|
||||||
|
|
||||||
|
@TableField("OUT_TRADE_NO")
|
||||||
|
private String outTradeNo;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<TOnlinePaymentSepAccD> sepAccDList;
|
private List<TOnlinePaymentSepAccD> sepAccDList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,4 +53,7 @@ public class TOnlinePaymentSepAccD extends BaseEntity {
|
||||||
|
|
||||||
@TableField("TRADE_AMOUNT")
|
@TableField("TRADE_AMOUNT")
|
||||||
private BigDecimal tradeAmount;
|
private BigDecimal tradeAmount;
|
||||||
|
|
||||||
|
@TableField("OUT_TRADE_NO")
|
||||||
|
private String outTradeNo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,10 @@ public class RefundOrderListener {
|
||||||
// 通联
|
// 通联
|
||||||
str = iRefundService.allInRefundHandle(refundDTO, tOnlinePayment);
|
str = iRefundService.allInRefundHandle(refundDTO, tOnlinePayment);
|
||||||
break;
|
break;
|
||||||
|
case JD:
|
||||||
|
// 京东
|
||||||
|
str = iRefundService.jdRefundDivision(tOnlinePayment.getBusinessCode(), tOnlinePayment.getPkCreator());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.hzs.third.pay.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "jd.bank") // 绑定jd.pay前缀的配置
|
||||||
|
public class JdPayBankProperties {
|
||||||
|
|
||||||
|
private String merchantNo;
|
||||||
|
private String signKey;
|
||||||
|
private String priCertPwd;
|
||||||
|
private String priCert;
|
||||||
|
private String pubCert;
|
||||||
|
private String apiDomain;
|
||||||
|
private String pageBackUrl;
|
||||||
|
private String notifyUrl;
|
||||||
|
private String refundNotifyUrl;
|
||||||
|
|
||||||
|
private List<JdPaySeparateAccountConfig> separateAccounts;
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
package com.hzs.third.pay.config;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "jd.pay") // 绑定jd.pay前缀的配置
|
|
||||||
public class JdPayProperties {
|
|
||||||
private List<JdPaySeparateAccountConfig> separateAccounts;
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.hzs.third.pay.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "jd.wechat-alipay") // 绑定jd.pay前缀的配置
|
||||||
|
public class JdPayWechatAlipayProperties {
|
||||||
|
|
||||||
|
private String merchantNo;
|
||||||
|
private String signKey;
|
||||||
|
private String priCertPwd;
|
||||||
|
private String priCert;
|
||||||
|
private String pubCert;
|
||||||
|
private String apiDomain;
|
||||||
|
private String pageBackUrl;
|
||||||
|
private String notifyUrl;
|
||||||
|
private String refundNotifyUrl;
|
||||||
|
|
||||||
|
private List<JdPaySeparateAccountConfig> separateAccounts;
|
||||||
|
}
|
|
@ -13,10 +13,7 @@ import com.hzs.third.pay.service.IRefundService;
|
||||||
import com.hzs.third.pay.service.ITOnlinePaymentService;
|
import com.hzs.third.pay.service.ITOnlinePaymentService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 京东退款控制器
|
* @Description: 京东退款控制器
|
||||||
|
@ -35,6 +32,18 @@ public class JdRefundController extends PayBaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ITOnlinePaymentService itOnlinePaymentService;
|
private ITOnlinePaymentService itOnlinePaymentService;
|
||||||
|
|
||||||
|
@GetMapping("/test/{orderCode}")
|
||||||
|
public AjaxResult test(@PathVariable String orderCode) {
|
||||||
|
iRefundService.jdRefundDivision(orderCode, SecurityUtils.getUserId());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/test2")
|
||||||
|
public AjaxResult test2() {
|
||||||
|
iRefundService.jdQueryEnterpriseWalletBalance();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 京东退款接口
|
* 京东退款接口
|
||||||
*
|
*
|
||||||
|
|
|
@ -123,6 +123,7 @@ public class PayController {
|
||||||
onlinePayment.setOriginalOrder(onlinePayment.getBusinessCode());
|
onlinePayment.setOriginalOrder(onlinePayment.getBusinessCode());
|
||||||
onlinePayment.setPaySource(dataSource.getValue());
|
onlinePayment.setPaySource(dataSource.getValue());
|
||||||
}
|
}
|
||||||
|
onlinePayment.setExtParam(payParam.getExtParam());
|
||||||
|
|
||||||
// 业务金额
|
// 业务金额
|
||||||
BigDecimal businessMoney = null;
|
BigDecimal businessMoney = null;
|
||||||
|
@ -208,7 +209,8 @@ public class PayController {
|
||||||
case WECHAT:
|
case WECHAT:
|
||||||
case ALIPAY:
|
case ALIPAY:
|
||||||
// 微信、支付宝 扫码支付
|
// 微信、支付宝 扫码支付
|
||||||
payResult = iJdPayService.scanPay(onlinePayment);
|
// payResult = iJdPayService.scanPay(onlinePayment);
|
||||||
|
payResult = iJdPayService.cashRegister(onlinePayment, dataSource);
|
||||||
break;
|
break;
|
||||||
case BANK_CARD:
|
case BANK_CARD:
|
||||||
// 银行卡支付
|
// 银行卡支付
|
||||||
|
@ -270,7 +272,10 @@ public class PayController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/status")
|
@GetMapping("/status")
|
||||||
public AjaxResult status(PayParam param) {
|
public AjaxResult status(PayParam param) {
|
||||||
if (null == param.getBusinessType() || StringUtils.isEmpty(param.getBusinessCode())) {
|
// if (null == param.getBusinessType() || StringUtils.isEmpty(param.getBusinessCode())) {
|
||||||
|
// return AjaxResult.success("缺少参数");
|
||||||
|
// }
|
||||||
|
if (StringUtils.isEmpty(param.getBusinessCode())) {
|
||||||
return AjaxResult.success("缺少参数");
|
return AjaxResult.success("缺少参数");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class JdPayNotifyController extends JdBaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource(name = "jdPayBank")
|
||||||
private JdPay jdPay;
|
private JdPay jdPay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class JdRefundNotifyController extends JdBaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource(name = "jdPayBank")
|
||||||
private JdPay jdPay;
|
private JdPay jdPay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.hzs.third.pay.jdpay.config;
|
package com.hzs.third.pay.jdpay.config;
|
||||||
|
|
||||||
|
import com.hzs.third.pay.config.JdPayBankProperties;
|
||||||
|
import com.hzs.third.pay.config.JdPayWechatAlipayProperties;
|
||||||
import com.hzs.third.pay.jdpay.sdk.JdPay;
|
import com.hzs.third.pay.jdpay.sdk.JdPay;
|
||||||
import com.hzs.third.pay.jdpay.sdk.JdPayNewConfig;
|
import com.hzs.third.pay.jdpay.sdk.JdPayNewConfig;
|
||||||
import com.hzs.third.pay.jdpay.sdk.JdPayDefaultNewConfig;
|
import com.hzs.third.pay.jdpay.sdk.JdPayDefaultNewConfig;
|
||||||
import com.hzs.third.pay.jdpay.util.FileUtil;
|
import com.hzs.third.pay.jdpay.util.FileUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -15,30 +18,50 @@ import org.springframework.context.annotation.Configuration;
|
||||||
*************************************************/
|
*************************************************/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class JdPayAutoConfiguration {
|
public class JdPayAutoConfiguration {
|
||||||
|
@Autowired
|
||||||
|
private JdPayBankProperties jdPayBankProperties;
|
||||||
|
@Autowired
|
||||||
|
private JdPayWechatAlipayProperties jdPayWechatAlipayProperties;
|
||||||
|
|
||||||
@Value("${jd.pay.merchantNo}")
|
|
||||||
private String merchantNo;
|
|
||||||
@Value("${jd.pay.signKey}")
|
|
||||||
private String signKey;
|
|
||||||
@Value("${jd.pay.priCertPwd}")
|
|
||||||
private String priCertPwd;
|
|
||||||
@Value("${jd.pay.priCert}")
|
|
||||||
private String priCert;
|
|
||||||
@Value("${jd.pay.pubCert}")
|
|
||||||
private String pubCert;
|
|
||||||
@Value("${jd.pay.apiDomain}")
|
|
||||||
private String apiDomain;
|
|
||||||
|
|
||||||
@Bean(name = "jdPay")
|
|
||||||
public JdPay initJddPay() {
|
@Bean(name = "jdPayBank")
|
||||||
|
public JdPay initJdBankPay() {
|
||||||
// 加载商户私钥证书
|
// 加载商户私钥证书
|
||||||
byte[] privateCert = FileUtil.readFile(priCert);
|
// byte[] privateCert = FileUtil.readFile(priCert);
|
||||||
|
byte[] privateCert = FileUtil.readFile(jdPayBankProperties.getPriCert());
|
||||||
// 加载商户公钥证书
|
// 加载商户公钥证书
|
||||||
byte[] publicCert = FileUtil.readFile(pubCert);
|
// byte[] publicCert = FileUtil.readFile(pubCert);
|
||||||
|
byte[] publicCert = FileUtil.readFile(jdPayBankProperties.getPubCert());
|
||||||
// 检查商户证书
|
// 检查商户证书
|
||||||
checkCert(privateCert, publicCert);
|
checkCert(privateCert, publicCert);
|
||||||
// 初始化京东支付配置对象
|
// 初始化京东支付配置对象
|
||||||
JdPayNewConfig myConfig = new JdPayDefaultNewConfig(merchantNo, signKey, privateCert, priCertPwd, publicCert, apiDomain);
|
// JdPayNewConfig myConfig = new JdPayDefaultNewConfig(merchantNo, signKey, privateCert, priCertPwd, publicCert, apiDomain);
|
||||||
|
JdPayNewConfig myConfig = new JdPayDefaultNewConfig(jdPayBankProperties.getMerchantNo()
|
||||||
|
, jdPayBankProperties.getSignKey()
|
||||||
|
, privateCert
|
||||||
|
, jdPayBankProperties.getPriCertPwd()
|
||||||
|
, publicCert
|
||||||
|
, jdPayBankProperties.getApiDomain());
|
||||||
|
return new JdPay(myConfig);
|
||||||
|
}@Bean(name = "jdPayWechatAli")
|
||||||
|
public JdPay initJdWechatAliPay() {
|
||||||
|
// 加载商户私钥证书
|
||||||
|
// byte[] privateCert = FileUtil.readFile(priCert);
|
||||||
|
byte[] privateCert = FileUtil.readFile(jdPayWechatAlipayProperties.getPriCert());
|
||||||
|
// 加载商户公钥证书
|
||||||
|
// byte[] publicCert = FileUtil.readFile(pubCert);
|
||||||
|
byte[] publicCert = FileUtil.readFile(jdPayWechatAlipayProperties.getPubCert());
|
||||||
|
// 检查商户证书
|
||||||
|
checkCert(privateCert, publicCert);
|
||||||
|
// 初始化京东支付配置对象
|
||||||
|
// JdPayNewConfig myConfig = new JdPayDefaultNewConfig(merchantNo, signKey, privateCert, priCertPwd, publicCert, apiDomain);
|
||||||
|
JdPayNewConfig myConfig = new JdPayDefaultNewConfig(jdPayWechatAlipayProperties.getMerchantNo()
|
||||||
|
, jdPayWechatAlipayProperties.getSignKey()
|
||||||
|
, privateCert
|
||||||
|
, jdPayWechatAlipayProperties.getPriCertPwd()
|
||||||
|
, publicCert
|
||||||
|
, jdPayWechatAlipayProperties.getApiDomain());
|
||||||
return new JdPay(myConfig);
|
return new JdPay(myConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账业务字段
|
||||||
|
*/
|
||||||
|
public class JdPayDivisionAccount implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String version = "v2";
|
||||||
|
// private String version;
|
||||||
|
/**
|
||||||
|
* 分账交易信息
|
||||||
|
*/
|
||||||
|
private List<JdPayDivisionAccountTradeInfo> divisionAccountTradeInfoList;
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JdPayDivisionAccountTradeInfo> getDivisionAccountTradeInfoList() {
|
||||||
|
return divisionAccountTradeInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDivisionAccountTradeInfoList(List<JdPayDivisionAccountTradeInfo> divisionAccountTradeInfoList) {
|
||||||
|
this.divisionAccountTradeInfoList = divisionAccountTradeInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{\"JdPayDivisionAccount\":{"
|
||||||
|
+ "\"version\":\"" + version + "\""
|
||||||
|
+ ", \"divisionAccountTradeInfoList\":" + divisionAccountTradeInfoList
|
||||||
|
+ "}}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账业务字段
|
||||||
|
* @author liulian115
|
||||||
|
*/
|
||||||
|
public class JdPayDivisionAccountRefund implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String version="V2";
|
||||||
|
/**
|
||||||
|
* 分账交易信息
|
||||||
|
* @see JdPayDivisionAccountRefundInfo
|
||||||
|
*/
|
||||||
|
private List<JdPayDivisionAccountRefundInfo> divisionAccountRefundInfoList;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{\"JdPayDivisionAccountRefund\":{"
|
||||||
|
+ "\"version\":\"" + version + "\""
|
||||||
|
+ ", \"divisionAccountRefundInfoList\":" + divisionAccountRefundInfoList
|
||||||
|
+ "}}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JdPayDivisionAccountRefundInfo> getDivisionAccountRefundInfoList() {
|
||||||
|
return divisionAccountRefundInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDivisionAccountRefundInfoList(List<JdPayDivisionAccountRefundInfo> divisionAccountRefundInfoList) {
|
||||||
|
this.divisionAccountRefundInfoList = divisionAccountRefundInfoList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账交易信息
|
||||||
|
*/
|
||||||
|
public class JdPayDivisionAccountRefundInfo implements Serializable {
|
||||||
|
/**
|
||||||
|
* 分账子商户号
|
||||||
|
*/
|
||||||
|
private String merchantNo;
|
||||||
|
/**
|
||||||
|
* 分账子商户订单号
|
||||||
|
*/
|
||||||
|
private String outTradeNo;
|
||||||
|
/**
|
||||||
|
* 分账子商户业务单号
|
||||||
|
*/
|
||||||
|
private String bizTradeNo;
|
||||||
|
/**
|
||||||
|
* 分账子单金额
|
||||||
|
*/
|
||||||
|
private String tradeAmount;
|
||||||
|
/**
|
||||||
|
* 原商户订单号
|
||||||
|
*/
|
||||||
|
private String originalOutTradeNo;
|
||||||
|
|
||||||
|
public String getOriginalOutTradeNo() {
|
||||||
|
return originalOutTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalOutTradeNo(String originalOutTradeNo) {
|
||||||
|
this.originalOutTradeNo = originalOutTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantNo() {
|
||||||
|
return merchantNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantNo(String merchantNo) {
|
||||||
|
this.merchantNo = merchantNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutTradeNo() {
|
||||||
|
return outTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutTradeNo(String outTradeNo) {
|
||||||
|
this.outTradeNo = outTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBizTradeNo() {
|
||||||
|
return bizTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBizTradeNo(String bizTradeNo) {
|
||||||
|
this.bizTradeNo = bizTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTradeAmount() {
|
||||||
|
return tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTradeAmount(String tradeAmount) {
|
||||||
|
this.tradeAmount = tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{\"JdPayDivisionAccountRefundInfo\":{"
|
||||||
|
+ "\"merchantNo\":\"" + merchantNo + "\""
|
||||||
|
+ ", \"outTradeNo\":\"" + outTradeNo + "\""
|
||||||
|
+ ", \"bizTradeNo\":\"" + bizTradeNo + "\""
|
||||||
|
+ ", \"tradeAmount\":\"" + tradeAmount + "\""
|
||||||
|
+ ", \"originalOutTradeNo\":\"" + originalOutTradeNo + "\""
|
||||||
|
+ "}}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账交易信息
|
||||||
|
*/
|
||||||
|
public class JdPayDivisionAccountTradeInfo implements Serializable {
|
||||||
|
/**
|
||||||
|
* 分账子商户号
|
||||||
|
*/
|
||||||
|
private String merchantNo;
|
||||||
|
/**
|
||||||
|
* 分账子商户订单号
|
||||||
|
*/
|
||||||
|
private String outTradeNo;
|
||||||
|
/**
|
||||||
|
* 分账子商户业务单号
|
||||||
|
*/
|
||||||
|
private String bizTradeNo;
|
||||||
|
/**
|
||||||
|
* 分账子单金额
|
||||||
|
*/
|
||||||
|
private String tradeAmount;
|
||||||
|
|
||||||
|
public String getMerchantNo() {
|
||||||
|
return merchantNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantNo(String merchantNo) {
|
||||||
|
this.merchantNo = merchantNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutTradeNo() {
|
||||||
|
return outTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutTradeNo(String outTradeNo) {
|
||||||
|
this.outTradeNo = outTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBizTradeNo() {
|
||||||
|
return bizTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBizTradeNo(String bizTradeNo) {
|
||||||
|
this.bizTradeNo = bizTradeNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTradeAmount() {
|
||||||
|
return tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTradeAmount(String tradeAmount) {
|
||||||
|
this.tradeAmount = tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{\"JdPayDivisionAccountTradeInfo\":{"
|
||||||
|
+ "\"merchantNo\":\"" + merchantNo + "\""
|
||||||
|
+ ", \"outTradeNo\":\"" + outTradeNo + "\""
|
||||||
|
+ ", \"bizTradeNo\":\"" + bizTradeNo + "\""
|
||||||
|
+ ", \"tradeAmount\":\"" + tradeAmount + "\""
|
||||||
|
+ "}}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class JdPayQueryEnterpriseWalletBalanceRequest implements Serializable {
|
||||||
|
private String accountNo;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.hzs.third.pay.jdpay.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class JdPayQueryEnterpriseWalletBalanceResponse implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务结果
|
||||||
|
*/
|
||||||
|
private String resultCode;
|
||||||
|
/**
|
||||||
|
* 响应描述
|
||||||
|
*/
|
||||||
|
private String resultDesc;
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
package com.hzs.third.pay.jdpay.sdk;
|
package com.hzs.third.pay.jdpay.sdk;
|
||||||
|
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayAggregateCreateOrderRequest;
|
import com.hzs.third.pay.jdpay.dto.*;
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayAggregateCreateOrderResponse;
|
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayRefundRequest;
|
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayRefundResponse;
|
|
||||||
import com.hzs.third.pay.jdpay.util.GsonUtil;
|
import com.hzs.third.pay.jdpay.util.GsonUtil;
|
||||||
import com.hzs.third.pay.jdpay.util.JdPayApiUtil;
|
import com.hzs.third.pay.jdpay.util.JdPayApiUtil;
|
||||||
import com.hzs.third.pay.jdpay.util.SignUtil;
|
import com.hzs.third.pay.jdpay.util.SignUtil;
|
||||||
|
@ -172,4 +169,9 @@ public class JdPay {
|
||||||
// public JdPayAgreementSignApplyResponse agreementSignApply(JdPayAgreementSignApplyRequest request) throws Exception{
|
// public JdPayAgreementSignApplyResponse agreementSignApply(JdPayAgreementSignApplyRequest request) throws Exception{
|
||||||
// return this.baseExecute(JdPayConstant.AGREEMENT_SIGN_APPLY_URL, request, JdPayAgreementSignApplyResponse.class);
|
// return this.baseExecute(JdPayConstant.AGREEMENT_SIGN_APPLY_URL, request, JdPayAgreementSignApplyResponse.class);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public JdPayQueryEnterpriseWalletBalanceResponse queryEnterpriseWalletBalance(JdPayQueryEnterpriseWalletBalanceRequest request) throws Exception{
|
||||||
|
return this.baseExecute(JdPayConstant.QUERY_ENTERPRISE_WALLET_BALANCE_URL, request, JdPayQueryEnterpriseWalletBalanceResponse.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class JdPayConstant {
|
||||||
* 账户签约
|
* 账户签约
|
||||||
*/
|
*/
|
||||||
public static final String AGREEMENT_SIGN_APPLY_URL = "/api/agreementSignApply";
|
public static final String AGREEMENT_SIGN_APPLY_URL = "/api/agreementSignApply";
|
||||||
|
public static final String QUERY_ENTERPRISE_WALLET_BALANCE_URL = "/api/queryEnterpriseWalletBalance";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机字符常量
|
* 随机字符常量
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.hzs.third.pay.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -12,5 +13,5 @@ import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
* @since 2025-07-01
|
* @since 2025-07-01
|
||||||
*/
|
*/
|
||||||
public interface TOnlinePaymentSepAccMapper extends BaseMapper<TOnlinePaymentSepAcc> {
|
public interface TOnlinePaymentSepAccMapper extends BaseMapper<TOnlinePaymentSepAcc> {
|
||||||
|
TOnlinePaymentSepAcc getSepAccByOrderCode(@Param("orderCode") String orderCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzs.third.pay.param;
|
package com.hzs.third.pay.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,4 +37,8 @@ public class PayParam {
|
||||||
*/
|
*/
|
||||||
private Integer appletFlag;
|
private Integer appletFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付-前端回调页面的扩展参数
|
||||||
|
*/
|
||||||
|
private String extParam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.hzs.third.pay.provider;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.hzs.common.core.domain.R;
|
||||||
|
import com.hzs.common.core.enums.EPayChannel;
|
||||||
|
import com.hzs.common.core.exception.ServiceException;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
|
import com.hzs.third.pay.ITOnlinePaymentServiceApi;
|
||||||
|
import com.hzs.third.pay.service.IRefundService;
|
||||||
|
import com.hzs.third.pay.service.ITOnlinePaymentService;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@DubboService
|
||||||
|
public class ITOnlinePaymentServiceProvider implements ITOnlinePaymentServiceApi {
|
||||||
|
@Autowired
|
||||||
|
private ITOnlinePaymentService itOnlinePaymentService;
|
||||||
|
@Autowired
|
||||||
|
private IRefundService iRefundService;
|
||||||
|
@Override
|
||||||
|
public R<TOnlinePayment> getOnlinePayment(String orderNo) {
|
||||||
|
LambdaQueryWrapper<TOnlinePayment> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(TOnlinePayment::getBusinessCode, orderNo);
|
||||||
|
return R.ok(itOnlinePaymentService.getOne(queryWrapper, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<String> refund(String orderNo, Long userId) {
|
||||||
|
LambdaQueryWrapper<TOnlinePayment> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(TOnlinePayment::getBusinessCode, orderNo);
|
||||||
|
TOnlinePayment tOnlinePayment = itOnlinePaymentService.getOne(queryWrapper, false);
|
||||||
|
if(ObjectUtil.isNotEmpty(tOnlinePayment)){
|
||||||
|
if (Objects.requireNonNull(EPayChannel.getEnumByValue(tOnlinePayment.getPayChannel())) == EPayChannel.JD) {
|
||||||
|
return R.ok(iRefundService.jdRefundDivision(orderNo, userId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.fail();
|
||||||
|
}
|
||||||
|
}
|
|
@ -63,4 +63,6 @@ public interface IRefundService {
|
||||||
*/
|
*/
|
||||||
String jdCashRefundHandle(RefundDTO refundDTO, TOnlinePayment tOnlinePayment);
|
String jdCashRefundHandle(RefundDTO refundDTO, TOnlinePayment tOnlinePayment);
|
||||||
|
|
||||||
|
String jdRefundDivision(String orderCode, Long userId);
|
||||||
|
String jdQueryEnterpriseWalletBalance();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,6 @@ import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
*/
|
*/
|
||||||
public interface ITOnlinePaymentSepAccService extends IService<TOnlinePaymentSepAcc> {
|
public interface ITOnlinePaymentSepAccService extends IService<TOnlinePaymentSepAcc> {
|
||||||
void saveOrUpdateReq(TOnlinePaymentSepAcc tOnlinePaymentSepAcc);
|
void saveOrUpdateReq(TOnlinePaymentSepAcc tOnlinePaymentSepAcc);
|
||||||
|
|
||||||
|
TOnlinePaymentSepAcc getSepAccByOrderCode(String code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ import com.hzs.common.domain.third.pay.TOnlineCard;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD;
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD;
|
||||||
|
import com.hzs.third.pay.config.JdPayBankProperties;
|
||||||
import com.hzs.third.pay.config.JdPayConfig;
|
import com.hzs.third.pay.config.JdPayConfig;
|
||||||
import com.hzs.third.pay.config.JdPayProperties;
|
|
||||||
import com.hzs.third.pay.config.JdPaySeparateAccountConfig;
|
import com.hzs.third.pay.config.JdPaySeparateAccountConfig;
|
||||||
|
import com.hzs.third.pay.config.JdPayWechatAlipayProperties;
|
||||||
import com.hzs.third.pay.constants.JdPayConstants;
|
import com.hzs.third.pay.constants.JdPayConstants;
|
||||||
import com.hzs.third.pay.constants.PayRedisConstants;
|
import com.hzs.third.pay.constants.PayRedisConstants;
|
||||||
import com.hzs.third.pay.dto.jd.JdFastDTO;
|
import com.hzs.third.pay.dto.jd.JdFastDTO;
|
||||||
|
@ -59,10 +60,10 @@ public class JdPayServiceImpl implements IJdPayService {
|
||||||
private JdPayConfig jdPayConfig;
|
private JdPayConfig jdPayConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ITOnlineCardService itOnlineCardService;
|
private ITOnlineCardService itOnlineCardService;
|
||||||
@Resource
|
@Resource(name = "jdPayBank")
|
||||||
private JdPay jdPay;
|
private JdPay jdPay;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdPayProperties jdPayProperties;
|
private JdPayBankProperties jdPayBankProperties;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate redisTemplate;
|
private RedisTemplate redisTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -71,16 +72,8 @@ public class JdPayServiceImpl implements IJdPayService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ITOnlinePaymentService itOnlinePaymentService;
|
private ITOnlinePaymentService itOnlinePaymentService;
|
||||||
|
|
||||||
/**
|
@Resource
|
||||||
* 页面回调地址
|
private JdPayWechatAlipayProperties jdPayWechatAlipayProperties;
|
||||||
*/
|
|
||||||
@Value("${jd.pay.pageBackUrl}")
|
|
||||||
private String pageBackUrl;
|
|
||||||
/**
|
|
||||||
* 支付回调地址
|
|
||||||
*/
|
|
||||||
@Value("${jd.pay.notifyUrl}")
|
|
||||||
private String notifyUrl;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -248,15 +241,54 @@ public class JdPayServiceImpl implements IJdPayService {
|
||||||
// 用户标识(收银台必传)
|
// 用户标识(收银台必传)
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
// 同步通知URL(收银台必传,页面回调地址)
|
// 同步通知URL(收银台必传,页面回调地址)
|
||||||
.pageBackUrl(this.pageBackUrl)
|
.pageBackUrl(jdPayWechatAlipayProperties.getPageBackUrl() + "?extParam=" + onlinePayment.getExtParam())
|
||||||
// 支付回调地址
|
// 支付回调地址
|
||||||
.notifyUrl(this.notifyUrl)
|
.notifyUrl(jdPayWechatAlipayProperties.getNotifyUrl())
|
||||||
// 交易类型
|
// 交易类型
|
||||||
.tradeType(tradeType)
|
.tradeType(tradeType)
|
||||||
// 交易场景(ONLINE_APP:线上移动端 ONLINE_PC:线上PC)
|
// 交易场景(ONLINE_APP:线上移动端 ONLINE_PC:线上PC)
|
||||||
.sceneType(sceneType)
|
.sceneType(sceneType)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
JdPayDivisionAccount divisionAccount = new JdPayDivisionAccount();
|
||||||
|
List<JdPayDivisionAccountTradeInfo> divisionAccountTradeInfoList = new ArrayList<JdPayDivisionAccountTradeInfo>();
|
||||||
|
List<TOnlinePaymentSepAccD> sepAccDList = new ArrayList<>();
|
||||||
|
if(ObjectUtil.isNotEmpty(jdPayBankProperties)){
|
||||||
|
List<JdPaySeparateAccountConfig> separateAccounts = jdPayBankProperties.getSeparateAccounts();
|
||||||
|
if(ObjectUtil.isNotEmpty(separateAccounts)){
|
||||||
|
BigDecimal tradeAmount = onlinePayment.getPayMoney();
|
||||||
|
BigDecimal remaining = onlinePayment.getPayMoney();
|
||||||
|
for (int i = 0; i < separateAccounts.size(); i++) {
|
||||||
|
JdPaySeparateAccountConfig separateAccount = separateAccounts.get(i);
|
||||||
|
BigDecimal subTradeAmount;
|
||||||
|
if(i == separateAccounts.size() - 1){
|
||||||
|
subTradeAmount = remaining;
|
||||||
|
}else{
|
||||||
|
subTradeAmount = tradeAmount.subtract(tradeAmount.multiply(separateAccount.getProportion().setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||||
|
remaining = remaining.subtract(subTradeAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
}
|
||||||
|
JdPayDivisionAccountTradeInfo divisionAccountTradeInfo = new JdPayDivisionAccountTradeInfo();
|
||||||
|
divisionAccountTradeInfo.setMerchantNo(separateAccount.getAccount());
|
||||||
|
divisionAccountTradeInfo.setOutTradeNo(onlinePayment.getBusinessCode() + "_" + (i + 1));
|
||||||
|
divisionAccountTradeInfo.setTradeAmount(subTradeAmount.multiply(new BigDecimal(100)).intValue() + "");
|
||||||
|
divisionAccountTradeInfoList.add(divisionAccountTradeInfo);
|
||||||
|
sepAccDList.add(
|
||||||
|
TOnlinePaymentSepAccD.builder()
|
||||||
|
.account(separateAccount.getAccount())
|
||||||
|
.proportion(separateAccount.getProportion())
|
||||||
|
.tradeAmount(subTradeAmount)
|
||||||
|
.outTradeNo(divisionAccountTradeInfo.getOutTradeNo())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
divisionAccount.setVersion( "V2" );
|
||||||
|
divisionAccount.setDivisionAccountTradeInfoList(divisionAccountTradeInfoList);
|
||||||
|
request.setDivisionAccount(GsonUtil.toJson(divisionAccount));
|
||||||
|
|
||||||
// 请求京东支付接口
|
// 请求京东支付接口
|
||||||
JdPayAggregateCreateOrderResponse response = jdPay.aggregateCreateOrder(request);
|
JdPayAggregateCreateOrderResponse response = jdPay.aggregateCreateOrder(request);
|
||||||
TOnlinePaymentSepAcc sepAcc = TOnlinePaymentSepAcc.builder()
|
TOnlinePaymentSepAcc sepAcc = TOnlinePaymentSepAcc.builder()
|
||||||
|
@ -266,6 +298,7 @@ public class JdPayServiceImpl implements IJdPayService {
|
||||||
.version(divisionAccount.getVersion())
|
.version(divisionAccount.getVersion())
|
||||||
.respContent(JSONUtil.toJsonStr(response))
|
.respContent(JSONUtil.toJsonStr(response))
|
||||||
.tradeAmount(onlinePayment.getPayMoney())
|
.tradeAmount(onlinePayment.getPayMoney())
|
||||||
|
.outTradeNo(request.getOutTradeNo())
|
||||||
.build();
|
.build();
|
||||||
if ("0000".equals(response.getResultCode())) {
|
if ("0000".equals(response.getResultCode())) {
|
||||||
// 请求响应成功
|
// 请求响应成功
|
||||||
|
|
|
@ -1,32 +1,38 @@
|
||||||
package com.hzs.third.pay.service.impl;
|
package com.hzs.third.pay.service.impl;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.hzs.common.core.domain.R;
|
import com.hzs.common.core.domain.R;
|
||||||
import com.hzs.common.core.enums.*;
|
import com.hzs.common.core.enums.*;
|
||||||
import com.hzs.common.core.utils.*;
|
import com.hzs.common.core.utils.CommonUtil;
|
||||||
|
import com.hzs.common.core.utils.DateUtils;
|
||||||
|
import com.hzs.common.core.utils.StringUtils;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
import com.hzs.common.domain.third.pay.TOnlinePayment;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD;
|
||||||
import com.hzs.common.domain.third.pay.TOnlineRefund;
|
import com.hzs.common.domain.third.pay.TOnlineRefund;
|
||||||
import com.hzs.common.domain.third.pay.ext.TOnlineRefundExt;
|
import com.hzs.common.domain.third.pay.ext.TOnlineRefundExt;
|
||||||
import com.hzs.sale.refund.ISaRefundServiceApi;
|
import com.hzs.sale.refund.ISaRefundServiceApi;
|
||||||
import com.hzs.third.pay.config.*;
|
import com.hzs.third.pay.config.AllInPayConfig;
|
||||||
import com.hzs.third.pay.constants.*;
|
import com.hzs.third.pay.config.JdPayConfig;
|
||||||
|
import com.hzs.third.pay.config.JdPayWechatAlipayProperties;
|
||||||
|
import com.hzs.third.pay.constants.AllInPayConstants;
|
||||||
|
import com.hzs.third.pay.constants.JdPayConstants;
|
||||||
import com.hzs.third.pay.dto.RefundDTO;
|
import com.hzs.third.pay.dto.RefundDTO;
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayRefundRequest;
|
import com.hzs.third.pay.jdpay.dto.*;
|
||||||
import com.hzs.third.pay.jdpay.dto.JdPayRefundResponse;
|
|
||||||
import com.hzs.third.pay.jdpay.sdk.JdPay;
|
import com.hzs.third.pay.jdpay.sdk.JdPay;
|
||||||
import com.hzs.third.pay.service.IAllInPayService;
|
import com.hzs.third.pay.jdpay.util.GsonUtil;
|
||||||
import com.hzs.third.pay.service.IRefundService;
|
import com.hzs.third.pay.service.*;
|
||||||
import com.hzs.third.pay.service.ITOnlineRefundService;
|
|
||||||
import com.hzs.third.pay.util.JdPayUtil;
|
import com.hzs.third.pay.util.JdPayUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,11 +53,18 @@ public class RefundServiceImpl implements IRefundService {
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
ISaRefundServiceApi iSaRefundServiceApi;
|
ISaRefundServiceApi iSaRefundServiceApi;
|
||||||
@Value("${jd.pay.refundNotifyUrl}")
|
|
||||||
private String refundNotifyUrl;
|
|
||||||
|
|
||||||
@Resource
|
@Resource(name = "jdPayBank")
|
||||||
private JdPay jdPay;
|
private JdPay jdPay;
|
||||||
|
@Resource
|
||||||
|
private JdPayWechatAlipayProperties jdPayWechatAlipayProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITOnlinePaymentService itOnlinePaymentService;
|
||||||
|
@Autowired
|
||||||
|
private ITOnlinePaymentSepAccService sepAccService;
|
||||||
|
@Autowired
|
||||||
|
private ITOnlinePaymentSepAccDService sepAccDService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -232,19 +245,19 @@ public class RefundServiceImpl implements IRefundService {
|
||||||
// 服务调用返回信息
|
// 服务调用返回信息
|
||||||
String resultMsg = "";
|
String resultMsg = "";
|
||||||
// 根据业务类型调用具体业务处理 dubbo 服务
|
// 根据业务类型调用具体业务处理 dubbo 服务
|
||||||
switch (businessType) {
|
// switch (businessType) {
|
||||||
case DIRECT_SELLING:
|
// case DIRECT_SELLING:
|
||||||
// 直销订单
|
// // 直销订单
|
||||||
R<String> saRefundR = iSaRefundServiceApi.onlinePayRefundCallback(onlineRefund.getPayBusinessCode(), onlineRefund.getBusinessCode(), onlineRefund.getRefundStatus(), onlineRefund.getErrorMsg());
|
// R<String> saRefundR = iSaRefundServiceApi.onlinePayRefundCallback(onlineRefund.getPayBusinessCode(), onlineRefund.getRefundCode(), onlineRefund.getRefundStatus(), onlineRefund.getErrorMsg());
|
||||||
if (saRefundR.isSuccess()) {
|
// if (saRefundR.isSuccess()) {
|
||||||
resultBool = true;
|
// resultBool = true;
|
||||||
} else {
|
// } else {
|
||||||
resultBool = false;
|
// resultBool = false;
|
||||||
resultMsg = saRefundR.getMsg();
|
// resultMsg = saRefundR.getMsg();
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (null != resultBool) {
|
if (null != resultBool) {
|
||||||
if (resultBool) {
|
if (resultBool) {
|
||||||
|
@ -363,7 +376,7 @@ public class RefundServiceImpl implements IRefundService {
|
||||||
// 货币种类
|
// 货币种类
|
||||||
.currency("CNY")
|
.currency("CNY")
|
||||||
// 退款回调地址
|
// 退款回调地址
|
||||||
.notifyUrl(this.refundNotifyUrl)
|
.notifyUrl(jdPayWechatAlipayProperties.getRefundNotifyUrl())
|
||||||
// 回传信息
|
// 回传信息
|
||||||
// .returnParams("")
|
// .returnParams("")
|
||||||
.build();
|
.build();
|
||||||
|
@ -397,4 +410,85 @@ public class RefundServiceImpl implements IRefundService {
|
||||||
return "退款异常,请重试";
|
return "退款异常,请重试";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String jdRefundDivision(String orderCode, Long userId) {
|
||||||
|
TOnlinePaymentSepAcc sepAcc = sepAccService.getSepAccByOrderCode(orderCode);
|
||||||
|
LambdaQueryWrapper<TOnlinePaymentSepAccD> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(TOnlinePaymentSepAccD::getPkSepAcc, sepAcc.getPkId());
|
||||||
|
queryWrapper.eq(TOnlinePaymentSepAccD::getDelFlag, EDelFlag.UN_DELETE.getValue());
|
||||||
|
queryWrapper.orderByAsc(TOnlinePaymentSepAccD::getPkId);
|
||||||
|
LambdaQueryWrapper<TOnlinePayment> paymentQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
paymentQueryWrapper.eq(TOnlinePayment::getBusinessCode, orderCode);
|
||||||
|
TOnlinePayment tOnlinePayment = itOnlinePaymentService.getOne(paymentQueryWrapper, false);
|
||||||
|
List<TOnlinePaymentSepAccD> sepAccDList = sepAccDService.list(queryWrapper);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
String now = sdf.format(new Date());
|
||||||
|
String refundCode = "R_" + orderCode;
|
||||||
|
JdPayRefundRequest request = JdPayRefundRequest.builder()
|
||||||
|
.outTradeNo("R_" + orderCode)
|
||||||
|
.originalOutTradeNo(orderCode)
|
||||||
|
.tradeAmount(sepAcc.getTradeAmount().multiply(new BigDecimal("100")).intValue() + "")
|
||||||
|
.currency("CNY")
|
||||||
|
.tradeDate(now)
|
||||||
|
.returnParams("")
|
||||||
|
.notifyUrl(jdPayWechatAlipayProperties.getRefundNotifyUrl())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
JdPayDivisionAccountRefund divisionAccountRefund = new JdPayDivisionAccountRefund();
|
||||||
|
List<JdPayDivisionAccountRefundInfo> divisionAccountTradeInfoList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < sepAccDList.size(); i++) {
|
||||||
|
TOnlinePaymentSepAccD sepAccD = sepAccDList.get(i);
|
||||||
|
JdPayDivisionAccountRefundInfo divisionAccountTradeInfo = new JdPayDivisionAccountRefundInfo();
|
||||||
|
divisionAccountTradeInfo.setMerchantNo(sepAccD.getAccount());
|
||||||
|
divisionAccountTradeInfo.setOutTradeNo("R_" + orderCode + "_" + ( i + 1 ));
|
||||||
|
divisionAccountTradeInfo.setOriginalOutTradeNo(sepAccD.getOutTradeNo());
|
||||||
|
divisionAccountTradeInfo.setTradeAmount(sepAccD.getTradeAmount().multiply(new BigDecimal("100")).intValue() + "");
|
||||||
|
divisionAccountTradeInfoList.add(divisionAccountTradeInfo);
|
||||||
|
}
|
||||||
|
divisionAccountRefund.setDivisionAccountRefundInfoList(divisionAccountTradeInfoList);
|
||||||
|
request.setDivisionAccountRefund(GsonUtil.toJson(divisionAccountRefund));
|
||||||
|
try {
|
||||||
|
JdPayRefundResponse response = jdPay.refund(request);
|
||||||
|
log.info("JdPayRefundResponse -> {}", JSONUtil.toJsonStr(response));
|
||||||
|
if ("0000".equals(response.getResultCode())) {
|
||||||
|
log.info("提交退款成功");
|
||||||
|
TOnlineRefund tOnlineRefund = new TOnlineRefund();
|
||||||
|
tOnlineRefund.setRefundCode(refundCode);
|
||||||
|
tOnlineRefund.setPkOnlinePayment(tOnlinePayment.getPkId());
|
||||||
|
tOnlineRefund.setBusinessCode(tOnlinePayment.getBusinessCode());
|
||||||
|
tOnlineRefund.setRefundMoney(tOnlinePayment.getPayMoney());
|
||||||
|
tOnlineRefund.setRefundChannel(tOnlinePayment.getPayChannel());
|
||||||
|
tOnlineRefund.setRefundNumber(response.getTradeNo());
|
||||||
|
tOnlineRefund.setPkCountry(1);
|
||||||
|
tOnlineRefund.setPkCreator(userId);
|
||||||
|
itOnlineRefundService.save(tOnlineRefund);
|
||||||
|
return "提交退款成功";
|
||||||
|
} else {
|
||||||
|
log.info("提交退款失败");
|
||||||
|
return "提交退款失败!["+response.getResultDesc()+"]";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "提交退款异常! ["+e.getMessage()+"]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String jdQueryEnterpriseWalletBalance() {
|
||||||
|
JdPayQueryEnterpriseWalletBalanceRequest request1 = JdPayQueryEnterpriseWalletBalanceRequest.builder()
|
||||||
|
.accountNo("153428607005")
|
||||||
|
.build();
|
||||||
|
JdPayQueryEnterpriseWalletBalanceRequest request2 = JdPayQueryEnterpriseWalletBalanceRequest.builder()
|
||||||
|
.accountNo("153428607007")
|
||||||
|
.build();
|
||||||
|
try {
|
||||||
|
JdPayQueryEnterpriseWalletBalanceResponse response1 = jdPay.queryEnterpriseWalletBalance(request1);
|
||||||
|
log.info("response1 -> {}", JSONUtil.toJsonStr(response1));
|
||||||
|
JdPayQueryEnterpriseWalletBalanceResponse response2 = jdPay.queryEnterpriseWalletBalance(request2);
|
||||||
|
log.info("response2 -> {}", JSONUtil.toJsonStr(response2));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.hzs.common.core.enums.EDelFlag;
|
||||||
import com.hzs.common.core.utils.DateUtils;
|
import com.hzs.common.core.utils.DateUtils;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc;
|
||||||
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD;
|
import com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD;
|
||||||
|
@ -38,9 +39,10 @@ public class TOnlinePaymentSepAccServiceImpl extends ServiceImpl<TOnlinePaymentS
|
||||||
tOnlinePaymentSepAcc.setCreationTime(DateUtils.currentDateTime());
|
tOnlinePaymentSepAcc.setCreationTime(DateUtils.currentDateTime());
|
||||||
tOnlinePaymentSepAcc.setPkCreator(SecurityUtils.getUserId());
|
tOnlinePaymentSepAcc.setPkCreator(SecurityUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
tOnlinePaymentSepAcc.setDelFlag(EDelFlag.UN_DELETE.getValue());
|
||||||
tOnlinePaymentSepAcc.setModifiedTime(DateUtils.currentDateTime());
|
tOnlinePaymentSepAcc.setModifiedTime(DateUtils.currentDateTime());
|
||||||
tOnlinePaymentSepAcc.setPkModified(SecurityUtils.getUserId());
|
tOnlinePaymentSepAcc.setPkModified(SecurityUtils.getUserId());
|
||||||
this.save(tOnlinePaymentSepAcc);
|
this.saveOrUpdate(tOnlinePaymentSepAcc);
|
||||||
LambdaQueryWrapper<TOnlinePaymentSepAccD> wrapperD = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<TOnlinePaymentSepAccD> wrapperD = new LambdaQueryWrapper<>();
|
||||||
wrapperD.eq(TOnlinePaymentSepAccD::getPkSepAcc, tOnlinePaymentSepAcc.getPkId());
|
wrapperD.eq(TOnlinePaymentSepAccD::getPkSepAcc, tOnlinePaymentSepAcc.getPkId());
|
||||||
itOnlinePaymentSepAccDService.remove(wrapperD);
|
itOnlinePaymentSepAccDService.remove(wrapperD);
|
||||||
|
@ -51,9 +53,15 @@ public class TOnlinePaymentSepAccServiceImpl extends ServiceImpl<TOnlinePaymentS
|
||||||
tOnlinePaymentSepAccD.setPkCreator(SecurityUtils.getUserId());
|
tOnlinePaymentSepAccD.setPkCreator(SecurityUtils.getUserId());
|
||||||
tOnlinePaymentSepAccD.setModifiedTime(DateUtils.currentDateTime());
|
tOnlinePaymentSepAccD.setModifiedTime(DateUtils.currentDateTime());
|
||||||
tOnlinePaymentSepAccD.setPkModified(SecurityUtils.getUserId());
|
tOnlinePaymentSepAccD.setPkModified(SecurityUtils.getUserId());
|
||||||
|
tOnlinePaymentSepAccD.setDelFlag(EDelFlag.UN_DELETE.getValue());
|
||||||
}
|
}
|
||||||
itOnlinePaymentSepAccDService.saveBatch(tOnlinePaymentSepAcc.getSepAccDList());
|
itOnlinePaymentSepAccDService.saveBatch(tOnlinePaymentSepAcc.getSepAccDList());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TOnlinePaymentSepAcc getSepAccByOrderCode(String code) {
|
||||||
|
return baseMapper.getSepAccByOrderCode(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ wechat:
|
||||||
|
|
||||||
## 京东收银台支付配置
|
## 京东收银台支付配置
|
||||||
jd:
|
jd:
|
||||||
pay:
|
bank:
|
||||||
## 二级商户号
|
## 二级商户号
|
||||||
merchantNo: 153428607005
|
merchantNo: 153428607005
|
||||||
## 签名密钥
|
## 签名密钥
|
||||||
|
@ -104,17 +104,17 @@ jd:
|
||||||
# pageBackUrl: https://t-app.beida666.com/prod-api/pay/jd/sync-notify
|
# pageBackUrl: https://t-app.beida666.com/prod-api/pay/jd/sync-notify
|
||||||
pageBackUrl: http://t-app.beida666.com/#/pages/pay/success
|
pageBackUrl: http://t-app.beida666.com/#/pages/pay/success
|
||||||
## 支付回调地址
|
## 支付回调地址
|
||||||
# notifyUrl: https://t-app.beida666.com/prod-api/pay/jd/trade-notify
|
notifyUrl: https://t-app.beida666.com/prod-api/pay/jd/trade-notify
|
||||||
notifyUrl: https://b747-218-57-66-5.ngrok-free.app/pay/jd/trade-notify
|
# notifyUrl: https://b747-218-57-66-5.ngrok-free.app/pay/jd/trade-notify
|
||||||
## 退款回调地下
|
## 退款回调地下
|
||||||
# refundNotifyUrl: https://t-app.beida666.com/prod-api/pay/jd-refund/trade-notify
|
refundNotifyUrl: https://t-app.beida666.com/prod-api/pay/jd-refund/trade-notify
|
||||||
refundNotifyUrl: https://b747-218-57-66-5.ngrok-free.app/pay/jd-refund/trade-notify
|
# refundNotifyUrl: https://b747-218-57-66-5.ngrok-free.app/pay/jd-refund/trade-notify
|
||||||
separateAccounts:
|
separateAccounts:
|
||||||
- account: 153428607007
|
- account: 153428607007
|
||||||
proportion: 0.5
|
proportion: 0.5
|
||||||
- account: 153428607005
|
- account: 153428607005
|
||||||
proportion: 0.5
|
proportion: 0.5
|
||||||
pay006:
|
wechat-alipay:
|
||||||
## 二级商户号
|
## 二级商户号
|
||||||
merchantNo: 153428607006
|
merchantNo: 153428607006
|
||||||
## 签名密钥
|
## 签名密钥
|
||||||
|
@ -141,7 +141,7 @@ jd:
|
||||||
proportion: 0.5
|
proportion: 0.5
|
||||||
- account: 153428607006
|
- account: 153428607006
|
||||||
proportion: 0.5
|
proportion: 0.5
|
||||||
pay004:
|
transfer-out:
|
||||||
## 二级商户号
|
## 二级商户号
|
||||||
merchantNo: 153428607004
|
merchantNo: 153428607004
|
||||||
## 签名密钥
|
## 签名密钥
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hzs.com.hzs.common.domain.mapper.TOnlinePaymentSepAccDMapper">
|
<mapper namespace="com.hzs.third.pay.mapper.TOnlinePaymentSepAccDMapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD">
|
<resultMap id="BaseResultMap" type="com.hzs.common.domain.third.pay.TOnlinePaymentSepAccD">
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
<result column="ACCOUNT" property="account" />
|
<result column="ACCOUNT" property="account" />
|
||||||
<result column="PROPORTION" property="proportion" />
|
<result column="PROPORTION" property="proportion" />
|
||||||
<result column="TRADE_AMOUNT" property="tradeAmount" />
|
<result column="TRADE_AMOUNT" property="tradeAmount" />
|
||||||
|
<result column="OUT_TRADE_NO" property="outTradeNo" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hzs.com.hzs.common.domain.mapper.TOnlinePaymentSepAccMapper">
|
<mapper namespace="com.hzs.third.pay.mapper.TOnlinePaymentSepAccMapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc">
|
<resultMap id="BaseResultMap" type="com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc">
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<result column="REQ_CONTENT_SEP_ACC" property="reqContentSepAcc" />
|
<result column="REQ_CONTENT_SEP_ACC" property="reqContentSepAcc" />
|
||||||
<result column="RESP_CONTENT" property="respContent" />
|
<result column="RESP_CONTENT" property="respContent" />
|
||||||
<result column="TRADE_AMOUNT" property="tradeAmount" />
|
<result column="TRADE_AMOUNT" property="tradeAmount" />
|
||||||
|
<result column="OUT_TRADE_NO" property="outTradeNo" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
|
@ -27,5 +28,8 @@
|
||||||
PK_MODIFIED,
|
PK_MODIFIED,
|
||||||
PK_ID, PK_PAYMENT, VERSION, REQ_CONTENT, REQ_CONTENT_SEP_ACC, RESP_CONTENT
|
PK_ID, PK_PAYMENT, VERSION, REQ_CONTENT, REQ_CONTENT_SEP_ACC, RESP_CONTENT
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getSepAccByOrderCode" resultType="com.hzs.common.domain.third.pay.TOnlinePaymentSepAcc">
|
||||||
|
select * from T_ONLINE_PAYMENT_SEP_ACC where pk_payment in (select pk_id from T_ONLINE_PAYMENT where BUSINESS_CODE = #{orderCode})
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -87,3 +87,13 @@ COMMENT ON COLUMN "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC"."TRADE_AMOUNT" IS '总金
|
||||||
ALTER TABLE "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"
|
ALTER TABLE "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"
|
||||||
ADD ("TRADE_AMOUNT" NUMBER(16,2));
|
ADD ("TRADE_AMOUNT" NUMBER(16,2));
|
||||||
COMMENT ON COLUMN "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"."TRADE_AMOUNT" IS '分账金额';
|
COMMENT ON COLUMN "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"."TRADE_AMOUNT" IS '分账金额';
|
||||||
|
|
||||||
|
ALTER TABLE "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC"
|
||||||
|
ADD ("OUT_TRADE_NO" VARCHAR2(255));
|
||||||
|
|
||||||
|
COMMENT ON COLUMN "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC"."OUT_TRADE_NO" IS '支付流水号';
|
||||||
|
|
||||||
|
ALTER TABLE "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"
|
||||||
|
ADD ("OUT_TRADE_NO" VARCHAR2(255));
|
||||||
|
|
||||||
|
COMMENT ON COLUMN "CLOUD_2"."T_ONLINE_PAYMENT_SEP_ACC_D"."OUT_TRADE_NO" IS '支付流水号';
|
||||||
|
|
Loading…
Reference in New Issue