提交代码

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 unionPayNotifyUrl;
private String unionPayTelNotifyUrl; 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 wx_cert;
private String telApiKey; private String telApiKey;
@ -47,52 +55,92 @@ public class CommonSysConfig {
private String telUrl; private String telUrl;
private String czOrderNotify; private String czOrderNotify;
public String getUnionPayTelNotifyUrl() { public String getTuanYouUrl() {
return unionPayTelNotifyUrl; return tuanYouUrl;
} }
public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) { public void setTuanYouUrl(String tuanYouUrl) {
this.unionPayTelNotifyUrl = unionPayTelNotifyUrl; this.tuanYouUrl = tuanYouUrl;
} }
public String getUnionPayNotifyUrl() { public String getTuanYouAppKey() {
return unionPayNotifyUrl; return tuanYouAppKey;
} }
public void setUnionPayNotifyUrl(String unionPayNotifyUrl) { public void setTuanYouAppKey(String tuanYouAppKey) {
this.unionPayNotifyUrl = unionPayNotifyUrl; this.tuanYouAppKey = tuanYouAppKey;
} }
public String getHuiLianTongUnionCardUrl() { public String getTuanYouAppSecret() {
return HuiLianTongUnionCardUrl; return tuanYouAppSecret;
} }
public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) { public void setTuanYouAppSecret(String tuanYouAppSecret) {
HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl; this.tuanYouAppSecret = tuanYouAppSecret;
} }
public String getHuiLianTongUnionCardAccessCode() { public String getTuanYouDieselAccount() {
return HuiLianTongUnionCardAccessCode; return tuanYouDieselAccount;
} }
public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) { public void setTuanYouDieselAccount(String tuanYouDieselAccount) {
HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode; this.tuanYouDieselAccount = tuanYouDieselAccount;
} }
public String getHuiLianTongUnionCardSignCode() { public String getTuanYouGasolineAccount() {
return HuiLianTongUnionCardSignCode; return tuanYouGasolineAccount;
} }
public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) { public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) {
HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode; this.tuanYouGasolineAccount = tuanYouGasolineAccount;
} }
public String getHuiliantongAppNo() { public String getQinzhuUrl() {
return huiliantongAppNo; return qinzhuUrl;
} }
public void setHuiliantongAppNo(String huiliantongAppNo) { public void setQinzhuUrl(String qinzhuUrl) {
this.huiliantongAppNo = huiliantongAppNo; 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() { public String getHuiliantongUrl() {
@ -103,6 +151,14 @@ public class CommonSysConfig {
this.huiliantongUrl = huiliantongUrl; this.huiliantongUrl = huiliantongUrl;
} }
public String getHuiliantongAppNo() {
return huiliantongAppNo;
}
public void setHuiliantongAppNo(String huiliantongAppNo) {
this.huiliantongAppNo = huiliantongAppNo;
}
public String getHuiliantongAppkey() { public String getHuiliantongAppkey() {
return huiliantongAppkey; return huiliantongAppkey;
} }
@ -119,100 +175,132 @@ public class CommonSysConfig {
this.huiliantongAppsecret = huiliantongAppsecret; this.huiliantongAppsecret = huiliantongAppsecret;
} }
public String getQinzhuHtmlUrl() { public String getHuiLianTongUnionCardUrl() {
return qinzhuHtmlUrl; return HuiLianTongUnionCardUrl;
} }
public void setQinzhuHtmlUrl(String qinzhuHtmlUrl) { public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) {
this.qinzhuHtmlUrl = qinzhuHtmlUrl; HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl;
} }
public String getCzOrderNotify() { public String getHuiLianTongUnionCardAccessCode() {
return czOrderNotify; return HuiLianTongUnionCardAccessCode;
} }
public void setCzOrderNotify(String czOrderNotify) { public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) {
this.czOrderNotify = czOrderNotify; HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode;
} }
public String getQinzhuMobileUrl() { public String getHuiLianTongUnionCardSignCode() {
return qinzhuMobileUrl; return HuiLianTongUnionCardSignCode;
} }
public void setQinzhuMobileUrl(String qinzhuMobileUrl) { public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) {
this.qinzhuMobileUrl = qinzhuMobileUrl; HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode;
} }
public String getQianzhuOrderNotify() { public String getUnionPayUrl() {
return qianzhuOrderNotify; return unionPayUrl;
} }
public void setQianzhuOrderNotify(String qianzhuOrderNotify) { public void setUnionPayUrl(String unionPayUrl) {
this.qianzhuOrderNotify = qianzhuOrderNotify; this.unionPayUrl = unionPayUrl;
} }
public String getTuanYouUrl() { public String getUnionPayChannelid() {
return tuanYouUrl; return unionPayChannelid;
} }
public void setTuanYouUrl(String tuanYouUrl) { public void setUnionPayChannelid(String unionPayChannelid) {
this.tuanYouUrl = tuanYouUrl; this.unionPayChannelid = unionPayChannelid;
} }
public String getTuanYouAppKey() { public String getUnionPayMerid() {
return tuanYouAppKey; return unionPayMerid;
} }
public void setTuanYouAppKey(String tuanYouAppKey) { public void setUnionPayMerid(String unionPayMerid) {
this.tuanYouAppKey = tuanYouAppKey; this.unionPayMerid = unionPayMerid;
} }
public String getTuanYouAppSecret() { public String getUnionPayTermid() {
return tuanYouAppSecret; return unionPayTermid;
} }
public void setTuanYouAppSecret(String tuanYouAppSecret) { public void setUnionPayTermid(String unionPayTermid) {
this.tuanYouAppSecret = tuanYouAppSecret; this.unionPayTermid = unionPayTermid;
} }
public String getTuanYouDieselAccount() { public String getUnionPaySignKey() {
return tuanYouDieselAccount; return unionPaySignKey;
} }
public void setTuanYouDieselAccount(String tuanYouDieselAccount) { public void setUnionPaySignKey(String unionPaySignKey) {
this.tuanYouDieselAccount = tuanYouDieselAccount; this.unionPaySignKey = unionPaySignKey;
} }
public String getTuanYouGasolineAccount() { public String getUnionPayNotifyUrl() {
return tuanYouGasolineAccount; return unionPayNotifyUrl;
} }
public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) { public void setUnionPayNotifyUrl(String unionPayNotifyUrl) {
this.tuanYouGasolineAccount = tuanYouGasolineAccount; this.unionPayNotifyUrl = unionPayNotifyUrl;
} }
public String getQinzhuUrl() { public String getUnionPayTelNotifyUrl() {
return qinzhuUrl; return unionPayTelNotifyUrl;
} }
public void setQinzhuUrl(String qinzhuUrl) { public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) {
this.qinzhuUrl = qinzhuUrl; this.unionPayTelNotifyUrl = unionPayTelNotifyUrl;
} }
public String getQinzhuPlatformId() { public String getUnionStagingPayUrl() {
return qinzhuPlatformId; return unionStagingPayUrl;
} }
public void setQinzhuPlatformId(String qinzhuPlatformId) { public void setUnionStagingPayUrl(String unionStagingPayUrl) {
this.qinzhuPlatformId = qinzhuPlatformId; this.unionStagingPayUrl = unionStagingPayUrl;
} }
public String getQinzhuSecret() { public String getUnionStagingPayOrgId() {
return qinzhuSecret; return unionStagingPayOrgId;
} }
public void setQinzhuSecret(String qinzhuSecret) { public void setUnionStagingPayOrgId(String unionStagingPayOrgId) {
this.qinzhuSecret = qinzhuSecret; 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() { public String getWx_cert() {
@ -255,43 +343,11 @@ public class CommonSysConfig {
this.telUrl = telUrl; this.telUrl = telUrl;
} }
public String getUnionPayUrl() { public String getCzOrderNotify() {
return unionPayUrl; return czOrderNotify;
}
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 void setUnionPaySignKey(String unionPaySignKey) { public void setCzOrderNotify(String czOrderNotify) {
this.unionPaySignKey = unionPaySignKey; 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 unionPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
unionPayTelNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notifyTel 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/ wx_cert=/home/project/wx_cert/

Loading…
Cancel
Save