Commit b5d9513a authored by 5359's avatar 5359

UAT环境银行代扣

parent 961699eb
package com.chinapay.bean;
/**
* @author huang.xuting
*
*/
public class TransactionBean {
private String MerId; //商户号,数字,定长15位
private String MerKeyPath; //商户私钥路径
private String PubKeyPath; //商户公钥路径
private String FileName; //上传txt文件名
private String Plain; //存款批量交易信息
private String FileHeader; //txt文件头
private String FileMatter; //txt文件体
private String FilePath; //txt文件路径
private String ChkValue; //交易签名,字符,定长256位
//应答数据
private String ResponseCode; //应答码
private String Message; //应答信息
//返回报文数据
private String Data; //控台返回报文
public void setMerId(String merId) {
MerId = merId;
}
public String getMerId() {
return MerId;
}
public void setResponseCode(String responseCode) {
ResponseCode = responseCode;
}
public String getResponseCode() {
return ResponseCode;
}
public void setData(String data) {
Data = data;
}
public String getData() {
return Data;
}
public void setMerKeyPath(String merKeyPath) {
MerKeyPath = merKeyPath;
}
public String getMerKeyPath() {
return MerKeyPath;
}
public void setPubKeyPath(String pubKeyPath) {
PubKeyPath = pubKeyPath;
}
public String getPubKeyPath() {
return PubKeyPath;
}
public void setFileName(String fileName) {
FileName = fileName;
}
public String getFileName() {
return FileName;
}
public void setPlain(String plain) {
Plain = plain;
}
public String getPlain() {
return Plain;
}
public void setFileHeader(String fileHeader) {
FileHeader = fileHeader;
}
public String getFileHeader() {
return FileHeader;
}
public void setFileMatter(String fileMatter) {
FileMatter = fileMatter;
}
public String getFileMatter() {
return FileMatter;
}
public void setFilePath(String filePath) {
FilePath = filePath;
}
public String getFilePath() {
return FilePath;
}
public void setChkValue(String chkValue) {
ChkValue = chkValue;
}
public String getChkValue() {
return ChkValue;
}
public void setMessage(String message) {
Message = message;
}
public String getMessage() {
return Message;
}
}
/**
* 项目名称(中文)
* 项目名称(英文)
* Copyright (c) 2016 ChinaPay Ltd. All Rights Reserved.
*/
package com.chinapay.comm;
/**
* @author hrtc .
*/
public class Constants {
/**
* 默认编码.
*/
public static final String ENCODING = "UTF-8";
/**
* 文件分隔符.
*/
public static final String FILE_SPLIT_STR = "/";
/**
* 默认错误码.
*/
public static final String DEFAULT_ERROR_CODE = "9999";
/******** 报文字段 ********/
/**
* 卡信息字段.
*/
public static final String CARD_TRAN_DATA = "CardTranData";
/**
* 交易保留域.
*/
public static final String TRAN_RESERVED = "TranReserved";
/**
* 风控保留域.
*/
public static final String RISK_DATA = "RiskData";
/**
* 风控保留域.
*/
public static final String FILE_DATA = "FileData";
/**
* 响应信息.
*/
public static final String RESP_MSG = "respMsg";
/**
* 响应码.
*/
public static final String RESP_CODE = "respCode";
/**
* 签名.
*/
public static final String SIGNATURE = "Signature";
/**
* .
*/
public static final String MER_ID = "MerId";
/**
* .
*/
public static final String INSTU_ID = "InstuId";
/******** demo特殊字段 ********/
/**
* 特殊字段前缀.
*/
public static final String SPEC_PRIFEX = "__";
/**
* 请求参数-定制接口类型.
*/
public static final String SPEC_INTERFACE_TYPE = "__interfaceType";
/**
* 请求参数-交易类型.
*/
public static final String SPEC_TRAN_TYPE = "__tranType";
/**
* 请求参数-交易子类型.
*/
public static final String SPEC_SUB_TRAN_TYPE = "__subTransType";
/**
* 请求参数-调用方法.
*/
public static final String SPEC_METHOD = "__method";
/**
* 请求参数-通知类型 0前台 1后台 默认是后台.
*/
public static final String SPEC_NOTIFY_TYPE = "__notifyType";
/**
* 请求参数-请求地址.
*/
public static final String SPEC_REQUEST_URL = "__requestUrl";
/**
* 响应参数-发送map.
*/
public static final String SEND_MAP = "sendMap";
/**
* 响应参数-响应map.
*/
public static final String RESULT_MAP = "resultMap";
/**
* 响应参数-接口缓存.
*/
public static final String INTERFACE_CACHE = "interfaceCache";
/**
* 响应参数-报文.
*/
public static final String PACKET = "packet";
/**
* 响应参数-请求地址.
*/
public static final String REQUEST_URL = "requestUrl";
/**
* 方法-生成请求页面.
*/
public static final String METHOD_GEN_REQUEST_PAGE = "genRequestPage";
/**
* 方法-组报文页面.
*/
public static final String METHOD_PACK = "pack";
/**
* 方法-解包.
*/
public static final String METHOD_UNPACK = "unpack";
/**
* 方法-发送.
*/
public static final String METHOD_SEND = "send";
/**
* 通知类型-前台.
*/
public static final String NOTIFY_TYPE_FRONT = "0";
/**
* 通知类型-后台.
*/
public static final String NOTIFY_TYPE_BACK = "1";
/**
* 接口版本.
*/
public static final String VERSION = "20140728";
/**
* 业务类型.
*/
public static final String BUSI_TYPE="0001";
/**
* 交易类型0610.
*/
public static final String TRAN_TYPE_0610="0608";
/**
* 交易类型9910.
*/
public static final String TRAN_TYPE_9910="9904";
/**
* 交易类型0506.
*/
public static final String TRAN_TYPE_0506="0506";
}
/**
* Copyright (C), 2018-2021
* FileName: HclcChinaPayController
* Author: lsy
* Date: 2021/12/8 14:40
* Description:
* History:
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.chinapay.controllers;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.service.IHclcChinaPayService;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.controllers.BaseController;
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.ResponseBody;
import javax.servlet.http.HttpServletRequest;
/*
* 〈〉
*
* @author 27214
* @create 2021/12/8
* @since 1.0.0
*/
@Controller
@RequestMapping(value = {"/r/api", "/"})
public class HclcChinaPayController extends BaseController {
@Autowired
IHclcChinaPayService hclcChinaPayService;
/**
* 4.4签约短信接口
*
* @param request
* @param params 4.4签约短信接口
* @return Map
*/
@ResponseBody
@RequestMapping("/china/pay/send/sign/message")
public JSONObject sendSignMessage(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
JSONObject jsonResult = new JSONObject();
IRequest iRequest = createRequestContext(request);
jsonResult = hclcChinaPayService.sendSignMessage(iRequest, params);
return jsonResult;
}
/**
* 4.5签约接口
*
* @param request
* @param params 4.5签约接口
* @return Map
*/
@ResponseBody
@RequestMapping("/china/pay/send/sign")
public JSONObject sendSign(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
JSONObject jsonResult = new JSONObject();
IRequest iRequest = createRequestContext(request);
jsonResult = hclcChinaPayService.sendSign(iRequest, params);
return jsonResult;
}
/**
* 4.9 批量交易文件上传接口
*
* @param request
* @param params 4.9 批量交易文件上传接口
* @return Map
*/
@ResponseBody
@RequestMapping("/china/pay/upload/batch")
public JSONObject uploadBatch(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
JSONObject jsonResult = new JSONObject();
IRequest iRequest = createRequestContext(request);
jsonResult = hclcChinaPayService.uploadBatch(iRequest, params);
return jsonResult;
}
/**
* 4.11 批量交易回盘文件内容下载接口
*
* @param request
* @param params 4.11 批量交易回盘文件内容下载接口
* @return Map
*/
@ResponseBody
@RequestMapping("/china/pay/download/batch")
public JSONObject downloadBatch(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
JSONObject jsonResult = new JSONObject();
IRequest iRequest = createRequestContext(request);
jsonResult = hclcChinaPayService.downloadBatch(iRequest, params);
return jsonResult;
}
/**
* 4.12 批量交易文件查询接口
*
* @param request
* @param params 4.12 批量交易文件查询接口
* @return Map
*/
@ResponseBody
@RequestMapping("/china/pay/query/batch")
public JSONObject queryBatch(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
JSONObject jsonResult = new JSONObject();
IRequest iRequest = createRequestContext(request);
jsonResult = hclcChinaPayService.queryBatch(iRequest, params);
return jsonResult;
}
}
\ No newline at end of file
/**
* Copyright (C), 2018-2021
* FileName: HclcCupSignInfo
* Author: lsy
* Date: 2021/12/10 11:25
* Description:
* History:
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.chinapay.dto;
import com.hand.hap.mybatis.annotation.ExtensionAttribute;
import com.hand.hap.system.dto.BaseDTO;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/*
* 〈〉
*
* @author 27214
* @create 2021/12/10
* @since 1.0.0
*/
@Table(name = "hclc_cup_sign_info")
@ExtensionAttribute(disable = true)
public class HclcCupSignInfo extends BaseDTO {
@Id
@GeneratedValue
private Long signId;
private String cardNo;
private String accName;
private String certType;
private String certNo;
private String mobileNo;
private String entrstAuthNo;
private String entrstAmtLmt;
private String entrstStrDtTm;
private String entrstEndDtTm;
private String entrstDtUnt;
private Long entrstDtStp;
private String status;
private String accType;
private String protocolNo;
private String merOrderNo;
private String merId;
private String remark;
public Long getSignId() {
return signId;
}
public void setSignId(Long signId) {
this.signId = signId;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public String getAccName() {
return accName;
}
public void setAccName(String accName) {
this.accName = accName;
}
public String getCertType() {
return certType;
}
public void setCertType(String certType) {
this.certType = certType;
}
public String getCertNo() {
return certNo;
}
public void setCertNo(String certNo) {
this.certNo = certNo;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getEntrstAuthNo() {
return entrstAuthNo;
}
public void setEntrstAuthNo(String entrstAuthNo) {
this.entrstAuthNo = entrstAuthNo;
}
public String getEntrstAmtLmt() {
return entrstAmtLmt;
}
public void setEntrstAmtLmt(String entrstAmtLmt) {
this.entrstAmtLmt = entrstAmtLmt;
}
public String getEntrstStrDtTm() {
return entrstStrDtTm;
}
public void setEntrstStrDtTm(String entrstStrDtTm) {
this.entrstStrDtTm = entrstStrDtTm;
}
public String getEntrstEndDtTm() {
return entrstEndDtTm;
}
public void setEntrstEndDtTm(String entrstEndDtTm) {
this.entrstEndDtTm = entrstEndDtTm;
}
public String getEntrstDtUnt() {
return entrstDtUnt;
}
public void setEntrstDtUnt(String entrstDtUnt) {
this.entrstDtUnt = entrstDtUnt;
}
public Long getEntrstDtStp() {
return entrstDtStp;
}
public void setEntrstDtStp(Long entrstDtStp) {
this.entrstDtStp = entrstDtStp;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAccType() {
return accType;
}
public void setAccType(String accType) {
this.accType = accType;
}
public String getProtocolNo() {
return protocolNo;
}
public void setProtocolNo(String protocolNo) {
this.protocolNo = protocolNo;
}
public String getMerOrderNo() {
return merOrderNo;
}
public void setMerOrderNo(String merOrderNo) {
this.merOrderNo = merOrderNo;
}
public String getMerId() {
return merId;
}
public void setMerId(String merId) {
this.merId = merId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
/**
* Copyright (C), 2018-2021
* FileName: HclcCupSignInfo
* Author: lsy
* Date: 2021/12/10 11:25
* Description:
* History:
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.chinapay.dto;
import com.hand.hap.mybatis.annotation.ExtensionAttribute;
import com.hand.hap.system.dto.BaseDTO;
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 = "hls_ebank_ccb_transaction")
@ExtensionAttribute(disable = true)
public class HlsEbankCcbTransaction extends BaseDTO {
@Id
@GeneratedValue
private Long transactionId;
private String transactionNumber;
private String status;
private Date newDate;
private Double amount;
private Long count;
private String returnCode;
private String returnMsg;
private Double successAmount;
private Long successCount;
private String sendFileName;
private String backFileName;
private String bankType;
private String merId;
private String version;
private String merOrderNo;
private String tranDate;
private String tranTime;
private String tranType;
private String orderStatus;
private String fileFlag;
public Long getTransactionId() {
return transactionId;
}
public void setTransactionId(Long transactionId) {
this.transactionId = transactionId;
}
public String getTransactionNumber() {
return transactionNumber;
}
public void setTransactionNumber(String transactionNumber) {
this.transactionNumber = transactionNumber;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getNewDate() {
return newDate;
}
public void setNewDate(Date newDate) {
this.newDate = newDate;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getReturnCode() {
return returnCode;
}
public void setReturnCode(String returnCode) {
this.returnCode = returnCode;
}
public String getReturnMsg() {
return returnMsg;
}
public void setReturnMsg(String returnMsg) {
this.returnMsg = returnMsg;
}
public Double getSuccessAmount() {
return successAmount;
}
public void setSuccessAmount(Double successAmount) {
this.successAmount = successAmount;
}
public Long getSuccessCount() {
return successCount;
}
public void setSuccessCount(Long successCount) {
this.successCount = successCount;
}
public String getSendFileName() {
return sendFileName;
}
public void setSendFileName(String sendFileName) {
this.sendFileName = sendFileName;
}
public String getBackFileName() {
return backFileName;
}
public void setBackFileName(String backFileName) {
this.backFileName = backFileName;
}
public String getBankType() {
return bankType;
}
public void setBankType(String bankType) {
this.bankType = bankType;
}
public String getMerId() {
return merId;
}
public void setMerId(String merId) {
this.merId = merId;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getMerOrderNo() {
return merOrderNo;
}
public void setMerOrderNo(String merOrderNo) {
this.merOrderNo = merOrderNo;
}
public String getTranDate() {
return tranDate;
}
public void setTranDate(String tranDate) {
this.tranDate = tranDate;
}
public String getTranTime() {
return tranTime;
}
public void setTranTime(String tranTime) {
this.tranTime = tranTime;
}
public String getTranType() {
return tranType;
}
public void setTranType(String tranType) {
this.tranType = tranType;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getFileFlag() {
return fileFlag;
}
public void setFileFlag(String fileFlag) {
this.fileFlag = fileFlag;
}
}
\ No newline at end of file
/**
* Copyright (C), 2018-2021
* FileName: HclcCupSignInfo
* Author: lsy
* Date: 2021/12/10 11:25
* Description:
* History:
* <author> <time> <version> <desc>
* lishuangyi 修改时间 版本号 描述
*/
package com.chinapay.dto;
import com.hand.hap.mybatis.annotation.ExtensionAttribute;
import com.hand.hap.system.dto.BaseDTO;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/*
* 〈〉
*
* @author 27214
* @create 2021/12/10
* @since 1.0.0
*/
@Table(name = "hls_ws_config")
@ExtensionAttribute(disable = true)
public class HlsWsConfig {
@Id
@GeneratedValue
private Long configId;
private String configName;
private String configDesc;
private String wsdlAddress;
private String endpointAddress;
public Long getConfigId() {
return configId;
}
public void setConfigId(Long configId) {
this.configId = configId;
}
public String getConfigName() {
return configName;
}
public void setConfigName(String configName) {
this.configName = configName;
}
public String getConfigDesc() {
return configDesc;
}
public void setConfigDesc(String configDesc) {
this.configDesc = configDesc;
}
public String getWsdlAddress() {
return wsdlAddress;
}
public void setWsdlAddress(String wsdlAddress) {
this.wsdlAddress = wsdlAddress;
}
public String getEndpointAddress() {
return endpointAddress;
}
public void setEndpointAddress(String endpointAddress) {
this.endpointAddress = endpointAddress;
}
}
\ No newline at end of file
package com.chinapay.mapper;
import com.chinapay.dto.HclcCupSignInfo;
import com.hand.app.esignHclc.dto.Lm005Hclc;
import com.hand.hap.mybatis.common.Mapper;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
public interface HclcCupSignInfoMapper extends Mapper<HclcCupSignInfo> {
}
package com.chinapay.mapper;
import com.chinapay.dto.HlsEbankCcbTransaction;
import com.hand.hap.mybatis.common.Mapper;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
public interface HlsEbankCcbTransactionMapper extends Mapper<HlsEbankCcbTransaction> {
}
package com.chinapay.mapper;
import com.chinapay.dto.HlsWsConfig;
import com.hand.hap.mybatis.common.Mapper;
/**
* Created with IntelliJ IDEA.
* User: lsy
* Date: 2020/2/24
* Time: 9:08
*/
public interface HlsWsConfigMapper extends Mapper<HlsWsConfig> {
}
package com.chinapay.service;
import com.alibaba.fastjson.JSONObject;
import com.chinapay.dto.HclcCupSignInfo;
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 IHclcChinaPayService extends IBaseService<HclcCupSignInfo>, ProxySelf<IHclcChinaPayService> {
JSONObject sendSignMessage(IRequest iRequest, JSONObject params);
JSONObject sendSign(IRequest iRequest, JSONObject params);
JSONObject uploadBatch(IRequest iRequest, JSONObject params);
JSONObject downloadBatch(IRequest iRequest, JSONObject params);
JSONObject queryBatch(IRequest iRequest, JSONObject params);
}
## Security properties configuration file
#the location of verify file
verify.file=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\cp_test.cer
#
sign.filePath=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\
#location of sign file
sign.file=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\000092112092486.pfx
#
sign.file.password=123456
#
sign.cert.type=PKCS12
#
sign.invalid.fields=Signature,CertId
#
signature.field=Signature
#
log4j.name=CONSOLE
This diff is collapsed.
This diff is collapsed.
...@@ -64,4 +64,11 @@ public class SignHclcListenController extends BaseController { ...@@ -64,4 +64,11 @@ public class SignHclcListenController extends BaseController {
responseData.put("name","黎双意"); responseData.put("name","黎双意");
return responseData; return responseData;
} }
@ResponseBody
@RequestMapping(value = "/api/public/china/send/sign/listen", method = RequestMethod.POST)
public JSONObject chinaSignListen(HttpServletRequest request) {
JSONObject responseData = new JSONObject();
return responseData;
}
} }
...@@ -80,6 +80,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -80,6 +80,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
private String listenSignUrl; private String listenSignUrl;
@Value("${tsign.api.signRedirectUrl}") @Value("${tsign.api.signRedirectUrl}")
private String signRedirectUrl; private String signRedirectUrl;
@Value("${tsign.face.api.url}")
private String faceApiUrl;
private CloseableHttpClient httpClient; private CloseableHttpClient httpClient;
...@@ -546,16 +548,18 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -546,16 +548,18 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
result.put("img", img); result.put("img", img);
JSONObject json = new JSONObject(result); JSONObject json = new JSONObject(result);
SignHclcUtils signHclcUtils = new SignHclcUtils(); SignHclcUtils signHclcUtils = new SignHclcUtils();
String tokenApiUrl = "https://smlopenapi.esign.cn/v1/oauth2/access_token"; //获取鉴权Token
this.logger.info("token url: {}", tokenApiUrl); //初始化接口密钥参数信息
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, "7438830952", "07e5a0e1bf7ff6891058c1f52b8e141b"); String tokenApiUrl = getApiUrl(indivSysName, tokenApiName);
logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, appId, secret);
Map<String, String> headInfo = new HashMap(); Map<String, String> headInfo = new HashMap();
headInfo.put("X-Tsign-Open-App-Id", "7438830952"); headInfo.put("X-Tsign-Open-App-Id", appId);
headInfo.put("X-Tsign-Open-Token", token); headInfo.put("X-Tsign-Open-Token", token);
JSONObject jsonResult = null; JSONObject jsonResult = null;
try { try {
String url = "https://smlopenapi.esign.cn/v2/identity/auth/api/ocr/idcard"; String url = faceApiUrl + "/v2/identity/auth/api/ocr/idcard";
this.logger.info("get ocr result url: {}", url); this.logger.info("get ocr result url: {}", url);
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, "application/json"); String stringResult = signHclcUtils1.postString(url, json, headInfo, "application/json");
...@@ -584,6 +588,51 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -584,6 +588,51 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
return resultjson; return resultjson;
} }
/***
* E签宝银行卡OCR;
* @param iRequest
* @param img 银行卡
***/
public JSONObject bankcard(IRequest iRequest, String img) {
JSONObject resultjson = new JSONObject();
JSONObject result = new JSONObject();
result.put("img", img);
JSONObject json = new JSONObject(result);
SignHclcUtils signHclcUtils = new SignHclcUtils();
String tokenApiUrl = getApiUrl(indivSysName, tokenApiName);
logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, appId, secret);
Map<String, String> headInfo = new HashMap();
headInfo.put("X-Tsign-Open-App-Id", appId);
headInfo.put("X-Tsign-Open-Token", token);
JSONObject jsonResult = null;
try {
String url = faceApiUrl + "/v2/identity/auth/api/ocr/bankcard";
this.logger.info("get ocr result url: {}", url);
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, "application/json");
jsonResult = JSONObject.parseObject(stringResult);
if ("0".equalsIgnoreCase(jsonResult.getString("code"))) {
JSONObject data = jsonResult.getJSONObject("data");
resultjson.put("银行卡号", data.getString("bankCardNo"));
resultjson.put("银行名称", data.getString("bankName"));
resultjson.put("code", "0");
resultjson.put("message", "e签宝银行卡OCR成功!");
} else {
this.logger.info("get ocr result failed, code:{} ,message:{}", jsonResult.getString("code"), jsonResult.getString("message"));
resultjson.put("code", jsonResult.getString("code"));
resultjson.put("message", "e签宝银行卡OCR失败," + jsonResult.getString("message"));
}
} catch (Exception var15) {
this.logger.info("get ocr result failed, msg:{}", var15.getMessage());
resultjson.put("code", "000006");
resultjson.put("message", "e签宝银行卡OCR失败," + var15.getMessage());
}
return resultjson;
}
/*** /***
* E签宝营业执照OCR; * E签宝营业执照OCR;
* @param iRequest * @param iRequest
...@@ -601,17 +650,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -601,17 +650,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
SignHclcUtils signHclcUtils = new SignHclcUtils(); SignHclcUtils signHclcUtils = new SignHclcUtils();
//获取鉴权Token //获取鉴权Token
// String tokenApiUrl = getApiUrl(indivSysName, tokenApiName); String tokenApiUrl = getApiUrl(indivSysName, tokenApiName);
String tokenApiUrl = "https://smlopenapi.esign.cn/v1/oauth2/access_token"; // String tokenApiUrl = "https://open.esign.cn/v1/oauth2/access_token";
logger.info("token url: {}", tokenApiUrl); logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, "7438830952", "07e5a0e1bf7ff6891058c1f52b8e141b"); // String token = signHclcUtils.getFaceApiToken(tokenApiUrl, "7438830952", "07e5a0e1bf7ff6891058c1f52b8e141b");
//初始化接口密钥参数信息 //初始化接口密钥参数信息
// String token = signHclcUtils.getFaceApiToken(tokenApiUrl, appId, secret); String token = signHclcUtils.getFaceApiToken(tokenApiUrl, appId, secret);
//设置http请求head信息 //设置http请求head信息
Map<String, String> headInfo = new HashMap<String, String>(); Map<String, String> headInfo = new HashMap<String, String>();
// headInfo.put("X-Tsign-Open-App-Id", appId); headInfo.put("X-Tsign-Open-App-Id", appId);
headInfo.put("X-Tsign-Open-App-Id", "7438830952"); // headInfo.put("X-Tsign-Open-App-Id", "7438830952");
headInfo.put("X-Tsign-Open-Token", token); headInfo.put("X-Tsign-Open-Token", token);
JSONObject jsonResult = null; JSONObject jsonResult = null;
...@@ -619,7 +668,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -619,7 +668,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
// String url = getApiUrl(indivSysName , getLicenseApiName); // String url = getApiUrl(indivSysName , getLicenseApiName);
String url = "https://smlopenapi.esign.cn/v2/identity/auth/api/ocr/license"; String url = faceApiUrl + "/v2/identity/auth/api/ocr/license";
logger.info("get ocr result url: {}", url); logger.info("get ocr result url: {}", url);
//发送http请求 //发送http请求
...@@ -703,9 +752,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -703,9 +752,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
SignHclcUtils signHclcUtils = new SignHclcUtils(); SignHclcUtils signHclcUtils = new SignHclcUtils();
String img; String img;
if ("app_file_id_card".equalsIgnoreCase(attachmentInfo.getSourceType())) { if ("app_file_id_card".equalsIgnoreCase(attachmentInfo.getSourceType())) {
// json = signHclcUtils.idcard(bytes); json = signHclcUtils.idcard(bytes);
img = Base64.encodeBase64String(bytes); // img = Base64.encodeBase64String(bytes);
json = this.idcard(iRequest, img); // json = this.idcard(iRequest, img);
} else if ("app_file_id_bank".equalsIgnoreCase(attachmentInfo.getSourceType())) {
json = signHclcUtils.bankcard(bytes);
// img = Base64.encodeBase64String(bytes);
// json = this.bankcard(iRequest, img);
} else { } else {
//营业执照 //营业执照
// json = signHclcUtils.businessLicense(bytes); // json = signHclcUtils.businessLicense(bytes);
......
...@@ -363,6 +363,29 @@ public class SignHclcUtils { ...@@ -363,6 +363,29 @@ public class SignHclcUtils {
return jsonObject; return jsonObject;
} }
/***
* orc银行卡识别;
* @param image
*/
public JSONObject bankcard(byte[] image) {
// 传入可选参数调用接口
AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);
HashMap<String, String> options = new HashMap<String, String>();
// 参数为本地图片路径
org.json.JSONObject res = client.bankcard(image, options);
JSONObject jsonObject = new JSONObject();
if (Objects.nonNull(res.get("result"))) {
jsonObject.put("bank_card_number",res.getJSONObject("result").getString("bank_card_number").replace(" ",""));
jsonObject.put("bank_name",res.getJSONObject("result").getString("bank_name"));
jsonObject.put("bank_card_type",res.getJSONObject("result").getLong("bank_card_type"));
}
logger.info("OCR身份证识别成功, result ={}", jsonObject.toString());
return jsonObject;
}
/*** /***
* 营业执照识别; * 营业执照识别;
* @param image * @param image
......
...@@ -139,3 +139,9 @@ face.check.enable=false ...@@ -139,3 +139,9 @@ face.check.enable=false
#金格电子合同配置文件地址 #金格电子合同配置文件地址
electronic.signature.path=/Volumes/work/idea/APIconfig electronic.signature.path=/Volumes/work/idea/APIconfig
#银联代扣
cup.mer.id=000092112092486
cup.upload.file.path=D:\\HCLC_FTP\\CUP_OUT\\
cup.download.file.path=D:\\HCLC_FTP\\CUP_IN\\
cup.init.file.path=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\
\ No newline at end of file
...@@ -46,6 +46,24 @@ ...@@ -46,6 +46,24 @@
<destination>elk-hap:4560</destination> <destination>elk-hap:4560</destination>
</appender> --> </appender> -->
<appender name="CUP-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-cup-${logName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/%d{yyyy-MM-dd}/hls-cup-${logName}.log</fileNamePattern>
</rollingPolicy>
</appender>
</sift>
</appender>
<root level="ERROR"> <root level="ERROR">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
...@@ -95,4 +113,10 @@ ...@@ -95,4 +113,10 @@
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="com.hand.app.zhongDengWang.mapper" level="DEBUG"/> <logger name="com.hand.app.zhongDengWang.mapper" level="DEBUG"/>
<logger name="com.chinapay.service.impl.HclcChinaPayServiceImpl" level="INFO" additivity="false">
<appender-ref ref="CUP-FILE"/>
</logger>
<logger name="com.chinapay.util.HttpUtils" level="INFO" additivity="false">
<appender-ref ref="CUP-FILE"/>
</logger>
</configuration> </configuration>
\ No newline at end of file
...@@ -145,3 +145,9 @@ zdw.login.clientKey=04593D186F5AB68871891C235A35ED90E6D5E8DC33414C89E05C29EBF5D1 ...@@ -145,3 +145,9 @@ zdw.login.clientKey=04593D186F5AB68871891C235A35ED90E6D5E8DC33414C89E05C29EBF5D1
zdw.login.userName=hclczhongdengwang1 zdw.login.userName=hclczhongdengwang1
zdw.login.password=zhongdengwang12345 zdw.login.password=zhongdengwang12345
zdw.login.authCode=7b7-f08f197fe2e5 zdw.login.authCode=7b7-f08f197fe2e5
#银联代扣
cup.mer.id=000092112092486
cup.upload.file.path=D:\\HCLC_FTP\\CUP_OUT\\
cup.download.file.path=D:\\HCLC_FTP\\CUP_IN\\
cup.init.file.path=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\
\ No newline at end of file
...@@ -139,3 +139,15 @@ face.check.enable=false ...@@ -139,3 +139,15 @@ face.check.enable=false
#金格电子合同配置文件地址 #金格电子合同配置文件地址
electronic.signature.path=/Volumes/work/idea/APIconfig electronic.signature.path=/Volumes/work/idea/APIconfig
#中登网
zdw.login.clientKey=04593D186F5AB68871891C235A35ED90E6D5E8DC33414C89E05C29EBF5D19C3919F0D1956568619BA138AC724F4E5DC730266C8186F610D8CC85BFC0748F899695
zdw.login.userName=hclc-hand
zdw.login.password=Pass20211221
zdw.login.authCode=bf4-7be3edba9a9b
#银联代扣
cup.mer.id=000092112092486
cup.upload.file.path=D:\\HCLC_FTP\\CUP_OUT\\
cup.download.file.path=D:\\HCLC_FTP\\CUP_IN\\
cup.init.file.path=F:\\work\\workspace\\IdeaProjects\\hls-support-rlwx\\key\\
\ No newline at end of file
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: qixiangyu
Created-By: Apache Maven 3.5.0
Build-Jdk: 1.8.0_131
#Generated by Apache Maven
#Fri Nov 17 15:00:12 CST 2017
version=3.3.1-RELEASE
groupId=com.hand
artifactId=hap
This diff is collapsed.
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