Commit ddd463b3 authored by 5359's avatar 5359

正式环境参数修改

parent 3df42561
...@@ -278,6 +278,15 @@ ...@@ -278,6 +278,15 @@
${project.basedir}/src/main/webapp/WEB-INF/lib/rfsp-api-1.6.jar ${project.basedir}/src/main/webapp/WEB-INF/lib/rfsp-api-1.6.jar
</systemPath> </systemPath>
</dependency> </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> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
......
...@@ -74,6 +74,12 @@ public class HlsEbankCcbTransaction extends BaseDTO { ...@@ -74,6 +74,12 @@ public class HlsEbankCcbTransaction extends BaseDTO {
private String userId; private String userId;
private String qrCode;
private String cmbOrderId;
private String txnTime;
public Long getTransactionId() { public Long getTransactionId() {
return transactionId; return transactionId;
} }
...@@ -249,4 +255,28 @@ public class HlsEbankCcbTransaction extends BaseDTO { ...@@ -249,4 +255,28 @@ public class HlsEbankCcbTransaction extends BaseDTO {
public void setUserId(String userId) { public void setUserId(String userId) {
this.userId = 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
/** /**
* Copyright (C), 2018-2021 * Copyright (C), 2018-2021
* FileName: HclcCupSignInfo * FileName: HclcCupSignInfo
* Author: lsy * Author: lsy
...@@ -26,7 +26,7 @@ import java.util.Date; ...@@ -26,7 +26,7 @@ import java.util.Date;
*/ */
@Table(name = "ld037") @Table(name = "ld037")
@ExtensionAttribute(disable = true) @ExtensionAttribute(disable = true)
public class Ld037{ public class Ld037 {
@Id @Id
@GeneratedValue @GeneratedValue
private Long id; private Long id;
...@@ -89,6 +89,12 @@ public class Ld037{ ...@@ -89,6 +89,12 @@ public class Ld037{
private Long num; private Long num;
private Date procdt;
private Date recdt;
private Date recbatchdt;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -328,4 +334,28 @@ public class Ld037{ ...@@ -328,4 +334,28 @@ public class Ld037{
public void setNum(Long num) { public void setNum(Long num) {
this.num = 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;
}
} }
\ No newline at end of file
package com.cmb.mapper;
import com.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);
}
...@@ -13,6 +13,8 @@ import com.cmb.util.SM2Util; ...@@ -13,6 +13,8 @@ import com.cmb.util.SM2Util;
import com.cmb.util.SignatureUtil; import com.cmb.util.SignatureUtil;
import com.cmb.util.Utils; import com.cmb.util.Utils;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.hand.app.zhongDengWang.dto.HlsWsRequests;
import com.hand.app.zhongDengWang.mapper.HlsWsRequestsMapper;
import com.hand.hap.core.IRequest; import com.hand.hap.core.IRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -37,6 +39,18 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -37,6 +39,18 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
public static final String appId = "8ab74856-8772-45c9-96db-54cb30ab9f74"; public static final String appId = "8ab74856-8772-45c9-96db-54cb30ab9f74";
public static final String appSecret = "5b96f20a-011f-4254-8be8-9a5ceb2f317f"; public static final String appSecret = "5b96f20a-011f-4254-8be8-9a5ceb2f317f";
/*接口区分*/
public static final String getQrCode = "GET_QR_CODE";
/*代扣交易状态*/
public static final String transNew = "NEW";
public static final String transDeal = "DEAL";
public static final String transFail = "FAIL";
/*交易结果状态*/
public static final String cmbSuccess = "SUCCESS";
public static final String cmbFail = "FAIL";
@Value("${cmb.version}") @Value("${cmb.version}")
private String version; private String version;
@Value("${cmb.encoding}") @Value("${cmb.encoding}")
...@@ -51,12 +65,15 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -51,12 +65,15 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
@Autowired @Autowired
private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper; private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper;
@Autowired @Autowired
private HlsWsRequestsMapper hlsWsRequestsMapper;
@Autowired
private Ld037Mapper ld037Mapper; private Ld037Mapper ld037Mapper;
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@Override @Override
public JSONObject getQrcode(IRequest iRequest, JSONObject params) { public JSONObject getQrcode(IRequest iRequest, JSONObject params) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
String resultType = null;
if (Objects.isNull(params.get("recamt_id"))) { if (Objects.isNull(params.get("recamt_id"))) {
result.put(Constants.RESP_CODE, "E"); result.put(Constants.RESP_CODE, "E");
...@@ -76,9 +93,12 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -76,9 +93,12 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
String signResult = getQrRequestParams(hlsEbankCcbTransaction); String signResult = getQrRequestParams(hlsEbankCcbTransaction);
if (Objects.isNull(signResult)) { if (Objects.isNull(signResult)) {
result.put(Constants.RESP_CODE, "E"); result.put(Constants.RESP_CODE, "E");
result.put("respMsg", "收款码申请加签发生异常,请检查!"); result.put(Constants.RESP_MSG, "收款码申请加签发生异常,请检查!");
return result; return result;
} }
Map<String, String> response = null;
try { try {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
Map<String, String> signResultMap = mapper.readValue(signResult, Map.class); Map<String, String> signResultMap = mapper.readValue(signResult, Map.class);
...@@ -101,8 +121,70 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -101,8 +121,70 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
apiHeader.put("timestamp", "" + currentTimeMills); apiHeader.put("timestamp", "" + currentTimeMills);
apiHeader.put("apisign", apiSignString); apiHeader.put("apisign", apiSignString);
// 发送HTTP post请求 //初始化日志
Map<String, String> response = Utils.postForEntity(url, signResult, apiHeader); HlsWsRequests hlsWsRequests = logInterfaceRequest(getQrCode, url, mapper.writeValueAsString(apiHeader), hlsEbankCcbTransaction.getTransactionId());
logger.info("发送收款码申请请求,请求参数: {}", mapper.writeValueAsString(apiHeader));
try {
// 发送HTTP post请求
response = Utils.postForEntity(url, signResult, apiHeader);
//处理接口日志
logger.info("收款码申请返回结果:" + mapper.writeValueAsString(response));
hlsWsRequests.setResponseClob(mapper.writeValueAsString(response));
hlsWsRequests.setReturnStatus("S");
hlsWsRequests.setResponsedDate(new Date());
// 返回结果验签,验证数据的正确性(安全性)
Boolean checkResult1 = checkSign(mapper.writeValueAsString(response));
//数据验签成功
if (checkResult1) {
//获取返回码,返回码不为SUCCESS表示报文内的字段不符合规范
String returnCode = response.get("returnCode");
if ("SUCCESS".equalsIgnoreCase(returnCode)) {
//响应码
String respCode = response.get("returnCode");
if ("SUCCESS".equalsIgnoreCase(respCode)) {
resultType = "1";
} else {
resultType = "2";
}
} else {
resultType = "3";
}
if (!"1".equalsIgnoreCase(resultType)) {
//更新现金事务表ld037失败处理
updateLd037Fail(ld037, response.get("errCode"));
}
}
//数据验签失败
else {
//更新现金事务表ld037失败处理
updateLd037Fail(ld037, "SIGN_ERROR");
//直接返回前端验签失败信息,重发或者直接告诉前端发送失败
resultType = "4";
}
} catch (Exception e) {
e.printStackTrace();
logger.info("发送请求异常: {} ", e.getMessage());
//更新现金事务表ld037失败处理
updateLd037Fail(ld037, "SEND_ERROR");
//处理接口日志
hlsWsRequests.setReturnStatus("E");
hlsWsRequests.setResponsedDate(new Date());
//请求批次事务表状态更新失败处理
hlsEbankCcbTransaction.setReturnMsg(e.getMessage());
result.put(Constants.RESP_MSG, "发送请求异常:" + e.getMessage());
resultType = "5";
}
hlsWsRequestsMapper.updateByPrimaryKeySelective(hlsWsRequests);
/* /*
版本号 version String(5) 是 固定为0.0.1 版本号 version String(5) 是 固定为0.0.1
编码方式 encoding String(20) 是 固定为UTF-8 编码方式 encoding String(20) 是 固定为UTF-8
...@@ -121,27 +203,99 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -121,27 +203,99 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
错误码 errCode String(32) 是 请求处理失败的错误码信息 错误码 errCode String(32) 是 请求处理失败的错误码信息
应答信息 respMsg String(256) 是 请求处理失败的详细描述信息 应答信息 respMsg String(256) 是 请求处理失败的详细描述信息
*/ */
} catch (Exception e) {
e.printStackTrace();
logger.info("组装请求报文信息失败: {} ", e.getMessage());
logger.info("收款码申请返回结果:" + mapper.writeValueAsString(response)); //更新现金事务表ld037失败处理
updateLd037Fail(ld037, "MESSAGE_ERROR");
// 返回结果验签,验证数据的正确性(安全性) //请求批次事务表状态更新失败处理
Boolean checkResult1 = checkSign(mapper.writeValueAsString(response)); hlsEbankCcbTransaction.setReturnMsg("组装请求报文信息失败:" + e.getMessage());
if (!checkResult1) { result.put(Constants.RESP_MSG, "组装请求报文信息失败:" + e.getMessage());
//数据验签失败的处理,重发或者直接告诉前端发送失败
result.put("respCode", response.get("errCode")); resultType = "5";
} }
//获取响应结果内容
String success = response.get("returnCode"); setEbankTransaction(hlsEbankCcbTransaction, response, resultType);
System.out.println("返回结果:" + success); hlsEbankCcbTransactionMapper.updateByPrimaryKeySelective(hlsEbankCcbTransaction);
result = putResult(result, response, resultType);
return result;
}
private JSONObject putResult(JSONObject result, Map<String, String> response, String type) {
//接口请求成功
if ("1".equalsIgnoreCase(type)) {
result.put(Constants.RESP_CODE, response.get("returnCode"));
result.put(Constants.RESP_MSG, "请求成功");
result.put("qrcode", response.get("qrcode")); result.put("qrcode", response.get("qrcode"));
result.put("respMsg", response.get("respMsg")); result.put("cmborderid", response.get("cmbOrderId"));
//业务数据的封装。。。 result.put("txnTime", response.get("txnTime"));
return result; }
} catch (Exception e) { //接口返回成功,响应失败
e.printStackTrace(); else if ("2".equalsIgnoreCase(type)) {
result.put("respCode", "服务器问题"); result.put(Constants.RESP_CODE, response.get("errCode"));
return result; result.put(Constants.RESP_MSG, response.get("respMsg"));
}
//接口返回失败
else if ("3".equalsIgnoreCase(type)) {
result.put(Constants.RESP_CODE, response.get("errCode"));
result.put(Constants.RESP_MSG, response.get("respMsg"));
}
//验签失败
else if ("4".equalsIgnoreCase(type)) {
result.put(Constants.RESP_CODE, cmbFail);
result.put(Constants.RESP_MSG, "验签失败,请检查!");
}
//组装请求报文信息失败
else if ("5".equalsIgnoreCase(type)) {
result.put(Constants.RESP_CODE, cmbFail);
}
return result;
}
private HlsEbankCcbTransaction setEbankTransaction(HlsEbankCcbTransaction hlsEbankCcbTransaction, Map<String, String> response, String type) {
//接口请求成功
if ("1".equalsIgnoreCase(type)) {
hlsEbankCcbTransaction.setStatus(transDeal);
hlsEbankCcbTransaction.setQrCode(response.get("qrCode"));
hlsEbankCcbTransaction.setCmbOrderId(response.get("cmbOrderId"));
hlsEbankCcbTransaction.setTxnTime(response.get("txnTime"));
}
//接口返回成功,响应失败
else if ("2".equalsIgnoreCase(type)) {
hlsEbankCcbTransaction.setStatus(transFail);
hlsEbankCcbTransaction.setReturnCode(response.get("errCode"));
hlsEbankCcbTransaction.setReturnMsg(response.get("respMsg"));
hlsEbankCcbTransaction.setOrderStatus("0000");
}
//接口返回失败
else if ("3".equalsIgnoreCase(type)) {
hlsEbankCcbTransaction.setStatus(transFail);
hlsEbankCcbTransaction.setReturnCode(response.get("errCode"));
hlsEbankCcbTransaction.setReturnMsg(response.get("respMsg"));
hlsEbankCcbTransaction.setOrderStatus("0003");
}
//验签失败
else if ("4".equalsIgnoreCase(type)) {
hlsEbankCcbTransaction.setStatus(transFail);
hlsEbankCcbTransaction.setReturnCode("SIGN_ERROR");
hlsEbankCcbTransaction.setReturnMsg("接口请求验签失败");
hlsEbankCcbTransaction.setOrderStatus("0003");
}
//组装请求报文信息失败
else if ("5".equalsIgnoreCase(type)) {
hlsEbankCcbTransaction.setStatus(transFail);
hlsEbankCcbTransaction.setReturnCode("SEND_ERROR");
hlsEbankCcbTransaction.setOrderStatus("0003");
} }
return hlsEbankCcbTransaction;
}
private void updateLd037Fail(Ld037 ld037, String errorCd) {
ld037.setErrorcd(errorCd);
ld037Mapper.updateLd037Fail(ld037);
} }
//生成招行扫码交易业务批次数据 //生成招行扫码交易业务批次数据
...@@ -150,7 +304,7 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -150,7 +304,7 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
ccbTransaction.setMerId("3089991701201D0"); ccbTransaction.setMerId("3089991701201D0");
ccbTransaction.setVersion("0.0.1"); ccbTransaction.setVersion("0.0.1");
ccbTransaction.setUserId("N003574551"); ccbTransaction.setUserId("N003574551");
ccbTransaction.setStatus("NEW"); ccbTransaction.setStatus(transNew);
ccbTransaction.setBankType("CMB"); ccbTransaction.setBankType("CMB");
ccbTransaction.setCount(1L); ccbTransaction.setCount(1L);
ccbTransaction.setAmount(ld037.getAmount()); ccbTransaction.setAmount(ld037.getAmount());
...@@ -265,4 +419,34 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService { ...@@ -265,4 +419,34 @@ public class HclcCmbPolyServiceImpl implements HclcCmbPolyService {
return null; return null;
} }
public HlsWsRequests logInterfaceRequest(String functionName, String url, String request, Long pkValue) {
HlsWsRequests hlsWsRequests = new HlsWsRequests();
hlsWsRequests.setRequestDate(new Date());
hlsWsRequests.setRequestWsdlUrl(url);
hlsWsRequests.setFunctionName(functionName);
String tableName = getTableName(functionName);
hlsWsRequests.setTableName(tableName);
hlsWsRequests.setStatusCode("1");
hlsWsRequests.setStatusDate(new Date());
hlsWsRequests.setPkValue(pkValue);
hlsWsRequests.setRequestClob(request);
hlsWsRequestsMapper.insertSelective(hlsWsRequests);
return hlsWsRequests;
}
private String getTableName(String functionName) {
String tableName = "";
if ("GET_QR_CODE".equalsIgnoreCase(functionName)) {
tableName = "HLS_EBANK_CCB_TRANSACTION";
} else if ("QUERY_PAY_RESULT".equalsIgnoreCase(functionName)) {
tableName = "HLS_EBANK_CMB_QUERY";
}
return tableName;
}
} }
<?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.cmb.mapper.Ld037Mapper">
<!--获取角色下的模块-->
<resultMap id="AppLd037Map" type="com.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.cmb.dto.Ld037">
UPDATE LD037
SET LD037.ProcDt = sysdate, /*文件处理日期*/
LD037.RecDt = sysdate, /*文件返回系统日期*/
LD037.RecBatchDt = sysdate, /*文件返回批处理日期*/
LD037.ReceiptStatus = '0', /*扣款成功与否状态*/
LD037.ReceiptCfmStatus = '1', /*扣款结果信息确认状态*/
LD037.ERRORMSG = (select h.description from hls_ebank_cmb_recode h where h.code=#{errorcd}), /*错误代码*/
LD037.ErrorCd = #{errorcd}, /*错误信息*/
LD037.UPDATEDDT = SYSDATE, /*更新日期*/
LD037.UPDATEDPERSON = 'CMB', /*更新者*/
LD037.Actdbtamount = 0 /* 实际扣款金额 */
WHERE LD037.id = #{id};
</update>
</mapper>
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