From 75ef4de1c55e6029fbd2b37ee3b52665c9135b5f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 15 Dec 2021 15:27:41 +0800
Subject: [PATCH] 1. 派遣查询修改 2. 车辆定位接口修改,会报空指针 3. 日志输出修改管理 4. 证书导出Png图片不显示bug修复
---
src/main/java/org/springblade/modules/equipage/controller/fixed.java | 91 +++++++++++++++++++++++----------------------
1 files changed, 47 insertions(+), 44 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 4208321..b010abf 100644
--- a/src/main/java/org/springblade/modules/equipage/controller/fixed.java
+++ b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -228,50 +228,53 @@
res = HttpReqUtil.getInstance().doPost(url, params, null);
String a = "[" + res + "]";
JSONArray jsonArray = JSONArray.fromObject(a);
- String data = jsonArray.getJSONObject(0).get("data").toString();
- String b = "[" + data + "]";
- JSONArray jsonArrayb = JSONArray.fromObject(b);
- String x = jsonArrayb.getJSONObject(0).get("x").toString();
- String y = jsonArrayb.getJSONObject(0).get("y").toString();
- String timestamp = jsonArrayb.getJSONObject(0).get("timestamp").toString();
- //实时位置实体类
- LiveLocation liveLocation = new LiveLocation();
- liveLocation.setType(2);
- String carnumber = maps.get(i).get("carnumber").toString();
- liveLocation.setWorkerId(carnumber);
- //经度
- liveLocation.setLongitude(x);
- //纬度
- liveLocation.setLatitude(y);
- Date date = timeStamp2Date(timestamp);
- liveLocation.setRecordTime(date);
- //先查询是否已有实时位置信息,如果有,则更新,没有则插入
- LiveLocation liveLocationInfo = liveLocationService.getLiveLocationInfo(liveLocation);
- boolean status = false;
- 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);
- } 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);
+ String code = jsonArray.getJSONObject(0).get("code").toString();
+ if (Integer.parseInt(code)==200) {
+ String data = jsonArray.getJSONObject(0).get("data").toString();
+ String b = "[" + data + "]";
+ JSONArray jsonArrayb = JSONArray.fromObject(b);
+ String x = jsonArrayb.getJSONObject(0).get("x").toString();
+ String y = jsonArrayb.getJSONObject(0).get("y").toString();
+ String timestamp = jsonArrayb.getJSONObject(0).get("timestamp").toString();
+ //实时位置实体类
+ LiveLocation liveLocation = new LiveLocation();
+ liveLocation.setType(2);
+ String carnumber = maps.get(i).get("carnumber").toString();
+ liveLocation.setWorkerId(carnumber);
+ //经度
+ liveLocation.setLongitude(x);
+ //纬度
+ liveLocation.setLatitude(y);
+ Date date = timeStamp2Date(timestamp);
+ liveLocation.setRecordTime(date);
+ //先查询是否已有实时位置信息,如果有,则更新,没有则插入
+ LiveLocation liveLocationInfo = liveLocationService.getLiveLocationInfo(liveLocation);
+ boolean status = false;
+ 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);
+ } 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);
+ }
}
} catch (Exception e) {
e.printStackTrace();
--
Gitblit v1.9.3