Commit 690960df authored by fangxinjiang's avatar fangxinjiang

交行jar引入及开发demo-fxj

parent d11d7495
......@@ -101,7 +101,7 @@
<version>1.2.0</version>
</dependency>
<!-- 交行jar引入 -->
<!--<dependency>
<dependency>
<groupId>com.ipct.safety</groupId>
<artifactId>ipct_safety</artifactId>
<version>2.1.1</version>
......@@ -110,6 +110,6 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.5.8</version>
</dependency>-->
</dependency>
</dependencies>
</project>
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.controller;
import com.yifu.cloud.plus.v1.ekp.util.IpctUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/ekpIpct")
@Tag(name = "预警配置表管理")
public class EkpIpctController {
@Autowired
private IpctUtil ipctUtil;
/**
* @Author fxj
* @Description 企业微信智能表格API调用调试入口
* @Date 15:56 2025/9/26
* @Param
* @return
**/
@PostMapping("/tesxIpctApi")
public void tesxIpctApi() {
try {
/**
* 第一步,调用ipct_safety包中的SM2类中的SM2Generate方法,将方法返回的公私钥对保存
* custId为云跨行客户号,由交行提供
*
*
* 私钥:MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgT9IzBq591GocYT7bxZPSW5S4xDLmeLG8zklsciINlT2gCgYIKoEcz1UBgi2hRANCAASaA0BYV6o6yMPKNl8DL0n4s9yV0e3Yzbh5D4ChG8ejGSDSPXmvUXJ6xgK61LH1N+Ns7dcPUtMvfWjIxxbIppaT
* 公钥:MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEmgNAWFeqOsjDyjZfAy9J+LPcldHt2M24eQ+AoRvHoxkg0j15r1FyesYCutSx9TfjbO3XD1LTL31oyMcWyKaWkw==
*/
//已获取公钥私钥这里直接注释
//ipctUtil.SM2Generate(ipctUtil.getCustId());
/**
* 第二步,请求交换密钥申请接口获取授权码。该操作仅系统第一次对接时需要进行,发送请求后需联系客户的云跨行管理员
* 在外部系统登记-授权码管理菜单中进行授权
* 参数系统名称sysNme与系统id sysId为客户云跨行管理员在外部系统登记-外部系统管理菜单中创建
*/
//ipctUtil.insertAuthCode(ipctUtil.getSysName(), ipctUtil.getSysId());
/**
* 第三步,交换非对称密钥对公钥,企业端上送第一步生成的公钥,银行端返回银行的公钥与对称密钥
* 调用ipct_safety包中的SM4类中的encryptErpSm4方法,对上送的公钥进行加密
* 再调用ipct_safety包中的SecretUtils类中的encrytErpSM4对报文体进行加密
*/
String publicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEmgNAWFeqOsjDyjZfAy9J+LPcldHt2M24eQ+AoRvHoxkg0j15r1FyesYCutSx9TfjbO3XD1LTL31oyMcWyKaWkw==";
String authCode = "SW94B7ZP492J";
//ipctUtil.erpPubKeyChange(ipctUtil.getCustId(), publicKey, authCode);
//云跨行公钥及新对称密钥
String sm2PublicKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEqqyqhXLF/DEw6GhVc6MhGnrwBFwVL0n7ck3eh2hGqzBt1qMJ8X0Yfk+WRg+1ttebTkEshrGC5VIxF0HBdOQ54A==";//云跨行公钥
String erpNewSymmetryKey = "OTNCVDNQWVo2VjA5";//新对称密钥
//云跨行公钥:MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEqqyqhXLF/DEw6GhVc6MhGnrwBFwVL0n7ck3eh2hGqzBt1qMJ8X0Yfk+WRg+1ttebTkEshrGC5VIxF0HBdOQ54A==
//新对称密钥:OTNCVDNQWVo2VjA5
/**
* 第四步,调用系统登录接口进行登录,该操作每个自然日均需要进行,若不登录则无法进行业务交易
*/
//ipctUtil.erpLogin();
/**
* 第五步,调用业务接口
* 组装报文体后,需将报文体调用ipct_safety包中的SecretUtils类中的erpEncryptAndSign方法对报文体进行加密
* 收到返回报文后,需将响应体调用ipct_safety包中的SecretUtils类中的erpDecryptAndVerify方法对报文体进行解密
* @throws Exception
*/
Map stdReqBody = new HashMap();
stdReqBody.put("busNum", "12340");
stdReqBody.put("bsnId", "1");
stdReqBody.put("startDate", "2042-11-16");
stdReqBody.put("endDate", "2042-11-16");
stdReqBody.put("bankCd", "");
stdReqBody.put("acctNo", "");
stdReqBody.put("acctNoNme", "");
stdReqBody.put("debitCdtFlg", "");
stdReqBody.put("summary", "");
stdReqBody.put("amtSort", "");
stdReqBody.put("pageSize", 10);
stdReqBody.put("currentPage", 1);
//客户私钥:
//当日明细查询 erpNewSymmetryKey:新对称密钥, sm2PrivateKey:客户方的私钥, publicKey:云跨行公钥 trCode:业务接口编号 参考交行文档
String sm2PrivateKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgT9IzBq591GocYT7bxZPSW5S4xDLmeLG8zklsciINlT2gCgYIKoEcz1UBgi2hRANCAASaA0BYV6o6yMPKNl8DL0n4s9yV0e3Yzbh5D4ChG8ejGSDSPXmvUXJ6xgK61LH1N+Ns7dcPUtMvfWjIxxbIppaT";
ipctUtil.erpRequest("C010100001", erpNewSymmetryKey, sm2PrivateKey, publicKey, stdReqBody);
}catch (Exception e){
e.printStackTrace();
}
}
}
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