Commit 0ab759ab authored by huyuchen's avatar huyuchen

huych-入职登记商险待办提交

parent 5364fb52
...@@ -80,6 +80,11 @@ ...@@ -80,6 +80,11 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.apache.shardingsphere</groupId>--> <!-- <groupId>org.apache.shardingsphere</groupId>-->
<!-- <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>--> <!-- <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>-->
......
...@@ -136,4 +136,9 @@ public class IcbcTransactionFlowIssueController { ...@@ -136,4 +136,9 @@ public class IcbcTransactionFlowIssueController {
return icbcTransactionFlowIssueService.doGetEkpBankStatus(); return icbcTransactionFlowIssueService.doGetEkpBankStatus();
} }
@Operation(summary = "获取回单文件", description = "获取回单文件")
@PostMapping("/getPdfFile")
public void getPdfFile() {
icbcTransactionFlowIssueService.getPdfFile();
}
} }
...@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.ekp.service; ...@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1; import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo; import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankAttaReturnVo; import com.yifu.cloud.plus.v1.ekp.vo.EkpBankAttaReturnVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -76,4 +75,6 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo> ...@@ -76,4 +75,6 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
**/ **/
R<String> doGetEkpBankStatus(); R<String> doGetEkpBankStatus();
void getPdfFile();
} }
...@@ -16,6 +16,7 @@ import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1; ...@@ -16,6 +16,7 @@ import com.icbc.api.response.JftApiPayrollQueryDetailResponseV1;
import com.icbc.api.response.MybankEnterpriseAccountQuerybankinfoResponseV1; import com.icbc.api.response.MybankEnterpriseAccountQuerybankinfoResponseV1;
import com.icbc.api.utils.IcbcSignature; import com.icbc.api.utils.IcbcSignature;
import com.icbc.api.utils.WebUtils; import com.icbc.api.utils.WebUtils;
import com.jcraft.jsch.*;
import com.yifu.cloud.plus.v1.ekp.config.IcbcIssueConfigProperties; import com.yifu.cloud.plus.v1.ekp.config.IcbcIssueConfigProperties;
import com.yifu.cloud.plus.v1.ekp.entity.*; import com.yifu.cloud.plus.v1.ekp.entity.*;
import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper; import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
...@@ -1035,6 +1036,68 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -1035,6 +1036,68 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return R.ok(); return R.ok();
} }
@Override
public void getPdfFile() {
String host = "gw.open.icbc.com.cn";
int port = 8001;
String username = "wxrl";
// String privateKeyPath = "/path/to/your/private_key"; // 替换为你的私钥路径
String privateKeyPath = "D:/icbcFile/id_rsa"; // 替换为你的私钥路径
String remoteDir = "/JFTStatementDownload/download";
String localPath = "D:/icbcFile/pdfFile"; // 替换为本地保存路径
Session session = null;
ChannelSftp channelSftp = null;
try {
JSch jsch = new JSch();
// 添加私钥(注意:需要是没有密码保护的私钥)
jsch.addIdentity(privateKeyPath);
// 创建会话
session = jsch.getSession(username, host, port);
// 关闭严格的主机密钥检查(生产环境应配置known_hosts)
session.setConfig("StrictHostKeyChecking", "no");
session.connect();
// 创建SFTP通道
channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
// 切换远程目录
channelSftp.cd(remoteDir);
// 列出目录文件
Vector<ChannelSftp.LsEntry> files = channelSftp.ls("*");
log.info("找到文件数量: " + files.size());
// 下载所有文件
for (ChannelSftp.LsEntry entry : files) {
if (!entry.getAttrs().isDir()) {
String fileName = entry.getFilename();
log.info("正在下载: " + fileName);
channelSftp.get(fileName, localPath + fileName);
}
}
} catch (JSchException e) {
if (e.getMessage().contains("Auth fail")) {
return;
}
} catch (SftpException e) {
return;
} finally {
if (channelSftp != null && channelSftp.isConnected()) {
channelSftp.exit();
}
if (session != null && session.isConnected()) {
session.disconnect();
}
}
}
/** /**
* @Description: 发放记录日志 * @Description: 发放记录日志
* @Author: hgw * @Author: hgw
......
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