提交代码

dev-discount
胡锐 3 years ago
parent 406b262178
commit abbdd56d40
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 272
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  3. 103
      hai-service/src/main/java/com/hai/config/UnionStagingPayConfig.java
  4. 7
      hai-service/src/main/resources/dev/commonConfig.properties

File diff suppressed because one or more lines are too long

@ -39,6 +39,14 @@ public class CommonSysConfig {
private String unionPayNotifyUrl;
private String unionPayTelNotifyUrl;
private String unionStagingPayUrl;
private String unionStagingPayOrgId;
private String unionStagingPayOrgMerCode;
private String unionStagingPayOrgTermNo;
private String unionStagingPaySignKey;
private String unionStagingPayNotifyUrl;
private String wx_cert;
private String telApiKey;
@ -47,52 +55,92 @@ public class CommonSysConfig {
private String telUrl;
private String czOrderNotify;
public String getUnionPayTelNotifyUrl() {
return unionPayTelNotifyUrl;
public String getTuanYouUrl() {
return tuanYouUrl;
}
public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) {
this.unionPayTelNotifyUrl = unionPayTelNotifyUrl;
public void setTuanYouUrl(String tuanYouUrl) {
this.tuanYouUrl = tuanYouUrl;
}
public String getUnionPayNotifyUrl() {
return unionPayNotifyUrl;
public String getTuanYouAppKey() {
return tuanYouAppKey;
}
public void setUnionPayNotifyUrl(String unionPayNotifyUrl) {
this.unionPayNotifyUrl = unionPayNotifyUrl;
public void setTuanYouAppKey(String tuanYouAppKey) {
this.tuanYouAppKey = tuanYouAppKey;
}
public String getHuiLianTongUnionCardUrl() {
return HuiLianTongUnionCardUrl;
public String getTuanYouAppSecret() {
return tuanYouAppSecret;
}
public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) {
HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl;
public void setTuanYouAppSecret(String tuanYouAppSecret) {
this.tuanYouAppSecret = tuanYouAppSecret;
}
public String getHuiLianTongUnionCardAccessCode() {
return HuiLianTongUnionCardAccessCode;
public String getTuanYouDieselAccount() {
return tuanYouDieselAccount;
}
public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) {
HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode;
public void setTuanYouDieselAccount(String tuanYouDieselAccount) {
this.tuanYouDieselAccount = tuanYouDieselAccount;
}
public String getHuiLianTongUnionCardSignCode() {
return HuiLianTongUnionCardSignCode;
public String getTuanYouGasolineAccount() {
return tuanYouGasolineAccount;
}
public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) {
HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode;
public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) {
this.tuanYouGasolineAccount = tuanYouGasolineAccount;
}
public String getHuiliantongAppNo() {
return huiliantongAppNo;
public String getQinzhuUrl() {
return qinzhuUrl;
}
public void setHuiliantongAppNo(String huiliantongAppNo) {
this.huiliantongAppNo = huiliantongAppNo;
public void setQinzhuUrl(String qinzhuUrl) {
this.qinzhuUrl = qinzhuUrl;
}
public String getQinzhuHtmlUrl() {
return qinzhuHtmlUrl;
}
public void setQinzhuHtmlUrl(String qinzhuHtmlUrl) {
this.qinzhuHtmlUrl = qinzhuHtmlUrl;
}
public String getQinzhuMobileUrl() {
return qinzhuMobileUrl;
}
public void setQinzhuMobileUrl(String qinzhuMobileUrl) {
this.qinzhuMobileUrl = qinzhuMobileUrl;
}
public String getQinzhuPlatformId() {
return qinzhuPlatformId;
}
public void setQinzhuPlatformId(String qinzhuPlatformId) {
this.qinzhuPlatformId = qinzhuPlatformId;
}
public String getQinzhuSecret() {
return qinzhuSecret;
}
public void setQinzhuSecret(String qinzhuSecret) {
this.qinzhuSecret = qinzhuSecret;
}
public String getQianzhuOrderNotify() {
return qianzhuOrderNotify;
}
public void setQianzhuOrderNotify(String qianzhuOrderNotify) {
this.qianzhuOrderNotify = qianzhuOrderNotify;
}
public String getHuiliantongUrl() {
@ -103,6 +151,14 @@ public class CommonSysConfig {
this.huiliantongUrl = huiliantongUrl;
}
public String getHuiliantongAppNo() {
return huiliantongAppNo;
}
public void setHuiliantongAppNo(String huiliantongAppNo) {
this.huiliantongAppNo = huiliantongAppNo;
}
public String getHuiliantongAppkey() {
return huiliantongAppkey;
}
@ -119,100 +175,132 @@ public class CommonSysConfig {
this.huiliantongAppsecret = huiliantongAppsecret;
}
public String getQinzhuHtmlUrl() {
return qinzhuHtmlUrl;
public String getHuiLianTongUnionCardUrl() {
return HuiLianTongUnionCardUrl;
}
public void setQinzhuHtmlUrl(String qinzhuHtmlUrl) {
this.qinzhuHtmlUrl = qinzhuHtmlUrl;
public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) {
HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl;
}
public String getCzOrderNotify() {
return czOrderNotify;
public String getHuiLianTongUnionCardAccessCode() {
return HuiLianTongUnionCardAccessCode;
}
public void setCzOrderNotify(String czOrderNotify) {
this.czOrderNotify = czOrderNotify;
public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) {
HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode;
}
public String getQinzhuMobileUrl() {
return qinzhuMobileUrl;
public String getHuiLianTongUnionCardSignCode() {
return HuiLianTongUnionCardSignCode;
}
public void setQinzhuMobileUrl(String qinzhuMobileUrl) {
this.qinzhuMobileUrl = qinzhuMobileUrl;
public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) {
HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode;
}
public String getQianzhuOrderNotify() {
return qianzhuOrderNotify;
public String getUnionPayUrl() {
return unionPayUrl;
}
public void setQianzhuOrderNotify(String qianzhuOrderNotify) {
this.qianzhuOrderNotify = qianzhuOrderNotify;
public void setUnionPayUrl(String unionPayUrl) {
this.unionPayUrl = unionPayUrl;
}
public String getTuanYouUrl() {
return tuanYouUrl;
public String getUnionPayChannelid() {
return unionPayChannelid;
}
public void setTuanYouUrl(String tuanYouUrl) {
this.tuanYouUrl = tuanYouUrl;
public void setUnionPayChannelid(String unionPayChannelid) {
this.unionPayChannelid = unionPayChannelid;
}
public String getTuanYouAppKey() {
return tuanYouAppKey;
public String getUnionPayMerid() {
return unionPayMerid;
}
public void setTuanYouAppKey(String tuanYouAppKey) {
this.tuanYouAppKey = tuanYouAppKey;
public void setUnionPayMerid(String unionPayMerid) {
this.unionPayMerid = unionPayMerid;
}
public String getTuanYouAppSecret() {
return tuanYouAppSecret;
public String getUnionPayTermid() {
return unionPayTermid;
}
public void setTuanYouAppSecret(String tuanYouAppSecret) {
this.tuanYouAppSecret = tuanYouAppSecret;
public void setUnionPayTermid(String unionPayTermid) {
this.unionPayTermid = unionPayTermid;
}
public String getTuanYouDieselAccount() {
return tuanYouDieselAccount;
public String getUnionPaySignKey() {
return unionPaySignKey;
}
public void setTuanYouDieselAccount(String tuanYouDieselAccount) {
this.tuanYouDieselAccount = tuanYouDieselAccount;
public void setUnionPaySignKey(String unionPaySignKey) {
this.unionPaySignKey = unionPaySignKey;
}
public String getTuanYouGasolineAccount() {
return tuanYouGasolineAccount;
public String getUnionPayNotifyUrl() {
return unionPayNotifyUrl;
}
public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) {
this.tuanYouGasolineAccount = tuanYouGasolineAccount;
public void setUnionPayNotifyUrl(String unionPayNotifyUrl) {
this.unionPayNotifyUrl = unionPayNotifyUrl;
}
public String getQinzhuUrl() {
return qinzhuUrl;
public String getUnionPayTelNotifyUrl() {
return unionPayTelNotifyUrl;
}
public void setQinzhuUrl(String qinzhuUrl) {
this.qinzhuUrl = qinzhuUrl;
public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) {
this.unionPayTelNotifyUrl = unionPayTelNotifyUrl;
}
public String getQinzhuPlatformId() {
return qinzhuPlatformId;
public String getUnionStagingPayUrl() {
return unionStagingPayUrl;
}
public void setQinzhuPlatformId(String qinzhuPlatformId) {
this.qinzhuPlatformId = qinzhuPlatformId;
public void setUnionStagingPayUrl(String unionStagingPayUrl) {
this.unionStagingPayUrl = unionStagingPayUrl;
}
public String getQinzhuSecret() {
return qinzhuSecret;
public String getUnionStagingPayOrgId() {
return unionStagingPayOrgId;
}
public void setQinzhuSecret(String qinzhuSecret) {
this.qinzhuSecret = qinzhuSecret;
public void setUnionStagingPayOrgId(String unionStagingPayOrgId) {
this.unionStagingPayOrgId = unionStagingPayOrgId;
}
public String getUnionStagingPayOrgMerCode() {
return unionStagingPayOrgMerCode;
}
public void setUnionStagingPayOrgMerCode(String unionStagingPayOrgMerCode) {
this.unionStagingPayOrgMerCode = unionStagingPayOrgMerCode;
}
public String getUnionStagingPayOrgTermNo() {
return unionStagingPayOrgTermNo;
}
public void setUnionStagingPayOrgTermNo(String unionStagingPayOrgTermNo) {
this.unionStagingPayOrgTermNo = unionStagingPayOrgTermNo;
}
public String getUnionStagingPaySignKey() {
return unionStagingPaySignKey;
}
public void setUnionStagingPaySignKey(String unionStagingPaySignKey) {
this.unionStagingPaySignKey = unionStagingPaySignKey;
}
public String getUnionStagingPayNotifyUrl() {
return unionStagingPayNotifyUrl;
}
public void setUnionStagingPayNotifyUrl(String unionStagingPayNotifyUrl) {
this.unionStagingPayNotifyUrl = unionStagingPayNotifyUrl;
}
public String getWx_cert() {
@ -255,43 +343,11 @@ public class CommonSysConfig {
this.telUrl = telUrl;
}
public String getUnionPayUrl() {
return unionPayUrl;
}
public void setUnionPayUrl(String unionPayUrl) {
this.unionPayUrl = unionPayUrl;
}
public String getUnionPayChannelid() {
return unionPayChannelid;
}
public void setUnionPayChannelid(String unionPayChannelid) {
this.unionPayChannelid = unionPayChannelid;
}
public String getUnionPayMerid() {
return unionPayMerid;
}
public void setUnionPayMerid(String unionPayMerid) {
this.unionPayMerid = unionPayMerid;
}
public String getUnionPayTermid() {
return unionPayTermid;
}
public void setUnionPayTermid(String unionPayTermid) {
this.unionPayTermid = unionPayTermid;
}
public String getUnionPaySignKey() {
return unionPaySignKey;
public String getCzOrderNotify() {
return czOrderNotify;
}
public void setUnionPaySignKey(String unionPaySignKey) {
this.unionPaySignKey = unionPaySignKey;
public void setCzOrderNotify(String czOrderNotify) {
this.czOrderNotify = czOrderNotify;
}
}

@ -0,0 +1,103 @@
package com.hai.config;
import com.alibaba.fastjson.JSONObject;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import org.apache.commons.codec.binary.Base64;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.*;
/**
* 银联分期
* @author hurui
*/
public class UnionStagingPayConfig {
/**
* 银联分期支付H5预下单-标准
* 文档地址 https://doc.eycard.cn/web/#/42?page_id=1516
* @param orderNo 订单号
* @param orgTrace 订单号
* @param openId 支付宝微信云闪付用户授权唯一标识(如果没有:-)
* @param payPrice 支付金额 单位
* @return 响应信息
* @throws Exception
*/
public static JSONObject advancePay(String orderNo, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl) throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo());
paramMap.put("prodTrace", orderNo);
paramMap.put("orgTrace", orgTrace);
paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA");
Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue());
bizDataMap.put("openId", openId);
bizDataMap.put("notifyUrl", notifyUrl);
paramMap.put("bizData", bizDataMap);
paramMap.put("sign", generateSign(bizDataMap));
JSONObject responseParam = HttpsUtils.doPost(CommonSysConst.getSysConfig().getUnionStagingPayUrl()+"cashier/apply/advancePay", paramMap, new HashMap<>());
return responseParam;
}
/**
* 参数排序
* @param param
* @return
*/
private static String paramSort(final Map<String, Object> param) {
Set<String> keySet = param.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (k.equals(WXPayConstants.FIELD_SIGN)) {
continue;
}
if (StringUtils.isBlank(sb.toString())) {
sb.append(k).append("=").append(param.get(k));
} else {
sb.append("&").append(k).append("=").append(param.get(k));
}
}
return sb.toString();
}
/**
* 生成签名
* @param data
* @return
* @throws Exception
*/
private static String generateSign(final Map<String, Object> data) throws IOException {
String paramSort = paramSort(data);
PrivateKey privateKey = PemUtil.loadPrivateKey(new FileInputStream("/home/project/wx_cert/BZ0001toORG000000000001.key"));
String signStr = null;
try {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(privateKey);
sign.update(paramSort.getBytes("utf-8"));
signStr = java.util.Base64.getEncoder().encodeToString(sign.sign());
} catch (SignatureException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
return signStr;
}
}

@ -32,6 +32,13 @@ unionPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
unionPayTelNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notifyTel
unionStagingPayUrl=https://mtest.eycard.cn/
unionStagingPayOrgId=ORG000000000001
unionStagingPayOrgMerCode=890000000123679
unionStagingPayOrgTermNo=W0616228
unionStagingPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionStagingPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
# ??????
wx_cert=/home/project/wx_cert/

Loading…
Cancel
Save