Parcourir la source

fix cashout

release_toaliyun_real
zhengfangyuan il y a 3 ans
Parent
révision
4824e80756
8 fichiers modifiés avec 39 ajouts et 16 suppressions
  1. +3
    -1
      mallinkAdmin/src/main/resources/db/migration/V20220801000001_cashout.sql
  2. +5
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java
  3. +11
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxCashOutController.java
  4. +7
    -3
      mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java
  5. +4
    -1
      mallinkService/src/main/java/com/iformall/pay/WxPay.java
  6. +3
    -3
      mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java
  7. +2
    -2
      mallinkService/src/main/java/com/iformall/utils/MaUtil.java
  8. +4
    -3
      mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml

+ 3
- 1
mallinkAdmin/src/main/resources/db/migration/V20220801000001_cashout.sql Voir le fichier

@@ -99,5 +99,7 @@ alter table wx_cash_out_97 ADD COLUMN `real_name` varchar(32) COMMENT '实
alter table wx_cash_out_98 ADD COLUMN `real_name` varchar(32) COMMENT '实名姓名,超2000需实名'; alter table wx_cash_out_98 ADD COLUMN `real_name` varchar(32) COMMENT '实名姓名,超2000需实名';
alter table wx_cash_out_99 ADD COLUMN `real_name` varchar(32) COMMENT '实名姓名,超2000需实名'; alter table wx_cash_out_99 ADD COLUMN `real_name` varchar(32) COMMENT '实名姓名,超2000需实名';


alter table wx_pay_account change column private_cert_path private_cert_pem_path varchar(255);
alter table wx_pay_account add COLUMN `merchant_key_path` varchar(100) COMMENT '商户key证书路径'; alter table wx_pay_account add COLUMN `merchant_key_path` varchar(100) COMMENT '商户key证书路径';
alter table wx_pay_account add COLUMN `merchant_apiv3_key` varchar(100) COMMENT '商户apiV3Key';
alter table wx_pay_account add COLUMN `merchant_apiv3_key` varchar(100) COMMENT '商户apiV3Key';
alter table wx_pay_account add COLUMN `merchant_cert_pem_path` varchar(100) COMMENT '商户证书密钥文件';

+ 5
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java Voir le fichier

@@ -123,7 +123,6 @@ public class WxBillController extends BaseController {
map.put("businessType", EnumFlowKey.BILL_FINISH.getCode()); map.put("businessType", EnumFlowKey.BILL_FINISH.getCode());
//map.put("payMoney", wxBillAll.getNewPrice()); //map.put("payMoney", wxBillAll.getNewPrice());
map.put("businessId", wxBillAll.getId()); map.put("businessId", wxBillAll.getId());
map.put("payImg", wxBillAll.getPayImg());
List<Map> variablesList = new ArrayList<Map>(); List<Map> variablesList = new ArrayList<Map>();
Map billTypeMap = new HashMap<String,Object>(); Map billTypeMap = new HashMap<String,Object>();
billTypeMap.put("key","billType"); billTypeMap.put("key","billType");
@@ -145,6 +144,11 @@ public class WxBillController extends BaseController {
newPriceMap.put("value",wxBillAll.getNewPrice()); newPriceMap.put("value",wxBillAll.getNewPrice());
variablesList.add(newPriceMap); variablesList.add(newPriceMap);
Map payImgMap = new HashMap<String,Object>();
payImgMap.put("key","payImg");
payImgMap.put("value",wxBillAll.getPayImg());
variablesList.add(payImgMap);
map.put("variables", variablesList); map.put("variables", variablesList);
map.put("phone", buser.getPhone()); map.put("phone", buser.getPhone());
wxFlowService.start(map, buser.getId(), buser.getName(), this.getTenantInfo()); wxFlowService.start(map, buser.getId(), buser.getName(), this.getTenantInfo());


+ 11
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxCashOutController.java Voir le fichier

@@ -2,10 +2,12 @@ package com.iformall.controller;


import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.annotation.AuthIgnore;
import com.iformall.common.Result; import com.iformall.common.Result;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.po.base.BaseEntity.SortField; import com.iformall.domain.po.base.BaseEntity.SortField;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumCashOutStatus; import com.iformall.enums.EnumCashOutStatus;
import com.iformall.enums.EnumPayShare; import com.iformall.enums.EnumPayShare;
import com.iformall.enums.EnumPayWay; import com.iformall.enums.EnumPayWay;
@@ -165,7 +167,6 @@ public class WxCashOutController extends BaseController {
@ApiOperation("微信B端提现") @ApiOperation("微信B端提现")
@PostMapping("cashout") @PostMapping("cashout")
public ResultData cashout(@RequestBody WxCashOut wxCashOut) { public ResultData cashout(@RequestBody WxCashOut wxCashOut) {
logger.info(">>>cashout>>>"+JSON.toJSONString(wxCashOut));
WxMerchantBUser buser = getLoginBUser(); WxMerchantBUser buser = getLoginBUser();
CUser user = getCUser(); CUser user = getCUser();
WxMerchant merchant = wxMerchantService.getById(buser.getMerchantId()); WxMerchant merchant = wxMerchantService.getById(buser.getMerchantId());
@@ -201,5 +202,13 @@ public class WxCashOutController extends BaseController {
// WxMerchantBUser buser = getLoginBUser(); // WxMerchantBUser buser = getLoginBUser();
// return wxCashOutService.reCashout(buser, wxCashOut,EnumPayWay.PAY_WAY_WECHAT); // return wxCashOutService.reCashout(buser, wxCashOut,EnumPayWay.PAY_WAY_WECHAT);
// } // }

@AuthIgnore
@GetMapping("test")
public String test() {
TenantEntity te = new TenantEntity();
te.setTenantId("789");
wxCashOutService.cashOutToWx(EnumPayWay.PAY_WAY_WECHAT,te, 714465978943332352L);
return "ok";
}
} }

+ 7
- 3
mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java Voir le fichier

@@ -26,14 +26,18 @@ public class WxPayAccount extends TenantEntity {
private String notifyUrl; private String notifyUrl;
@io.swagger.annotations.ApiModelProperty(value="tt回调token",name="notifyToken") @io.swagger.annotations.ApiModelProperty(value="tt回调token",name="notifyToken")
private String notifyToken; private String notifyToken;
@io.swagger.annotations.ApiModelProperty(value="证书本地存放位置",name="certPath")
@io.swagger.annotations.ApiModelProperty(value="平台证书本地存放位置",name="certPath")
private String certPath; private String certPath;
@io.swagger.annotations.ApiModelProperty(value="商户自己的证书",name="merchantCertPath") @io.swagger.annotations.ApiModelProperty(value="商户自己的证书",name="merchantCertPath")
private String merchantCertPath; private String merchantCertPath;
@io.swagger.annotations.ApiModelProperty(value="商户自己的证书密钥文件",name="merchantCertPemPath")
private String merchantCertPemPath;
@io.swagger.annotations.ApiModelProperty(value="商户自己的密钥文件",name="merchantKeyPath") @io.swagger.annotations.ApiModelProperty(value="商户自己的密钥文件",name="merchantKeyPath")
private String merchantKeyPath; private String merchantKeyPath;
@io.swagger.annotations.ApiModelProperty(value="商户自己的apiv3密钥",name="merchantApiv3Key") @io.swagger.annotations.ApiModelProperty(value="商户自己的apiv3密钥",name="merchantApiv3Key")
private String merchantApiv3Key; private String merchantApiv3Key;
@io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type")
private Integer type; private Integer type;
@io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type") @io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type")
@@ -66,8 +70,8 @@ public class WxPayAccount extends TenantEntity {
private String certSerialNo; private String certSerialNo;
@io.swagger.annotations.ApiModelProperty(value="平台私钥文件",name="privateKeyPath") @io.swagger.annotations.ApiModelProperty(value="平台私钥文件",name="privateKeyPath")
private String privateKeyPath; private String privateKeyPath;
@io.swagger.annotations.ApiModelProperty(value="平台证书文件,同certPath",name="privateCertPath")
private String privateCertPath;
@io.swagger.annotations.ApiModelProperty(value="平台证书密钥文件",name="privateCertPemPath")
private String privateCertPemPath;


// @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat") // @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat")
// private Integer plat; // private Integer plat;


+ 4
- 1
mallinkService/src/main/java/com/iformall/pay/WxPay.java Voir le fichier

@@ -8,6 +8,7 @@ import java.util.Map;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;


import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.WxPayService;
@@ -270,7 +271,9 @@ public class WxPay {
X509Certificate certificate = payService.getConfig().getVerifier().getValidCertificate(); X509Certificate certificate = payService.getConfig().getVerifier().getValidCertificate();
List<WxCashOutPV3Item> items = cashOutV3.getTransfer_detail_list(); List<WxCashOutPV3Item> items = cashOutV3.getTransfer_detail_list();
for (WxCashOutPV3Item it : items) { for (WxCashOutPV3Item it : items) {
it.setUser_name(RsaCryptoUtil.encryptOAEP(it.getUser_name(), certificate));
if (!StringUtils.isBlank(it.getUser_name())) {
it.setUser_name(RsaCryptoUtil.encryptOAEP(it.getUser_name(), certificate));
}
} }
return payService.postV3WithWechatpaySerial(MERCHANT_TRANSFER_CHANGE_URL, JSON.toJSONString(cashOutV3)); return payService.postV3WithWechatpaySerial(MERCHANT_TRANSFER_CHANGE_URL, JSON.toJSONString(cashOutV3));
} }


+ 3
- 3
mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java Voir le fichier

@@ -214,7 +214,7 @@ public class WxCashOutAdapterService implements CashOutAdapterService{
return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "零钱支付失败。商户密钥ApiV3为空。请联系管理员配置。", null); return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "零钱支付失败。商户密钥ApiV3为空。请联系管理员配置。", null);
} }
WxPayService payService = maUtil.getWxPayService(appInfo,payAccount);
WxPayService payService = maUtil.getWxPayServiceBySelfModel(appInfo,payAccount);
if (null == payService) { if (null == payService) {
return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "零钱支付失败。当前小程序未查询到payService。", null); return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "零钱支付失败。当前小程序未查询到payService。", null);
} }
@@ -225,7 +225,7 @@ public class WxCashOutAdapterService implements CashOutAdapterService{
log.error("零钱支付异常: " + e.getMessage(),e); log.error("零钱支付异常: " + e.getMessage(),e);
return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "微信零钱支付接口调用异常."+e.getMessage(), null); return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "微信零钱支付接口调用异常."+e.getMessage(), null);
} }
//log.info("微信零钱支付:" + wxCashOutP.toString() +", response: " + response.toString());
log.info("微信零钱支付:, response: " + response.toString());
return generateResult(response,cashOut); return generateResult(response,cashOut);
// if (payAccount.getType() == EnumPayMode.MCH.getCode()) { // if (payAccount.getType() == EnumPayMode.MCH.getCode()) {
@@ -290,7 +290,7 @@ public class WxCashOutAdapterService implements CashOutAdapterService{
log.error("零钱支付查询异常: " + e.getMessage(),e); log.error("零钱支付查询异常: " + e.getMessage(),e);
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "微信零钱支付查询接口异常:"+e.getMessage()); throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "微信零钱支付查询接口异常:"+e.getMessage());
} }
//log.info("微信零钱支付查询:"+ response.toString());
log.info("微信零钱支付查询:"+ response.toString());
return getReusltFromQuery(response,cashOut); return getReusltFromQuery(response,cashOut);
} }


+ 2
- 2
mallinkService/src/main/java/com/iformall/utils/MaUtil.java Voir le fichier

@@ -117,7 +117,7 @@ public class MaUtil {
config.setSubMchId(payAccount.getSubMchId()); config.setSubMchId(payAccount.getSubMchId());
config.setKeyPath(payAccount.getCertPath()); config.setKeyPath(payAccount.getCertPath());
config.setPrivateKeyPath(payAccount.getPrivateKeyPath()); config.setPrivateKeyPath(payAccount.getPrivateKeyPath());
config.setPrivateCertPath(payAccount.getPrivateCertPath());
config.setPrivateCertPath(payAccount.getPrivateCertPemPath());
//config.setCertSerialNo(payAccount.getCertSerialNo()); //config.setCertSerialNo(payAccount.getCertSerialNo());
config.setApiV3Key(payAccount.getApiV3Key()); config.setApiV3Key(payAccount.getApiV3Key());
}else { }else {
@@ -128,7 +128,7 @@ public class MaUtil {
config.setSubMchId(payAccount.getSubMchId()); config.setSubMchId(payAccount.getSubMchId());
config.setKeyPath(payAccount.getMerchantKeyPath()); config.setKeyPath(payAccount.getMerchantKeyPath());
config.setPrivateKeyPath(payAccount.getMerchantKeyPath()); config.setPrivateKeyPath(payAccount.getMerchantKeyPath());
config.setPrivateCertPath(payAccount.getMerchantCertPath());
config.setPrivateCertPath(payAccount.getMerchantCertPemPath());
//config.setCertSerialNo(payAccount.getCertSerialNo()); //config.setCertSerialNo(payAccount.getCertSerialNo());
config.setApiV3Key(payAccount.getMerchantApiv3Key()); config.setApiV3Key(payAccount.getMerchantApiv3Key());
} }


+ 4
- 3
mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml Voir le fichier

@@ -17,6 +17,7 @@


<result column="cert_path" jdbcType="VARCHAR" property="certPath"/> <result column="cert_path" jdbcType="VARCHAR" property="certPath"/>
<result column="merchant_cert_path" jdbcType="VARCHAR" property="merchantCertPath"/> <result column="merchant_cert_path" jdbcType="VARCHAR" property="merchantCertPath"/>
<result column="merchant_cert_pem_path" jdbcType="VARCHAR" property="merchantCertPemPath"/>
<result column="type" jdbcType="INTEGER" property="type"/> <result column="type" jdbcType="INTEGER" property="type"/>
<result column="share" jdbcType="INTEGER" property="share"/> <result column="share" jdbcType="INTEGER" property="share"/>
<result column="rate" jdbcType="INTEGER" property="rate"/> <result column="rate" jdbcType="INTEGER" property="rate"/>
@@ -27,13 +28,13 @@
<result column="api_v3_key" jdbcType="VARCHAR" property="apiV3Key"/> <result column="api_v3_key" jdbcType="VARCHAR" property="apiV3Key"/>
<result column="cert_serial_no" jdbcType="VARCHAR" property="certSerialNo"/> <result column="cert_serial_no" jdbcType="VARCHAR" property="certSerialNo"/>
<result column="private_key_path" jdbcType="VARCHAR" property="privateKeyPath"/> <result column="private_key_path" jdbcType="VARCHAR" property="privateKeyPath"/>
<result column="private_cert_path" jdbcType="VARCHAR" property="privateCertPath"/>
<result column="private_cert_pem_path" jdbcType="VARCHAR" property="privateCertPemPath"/>
</resultMap> </resultMap>


<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`, `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`,
`merchant_cert_path`,`type`,`share`,`rate`,`real_rate`,
`service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_path`,`merchant_key_path`,`merchant_apiv3_key`
`merchant_cert_path`,`type`,`share`,`rate`,`real_rate`,`service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,
`private_cert_pem_path`,`merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path`
</sql> </sql>


<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">


Chargement…
Annuler
Enregistrer