From a2128bbba47602e6795f2667cf2948992f24bebe Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 10 Jan 2022 17:00:22 +0800
Subject: [PATCH] 1. 上岗证新增审核 2. 上岗证导出和证书打印记录时间
---
src/main/java/org/springblade/modules/equipage/controller/fixed.java | 92 ++++++++++++++++++++++++----------------------
1 files changed, 48 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..f6dd7b5 100644
--- a/src/main/java/org/springblade/modules/equipage/controller/fixed.java
+++ b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -61,6 +61,7 @@
params.put("acc", equipmentCode);
String res = null;
res = HttpReqUtil.getInstance().doPost(url, params, null);
+ System.out.println("res = " + res);
JSONArray jsonArray = JSONArray.fromObject(res);
JSONArray sortedJsonArray = new JSONArray();
List<JSONObject> jsonValues = new ArrayList<JSONObject>();
@@ -228,50 +229,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