From 4de91039822b571db3ceee8cedf351455e31fc24 Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Thu, 19 May 2022 11:08:21 +0800
Subject: [PATCH] 设置连接超时

---
 src/main/java/org/springblade/modules/FTP/MyAsyncService.java |   49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/springblade/modules/FTP/MyAsyncService.java b/src/main/java/org/springblade/modules/FTP/MyAsyncService.java
index 0cfd43c..93de9ae 100644
--- a/src/main/java/org/springblade/modules/FTP/MyAsyncService.java
+++ b/src/main/java/org/springblade/modules/FTP/MyAsyncService.java
@@ -37,7 +37,39 @@
 	 * FTP
 	 * @param s sql语句
 	 */
+	@Async
 	public void FTP(String s) {
+		FtpUtil.sqlFileUpload(s);
+	}
+
+	/**
+	 * FTP 审查结果推送
+	 * @param s sql语句
+	 */
+	@Async
+	public void FTP1(String s) {
+		//为防止外网尚未更新完成,休眠2秒发送第一次
+		try {
+			Thread.sleep(2);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		FtpUtil.sqlFileUpload(s);
+		FTP2(s);
+	}
+
+	/**
+	 * FTP 审查结果推送
+	 * @param s sql语句
+	 */
+	@Async
+	public void FTP2(String s) {
+		//休眠30s,再次发送一次
+		try {
+			Thread.sleep(30);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
 		FtpUtil.sqlFileUpload(s);
 	}
 
@@ -52,15 +84,17 @@
 		if (user0.getRoleId().equals("1412226235153731586")){
 			//创建用户对象
 			User user = new User();
-			user.setId(user.getId());
+			user.setId(user0.getId());
 			//远程调用接口
 			String body = InvestigateUtil.httpGetOne(user0.getCardid());
+			System.out.println("user0 = " + user0.getCardid());
 			JSONObject jsonObject = new JSONObject(body);
 			Object data = jsonObject.get("data");
 			JSONObject jsonData = new JSONObject(data.toString());
 			JSONArray res = jsonData.getJSONArray("res");
 			//设置审核时间
 			user.setAuditTime(new Date());
+			//如果有结果返回
 			if (res.length() == 0) {
 				//没有数据正常
 				user.setExaminationType("0");
@@ -74,7 +108,7 @@
 					) {
 						user.setExaminationMx(res.getJSONObject(i).get("zdrylbjh").toString());
 						//更新用户数据
-						userService.updateById(user);
+//						userService.updateById(user);
 						break;
 					}
 					if (res.getJSONObject(i).get("zdryxlmc").toString() != null
@@ -83,7 +117,7 @@
 					) {
 						user.setExaminationMx(res.getJSONObject(i).get("zdryxlmc").toString());
 						//更新用户数据
-						userService.updateById(user);
+//						userService.updateById(user);
 						break;
 					}
 					if (res.getJSONObject(i).get("ztrylx").toString() != null
@@ -92,7 +126,7 @@
 					) {
 						user.setExaminationMx(res.getJSONObject(i).get("ztrylx").toString());
 						//更新用户数据
-						userService.updateById(user);
+//						userService.updateById(user);
 						break;
 					}
 					count++;
@@ -100,12 +134,17 @@
 					if (count==res.length()){
 						//更新用户数据,设为正常
 						user.setExaminationType("0");
-						userService.updateById(user);
+//						userService.updateById(user);
 					}
 				}
 			}
 			//更新用户数据
 			userService.updateById(user);
+			//同时更新外网用户信息
+			String s1 = "update blade_user set examination_type = " + user.getExaminationType() +
+				",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" +
+				" where id = " + "'" + user.getId() + "'";
+			FTP1(s1);
 		}
 
 	}

--
Gitblit v1.9.3