From 7c2c09439da3dccf1e032e89e1cb950b8fa1cc26 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 01 Mar 2022 20:09:57 +0800
Subject: [PATCH] 健康证,合同基础接口编写

---
 src/main/java/org/springblade/modules/equipage/controller/fixed.java |   64 +++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/springblade/modules/equipage/controller/fixed.java b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
index 9e853b2..2638189 100644
--- a/src/main/java/org/springblade/modules/equipage/controller/fixed.java
+++ b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -13,9 +13,11 @@
 import org.springblade.modules.location.service.LiveLocationService;
 import org.springblade.modules.location.service.LocusService;
 import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.system.service.MyAsyncService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+
 import java.io.IOException;
 import java.text.DateFormat;
 import java.text.ParseException;
@@ -33,6 +35,8 @@
 	private LocusService locusService;
 	@Autowired
 	private CarService carService;
+	@Autowired
+	private MyAsyncService myAsyncService;
 
 	/**
 	 * 押运人员
@@ -45,7 +49,7 @@
 		String url = "http://47.104.104.46/api/client/getgis.php";
 		//查询有押运人员的数据
 		List<Map<String, Object>> list = userService.selectEquipent();
-		if (list.size()>0) {
+		if (list.size() > 0) {
 			for (int i = 0; i < list.size(); i++) {
 				//实时位置实体类
 				LiveLocation liveLocation = new LiveLocation();
@@ -111,7 +115,8 @@
 							"'" + liveLocation.getLongitude() + "'" + "," +
 							"'" + liveLocation.getLatitude() + "'" + "," +
 							"'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + ")";
-					FtpUtil.sqlFileUpload(s1);
+					//FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 				} else {
 					status = liveLocationService.updateById(liveLocationInfo);
 					//内网同步
@@ -122,7 +127,8 @@
 							",latitude = " + "'" + liveLocationInfo.getLatitude() + "'" +
 							",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocationInfo.getRecordTime()) + "'" +
 							" " + "where id = " + "'" + liveLocationInfo.getId() + "'";
-					FtpUtil.sqlFileUpload(s1);
+					//FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 				}
 			}
 		}
@@ -162,10 +168,9 @@
 			JSONArray jsonArray = JSONArray.fromObject(a);
 			String s1 = "";
 			String track = jsonArray.getJSONObject(0).get("track").toString();
-			if (track.equals("[]")){
+			if (track.equals("[]")) {
 				System.out.println("数据为空");
-			}
-			else {
+			} else {
 				JSONArray jsonArray1 = JSONArray.fromObject(track);
 				for (int j = 0; j < jsonArray1.size(); j++) {
 					String gis_jd = jsonArray1.getJSONObject(j).get("gis_jd").toString();
@@ -195,7 +200,8 @@
 						s1 += ";";
 					}
 				}
-				FtpUtil.sqlFileUpload(s1);
+				//FtpUtil.sqlFileUpload(s1);
+				myAsyncService.FTP(s1);
 			}
 		}
 	}
@@ -227,7 +233,7 @@
 				String a = "[" + res + "]";
 				JSONArray jsonArray = JSONArray.fromObject(a);
 				String code = jsonArray.getJSONObject(0).get("code").toString();
-				if (Integer.parseInt(code)==200) {
+				if (Integer.parseInt(code) == 200) {
 					String data = jsonArray.getJSONObject(0).get("data").toString();
 					String b = "[" + data + "]";
 					JSONArray jsonArrayb = JSONArray.fromObject(b);
@@ -251,27 +257,33 @@
 					if (null == liveLocationInfo) {
 						//新增
 						status = liveLocationService.save(liveLocation);
-						//数据推送
-						String s1 =
-							"insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " +
-								"values(" + "'" + liveLocation.getId() + "'" + "," +
-								"'" + liveLocation.getType() + "'" + "," +
-								"'" + liveLocation.getWorkerId() + "'" + "," +
-								"'" + liveLocation.getLongitude() + "'" + "," +
-								"'" + liveLocation.getLatitude() + "'" + "," +
-								"'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + ")";
-						FtpUtil.sqlFileUpload(s1);
+						if (status) {
+							//数据推送
+							String s1 =
+								"insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " +
+									"values(" + "'" + liveLocation.getId() + "'" + "," +
+									"'" + liveLocation.getType() + "'" + "," +
+									"'" + liveLocation.getWorkerId() + "'" + "," +
+									"'" + liveLocation.getLongitude() + "'" + "," +
+									"'" + liveLocation.getLatitude() + "'" + "," +
+									"'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + ")";
+							//FtpUtil.sqlFileUpload(s1);
+							myAsyncService.FTP(s1);
+						}
 					} else {
 						status = liveLocationService.updateById(liveLocationInfo);
 						//内网同步
-						String s1 =
-							"update sys_live_location set type = " + "'" + liveLocationInfo.getType() + "'" +
-								",worker_id = " + "'" + liveLocationInfo.getWorkerId() + "'" +
-								",longitude = " + "'" + liveLocationInfo.getLongitude() + "'" +
-								",latitude = " + "'" + liveLocationInfo.getLatitude() + "'" +
-								",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocationInfo.getRecordTime()) + "'" +
-								" " + "where id = " + "'" + liveLocationInfo.getId() + "'";
-						FtpUtil.sqlFileUpload(s1);
+						if (status) {
+							String s1 =
+								"update sys_live_location set type = " + "'" + liveLocationInfo.getType() + "'" +
+									",worker_id = " + "'" + liveLocationInfo.getWorkerId() + "'" +
+									",longitude = " + "'" + liveLocationInfo.getLongitude() + "'" +
+									",latitude = " + "'" + liveLocationInfo.getLatitude() + "'" +
+									",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocationInfo.getRecordTime()) + "'" +
+									" " + "where id = " + "'" + liveLocationInfo.getId() + "'";
+							//FtpUtil.sqlFileUpload(s1);
+							myAsyncService.FTP(s1);
+						}
 					}
 				}
 			} catch (Exception e) {

--
Gitblit v1.9.3