From 313d7010b659ea9c866c8d56d51a7cf0370ddc71 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 07 Mar 2023 20:26:01 +0800
Subject: [PATCH] 设备插入修改

---
 .idea/workspace.xml                                                                              |   41 +++++++++++++-------
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java                     |    1 
 src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java |    4 +-
 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java                  |   24 +++++++++---
 4 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 72d0832..517c4db 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -18,6 +18,9 @@
   <component name="ChangeListManager">
     <list default="true" id="208daac0-1abd-465d-abf2-6a0414be019b" name="默认的" comment="配置提交">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -163,7 +166,7 @@
       <workItem from="1677651650908" duration="1778000" />
       <workItem from="1677660534432" duration="58000" />
       <workItem from="1677726051229" duration="38096000" />
-      <workItem from="1678063078799" duration="35272000" />
+      <workItem from="1678063078799" duration="42993000" />
     </task>
     <task id="LOCAL-00001" summary="默认的">
       <created>1676691639632</created>
@@ -221,7 +224,14 @@
       <option name="project" value="LOCAL" />
       <updated>1678169349330</updated>
     </task>
-    <option name="localTasksCounter" value="9" />
+    <task id="LOCAL-00009" summary="对讲设备字段修改读取数据修改">
+      <created>1678171715256</created>
+      <option name="number" value="00009" />
+      <option name="presentableId" value="LOCAL-00009" />
+      <option name="project" value="LOCAL" />
+      <updated>1678171715257</updated>
+    </task>
+    <option name="localTasksCounter" value="10" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -260,7 +270,8 @@
     <MESSAGE value="手台,执法记录仪基础接口新增(新增,修改,查询接口)&#10;集成lombok" />
     <MESSAGE value="执法记录仪移动位置插入新增" />
     <MESSAGE value="对讲设备读取数据修改" />
-    <option name="LAST_COMMIT_MESSAGE" value="对讲设备读取数据修改" />
+    <MESSAGE value="对讲设备字段修改读取数据修改" />
+    <option name="LAST_COMMIT_MESSAGE" value="对讲设备字段修改读取数据修改" />
   </component>
   <component name="WindowStateProjectService">
     <state x="414" y="174" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1678100334007">
@@ -287,22 +298,22 @@
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
     <state x="740" y="275" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1677835225799" />
-    <state width="1877" height="244" key="GridCell.Tab.0.bottom" timestamp="1678169317801">
+    <state width="1877" height="244" key="GridCell.Tab.0.bottom" timestamp="1678181753747">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="244" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1678169317801" />
-    <state width="1877" height="244" key="GridCell.Tab.0.center" timestamp="1678169317801">
+    <state width="1877" height="244" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1678181753747" />
+    <state width="1877" height="244" key="GridCell.Tab.0.center" timestamp="1678181753746">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="244" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1678169317801" />
-    <state width="1877" height="244" key="GridCell.Tab.0.left" timestamp="1678169317801">
+    <state width="1877" height="244" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1678181753746" />
+    <state width="1877" height="244" key="GridCell.Tab.0.left" timestamp="1678181753746">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="244" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1678169317801" />
-    <state width="1877" height="244" key="GridCell.Tab.0.right" timestamp="1678169317801">
+    <state width="1877" height="244" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1678181753746" />
+    <state width="1877" height="244" key="GridCell.Tab.0.right" timestamp="1678181753747">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="244" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1678169317801" />
+    <state width="1877" height="244" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1678181753747" />
     <state width="1877" height="437" key="GridCell.Tab.1.bottom" timestamp="1678169313836">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
@@ -351,10 +362,10 @@
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
     <state x="461" y="164" key="SettingsEditor/0.0.1920.1040@0.0.1920.1040" timestamp="1676692121637" />
-    <state x="552" y="252" key="Vcs.Push.Dialog.v2" timestamp="1678169653397">
+    <state x="552" y="252" key="Vcs.Push.Dialog.v2" timestamp="1678171716665">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1678169653397" />
+    <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1678171716665" />
     <state x="92" y="92" width="1736" height="856" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1673925442539">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
@@ -363,10 +374,10 @@
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
     <state x="122" y="0" width="1402" height="698" maximized="true" key="dock-window-1/0.0.1920.1040@0.0.1920.1040" timestamp="1678073150799" />
-    <state x="661" y="252" width="866" height="536" key="find.popup" timestamp="1678152440240">
+    <state x="661" y="252" width="866" height="536" key="find.popup" timestamp="1678183717780">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state x="661" y="252" width="866" height="536" key="find.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1678152440240" />
+    <state x="661" y="252" width="866" height="536" key="find.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1678183717780" />
     <state x="643" y="306" key="git4idea.merge.GitPullDialog" timestamp="1676946006482">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
diff --git a/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java b/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java
index d5323c9..3e36a11 100644
--- a/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/policeBodyCamera/mapper/DeviceChannelPoliceCameraMapper.java
@@ -354,7 +354,7 @@
      * @param mobilePosition
      * @return
      */
-    @Insert("INSERT INTO device_mobile_position_police_camera (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, geodeticSystem, cnLng, cnLat) " +
-            "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', '${geodeticSystem}', '${cnLng}', '${cnLat}')")
+    @Insert("INSERT INTO device_mobile_position_police_camera (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource) " +
+            "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}')")
     int insertNewPositionPoliceCamera(MobilePosition mobilePosition);
 }
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
index 0139bbb..b640b6b 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -185,10 +185,10 @@
 		deviceChannelMapper.updateChannelSubCount(deviceId,channel.getParentId());
 		System.out.println("设备名称 = " + channel.getName());
 		//如果是是执法记录仪
-//		if (null!=channel.getName() && channel.getName().contains("执法记录仪")){
+		if (null!=channel.getName() && channel.getName().contains("执法记录仪")){
 			//更新执法记录仪信息
 			deviceChannelPoliceCameraService.updateChannelPoliceCamera(channel);
-//		}
+		}
 	}
 
 	@Override
@@ -240,13 +240,13 @@
 						}
 						deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex));
 						//执法记录仪数据新增
-						System.out.println("执法记录仪批量新增 ================= ");
+//						System.out.println("执法记录仪批量新增 ================= ");
 						deviceChannelPoliceCameraMapper.batchAdd(addChannels.subList(i, toIndex));
 					}
 				}else {
 					deviceChannelMapper.batchAdd(addChannels);
 					//执法记录仪数据新增
-					System.out.println("执法记录仪批量新增 ================= ");
+//					System.out.println("执法记录仪批量新增 ================= ");
 					deviceChannelPoliceCameraMapper.batchAdd(addChannels);
 				}
 			}
@@ -259,13 +259,13 @@
 						}
 						deviceChannelMapper.batchUpdate(updateChannels.subList(i, toIndex));
 						//执法记录仪数据修改
-						System.out.println("执法记录仪批量修改 ================= ");
+//						System.out.println("执法记录仪批量修改 ================= ");
 						deviceChannelPoliceCameraMapper.batchUpdate(updateChannels.subList(i, toIndex));
 					}
 				}else {
 					deviceChannelMapper.batchUpdate(updateChannels);
 					//执法记录仪数据修改
-					System.out.println("执法记录仪批量修改 ================= ");
+//					System.out.println("执法记录仪批量修改 ================= ");
 					deviceChannelPoliceCameraMapper.batchUpdate(updateChannels);
 				}
 			}
@@ -325,9 +325,21 @@
 						if (i + limitCount > channels.size()) {
 							toIndex = channels.size();
 						}
+						//设置创建时间,更新时间
+						for (DeviceChannel channel : channels) {
+							channel.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+							channel.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+						}
+//						System.out.println("==============设备开始更新============ ");
 						result = result || deviceChannelMapper.batchAdd(channels.subList(i, toIndex)) < 0;
 					}
 				}else {
+					//设置创建时间,更新时间
+					for (DeviceChannel channel : channels) {
+						channel.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+						channel.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+					}
+//					System.out.println("==============设备开始更新============ ");
 					result = result || deviceChannelMapper.batchAdd(channels) < 0;
 				}
 			}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
index acd4fdd..c1a94c3 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -196,7 +196,6 @@
 	})
 	@PostMapping("/devices/{deviceId}/sync")
 	public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){
-
 		if (logger.isDebugEnabled()) {
 			logger.debug("设备通道信息同步API调用,deviceId:" + deviceId);
 		}

--
Gitblit v1.9.3