Commit f10dddc2 authored by 胡建龙's avatar 胡建龙

Merge branch 'uat' of https://hel.hand-china.com/rl/hls-support-rlwx into uat

 Conflicts:
	core/src/main/java/com/cmb/service/impl/HclcCmbPolyServiceImpl.java
	core/src/main/java/com/hand/app/cmb/util/GenerateUtil.java
	core/src/main/java/com/hand/app/cmb/util/Pojo.java
parents 7b2af1cc 51e30f4b
......@@ -279,6 +279,15 @@
${project.basedir}/src/main/webapp/WEB-INF/lib/rfsp-api-1.6.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.chinapay.secss</groupId>
<artifactId>chinapaysecure1_5</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/chinapaysecure1_5.jar
</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
......
......@@ -72,6 +72,14 @@ public class HlsEbankCcbTransaction extends BaseDTO {
private String fileFlag;
private String userId;
private String qrCode;
private String cmbOrderId;
private String txnTime;
public Long getTransactionId() {
return transactionId;
}
......@@ -239,4 +247,36 @@ public class HlsEbankCcbTransaction extends BaseDTO {
public void setFileFlag(String fileFlag) {
this.fileFlag = fileFlag;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getCmbOrderId() {
return cmbOrderId;
}
public void setCmbOrderId(String cmbOrderId) {
this.cmbOrderId = cmbOrderId;
}
public String getTxnTime() {
return txnTime;
}
public void setTxnTime(String txnTime) {
this.txnTime = txnTime;
}
}
\ No newline at end of file
package com.chinapay.service;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.dto.HclcCupSignInfo;
import com.chinapay.dto.HlsEbankCcbTransaction;
import com.hand.hap.core.IRequest;
import com.hand.hap.core.ProxySelf;
import com.hand.hap.system.service.IBaseService;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
public interface IHlsEbankCcbTransactionService extends IBaseService<HlsEbankCcbTransaction>, ProxySelf<IHlsEbankCcbTransactionService> {
}
package com.chinapay.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.comm.Constants;
import com.chinapay.dto.HclcCupSignInfo;
import com.chinapay.dto.HlsEbankCcbTransaction;
import com.chinapay.dto.HlsWsConfig;
import com.chinapay.mapper.HclcCupSignInfoMapper;
import com.chinapay.mapper.HlsEbankCcbTransactionMapper;
import com.chinapay.mapper.HlsWsConfigMapper;
import com.chinapay.secss.SecssConstants;
import com.chinapay.secss.SecssUtil;
import com.chinapay.service.IHclcChinaPayService;
import com.chinapay.service.IHlsEbankCcbTransactionService;
import com.chinapay.util.HttpUtils;
import com.chinapay.util.StringUtil;
import com.hand.app.zhongDengWang.dto.HlsWsRequests;
import com.hand.app.zhongDengWang.mapper.HlsWsRequestsMapper;
import com.hand.hap.core.IRequest;
import com.hand.hap.intergration.service.IHapInterfaceHeaderService;
import com.hand.hap.system.service.impl.BaseServiceImpl;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.*;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
@Service
public class HlsEbankCcbTransactionServiceImpl extends BaseServiceImpl<HlsEbankCcbTransaction> implements IHlsEbankCcbTransactionService {
}
......@@ -9,9 +9,13 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.comm.Constants;
import com.chinapay.secss.SecssConstants;
import com.chinapay.secss.SecssUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hand.app.cmb.util.SM2Util;
import com.hand.app.cmb.util.SignatureUtil;
import com.hand.hap.system.dto.BaseDTO;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.time.DateUtils;
......@@ -140,34 +144,73 @@ public class StringUtil {
// String fileData = "6226 0912 1056 2371";
// fileData.trim();
String strCardTranData = null;
String path = String.format("%s%s.properties", "F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\", "000092112092486");
SecssUtil secssUtil = new SecssUtil(true);
secssUtil.init(path);
// String strCardTranData = null;
// String path = String.format("%s%s.properties", "F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\", "000092112092486");
// SecssUtil secssUtil = new SecssUtil(true);
// secssUtil.init(path);
// strCardTranData = "{\"AccName\":\"张博\",\"MobileNo\":\"18653352435\",\"CardNo\":\"6215686000014576697\",\"EntrstAuthNo\":\"370321199004060610\",\"EntrstAmtLmt\":\"50000000\",\"CertType\":\"01\",\"EntrstDtStp\":\"9999\",\"EntrstEndDtTm\":\"20320118202019\",\"CertNo\":\"370321199004060610\",\"EntrstStrDtTm\":\"20220118202019\",\"EntrstDtUnt\":\"07\"}";
// // 加密
// strCardTranData = Base64.encodeBase64String(strCardTranData.getBytes(Constants.ENCODING));
// secssUtil.encryptData(strCardTranData);
Map<String, String> sendMap=new HashMap<String, String>();
sendMap.put("TranType","0608");
sendMap.put("BusiType","0001");
sendMap.put("Version","20140728");
sendMap.put("TranDate","20220119");
sendMap.put("CardTranData","i4T9Hpt/Qmkhh/xSzULM39qft9MS4KhMi+MQ3dvxJtbihUTlrk/xR1U8DhIAxvzsTVjINd14GbxYuXdG/N8cFZ15bHhDp89gkk6hvK9A+7l0WWNDnVlJWcLag0ERgA0v0FhXgfheqrMWuWnr9zrVp7yN+9SOs6XzTEUpN/ejhLd/nDkRBEyzJcPtxEWDB+M2KWOWLEjZf4L0NO3UN93ir7IvzoZmwzmwvpEW3Y4+sW9X9VMP8riaGnYV5VtoUvzUr55uBR6mIeuoqrZApvs0Pj8mJ687AvOz/yeyhlPvm1WMzjsrjPeztx1C3hstwwAEk9i6K3VjNkD2KaFwgFK1jcdTzqE5IqvXh5jRVlmBHaVnRzmfhBaZiFVvSkqbGdY90icPfDFhPR843ZsQOvO6Xul1fKfl5oH8UfASwqkCmYRKSnVwmK1oAN/QrOgNmTLBRuKY6F2qKLvX4ZJ784aqRimWVYLVdIknAj224MHoSG4bWRDIvu7kw2+tI9+wne1ng4t6KZtEreAL8BpDpvIVUhApKapf5l4T9qWS7BC8EFMIGSl5qyxi686C+EFRXSp9J9m6H3cia1Pad5URvkFItvSIhwyulL8pcUEnr0uIJdohJUHbuevCRVQEJffA1MSY0MEbYSRaMBzPfqqsORfRjGI+XO1Qwtq2rQw+ShXirlc=");
sendMap.put("MerOrderNo","F38CE3A782984D21AD8584238D40C890");
sendMap.put("MerId","739412105210001");
sendMap.put("TranTime","224028");
sendMap.put("AccessType","0");
// Map<String, String> sendMap=new HashMap<String, String>();
// sendMap.put("TranType","0608");
// sendMap.put("BusiType","0001");
// sendMap.put("Version","20140728");
// sendMap.put("TranDate","20220119");
// sendMap.put("CardTranData","i4T9Hpt/Qmkhh/xSzULM39qft9MS4KhMi+MQ3dvxJtbihUTlrk/xR1U8DhIAxvzsTVjINd14GbxYuXdG/N8cFZ15bHhDp89gkk6hvK9A+7l0WWNDnVlJWcLag0ERgA0v0FhXgfheqrMWuWnr9zrVp7yN+9SOs6XzTEUpN/ejhLd/nDkRBEyzJcPtxEWDB+M2KWOWLEjZf4L0NO3UN93ir7IvzoZmwzmwvpEW3Y4+sW9X9VMP8riaGnYV5VtoUvzUr55uBR6mIeuoqrZApvs0Pj8mJ687AvOz/yeyhlPvm1WMzjsrjPeztx1C3hstwwAEk9i6K3VjNkD2KaFwgFK1jcdTzqE5IqvXh5jRVlmBHaVnRzmfhBaZiFVvSkqbGdY90icPfDFhPR843ZsQOvO6Xul1fKfl5oH8UfASwqkCmYRKSnVwmK1oAN/QrOgNmTLBRuKY6F2qKLvX4ZJ784aqRimWVYLVdIknAj224MHoSG4bWRDIvu7kw2+tI9+wne1ng4t6KZtEreAL8BpDpvIVUhApKapf5l4T9qWS7BC8EFMIGSl5qyxi686C+EFRXSp9J9m6H3cia1Pad5URvkFItvSIhwyulL8pcUEnr0uIJdohJUHbuevCRVQEJffA1MSY0MEbYSRaMBzPfqqsORfRjGI+XO1Qwtq2rQw+ShXirlc=");
// sendMap.put("MerOrderNo","F38CE3A782984D21AD8584238D40C890");
// sendMap.put("MerId","739412105210001");
// sendMap.put("TranTime","224028");
// sendMap.put("AccessType","0");
//
// secssUtil.sign(sendMap);
// sendMap.put("Signature",secssUtil.getSign());
//
//// sendMap.put("Signature","zJ0CnwrHFzSL8OcAXI1YudMCHXLkB98P78JSBcCTmV4zhJIcgpGcgiKkrIdI4PXi5NUtJsxZ8S5bYbNE8XkWGQocfgDqwvzFGuU64adxxW6yNMNPg0Ug7TX6GOZatmGenLPL9YyyRxsIpUhPN2nDBYc4jCpAtMKYE/mCZLIvXdXyUnUgRD7D5KiXTN5Ka0QClmNQcmbiG22lMYb63i9fCJtcXeIK8FW0XiCbN1dv9ZSeMUgeXQzQWNQSRb5R8+GpWTpaTO4vHv+MEne9fW3p7ud33jhfwo/Cap5CdFyLU9r5kvk1sBx6XdOjDHuN84rK1nvaVaxqm9EdSEeck64rXw==");
// secssUtil.verify(sendMap);
// System.out.println(secssUtil.getErrCode());
// System.out.println(secssUtil.getErrCode());
// System.out.println(secssUtil.getEncValue());
//对待加签内容进行排序拼接
Map<String, String> requestPublicParams = new TreeMap<>();
ObjectMapper mapper = new ObjectMapper();
//公共请求参数
requestPublicParams.put("version", "0.0.1"); //版本号,固定为0.0.1(必传字段)
requestPublicParams.put("encoding", "UTF-8"); //编码方式,固定为UTF-8(必传)
requestPublicParams.put("signMethod", "02"); //签名方法,固定为02,表示签名方式为国密(必传)
requestPublicParams.put("biz_content", "{\"tradeScene\":\"OFFLINE\",\"orderId\":\"2022042400000390\",\"notifyUrl\":\"http://sign.hitachics.com/core/api/public/cmb/get/qr/code/listen\",\"merId\":\"3089991701201D0\",\"body\":\"聚合支付测试\",\"userId\":\"N003574551\",\"payValidTime\":\"900\",\"currencyCode\":\"156\",\"txnAmt\":\"200000\"}");
String signContent = SignatureUtil.getSignContent(requestPublicParams);
System.out.println("签名signContent:"+signContent);
//加签
requestPublicParams.put("sign", SM2Util.sm2Sign(signContent, "D5F2AFA24E6BA9071B54A8C9AD735F9A1DE9C4657FA386C09B592694BC118B38"));
secssUtil.sign(sendMap);
sendMap.put("Signature",secssUtil.getSign());
System.out.println(requestPublicParams.get("sign").toString());
// System.out.println(checkSign(JSONObject.parseObject(mapper.writeValueAsString(requestPublicParams)).toJSONString()));
}
// sendMap.put("Signature","zJ0CnwrHFzSL8OcAXI1YudMCHXLkB98P78JSBcCTmV4zhJIcgpGcgiKkrIdI4PXi5NUtJsxZ8S5bYbNE8XkWGQocfgDqwvzFGuU64adxxW6yNMNPg0Ug7TX6GOZatmGenLPL9YyyRxsIpUhPN2nDBYc4jCpAtMKYE/mCZLIvXdXyUnUgRD7D5KiXTN5Ka0QClmNQcmbiG22lMYb63i9fCJtcXeIK8FW0XiCbN1dv9ZSeMUgeXQzQWNQSRb5R8+GpWTpaTO4vHv+MEne9fW3p7ud33jhfwo/Cap5CdFyLU9r5kvk1sBx6XdOjDHuN84rK1nvaVaxqm9EdSEeck64rXw==");
secssUtil.verify(sendMap);
System.out.println(secssUtil.getErrCode());
System.out.println(secssUtil.getErrCode());
System.out.println(secssUtil.getEncValue());
private static Boolean checkSign(String string) {
System.out.println("要验签的报文内容:" + string);
try {
//验签
ObjectMapper objectMapper = new ObjectMapper();
Map<String, String> responseBodyMap = objectMapper.readValue(string, Map.class);
String sign = responseBodyMap.remove("sign");
String contentStr = SignatureUtil.getSignContent(responseBodyMap);
System.out.println("验签contentStr:"+contentStr);
boolean result = SM2Util.sm2Check(contentStr, sign, "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE6Q+fktsnY9OFP+LpSR5Udbxf5zHCFO0PmOKlFNTxDIGl8jsPbbB/9ET23NV+acSz4FEkzD74sW2iiNVHRLiKHg==");
if (result) {
System.out.println("报文验签成功!");
} else {
System.out.println("报文验签失败!");
}
return result;
} catch (Exception e) {
System.out.println("验签发生异常!");
e.printStackTrace();
return false;
}
}
/**
......
package com.cmb.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import java.util.HashMap;
import java.util.Map;
//构造请求报文工具类
public class GenerateUtil {
private static final Logger LOGGER = Logger.getLogger(GenerateUtil.class);
@Value("${cmb.version}")
private static String version;
@Value("${cmb.encoding}")
private static String encoding;
@Value("${cmb.signMethod}")
private static String signMethod;
public static final String privateKey = "D5F2AFA24E6BA9071B54A8C9AD735F9A1DE9C4657FA386C09B592694BC118B38";
public static final String publicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE6Q+fktsnY9OFP+LpSR5Udbxf5zHCFO0PmOKlFNTxDIGl8jsPbbB/9ET23NV+acSz4FEkzD74sW2iiNVHRLiKHg==";
public static String initRequestParam(Pojo pojo){
//设置公共请求参数
Map<String,String> resultPublicParam = new HashMap<>();
resultPublicParam.put("version",version);
resultPublicParam.put("encoding",encoding);
resultPublicParam.put("sign_method", signMethod);
//初始化业务请求参数
try {
ObjectMapper objectMapper = new ObjectMapper();
String bizContent = objectMapper.writeValueAsString(pojo);
System.out.println(bizContent);
resultPublicParam.put("biz_content",bizContent);
//对待加签内容进行排序拼接
String signStr = SignatureUtil.getSignContent(resultPublicParam);
//加签
String sign = SM2Util.sm2Sign(signStr, privateKey);
resultPublicParam.put("sign",sign);
String requestStr = objectMapper.writeValueAsString(resultPublicParam);
LOGGER.info("加签后的报文内容:" + requestStr);
return requestStr;
}catch (Exception ex){
ex.printStackTrace();
return null;
}
}
/**
* 处理响应报文
* @param responseMap
* @return
*/
public static void handleResponse(Map<String,String> responseMap){
if( null == responseMap){
LOGGER.equals("响应的内容为空");
return ;
}
try {
ObjectMapper objectMapper = new ObjectMapper();
LOGGER.info("收到响应的内容为:" + objectMapper.writeValueAsString(responseMap));
//验签
String sign = responseMap.remove("sign");
//生成验签字符串
String signStr = SignatureUtil.getSignContent(responseMap);
boolean flag = SM2Util.sm2Check(signStr,sign, publicKey);
if( flag ){
LOGGER.info("验签成功!");
} else {
LOGGER.error("验签失败!");
}
return;
}catch (Exception ex){
LOGGER.equals("系统异常");
return;
}
}
}
package com.cmb.util;
public class Pojo {
public Pojo(){}
}
......@@ -8,11 +8,11 @@
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.cmb.controllers;
package com.hand.app.cmb.controllers;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.service.IHclcChinaPayService;
import com.cmb.service.HclcCmbPolyService;
import com.hand.app.cmb.service.HclcCmbPolyService;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.controllers.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,6 +32,7 @@ import java.util.Map;
* @since 1.0.0
*/
@Controller
@RequestMapping(value = {"/r/api", "/"})
public class HclcCmbPolyController extends BaseController {
@Autowired
......
package com.hand.app.cmb.controllers;
import com.alibaba.fastjson.JSONObject;
import com.hand.app.esignHclc.service.ISignInfoHclcFaceService;
import com.hand.app.esignHclc.service.ISignInfoHclcService;
import com.hand.hap.system.controllers.BaseController;
import com.hand.hap.system.dto.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/25
* Time: 21:32
*/
@Controller
public class HclcCmbPolyListenController extends BaseController {
@Autowired
private ISignInfoHclcFaceService iSignInfoHclcFaceService;
@Autowired
private ISignInfoHclcService iSignInfoHclcService;
@ResponseBody
@RequestMapping(value = "/api/public/cmb/get/qr/code/listen", method = RequestMethod.POST)
public JSONObject chinaSignListen(HttpServletRequest request) {
JSONObject responseData = new JSONObject();
return responseData;
}
}
/**
* Copyright (C), 2018-2021
* FileName: HclcCupSignInfo
* Author: lsy
* Date: 2021/12/10 11:25
* Description:
* History:
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.hand.app.cmb.dto;
import com.hand.hap.mybatis.annotation.ExtensionAttribute;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/*
* 〈〉
*
* @author 27214
* @create 2021/12/10
* @since 1.0.0
*/
@Table(name = "ld037")
@ExtensionAttribute(disable = true)
public class Ld037 {
@Id
@GeneratedValue
private Long id;
private String contractno;
private String times;
private Date generatedt;
private String recamtno;
private Date recduedt;
private String bankname;
private String accountid;
private String accountname;
private Double amount;
private String filestatus;
private String receiptstatus;
private String receiptcfmstatus;
private String errorcd;
private String dealercd;
private String branchcd;
private String customercd;
private String customername;
private String outfilename;
private String infilename;
private String characterid;
private String errormsg;
private String chargeaccountno;
private Double actdbtamount;
private String version;
private String ctino;
private String cupPin;
private String phone;
private Long transactionId;
private Long num;
private Date procdt;
private Date recdt;
private Date recbatchdt;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getContractno() {
return contractno;
}
public void setContractno(String contractno) {
this.contractno = contractno;
}
public String getTimes() {
return times;
}
public void setTimes(String times) {
this.times = times;
}
public Date getGeneratedt() {
return generatedt;
}
public void setGeneratedt(Date generatedt) {
this.generatedt = generatedt;
}
public String getRecamtno() {
return recamtno;
}
public void setRecamtno(String recamtno) {
this.recamtno = recamtno;
}
public Date getRecduedt() {
return recduedt;
}
public void setRecduedt(Date recduedt) {
this.recduedt = recduedt;
}
public String getBankname() {
return bankname;
}
public void setBankname(String bankname) {
this.bankname = bankname;
}
public String getAccountid() {
return accountid;
}
public void setAccountid(String accountid) {
this.accountid = accountid;
}
public String getAccountname() {
return accountname;
}
public void setAccountname(String accountname) {
this.accountname = accountname;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public String getFilestatus() {
return filestatus;
}
public void setFilestatus(String filestatus) {
this.filestatus = filestatus;
}
public String getReceiptstatus() {
return receiptstatus;
}
public void setReceiptstatus(String receiptstatus) {
this.receiptstatus = receiptstatus;
}
public String getReceiptcfmstatus() {
return receiptcfmstatus;
}
public void setReceiptcfmstatus(String receiptcfmstatus) {
this.receiptcfmstatus = receiptcfmstatus;
}
public String getErrorcd() {
return errorcd;
}
public void setErrorcd(String errorcd) {
this.errorcd = errorcd;
}
public String getDealercd() {
return dealercd;
}
public void setDealercd(String dealercd) {
this.dealercd = dealercd;
}
public String getBranchcd() {
return branchcd;
}
public void setBranchcd(String branchcd) {
this.branchcd = branchcd;
}
public String getCustomercd() {
return customercd;
}
public void setCustomercd(String customercd) {
this.customercd = customercd;
}
public String getCustomername() {
return customername;
}
public void setCustomername(String customername) {
this.customername = customername;
}
public String getOutfilename() {
return outfilename;
}
public void setOutfilename(String outfilename) {
this.outfilename = outfilename;
}
public String getInfilename() {
return infilename;
}
public void setInfilename(String infilename) {
this.infilename = infilename;
}
public String getCharacterid() {
return characterid;
}
public void setCharacterid(String characterid) {
this.characterid = characterid;
}
public String getErrormsg() {
return errormsg;
}
public void setErrormsg(String errormsg) {
this.errormsg = errormsg;
}
public String getChargeaccountno() {
return chargeaccountno;
}
public void setChargeaccountno(String chargeaccountno) {
this.chargeaccountno = chargeaccountno;
}
public Double getActdbtamount() {
return actdbtamount;
}
public void setActdbtamount(Double actdbtamount) {
this.actdbtamount = actdbtamount;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getCtino() {
return ctino;
}
public void setCtino(String ctino) {
this.ctino = ctino;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getNum() {
return num;
}
public void setNum(Long num) {
this.num = num;
}
public Date getProcdt() {
return procdt;
}
public void setProcdt(Date procdt) {
this.procdt = procdt;
}
public Date getRecdt() {
return recdt;
}
public void setRecdt(Date recdt) {
this.recdt = recdt;
}
public Date getRecbatchdt() {
return recbatchdt;
}
public void setRecbatchdt(Date recbatchdt) {
this.recbatchdt = recbatchdt;
}
public Long getTransactionId() {
return transactionId;
}
public void setTransactionId(Long transactionId) {
this.transactionId = transactionId;
}
public String getCupPin() {
return cupPin;
}
public void setCupPin(String cupPin) {
this.cupPin = cupPin;
}
}
\ No newline at end of file
package com.hand.app.cmb.mapper;
import com.hand.app.cmb.dto.Ld037;
import com.hand.hap.mybatis.common.Mapper;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
public interface Ld037Mapper extends Mapper<Ld037> {
void updateLd037Fail(Ld037 ld037);
}
package com.cmb.service;
package com.hand.app.cmb.service;
import com.alibaba.fastjson.JSONObject;
import com.hand.hap.core.IRequest;
......
package com.cmb.util;
package com.hand.app.cmb.util;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
......
package com.cmb.util;
package com.hand.app.cmb.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
......
package com.cmb.util;
package com.hand.app.cmb.util;
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey;
......
package com.cmb.util;
package com.hand.app.cmb.util;
public class Sm2Vo {
......
package com.cmb.util;
package com.hand.app.cmb.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.Map;
import java.util.*;
public class Utils {
......@@ -21,15 +36,16 @@ public class Utils {
}
private static void disableSslVerification() {
try
{
try {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
......@@ -56,13 +72,22 @@ public class Utils {
}
public static Map<String, String> postForEntity(String url,String requestBody, Map<String, String> apiHeader){
public static Map<String, String> postForEntity(String url, String requestBody, Map<String, String> apiHeader) {
RestTemplate client = getRestTemplate();
client.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
List<HttpMessageConverter<?>> httpMessageConverters = client.getMessageConverters();
httpMessageConverters.stream().forEach(httpMessageConverter -> {
if (httpMessageConverter instanceof StringHttpMessageConverter) {
StringHttpMessageConverter messageConverter = (StringHttpMessageConverter) httpMessageConverter;
messageConverter.setDefaultCharset(Charset.forName("UTF-8"));
}
});
HttpHeaders headers = getHttpHeaders();
// 以json的方式提交
headers.setContentType(MediaType.APPLICATION_JSON);
List<Charset> acceptCharset = Collections.singletonList(StandardCharsets.UTF_8);
headers.setAcceptCharset(acceptCharset);
headers.add("appid", apiHeader.get("appid"));
headers.add("timestamp", apiHeader.get("timestamp"));
headers.add("apisign", apiHeader.get("apisign"));
......@@ -70,17 +95,77 @@ public class Utils {
// 将请求头部和参数合成一个请求
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
// 执行HTTP请求
Map<String,String> response = client.postForEntity(url,requestEntity,Map.class).getBody();
Map<String, String> response = client.postForEntity(url, requestEntity, Map.class).getBody();
return response;
}
public static RestTemplate getRestTemplate(){
/**
* 向指定URL发送POST方法的请求
*
* @param urls 发送请求的URL
* @param params 请求参数,请求参数应该是 JSON 的形式。
* @return URL 所代表远程资源的响应结果
*/
public static Map<String, String> postString(String urls, String params, Map<String, String> headInfo) {
HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(urls);
String result = "";
try {
if (Objects.nonNull(headInfo)) {
for (Map.Entry<String, String> entry : headInfo.entrySet()) {
post.setHeader(entry.getKey(), entry.getValue());
}
}
StringEntity s = new StringEntity(params, "utf-8");
s.setContentEncoding(new BasicHeader("Content-Type", "application/json"));
post.setHeader("Content-Type", "application/json");
post.setEntity(s);
HttpResponse httpResponse = client.execute(post);
InputStream inStream = httpResponse.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, "utf-8"));
StringBuilder strber = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
strber.append(line + "\n");
}
inStream.close();
result = strber.toString();
//解析返回结果
JSONObject jsonResult = JSONObject.parseObject(result);
return JsonToMap(jsonResult);
} catch (Exception var12) {
var12.printStackTrace();
throw new RuntimeException(var12);
}
}
public static RestTemplate getRestTemplate() {
return new RestTemplate();
}
public static HttpHeaders getHttpHeaders(){
public static HttpHeaders getHttpHeaders() {
return new HttpHeaders();
}
public static Map<String, String> JsonToMap(JSONObject params) {
Map<String, String> paramMap = new HashMap<>();
//循环转换
for (Map.Entry<String, Object> entry : params.entrySet()) {
paramMap.put(entry.getKey(), entry.getValue().toString());
}
return paramMap;
}
}
<?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">
<mapper namespace="com.hand.app.cmb.mapper.Ld037Mapper">
<!--获取角色下的模块-->
<resultMap id="AppLd037Map" type="com.hand.app.cmb.dto.Ld037">
<result column="ID" property="id" jdbcType="VARCHAR"/>
<result column="CONTRACTNO" property="contractno" jdbcType="VARCHAR"/>
<result column="TIMES" property="times" jdbcType="DECIMAL"/>
<result column="generatedt" property="generatedt" jdbcType="DATE"/>
<result column="recamtno" property="recamtno" jdbcType="VARCHAR"/>
<result column="recduedt" property="recduedt" jdbcType="DATE"/>
<result column="bankname" property="bankname" jdbcType="VARCHAR"/>
<result column="accountid" property="accountid" jdbcType="VARCHAR"/>
<result column="accountname" property="accountname" jdbcType="VARCHAR"/>
<result column="amount" property="amount" jdbcType="DECIMAL"/>
<result column="filestatus" property="filestatus" jdbcType="VARCHAR"/>
<result column="receiptstatus" property="receiptstatus" jdbcType="VARCHAR"/>
<result column="receiptcfmstatus" property="receiptcfmstatus" jdbcType="VARCHAR"/>
<result column="errorcd" property="errorcd" jdbcType="VARCHAR"/>
<result column="dealercd" property="dealercd" jdbcType="VARCHAR"/>
<result column="branchcd" property="branchcd" jdbcType="VARCHAR"/>
<result column="customercd" property="customercd" jdbcType="VARCHAR"/>
<result column="customername" property="customername" jdbcType="VARCHAR"/>
<result column="outfilename" property="outfilename" jdbcType="VARCHAR"/>
<result column="infilename" property="infilename" jdbcType="VARCHAR"/>
<result column="characterid" property="characterid" jdbcType="VARCHAR"/>
<result column="errormsg" property="errormsg" jdbcType="VARCHAR"/>
<result column="chargeaccountno" property="chargeaccountno" jdbcType="VARCHAR"/>
<result column="actdbtamount" property="actdbtamount" jdbcType="DECIMAL"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="ctino" property="ctino" jdbcType="VARCHAR"/>
<result column="cup_pin" property="cup_pin" jdbcType="VARCHAR"/>
<result column="phone" property="phone" jdbcType="VARCHAR"/>
<result column="transaction_id" property="transaction_id" jdbcType="DECIMAL"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="procdt" property="procdt" jdbcType="DATE"/>
<result column="recdt" property="recdt" jdbcType="DATE"/>
<result column="recbatchdt" property="recbatchdt" jdbcType="DATE"/>
</resultMap>
<update id="updateLd037Fail" parameterType="com.hand.app.cmb.dto.Ld037">
UPDATE LD037 t
SET t.ProcDt = sysdate,
t.RecDt = sysdate,
t.RecBatchDt = sysdate,
t.ReceiptStatus = '0',
t.ReceiptCfmStatus = '1',
t.ERRORMSG = (select h.description from hls_ebank_cmb_recode h where h.code=#{errorcd,jdbcType=VARCHAR}),
t.ErrorCd = #{errorcd,jdbcType=VARCHAR},
t.UPDATEDDT = SYSDATE,
t.UPDATEDPERSON = 'CMB',
t.Actdbtamount = 0,
t.transaction_id = #{transactionId,jdbcType=DECIMAL}
WHERE t.id = #{id,jdbcType=DECIMAL}
</update>
</mapper>
......@@ -140,6 +140,12 @@ face.check.enable=false
#金格电子合同配置文件地址
electronic.signature.path=/Volumes/work/idea/APIconfig
zdw.login.clientKey=04593D186F5AB68871891C235A35ED90E6D5E8DC33414C89E05C29EBF5D19C3919F0D1956568619BA138AC724F4E5DC730266C8186F610D8CC85BFC0748F899695
zdw.login.userName=hclczhongdengwang1
zdw.login.password=zhongdengwang12345
zdw.login.authCode=7b7-f08f197fe2e5
#银联代扣
cup.mer.id=000092112092486
cup.upload.file.path=D:\\HCLC_FTP\\CUP_OUT\\
......@@ -147,7 +153,7 @@ cup.download.file.path=D:\\HCLC_FTP\\CUP_IN\\
cup.init.file.path=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\
cmb.version = 0.0.1
cmb.encoding = UTF-8
cmb.signMethod = 02
cmb.currencyCode = 156
\ No newline at end of file
cmb.version=0.0.1
cmb.encoding=UTF-8
cmb.signMethod=02
cmb.currencyCode=156
\ No newline at end of file
......@@ -19,7 +19,8 @@
<sift>
<appender name="REQ-${logName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n</pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n
</pattern>
</encoder>
<file>${catalina.base}/logs/hls-${logName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
......@@ -54,7 +55,8 @@
<sift>
<appender name="REQ-${logName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n</pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n
</pattern>
</encoder>
<file>${catalina.base}/logs/hls-cup-${logName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
......@@ -64,6 +66,25 @@
</sift>
</appender>
<appender name="CMB-FILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>logName</key>
<defaultValue>default</defaultValue>
</discriminator>
<sift>
<appender name="REQ-${logName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n
</pattern>
</encoder>
<file>${catalina.base}/logs/hls-cmb-${logName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/%d{yyyy-MM-dd}/hls-cmb-${logName}.log</fileNamePattern>
</rollingPolicy>
</appender>
</sift>
</appender>
<root level="ERROR">
<appender-ref ref="STDOUT"/>
......@@ -119,4 +140,7 @@
<logger name="com.chinapay.util.HttpUtils" level="INFO" additivity="false">
<appender-ref ref="CUP-FILE"/>
</logger>
<logger name="com.hand.app.cmb.service.impl.HclcCmbPolyServiceImpl" level="INFO" additivity="false">
<appender-ref ref="CMB-FILE"/>
</logger>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment