From 2ebca060a47784db76369a4aa84f63293da9be33 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 10:08:08 +0800
Subject: [PATCH] 保安员新增同步编号问题
---
src/main/java/org/springblade/modules/FTP/FtpUtil.java | 74 +++++++++++++++++++++++++++++++++----
1 files changed, 66 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/springblade/modules/FTP/FtpUtil.java b/src/main/java/org/springblade/modules/FTP/FtpUtil.java
index 8473c3a..40f35f2 100644
--- a/src/main/java/org/springblade/modules/FTP/FtpUtil.java
+++ b/src/main/java/org/springblade/modules/FTP/FtpUtil.java
@@ -47,6 +47,10 @@
FTPClient ftpClient = null;
try {
ftpClient = new FTPClient();
+ //设置超时时间
+ ftpClient.setDataTimeout(10000);
+ //连接超时为60秒
+ ftpClient.setConnectTimeout(10000);
ftpClient.connect(ftpHost, ftpPort);// 连接FTP服务器
ftpClient.login(ftpUserNameOut, ftpPasswordOut);// 登陆FTP服务器
if (!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) {
@@ -362,22 +366,40 @@
}
/**
- * 执行 对象数据(用户,报名对象信息等) 上传
- * @param obj 对象信息
+ * 执行sql 上传,推送审查结果,json 命名用户id相同的文件名称一致
+ * @param obj sql
+ * @param id 用户id
*/
- public static void objectFileUpload(Object obj){
+ public static void sqlFileUploadUserExamine(String obj,String id){
String json1 = JSON.toJSONString(obj);
- String response1 = String.valueOf((new Date()).getTime());
- OutJson.createJsonFile(json1, localPath, "ni"+response1);
+ OutJson.createJsonFile(json1, localPath, "nq"+id);
FileInputStream in1 = null;
try {
- in1 = new FileInputStream(new File(localPath + "ni"+response1+".json"));
+ in1 = new FileInputStream(new File(localPath + "nq"+id+".json"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
- FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "ni"+response1+".json", in1);
+ FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "nq"+id+".json", in1);
+ MysqlCenlint.deletess("nq"+id+".json");
+ }
+
+ /**
+ * 执行 对象数据(用户,报名对象信息等) 上传
+ * @param obj 对象信息
+ * @param uuid
+ */
+ public static void objectFileUpload(Object obj,String uuid){
+ String json1 = JSON.toJSONString(obj);
+ OutJson.createJsonFile(json1, localPath, "ni"+uuid);
+ FileInputStream in1 = null;
+ try {
+ in1 = new FileInputStream(new File(localPath + "ni"+uuid+".json"));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "ni"+uuid+".json", in1);
System.out.println("用户新增,向外网推送数据结束.................");
- MysqlCenlint.deletess("ni"+response1+".json");
+ MysqlCenlint.deletess("ni"+uuid+".json");
}
@@ -397,6 +419,24 @@
}
FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "nl"+response1+".json", in1);
MysqlCenlint.deletess("nl"+response1+".json");
+ }
+
+ /**
+ * 执行 对象数据(实操成绩导入反馈) 上传
+ * @param obj 对象信息
+ */
+ public static void objectFileUploadExamScore(Object obj){
+ String json1 = JSON.toJSONString(obj);
+ String response1 = String.valueOf((new Date()).getTime());
+ OutJson.createJsonFile(json1, localPath, "ne"+response1);
+ FileInputStream in1 = null;
+ try {
+ in1 = new FileInputStream(new File(localPath + "ne"+response1+".json"));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "ne"+response1+".json", in1);
+ MysqlCenlint.deletess("ne"+response1+".json");
}
/**
@@ -434,4 +474,22 @@
FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "ns"+response1+".json", in1);
MysqlCenlint.deletess("ns"+response1+".json");
}
+
+ /**
+ * 管理员新增保安员并生成保安员证编号
+ * @param obj
+ */
+ public static void objectFileUploadPaperList(Object obj) {
+ String json1 = JSON.toJSONString(obj);
+ String response1 = String.valueOf((new Date()).getTime());
+ OutJson.createJsonFile(json1, localPath, "np"+response1);
+ FileInputStream in1 = null;
+ try {
+ in1 = new FileInputStream(new File(localPath + "np"+response1+".json"));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserNameOut, ftpPasswordOut, ftpPath, "/", "np"+response1+".json", in1);
+ MysqlCenlint.deletess("np"+response1+".json");
+ }
}
--
Gitblit v1.9.3