Commit c8ca3e8f authored by huyuchen's avatar huyuchen

工行对接修改

parent 0068671f
......@@ -179,9 +179,9 @@
if(sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)) > 0,1,0) as IS_COMPLETE,
sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)) as INCOMPLETE_NUM,
concat(ROUND((sum(if(PROJECT_STATUS = 0,1,0)) - sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)))*100/sum(if(PROJECT_STATUS = 0,1,0)),2),'%') as COMPLETE_PER,
sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01',1,0)) as AFTER_EMPLOYMENT,
if(sum(if((PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01' and IS_COMPLETE = '0') or '2024-05-01' > DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') or PROJECT_STATUS = 1,0,1)) > 0,1,0) AFTER_IS_COMPLETE,
sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01' and IS_COMPLETE = '1',1,0)) as AFTER_INCOMPLETE_NUM
sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-09-01',1,0)) as AFTER_EMPLOYMENT,
if(sum(if((PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-09-01' and IS_COMPLETE = '0') or '2024-09-01' > DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') or PROJECT_STATUS = 1,0,1)) > 0,1,0) AFTER_IS_COMPLETE,
sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-09-01' and IS_COMPLETE = '1',1,0)) as AFTER_INCOMPLETE_NUM
from t_employee_project where DELETE_FLAG = '0' and PROJECT_STATUS = 0 group by DEPT_NO) a on a.DEPT_NO = b.DEPART_NO
where b.DELETE_FLAG = '0'
<if test="deptNo != null and deptNo.trim() != ''">
......
package com.yifu.cloud.plus.v1.ekp.vo;
import lombok.Data;
/**
* @author huych
* @description 入账明细推送
* @date 2024-08-23 16:31:15
*/
@Data
public class EKPEntryPushParam {
/**
* 来款单位
*/
private String fd_3aa453180cc7f0;
/**
* 来款银行账号
*/
private String fd_3aa4531865bada;
/**
* 是否银企直连读取
*/
private String fd_3b57f8de9df354;
/**
* 来款单位开户行名
*/
private String fd_3b88c420e5ca80;
/**
* 入账日期
*/
private String fd_3aa4531d3b86e0;
/**
* 到款单位
*/
private String fd_3aa45319a4cde4;
/**
* 到款银行账号
*/
private String fd_3b62f3470beb30;
/**
* 财务备注
*/
private String fd_3b1b88110cb39e;
/**
* 入账金额
*/
private String fd_3b208d364c2b70;
/**
* 入账日期(精确)
*/
private String fd_3cddecabdd3dc0;
/**
* 数据同步时间
*/
private String fd_3aa4531c687958;
/**
* 系统交易流水号
*/
private String fd_3b573843db30ce;
}
//package com.yifu.cloud.plus.v1.ekp.controller;
//
//import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowIssueService;
//import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import lombok.RequiredArgsConstructor;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 聚富通代发工资相关
// *
// * @author huyc
// * @date 2024-05-23 10:24:12
// */
//@RestController
//@RequiredArgsConstructor
//@RequestMapping("/icbcIssue" )
//@Tag(name = "聚富通代发工资相关")
//public class IcbcTransactionFlowIssueController {
//
// private final IcbcTransactionFlowIssueService icbcTransactionFlowIssueService;
//
// /**
// * 聚富通代发工资确认提交
// *
// * @param
// * @param
// * @return
// */
// @Operation(summary = "聚富通代发工资确认提交接口", description = "聚富通代发工资确认提交接口")
// @PostMapping("/submit")
// public R submitIcbcTransactionFlow() {
// return icbcTransactionFlowIssueService.submitIcbcTransactionFlow();
// }
//
// /**
// * 代发工资明细查询
// *
// * @param
// * @param
// * @return
// */
// @Operation(summary = "代发工资明细查询", description = "代发工资明细查询")
// @PostMapping("/page")
// public R selectIcbcTransactionFlowInfo() {
// return icbcTransactionFlowIssueService.selectIcbcTransactionFlowInfo();
// }
//}
package com.yifu.cloud.plus.v1.ekp.controller;
import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowIssueService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* 聚富通代发工资相关
*
* @author huyc
* @date 2024-05-23 10:24:12
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/icbcIssue" )
@Tag(name = "聚富通代发工资相关")
public class IcbcTransactionFlowIssueController {
private final IcbcTransactionFlowIssueService icbcTransactionFlowIssueService;
/**
* 聚富通代发工资确认提交
*
* @param
* @param
* @return
*/
@Operation(summary = "聚富通代发工资确认提交接口", description = "聚富通代发工资确认提交接口")
@PostMapping("/submit")
public R submitIcbcTransactionFlow() {
return icbcTransactionFlowIssueService.submitIcbcTransactionFlow();
}
/**
* 代发工资明细查询
*
* @param
* @param
* @return
*/
@Operation(summary = "代发工资明细查询", description = "代发工资明细查询")
@PostMapping("/page")
public R selectIcbcTransactionFlowInfo() {
return icbcTransactionFlowIssueService.selectIcbcTransactionFlowInfo();
}
/**
* 企业会员用户绑定管家卡
*
* @param
* @param
* @return
*/
@Operation(summary = "企业会员用户绑定管家卡", description = "企业会员用户绑定管家卡")
@PostMapping("/business")
public R businessOpen() {
return icbcTransactionFlowIssueService.businessOpen();
}
/**
* 代发工资发放成功异步通知功能
*
* @param
* @param
* @return
*/
@Operation(summary = "代发工资发放成功异步通知功能", description = "代发工资发放成功异步通知功能")
@PostMapping("/notifyUrl")
public R asyncNotice(HttpServletRequest request) throws Exception {
return icbcTransactionFlowIssueService.asyncNotice(request);
}
}
package com.yifu.cloud.plus.v1.ekp.controller;
import com.icbc.api.IcbcApiException;
import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowQueryService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
......@@ -35,6 +36,18 @@ public class IcbcTransactionFlowQueryController {
return icbcTransactionFlowQueryService.getIcbcTransactionFlow();
}
/**
* 交易流水查询
*
* @param
* @return
*/
@Operation(summary = "交易流水查询", description = "交易流水查询")
@PostMapping("/newPage")
public R getIcbcTransactionFlowNew() throws IcbcApiException {
return icbcTransactionFlowQueryService.getIcbcTransactionFlowNew();
}
/**
* 预订单接口
*
......@@ -46,4 +59,18 @@ public class IcbcTransactionFlowQueryController {
public R saveIcbcManagerCard() {
return icbcTransactionFlowQueryService.saveIcbcManagerCard();
}
/**
* 行名行号查询接口
*
* @param
* @param
* @return
*/
@Operation(summary = "行名行号查询接口", description = "行名行号查询接口")
@PostMapping("/querybankinfo")
public R querybankinfo() {
return icbcTransactionFlowQueryService.querybankinfo();
}
}
......@@ -33,4 +33,11 @@ public interface EkpSocialInfoMapper extends BaseMapper<EkpSocialInfo> {
EkpSocialSumInfoVo getCostSumInfo(@Param("card") String empIdCard, @Param("month") String createMonth);
void updateSocialStatus(@Param("sql") String sql);
/**
* 获取所有当天的到账明细的交易流水号
* @param
* @return
*/
List<String> getAllserioNo();
}
//package com.yifu.cloud.plus.v1.ekp.service;
//
//import com.baomidou.mybatisplus.extension.service.IService;
//import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
//import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
//
///**
// * 聚富通代发工资相关
// *
// * @author huyc
// * @date 2024-05-24 10:55:24
// */
//public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo> {
//
// R submitIcbcTransactionFlow();
//
// R selectIcbcTransactionFlowInfo();
//
//}
package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletRequest;
/**
* 聚富通代发工资相关
*
* @author huyc
* @date 2024-05-24 10:55:24
*/
public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo> {
R submitIcbcTransactionFlow();
R selectIcbcTransactionFlowInfo();
R businessOpen();
R asyncNotice(HttpServletRequest request) throws Exception;
}
package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.icbc.api.IcbcApiException;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -14,6 +15,10 @@ public interface IcbcTransactionFlowQueryService extends IService<EkpSocialInfo>
R getIcbcTransactionFlow();
R getIcbcTransactionFlowNew() throws IcbcApiException;
R saveIcbcManagerCard();
R querybankinfo();
}
//package com.yifu.cloud.plus.v1.ekp.service.impl;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.icbc.api.DefaultIcbcClient;
//import com.icbc.api.IcbcApiException;
//import com.icbc.api.IcbcConstants;
//import com.icbc.api.UiIcbcClient;
//import com.icbc.api.request.JftApiPayrollQueryDetailRequestV1;
//import com.icbc.api.request.JftUiPayrollComfirmSubmitRequestV1;
//import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1;
//import com.yifu.cloud.plus.v1.ekp.config.IcbcConfigProperties;
//import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
//import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
//import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowIssueService;
//import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
//import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.log4j.Log4j2;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.stereotype.Service;
//
//import java.io.FileInputStream;
//import java.io.IOException;
//import java.security.MessageDigest;
//import java.security.NoSuchAlgorithmException;
//
///**
// * 聚富通到账通知交易流水查询
// *
// * @author huyc
// * @date 2024-05-23 11:21:56
// */
//@Log4j2
//@Service
//@RequiredArgsConstructor
//@EnableConfigurationProperties(IcbcConfigProperties.class)
//public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialInfoMapper, EkpSocialInfo> implements IcbcTransactionFlowIssueService {
//
// @Autowired
// private IcbcConfigProperties icbcConfigProperties;
//
// public R submitIcbcTransactionFlow() {
//
// UiIcbcClient client = new UiIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_RSA2, icbcConfigProperties.getAppPrivateKey(),
// IcbcConstants.CHARSET_UTF8);
// JftUiPayrollComfirmSubmitRequestV1 request = new JftUiPayrollComfirmSubmitRequestV1();
// request.setServiceUrl("https://apipcs3.dccnet.com.cn/ui/jft/ui/payroll/comfirmsubmit/V1");
// JftUiPayrollComfirmSubmitRequestV1.JjftUiPayrolComfirmSubmitRequestV1BizV1 bizContent =
// new JftUiPayrollComfirmSubmitRequestV1.JjftUiPayrolComfirmSubmitRequestV1BizV1();
// bizContent.setAppId(icbcConfigProperties.getAppId());
// //HR系统名称
// bizContent.setAppName("HRO");
// //企业编号
// bizContent.setOutVendorId(icbcConfigProperties.getCompanyNo());
// //操作类型:1-受理 2-审核
// bizContent.setOprType("1");
// bizContent.setTotalAmt("1000");
// bizContent.setTotalCount("1");
// bizContent.setAppSerialno("21900");
// bizContent.setLocalFilepath("D:/icbcFile/955888_21900_0_20240524.xls");
// bizContent.setFileMdcode(getMdCode("D:/icbcFile/955888_21900_0_20240524.xls"));
// bizContent.setFileType("1");
// bizContent.setNotifyUrl(null);
// bizContent.setAppRemark("备注");
// bizContent.setBusinessType(null);
// bizContent.setFileCheckSign(null);
// request.setBizContent(bizContent);
// try {
// String result = client.buildPostForm(request);
// if (Common.isNotNull(result)) {
// return R.ok();
// }
// } catch (IcbcApiException e) {
// e.printStackTrace();
// return R.failed();
// }
// return R.ok();
// }
//
// public R selectIcbcTransactionFlowInfo() {
//
// DefaultIcbcClient client = new DefaultIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_RSA2,
// icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON,
// icbcConfigProperties.getApigwPublicKey(), IcbcConstants.ENCRYPT_TYPE_AES, icbcConfigProperties.getAesKey(), null, null);
// JftApiPayrollQueryDetailRequestV1 request = new JftApiPayrollQueryDetailRequestV1();
// request.setServiceUrl("https://apipcs3.dccnet.com.cn/api/jft/api/payroll/querydetail/V1");
// JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz bizContent = new
// JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz();
// bizContent.setAppId(icbcConfigProperties.getAppId());
// bizContent.setOutVendorId(icbcConfigProperties.getCompanyNo());
// bizContent.setType("2");
// //批次号,appSerialno为空时,必输
// bizContent.setAppBatserialno("21900");
// //内部批次号,组成规则:批次号-顺序号,appBatserialno为空时必输
//// bizContent.setAppSerialno("230921");
// bizContent.setStartId("0");
// bizContent.setEndId("10");
// request.setBizContent(bizContent);
// try {
// JftApiPayrollQueryDetailResponseV1 responseV1 = client.execute(request);
// if (Common.isNotNull(responseV1)) {
// return R.ok();
// }
// } catch (IcbcApiException e) {
// e.printStackTrace();
// return R.failed();
// }
// return R.ok();
// }
//
// public String getMdCode(String filePath) {
// try {
// MessageDigest md5Digest = MessageDigest.getInstance("MD5");
// byte[] buffer = new byte[8192];
//
// try (FileInputStream fis = new FileInputStream(filePath)) {
// int bytesRead;
// while ((bytesRead = fis.read(buffer)) != -1) {
// md5Digest.update(buffer, 0, bytesRead);
// }
// }
// byte[] md5Bytes = md5Digest.digest();
//
// // Convert the byte to hex format
// StringBuilder result = new StringBuilder();
// for (byte md5Byte : md5Bytes) {
// result.append(Integer.toString((md5Byte & 0xff) + 0x100, 16).substring(1));
// }
//
// return result.toString();
// } catch (NoSuchAlgorithmException | IOException e) {
// //Handle the exception according to your requirements
// e.printStackTrace();
// return null;
// }
// }
//
//}
package com.yifu.cloud.plus.v1.ekp.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.icbc.api.DefaultIcbcClient;
import com.icbc.api.IcbcApiException;
import com.icbc.api.IcbcConstants;
import com.icbc.api.UiIcbcClient;
import com.icbc.api.request.JftApiPayrollQueryDetailRequestV1;
import com.icbc.api.request.JftApiVendorSeparateAccountsBusinessOpenRequestV1;
import com.icbc.api.request.JftUiPayrollComfirmSubmitRequestV1;
import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1;
import com.icbc.api.response.JftApiVendorSeparateAccountsBusinessOpenResponseV1;
import com.icbc.api.utils.IcbcSignature;
import com.icbc.api.utils.WebUtils;
import com.yifu.cloud.plus.v1.ekp.config.IcbcConfigProperties;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowIssueService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 聚富通到账通知交易流水查询
*
* @author huyc
* @date 2024-05-23 11:21:56
*/
@Log4j2
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties(IcbcConfigProperties.class)
public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialInfoMapper, EkpSocialInfo> implements IcbcTransactionFlowIssueService {
@Autowired
private IcbcConfigProperties icbcConfigProperties;
//1、网关公钥
private static final String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
//2、appid
private static final String APP_ID = "11000000000000028685";
//3、密钥对认证方式,公钥在API平台登记,此处为私钥
private static final String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEZYrhm3dBp3PqlMc9fBBEE8Tp8M34Yy6Ucs3FV/VahsdHaLe0kEPugf1twbt/hD4hdIwzUj/ZtG2BhusRiMptdlWtNKcIgFxaaFaKANKrIodeQjv0jjZvK9ugoQxmiM4gF5SGX2a847zohv/6TvAYiB9AI3tdKQTbj6I3pwmuO3cfzgU5IwepeguE4fxqnh7C19MEq4vXv0yBq/f43zQ2HBMS+KRgokNLUBqoEOyfaKkPL9ot+zISPwENQOLqQMZ1hczp5tEB2FeZecdzrzjeXkzPSy1ZJmNyNuOl+WG85aoeDJTQ7hx/g6KFA6z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2/fVV/PDUVCAA+aeWstojR1ncDhJmFnENSk5I/y3mh+d+u4ZG3hmVQZfR1EYM+n9wPQ2LxqNpGPA8o4JK/MSfVKun4lBwjkergHzxWJ5AMuYL1DPrOtMPEqrTqOHfVzSZGsz9cMK4tDWETKKFBOM/5oSdGGW3oYvzcS0M=";
public R submitIcbcTransactionFlow() {
//应用方加密串
UiIcbcClient client = new UiIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8);
JftUiPayrollComfirmSubmitRequestV1 request = new JftUiPayrollComfirmSubmitRequestV1();
request.setServiceUrl("https://gw.open.icbc.com.cn/ui/jft/ui/payroll/comfirmsubmit/V1");
JftUiPayrollComfirmSubmitRequestV1.JjftUiPayrolComfirmSubmitRequestV1BizV1 bizContent =
new JftUiPayrollComfirmSubmitRequestV1.JjftUiPayrolComfirmSubmitRequestV1BizV1();
bizContent.setAppId(APP_ID);
//HR系统名称
bizContent.setAppName("HRO");
//企业编号
bizContent.setOutVendorId("020101190");
//操作类型:1-受理 2-审核
bizContent.setOprType("1");
bizContent.setTotalAmt("1");
bizContent.setTotalCount("1");
bizContent.setAppSerialno("WX06");
bizContent.setFileCheckSign("1");
bizContent.setLocalFilepath("D:/icbcFile/020101190_WX06_0_20240819.xls");
bizContent.setFileMdcode(getMdCode("D:/icbcFile/020101190_WX06_0_20240819.xls"));
bizContent.setFileType("1");
bizContent.setNotifyUrl(null);
bizContent.setAppRemark("备注");
JSONObject jsonObject = new JSONObject();
jsonObject.put("key",request);
request.setBizContent(bizContent);
System.out.println("request: " + JSON.toJSONString(request));
try {
String result = client.buildPostForm(request);
if (Common.isNotNull(result)) {
return R.ok();
}
} catch (IcbcApiException e) {
e.printStackTrace();
return R.failed();
}
return R.ok();
}
public R selectIcbcTransactionFlowInfo() {
//应用方加密串
String AES_Key = "8jTKCqZ9035g+HRzpZQqZA==";
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2,
MY_PRIVATE_KEY, IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON,
APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES, AES_Key, null, null);
JftApiPayrollQueryDetailRequestV1 request = new JftApiPayrollQueryDetailRequestV1();
request.setServiceUrl("https://gw.open.icbc.com.cn/api/jft/api/payroll/querydetail/V1");
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz bizContent = new
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId("020101190");
bizContent.setType("2");
//批次号,appSerialno为空时,必输
bizContent.setAppBatserialno("WX04");
//内部批次号,组成规则:批次号-顺序号,appBatserialno为空时必输
// bizContent.setAppSerialno("WX04-1");
bizContent.setStartId("0");
bizContent.setEndId("10");
request.setBizContent(bizContent);
try {
JftApiPayrollQueryDetailResponseV1 responseV1 = client.execute(request);
if (Common.isNotNull(responseV1)) {
return R.ok();
}
} catch (IcbcApiException e) {
e.printStackTrace();
return R.failed();
}
return R.ok();
}
public R businessOpen() {
String apiUrl= "https://gw.open.icbc.com.cn/api/jft/api/vendor/separate/accounts/business/open/V1";
String encryptKey = "u1NKBJOMzvkHFvGiKbsq3g==";
//签名类型为RSA2时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA2,其他参数使用缺省值
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID,"RSA2", MY_PRIVATE_KEY,"UTF-8", "json",APIGW_PUBLIC_KEY,"AES",encryptKey, "", "");
JftApiVendorSeparateAccountsBusinessOpenRequestV1 request = new JftApiVendorSeparateAccountsBusinessOpenRequestV1();
//4、根据测试环境和生产环境替换相应ip和端口
request.setServiceUrl(apiUrl);
//5、请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
JftApiVendorSeparateAccountsBusinessOpenRequestV1.JftApiVendorSeparateAccountsBusinessOpenRequestV1Biz bizContent = new JftApiVendorSeparateAccountsBusinessOpenRequestV1.JftApiVendorSeparateAccountsBusinessOpenRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId("0202407190000011934");
bizContent.setOutVendorManagerId("0202407190000011934");
bizContent.setOutUpperVendorId(APP_ID);
bizContent.setVendorName("安徽皖信人力资源管理有限公司");
bizContent.setBizType("01");
bizContent.setOpenCardType("0");
bizContent.setBusinessType("02");//开通业务类型
bizContent.setSubBusinessType("03");//开通业务类型
bizContent.setBusSwitch("1");//业务开通关闭标志,开通时传1 关闭时传0
bizContent.setRegistType("1");//注册标识 1 注册+开通业务 2 仅维护业务
bizContent.setUpperMcardNo("");
bizContent.setEqfEnsurePhone("");
request.setBizContent(bizContent);
JftApiVendorSeparateAccountsBusinessOpenResponseV1 response;
JSONObject jsonObject = new JSONObject();
jsonObject.put("key",request);
String a = jsonObject.toJSONString();
try {
response = (JftApiVendorSeparateAccountsBusinessOpenResponseV1)client.execute(request, System.currentTimeMillis()+"");
if (response.isSuccess()) {
//6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据
System.out.println("ReturnCode:"+response.getReturnCode());
System.out.println("response:" + response);
} else {
//失败
System.out.println("ReturnCode:"+response.getReturnCode());
System.out.println("ReturnMsg:"+response.getReturnMsg());
}
} catch (IcbcApiException e) {
e.printStackTrace();
}
return R.ok();
}
public R asyncNotice(HttpServletRequest request) throws Exception {
//验签
String api = "/icbcIssue/notifyUrl";
boolean verifyFlag = verifySignData(request, api);
String returnJson;
if (verifyFlag) {// 验签成功
log.info("解密...");
String bizContent = dencrypt(request);
log.info("解密后参数:" + bizContent);// 进行自己的处理,此处默认处理成功,返回通知方成功,return_code=0
String copReturnCode = "0";// 通知合作方接收成功的返回码,固定
String copReturnMsg = "success";// 合作方的返回信息,固定
returnJson = sign(request, copReturnCode, copReturnMsg);
log.error("通知响应json结果:{}", returnJson);
return R.ok(returnJson);
} else {// 验签失败
String copReturnCode = "-12345";
String copReturnMsg = "icbc jft sign not pass.";
returnJson = sign(request, copReturnCode, copReturnMsg);
log.error("通知响应json结果:{}", returnJson);
return R.failed(returnJson);
}
}
public String getMdCode(String filePath) {
FileInputStream in = null;
byte[] buffer = new byte[1024];
String mdCode;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
in = new FileInputStream(filePath);
int len;
while ((len = in.read(buffer, 0, 1024)) != -1) {
digest.update(buffer, 0, len);
}
BigInteger bigInt = new BigInteger(1, digest.digest());
mdCode = bigInt.toString();
return mdCode;
} catch (NoSuchAlgorithmException noSuchExc) {
mdCode = null;
} catch (IOException exception) {
exception.printStackTrace();
return null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException exc) {
;
}
}
}
return mdCode;
}
/**
* 验签方法
*
* @param request
* @param path
* @return
* @throws Exception
*/
private boolean verifySignData(HttpServletRequest request, String path) throws Exception {
// 网关公钥
Map<String, String> params = new HashMap<>();
String api = request.getParameter("api");
String from = request.getParameter("from");
String appId = request.getParameter("app_id");
String charset = request.getParameter("charset");
String format = request.getParameter("format");
//String encrypt_type = request.getParameter("encrypt_type");
String timestamp = request.getParameter("timestamp");
String bizContent = request.getParameter("biz_content");
String signType = request.getParameter("sign_type");
String sign = request.getParameter("sign");
params.put("from", from);
params.put("api", api);
params.put("app_id", appId);
params.put("charset", charset);
params.put("format", format);
//params.put("encrypt_type", encrypt_type);
params.put("timestamp", timestamp);
params.put("biz_content", bizContent);
params.put("sign_type", signType);// 目前上行网关签名暂时仅支持RSA
//验证工行上行网关RSA签名
String signStr = WebUtils.buildOrderedSignStr(path, params);
log.error("验签入参,signStr:[[{}]], sign_type:[[{}]], APIGW_PUBLIC_KEY:[[{}]], charset:[[{}]], sign:[[{}]]",
signStr, signType, APIGW_PUBLIC_KEY, sign);
return IcbcSignature.verify(signStr, signType, APIGW_PUBLIC_KEY, charset, sign);
}
/**
* 解密
*
* @param request
* @return
* @throws IOException
*/
private String dencrypt(HttpServletRequest request) throws IOException {
String bizContent = URLDecoder.decode(request.getParameter("biz_content"),"utf-8");
// 解析请求数据map
ObjectMapper mapper = new ObjectMapper();
Map<String, String> transMap = mapper.readValue(bizContent, Map.class);
// 获取报文密文信息
String notifyData = transMap.get("notifyData");
return new String(Base64.getDecoder().decode(notifyData));
}
/**
* 加签方法
*
* @param request
* @param copReturnCode
* @param copReturnMsg
* @return
* @throws Exception
*/
private String sign(HttpServletRequest request, String copReturnCode, String copReturnMsg) throws Exception {
String msgId = new SimpleDateFormat("yyyyMMdd").format(new Date())
+ new SimpleDateFormat("HHmmss").format(new Date());
String responseBizContent = "{\"return_code\":\"" + copReturnCode + "\",\"return_msg\":\"" + copReturnMsg + "\""
+ ",\"msg_id\":\"" + msgId + "\"}";
String charset = request.getParameter("charset");// 调用过程使用的编码格式
//商户对消息返回响应进行签名,签名方式需与在API平台登记APP的sign_type保持一致(目前基本都是RSA2)
String signType = IcbcConstants.SIGN_TYPE_RSA2;
String signStr = "\"response_biz_content\":" + responseBizContent + "," + "\"sign_type\":" + "\"" + signType
+ "\"";
String signParam = IcbcSignature.sign(signStr, signType, MY_PRIVATE_KEY, charset);
String returnJson = "{\"response_biz_content\":" + responseBizContent + ",\"sign_type\":\"" + signType + "\""
+ ",\"sign\":\"" + signParam + "\"}";
return returnJson;
}
}
package com.yifu.cloud.plus.v1.ekp.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.icbc.api.DefaultIcbcClient;
import com.icbc.api.IcbcApiException;
import com.icbc.api.IcbcConstants;
import com.icbc.api.request.JftApiB2bpayTransqueryRequestV1;
import com.icbc.api.request.JftApiPayB2bpayGenpreorderRequestV1;
import com.icbc.api.request.MybankEnterpriseAccountQuerybankinfoRequestV1;
import com.icbc.api.request.MybankEnterpriseTradeQhisdRequestV1;
import com.icbc.api.response.JftApiB2bpayTransqueryResponseV1;
import com.icbc.api.response.JftApiPayB2bpayGenpreorderResponseV1;
import com.icbc.api.response.MybankEnterpriseAccountQuerybankinfoResponseV1;
import com.icbc.api.response.MybankEnterpriseTradeQhisdResponseV1;
import com.icbc.api.utils.IcbcSignature;
import com.yifu.cloud.plus.v1.ekp.config.IcbcConfigProperties;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowQueryService;
import com.yifu.cloud.plus.v1.ekp.vo.EKPEntryPushParam;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -19,8 +28,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 聚富通到账通知交易流水查询
......@@ -38,32 +50,45 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
private IcbcConfigProperties icbcConfigProperties;
public R getIcbcTransactionFlow() {
//应用id 应用方私钥 网关公钥 应用方加密串
String APP_ID = "11000000000000028685";
//应用方私钥
String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEZYrhm3dBp3PqlMc9fBBEE8Tp8M34Yy6Ucs3FV/VahsdHaLe0kEPugf1twbt/hD4hdIwzUj/ZtG2BhusRiMptdlWtNKcIgFxaaFaKANKrIodeQjv0jjZvK9ugoQxmiM4gF5SGX2a847zohv/6TvAYiB9AI3tdKQTbj6I3pwmuO3cfzgU5IwepeguE4fxqnh7C19MEq4vXv0yBq/f43zQ2HBMS+KRgokNLUBqoEOyfaKkPL9ot+zISPwENQOLqQMZ1hczp5tEB2FeZecdzrzjeXkzPSy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ZL88fdDX0E3xuBtBwBuxIkH0CgYEAlXyBbG2/fVV/PDUVCAA+aeWstojR1ncDhJmFnENSk5I/y3mh+d+u4ZG3hmVQZfR1EYM+n9wPQ2LxqNpGPA8o4JK/MSfVKun4lBwjkergHzxWJ5AMuYL1DPrOtMPEqrTqOHfVzSZGsz9cMK4tDWETKKFBOM/5oSdGGW3oYvzcS0M=";
//网关公钥
// //应用id 应用方私钥 网关公钥 应用方加密串
// String APP_ID = "11000000000000028685";
// //应用方私钥
// String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEZYrhm3dBp3PqlMc9fBBEE8Tp8M34Yy6Ucs3FV/VahsdHaLe0kEPugf1twbt/hD4hdIwzUj/ZtG2BhusRiMptdlWtNKcIgFxaaFaKANKrIodeQjv0jjZvK9ugoQxmiM4gF5SGX2a847zohv/6TvAYiB9AI3tdKQTbj6I3pwmuO3cfzgU5IwepeguE4fxqnh7C19MEq4vXv0yBq/f43zQ2HBMS+KRgokNLUBqoEOyfaKkPL9ot+zISPwENQOLqQMZ1hczp5tEB2FeZecdzrzjeXkzPSy1ZJmNyNuOl+WG85aoeDJTQ7hx/g6KFA6zU2VBGUR7q4pXdGRslpa6KYETBAgMBAAECggEALkfElXqf5G5hocWiJAcDNJjog5JunX4mITREY9CMbrmgXYDofpDTfkMoUL6hCUEz6sPv4lzE/xgIE3gTIcz8Xek4p9Q480rTfbLtVU5WVgY65aMnjCROOOxO2MaTLCB0VVmIzLP6mNrPBUVzo48GdLzYl7YPgJA/J3T9EpEsXB/iAdjiv/VH9vOIW6WUlQUSceyNznf1rfwMJvHt7zb56IJGZMq9G6C5SUeqWbqbvNi+nL8yeu8fM/O/ERZJQBDwMXbRAPvhhcbDwVzpg4BRc7AVv0SLzy6ZA2+zLJmDe9F9uXmG6QQ4ra8mDqLeugDP9blKUOEm8JLIh7nzvhpNhQKBgQDK4ZEz1zui6GQsxsnbm24EvparfniPqDBS/V29MD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密串
// String AES_Key = "8jTKCqZ9035g+HRzpZQqZA==";
//1、网关公钥
String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
//应用方加密串
String AES_Key = "8jTKCqZ9035g+HRzpZQqZA==";
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2,
//2、appid
String APP_ID = "11000000000000029313";
//3、密钥对认证方式,公钥在API平台登记,此处为私钥
String MY_PRIVATE_KEY = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC96zrfaBT4YOoLErhTaFnv0De1K3ZsZRQDGm3dIF8wHX/Rqg2sz5hfJexMwNgTepHdxrpveq8bog9jny8CtCT2etUD+NKT0gBYx4FzjCy1vtJzO1BqyzqzHA+GMsFQ/CYucRo25SJRv9szJD7d0SlnD0rnJWnbCuK+OgzM1ixCeUKsF/94Fgbo95UeW6EhH8H4VwNNrWRZei+eLfkIoHMSTB9D2g58i5S++/oieLg52MRd35x3pm60ipcGTgLpLi0xJGNB3dDDNA/UG3D7jbpLha3+eX1SaKU3jmTZYyLBFRe4fuY1LJq8gI03KGNHhPsbu1Gn8q9H7pcK3O1JAqStAgMBAAECggEAPiRuCxO/aNYtPppNfd0zMGjtEXa7NRSNy8YmFKi2/MNqQ2xlNRpoPRnni+W9zgHZILwZ3MhD68LHTk2T0EqpnYzrjnUoUf3w5xvAm9JN/toFenb6BTeiaWDRI5QP9TPMOn3/md63sBAa5U0C1QnPhk1WsPNpA6c4Mg5EifG6YbVDPUbC8tGLA+l9KCtpYxHc48rcYwe4/Pq5zA3dCx4vcXahdXJh6ZFO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APP_ID, IcbcConstants.SIGN_TYPE_CA_SM_ICBC,
MY_PRIVATE_KEY, IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY,
IcbcConstants.ENCRYPT_TYPE_AES, AES_Key, "", "");
JftApiB2bpayTransqueryRequestV1 request = new JftApiB2bpayTransqueryRequestV1();
request.setServiceUrl("https://gw.open.icbc.com.cn/api/jft/api/b2bpay/transquery/V1");
request.setServiceUrl("https://apipcs3.dccnet.com.cn/api/jft/api/b2bpay/transquery/V1");
JftApiB2bpayTransqueryRequestV1.JftApiB2bpayTransqueryRequestV1Biz bizContent = new
JftApiB2bpayTransqueryRequestV1.JftApiB2bpayTransqueryRequestV1Biz();
bizContent.setAppId(APP_ID);
// bizContent.setOutVendorId("130290000436004");
// bizContent.setOutVendorId("0202407150000011719");
// bizContent.setOutUserId("874");
bizContent.setCardNo("1302010109024596014");
// bizContent.setPayAccount("0200000309200211917");
// bizContent.setStartTrxDate("20240301");
// bizContent.setEndTrxDate("20240730");
// bizContent.setCardNo("1302010109024596014");
// bizContent.setCardNo("9558851302001955895");
// bizContent.setPayAccount("990204011101001401");
bizContent.setStartTrxDate("20240724");
bizContent.setEndTrxDate("20240726");
bizContent.setStartId("1");
bizContent.setEndId("50");
bizContent.setType("00");
request.setBizContent(bizContent);
JSONObject jsonObject = new JSONObject();
jsonObject.put("key",request);
String a = jsonObject.toJSONString();
JftApiB2bpayTransqueryResponseV1 response;
try {
//到账通知交易流水查询
......@@ -81,6 +106,159 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
}
}
public R getIcbcTransactionFlowNew() throws IcbcApiException {
//1、网关公钥
// String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwFgHD4kzEVPdOj03ctKM7KV+16bWZ5BMNgvEeuEQwfQYkRVwI9HFOGkwNTMn5hiJXHnlXYCX+zp5r6R52MY0O7BsTCLT7aHaxsANsvI9ABGx3OaTVlPB59M6GPbJh0uXvio0m1r/lTW3Z60RU6Q3oid/rNhP3CiNgg0W6O3AGqwIDAQAB";
// //2、appid
// String APP_ID = "10000000000000223600";
// //3、密钥对认证方式,公钥在API平台登记,此处为私钥
// String MY_PRIVATE_KEY = "73382de53fcbf8aa3b00d07f9808b18e89d1b6b33c9759829eee5cbf1947dbdb";
// DefaultIcbcClient client = new DefaultIcbcClient("10000000000000223600", IcbcConstants.SIGN_TYPE_CA_SM_ICBC, MY_PRIVATE_KEY,
// IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, null,
// null, null, "1.2.156.10197.1.301", null);
// String ca_sm_path = "D:/icbcFile/ahwx.y.1302.cer";
// String ca_sm_icbc_path = "D:/icbcFile/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm_path = "/file/ahwx.y.1302.cer";
String ca_sm_icbc_path = "/file/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm = IcbcSignature.getCAInfoStr(ca_sm_path);
String ca_sm_icbc = IcbcSignature.getCAInfoStr(ca_sm_icbc_path);
// DefaultIcbcClient(appid, 签名类型, SM2企业私钥, 编码格式, 数据格式, null, null, null, SM2 cer公钥串, null)
DefaultIcbcClient client = new DefaultIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_CA_SM_ICBC,
icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, null,
null, null, ca_sm, null);
client.setIcbc_ca(ca_sm_icbc);
MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1 bizContent = new MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1();
MybankEnterpriseTradeQhisdRequestV1 request = new MybankEnterpriseTradeQhisdRequestV1();
// 获取当前时间
LocalTime currentTime = LocalTime.now();
// 使用DateTimeFormatter格式化
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HHmmssSSS");
String formattedTime = currentTime.format(formatter);
bizContent.setTranDate(DateUtil.getThisDay());
bizContent.setTranTime(formattedTime);
bizContent.setTransCode("QHISD");
bizContent.setLanguage("zh_CN");
String fSeqNo = "AHWX" + System.currentTimeMillis();
bizContent.setfSeqno(fSeqNo);
bizContent.setAccountNo("1302010109024596014");
bizContent.setBeginDate(DateUtil.getThisDay());
bizContent.setDrcrf("2");
request.setServiceUrl(icbcConfigProperties.getServerUrl());
request.setBizContent(bizContent);
System.out.println("request: " + JSON.toJSONString(request));
MybankEnterpriseTradeQhisdResponseV1 response = client.execute(request);
System.out.println("response: " + JSON.toJSONString(response));
if(!response.isSuccess()) {
//查询当天的所有入账记录数据
List<String> serioList = baseMapper.getAllserioNo();
List<MybankEnterpriseTradeQhisdResponseV1.MybankEnterpriseTradeQhisdResponseRdV1> list = response.getRd();
String bankName = response.getAccountName();
String bankNo = response.getAccountNo();
//获取成功后根据流水号去重和根据借贷标志02筛选出所有数据
if (!list.isEmpty()) {
List<MybankEnterpriseTradeQhisdResponseV1.MybankEnterpriseTradeQhisdResponseRdV1> insertList =
list.stream().filter(e-> e.getDrcrf().equals("2") && !serioList.contains(e)).collect(Collectors.toList());
//封装数据
if (insertList.isEmpty()) {
for (MybankEnterpriseTradeQhisdResponseV1.MybankEnterpriseTradeQhisdResponseRdV1 entry : insertList) {
EKPEntryPushParam pushParam = new EKPEntryPushParam();
initValue(entry,pushParam,bankName,bankNo);
}
}
}
}
return R.ok();
}
// //推送数据
// public String sendToEkp(EKPEntryPushParam pushParam){
// RestTemplate yourRestTemplate = new RestTemplate();
// try{
// String formValues = new ObjectMapper().writeValueAsString(pushParam);
// //指向EKP的接口url
// //把ModelingAppModelParameterAddForm转换成MultiValueMap
// MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
// wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceDocSubject());
// wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
// wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
// wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
// wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceFdFlowId());
// wholeForm.add("formValues", formValues);
// HttpHeaders headers = new HttpHeaders();
// //如果EKP对该接口启用了Basic认证,那么客户端需要加入
// //addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
// //必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
// HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
// //有返回值的情况 VO可以替换成具体的JavaBean
// log.info("推送EKP开始,formValues:"+formValues);
// ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
// String body = obj.getBody();
// if (StringUtils.isBlank(body)){
// log.error("交易失败:"+obj);
// return null;
// }else{
// log.info("交易成功:"+obj);
// return body;
// }
// }catch (Exception e){
// log.error("交易失败:", e);
// return null;
// }
// }
public R querybankinfo() {
String ca_sm_path = "D:/icbcFile/ahwx.y.1302.cer";
String ca_sm_icbc_path = "D:/icbcFile/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm = IcbcSignature.getCAInfoStr(ca_sm_path);
String ca_sm_icbc = IcbcSignature.getCAInfoStr(ca_sm_icbc_path);
String privateKey = "4d931f6ad4331158fcc4dea23f0d71393328146e40b5f63f197b9f6ad3732f44";
String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
// DefaultIcbcClient client = new DefaultIcbcClient("11000000000000019038", IcbcConstants.SIGN_TYPE_CA_SM_ICBC,privateKey, APIGW_PUBLIC_KEY);
DefaultIcbcClient client = new DefaultIcbcClient("11000000000000019038", IcbcConstants.SIGN_TYPE_CA_SM_ICBC, privateKey,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, null,
null, null, ca_sm, null);
client.setIcbc_ca(ca_sm_icbc);
try {
MybankEnterpriseAccountQuerybankinfoRequestV1.MybankEnterpriseAccountQuerybankinfoRequestBizV1 bizContent =
new MybankEnterpriseAccountQuerybankinfoRequestV1.MybankEnterpriseAccountQuerybankinfoRequestBizV1();
MybankEnterpriseAccountQuerybankinfoRequestV1 request = new MybankEnterpriseAccountQuerybankinfoRequestV1();
// 请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
bizContent.setTransCode("QBKNC");
bizContent.setTranDate("20240821");
bizContent.setTranTime("103231001");
bizContent.setLanguage("zh_CN");
bizContent.setfSeqNo("AHWX"+ System.currentTimeMillis());
bizContent.setCardNo("6222620250010165293");
request.setServiceUrl("https://gw.open.icbc.com.cn/api/mybank/enterprise/account/querybankinfo/V1");
request.setBizContent(bizContent);
MybankEnterpriseAccountQuerybankinfoResponseV1 response = client.execute(request);
if (response.isSuccess()) {
// 业务成功处理
System.out.println("success");
} else {
// 失败
System.out.println("error");
}
} catch (Exception e) {
e.printStackTrace();
}
return R.ok();
}
public R saveIcbcManagerCard() {
//应用id 应用方私钥 网关公钥 应用方加密串
String APP_ID = "11000000000000015602";
......@@ -192,4 +370,20 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
return R.ok();
}
}
public void initValue(MybankEnterpriseTradeQhisdResponseV1.MybankEnterpriseTradeQhisdResponseRdV1 entry,
EKPEntryPushParam pushParam,String bankName,String bankNo) {
pushParam.setFd_3aa453180cc7f0(entry.getRecipName());
pushParam.setFd_3aa4531865bada(entry.getRecipAccountNo());
pushParam.setFd_3b57f8de9df354("是");
pushParam.setFd_3b88c420e5ca80(entry.getRecipBkName1());
pushParam.setFd_3aa4531d3b86e0(entry.getDate());
pushParam.setFd_3aa45319a4cde4(bankName);
pushParam.setFd_3b62f3470beb30(bankNo);
pushParam.setFd_3b1b88110cb39e(entry.getSummary());
pushParam.setFd_3b208d364c2b70(entry.getCreditAmount().toString());
pushParam.setFd_3cddecabdd3dc0(entry.getBusiTime());
pushParam.setFd_3aa4531c687958(DateUtil.getThisTime());
pushParam.setFd_3b573843db30ce(entry.getOnlySequence());
}
}
......@@ -70,3 +70,9 @@ springdoc:
- group: ekp
#按包路径匹配
packagesToScan: com.yifu.cloud.plus.v1.ekp.controller
#工行生产环境配置
icbc:
appId: 11000000000000019038
appPrivateKey: 4d931f6ad4331158fcc4dea23f0d71393328146e40b5f63f197b9f6ad3732f44
serverUrl: https://gw.open.icbc.com.cn/api/mybank/enterprise/trade/qhisd/V1
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIDdDCCAxegAwIBAgIFRjBiNDYwDAYIKoEcz1UBg3UFADBcMQswCQYDVQQGEwJD
TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y
aXR5MRswGQYDVQQDDBJDRkNBIEFDUyBTTTIgT0NBMzEwHhcNMjMwMjE1MDkyMTA5
WhcNMjgwMjE1MDkyMTA5WjCBpTELMAkGA1UEBhMCQ04xGzAZBgNVBAoMEkNGQ0Eg
QUNTIFNNMiBPQ0EzMTETMBEGA1UECwwKQ0ZDQSBPQ0EzMTEZMBcGA1UECwwQT3Jn
YW5pemF0aW9uYWwtMTFJMEcGA1UEAwxAQ0ZDQUDkuK3lm73lt6XllYbpk7booYzo
gqHku73mnInpmZDlhazlj7hATjkxMTAwMDAwMTAwMDAzOTYyVEAxNjBZMBMGByqG
SM49AgEGCCqBHM9VAYItA0IABC7pDFU19+SE4Bog4M7om/nsDbTtXHBlfp5G2e1I
ya4LmFW5ZqOxmmQBysFwl9nDq3svOHMZ53Mpe14Z1m/OYFajggF4MIIBdDBsBggr
BgEFBQcBAQRgMF4wKAYIKwYBBQUHMAGGHGh0dHA6Ly9vY3NwLmNmY2EuY29tLmNu
L29jc3AwMgYIKwYBBQUHMAKGJmh0dHA6Ly9jcmwuY2ZjYS5jb20uY24vb2NhMzEv
b2NhMzEuY2VyMB8GA1UdIwQYMBaAFAjY0SbESH2c7KyY6fF/YrmAzqlFMAwGA1Ud
EwEB/wQCMAAwSAYDVR0gBEEwPzA9BghggRyG7yoBBDAxMC8GCCsGAQUFBwIBFiNo
dHRwOi8vd3d3LmNmY2EuY29tLmNuL3VzL3VzLTE0Lmh0bTA9BgNVHR8ENjA0MDKg
MKAuhixodHRwOi8vY3JsLmNmY2EuY29tLmNuL29jYTMxL1NNMi9jcmwyNzMwLmNy
bDAOBgNVHQ8BAf8EBAMCBsAwHQYDVR0OBBYEFOpEqrs73yvBXqvDQoT33v05FnDI
MB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAMBggqgRzPVQGDdQUAA0kA
MEYCIQCdKpfhUijpAKEQekHxlk4LvnqzzaYmODo3T3qmZUJsUwIhAOaMMH0Ipwef
VTSwJlhrVbmEB5DmoxLo1Xb/1tvfW1l2
-----END CERTIFICATE-----
\ No newline at end of file
......@@ -116,4 +116,14 @@
<update id="updateSocialStatus">
#{sql}
</update>
<!--查询社保明细信息-->
<select id="getAllserioNo" resultType="java.lang.String">
SELECT
fd_3b573843db30ce
from ekp_79c234bf64d412294f23
where fd_3b62f3470beb30 = '1302010109024596014'
and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(fd_3aa4531d3b86e0, '%Y-%m-%d')
and fd_3b57f8de9df354 = '是'
</select>
</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