Commit 3fb932ae authored by huyuchen's avatar huyuchen

huych-工行回单下载

parent b1f989e0
...@@ -141,13 +141,13 @@ public class IcbcTransactionFlowIssueController { ...@@ -141,13 +141,13 @@ public class IcbcTransactionFlowIssueController {
@Operation(summary = "定时任务获取回单文件", description = "定时任务获取回单文件") @Operation(summary = "定时任务获取回单文件", description = "定时任务获取回单文件")
@Inner @Inner
@PostMapping("/inner/getPdfFile") @PostMapping("/inner/getPdfFile")
public R getPdfFile(){ public R getPdfFile() throws IOException {
return icbcTransactionFlowIssueService.getPdfFile(); return icbcTransactionFlowIssueService.getPdfFile();
} }
@Operation(summary = "定时任务获取回单文件", description = "定时任务获取回单文件") @Operation(summary = "定时任务获取回单文件", description = "定时任务获取回单文件")
@PostMapping("/getTestPdfFile") @PostMapping("/getTestPdfFile")
public R getPdfFileTest() { public R getPdfFileTest() throws IOException {
return icbcTransactionFlowIssueService.getPdfFile(); return icbcTransactionFlowIssueService.getPdfFile();
} }
} }
...@@ -8,6 +8,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -8,6 +8,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/** /**
* 聚富通代发工资相关 * 聚富通代发工资相关
...@@ -75,6 +76,6 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo> ...@@ -75,6 +76,6 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
**/ **/
R<String> doGetEkpBankStatus(); R<String> doGetEkpBankStatus();
R getPdfFile(); R getPdfFile() throws IOException;
} }
...@@ -1049,7 +1049,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -1049,7 +1049,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
* @Date: 2025/5/19 17:36 * @Date: 2025/5/19 17:36
**/ **/
@Override @Override
public R getPdfFile(){ public R getPdfFile() throws IOException {
// 工商银行SFTP服务器地址 // 工商银行SFTP服务器地址
String host = "gw.open.icbc.com.cn"; String host = "gw.open.icbc.com.cn";
// 工商银行SFTP服务器端口 // 工商银行SFTP服务器端口
...@@ -1059,8 +1059,24 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -1059,8 +1059,24 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 私钥路径(用于身份验证) // 私钥路径(用于身份验证)
//E:\IdeaProjects\yifu_mvp\yifu-ekp\yifu-ekp-biz\src\main\resources\icbc\icbc //E:\IdeaProjects\yifu_mvp\yifu-ekp\yifu-ekp-biz\src\main\resources\icbc\icbc
String privateKeyPath = ""; String privateKeyPath = "";
URL url = getClass().getClassLoader().getResource("icbc"); // URL url = getClass().getClassLoader().getResource("icbc");
privateKeyPath = url.getPath(); InputStream inputStream = getClass().getClassLoader().getResourceAsStream("icbc");
if (inputStream == null) {
throw new FileNotFoundException("资源未找到");
}
File tempFile = File.createTempFile("temp-", ".tmp");
tempFile.deleteOnExit(); // JVM退出时删除临时文件
try (FileOutputStream out = new FileOutputStream(tempFile)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
}
privateKeyPath = tempFile.getAbsolutePath();
// privateKeyPath = url.getPath();
// 远程目录路径 // 远程目录路径
log.info("秘钥文件目录: " + privateKeyPath); log.info("秘钥文件目录: " + privateKeyPath);
...@@ -1125,8 +1141,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -1125,8 +1141,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
} }
// 3. 创建临时目录 System.getProperty("user.dir") + "/yifu-ekp/yifu-ekp-biz/src/main/resources/tem/sftp_processing/" + System.currentTimeMillis() + "/"; // 3. 创建临时目录 System.getProperty("user.dir") + "/yifu-ekp/yifu-ekp-biz/src/main/resources/tem/sftp_processing/" + System.currentTimeMillis() + "/";
String tempDir = privateKeyPath.replace("/icbc","") + "/temp/sftp_processing/" + System.currentTimeMillis() + "/"; String tempDir = privateKeyPath + "/tem/sftp_processing/" + System.currentTimeMillis() + "/";
log.info("临时目录: " + privateKeyPath); // String tempDir = System.getProperty("user.dir") + "/yifu-ekp/yifu-ekp-biz/src/main/resources/temp/sftp_processing/" + System.currentTimeMillis() + "/";
log.info("临时目录: " + tempDir);
new File(tempDir).mkdirs(); new File(tempDir).mkdirs();
// 4. 下载并解压压缩包 // 4. 下载并解压压缩包
......
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