瀏覽代碼

Merge remote-tracking branch 'origin/master'

wangchao 4 年之前
父節點
當前提交
dc4c59924a

+ 47 - 11
ebc-middle-platform/src/ipu-stomp.js

@ -4,28 +4,64 @@ import {socketUrl} from '@/constants'
4 4
import EventBus from './bus'
5 5
6 6
var socket = null
7
var stompClient = null
7
var peronStompClient = null
8
var shipStompClient = null
8 9
9 10
export default function initWebSocket(params) {
11
  personStomp(params)
12
  shipStomp(params)
13
}
14
15
function personStomp(params) {
10 16
  if (socketUrl.startsWith('http') || socketUrl.startsWith('https')) {
11 17
    socket = new SockJS(socketUrl)// 连接服务端
12
    stompClient = Stomp.over(socket)
18
    peronStompClient = Stomp.over(socket)
13 19
  } else { // SockJS支持ws前缀
14
    stompClient = Stomp.client(socketUrl)
20
    peronStompClient = Stomp.client(socketUrl)
15 21
  }
16
  stompClient.connect(params, (frame) => {
22
  params.uuid = uuid()
23
  peronStompClient.connect(params, (frame) => {
17 24
    successCallback()
18 25
  }, () => {
19
    initWebSocket(params)
26
    personStomp(params)
20 27
  })
21
  return stompClient
22 28
}
23 29
24
function successCallback() {
25
  stompClient.subscribe('personnel', msg => {
26
    EventBus.$emit('person', msg)
30
function shipStomp(params) {
31
  if (socketUrl.startsWith('http') || socketUrl.startsWith('https')) {
32
    socket = new SockJS(socketUrl)// 连接服务端
33
    shipStompClient = Stomp.over(socket)
34
  } else { // SockJS支持ws前缀
35
    shipStompClient = Stomp.client(socketUrl)
36
  }
37
  params.uuid = uuid()
38
  shipStompClient.connect(params, (frame) => {
39
    successShipCallback()
40
  }, () => {
41
    shipStomp(params)
27 42
  })
28
  stompClient.subscribe('ship', msg => {
29
    EventBus.$emit('ship', msg)
43
}
44
function successShipCallback() {
45
  shipStompClient.subscribe('ship', msg => {
46
    EventBus.$emit('ship', msg.body)
47
  })
48
}
49
function successCallback() {
50
  peronStompClient.subscribe('personnel', msg => {
51
    EventBus.$emit('person', msg.body)
30 52
  })
31 53
}
54
55
function uuid() {
56
  var s = []
57
  var hexDigits = '0123456789abcdef'
58
  for (var i = 0; i < 36; i++) {
59
    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
60
  }
61
  s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
62
  s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
63
  s[8] = s[13] = s[18] = s[23] = '-'
64
65
  var uuid = s.join('')
66
  return uuid
67
}

+ 2 - 15
ebc-middle-platform/src/modules/layouts/BasicLayout.vue

@ -67,10 +67,10 @@ export default {
67 67
  },
68 68
  mounted() {
69 69
    // 镜屏调用
70
    initWebSocket({name: 'zhangsan', passcode: '123456', uuid: this.uuid()})
70
    initWebSocket({name: 'zhangsan', passcode: '123456'})
71 71
    EventBus.$on('person', (msg) => { // 获取镜屏推送消息
72 72
      console.log(msg)
73
      var obj = JSON.parse(msg.body)
73
      var obj = JSON.parse(msg)
74 74
      if (obj.isNewAlarm == '1') {
75 75
        this.alarmObj.alarmType = obj.alarmType
76 76
        this.alarmObj.alarmLocation = obj.longitude + ' , ' + obj.latitude
@ -82,19 +82,6 @@ export default {
82 82
  methods: {
83 83
    closeAlarmModal() {
84 84
      this.modal = false
85
    },
86
    uuid() {
87
      var s = []
88
      var hexDigits = '0123456789abcdef'
89
      for (var i = 0; i < 36; i++) {
90
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
91
      }
92
      s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
93
      s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
94
      s[8] = s[13] = s[18] = s[23] = '-'
95
96
      var uuid = s.join('')
97
      return uuid
98 85
    }
99 86
  }
100 87
}

+ 23 - 3
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -329,6 +329,7 @@ export default {
329 329
      this.nowDate = new Date()
330 330
    }, 1000)
331 331
    EventBus.$on('person', (msg) => { // 获取镜屏推送消息
332
      console.log(msg)
332 333
      this.changeLocation(msg)
333 334
    })
334 335
    EventBus.$on('ship', (msg) => { // 获取镜屏推送消息
@ -348,7 +349,7 @@ export default {
348 349
        })
349 350
    },
350 351
    changeLocation(msg) { // 修改人员信息状态等
351
      var obj = JSON.parse(msg.body)
352
      var obj = JSON.parse(msg)
352 353
      console.log('person' + obj)
353 354
      var flag = false
354 355
      this.layer.personLayer.eachLayer((e) => {
@ -374,7 +375,7 @@ export default {
374 375
      }
375 376
    },
376 377
    changeShip(msg) {
377
      var obj = JSON.parse(msg.body)
378
      var obj = JSON.parse(msg)
378 379
      console.log('ship' + obj)
379 380
      this.layer.equipmentLayer.eachLayer((point) => {
380 381
        if (point.getAttributes().DEVICE_NO == obj.deviceNo) {
@ -693,6 +694,7 @@ export default {
693 694
          res.data.dataList.forEach((e) => {
694 695
            var icon, tips
695 696
            var callHelp = ''
697
            var other = ''
696 698
            if (e.locationStatus === '0') {
697 699
              icon = '/static/images/normalworker.png'
698 700
              layer = this.layer.normalLayer
@ -712,10 +714,28 @@ export default {
712 714
              layer = this.layer.outLineLayer
713 715
              tips = '<div class="outline">违规</div>'
714 716
              this.personStatistics.outLine++
717
              if (e.locationStatus == '2') {
718
                other = '<div class="row outline">' +
719
                        '<div>定点停留超时</div>' +
720
                        '<div>已停留' + e.fixedLong + 'min</div>' +
721
                        '</div>'
722
              } else {
723
                other = '<div class="row outline">' +
724
                        '<div>进入时间</div>' +
725
                        '<div>' + e.inDate + '</div>' +
726
                        '</div>'
727
              }
715 728
            } else if (e.locationStatus === '4' || e.locationStatus === '5') {
716 729
              icon = '/static/images/sosworker.png'
717 730
              layer = this.layer.sosLayer
718 731
              tips = '<div class="sos">SOS</div>'
732
              other = '<div class="row sos">' +
733
                  '<div>求救时间</div>' +
734
                  '<div>' + e.alarmDate + '</div>' +
735
                  '</div>' + '<div class="row sos">' +
736
                  '<div>求救时长</div>' +
737
                  '<div>' + e.alarmLong + 'min</div>' +
738
                  '</div>'
719 739
              callHelp = '<div style="display:flex;">' +
720 740
                  '<button class="point-out" onClick="window.Vue.rescueModal=true"><i style="font-size: 20px;" class="aidicon aidicon-user-outline"></i>指派</button>' +
721 741
                  '<button class="close-confirm" onClick="window.Vue.close()"><i style="font-size: 20px;" class="aidicon aidicon-close"></i>关闭</button>' +
@ -746,7 +766,7 @@ export default {
746 766
                  '<div class="row">' +
747 767
                  '<div>纬度</div>' +
748 768
                  '<div>' + e.latitude + '</div>' +
749
                  '</div>' +
769
                  '</div>' + other +
750 770
                  '<div class="row">' +
751 771
                  '<div>最新定位时间</div>' +
752 772
                  '<div>' + e.newDate + '</div>' +

+ 14 - 104
ebc-sea-platform/pom.xml

@ -194,123 +194,33 @@
194 194
					<encoding>${encoding}</encoding>
195 195
					<!-- 通过此方法添加本地jar -->
196 196
					<compilerArguments>
197
						<!--suppress UnresolvedMavenProperty -->
198
						<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
199
						<extdirs>${project.basedir}/libs</extdirs>
197
	 					<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
198
	 					<extdirs>${project.basedir}/libs</extdirs>
200 199
					</compilerArguments>
201 200
				</configuration>
202 201
			</plugin>
203 202
			<plugin>
204
				<groupId>org.apache.maven.plugins</groupId>
205
				<artifactId>maven-surefire-plugin</artifactId>
206
				<configuration>
207
					<skip>true</skip>
208
				</configuration>
209
			</plugin>
210
			<!-- ==========应用包和依赖包分离的打包方法================ -->
203
                <groupId>org.apache.maven.plugins</groupId>
204
                <artifactId>maven-surefire-plugin</artifactId>
205
                <configuration>
206
                    <skip>true</skip>
207
                </configuration>
208
            </plugin>
209
			<!-- 比spring-boot-dependencies中多了build-info -->
211 210
			<plugin>
212
				<groupId>org.apache.maven.plugins</groupId>
213
				<artifactId>maven-resources-plugin</artifactId>
214
				<executions>
215
					<execution>
216
						<id>copy-resources</id>
217
						<phase>compile</phase>
218
						<goals>
219
							<goal>copy-resources</goal>
220
						</goals>
221
						<configuration>
222
							<encoding>${encoding}</encoding>
223
							<resources>
224
								<resource>
225
									<directory>${project.build.directory}/classes</directory>
226
									<includes>
227
										<include>**/*.properties</include>
228
										<include>**/*.xml</include>
229
										<include>**/*.yaml</include>
230
										<include>**/*.yml</include>
231
										<include>**/*.txt</include>
232
									</includes>
233
								</resource>
234
							</resources>
235
							<!-- 表示把配置文件拷到和jar包同一个路径下 -->
236
							<outputDirectory>
237
								${project.build.directory}/config
238
							</outputDirectory>
239
						</configuration>
240
					</execution>
241
				</executions>
242
			</plugin>
243
			<!-- 复制依赖包 -->
244
			<plugin>
245
				<groupId>org.apache.maven.plugins</groupId>
246
				<artifactId>maven-dependency-plugin</artifactId>
211
				<groupId>org.springframework.boot</groupId>
212
				<artifactId>spring-boot-maven-plugin</artifactId>
247 213
				<executions>
248 214
					<execution>
249
						<id>copy-dependencies</id>
250
						<phase>package</phase>
251 215
						<goals>
252
							<goal>copy-dependencies</goal>
216
							<goal>repackage</goal>
217
							<goal>build-info</goal>
253 218
						</goals>
254
						<configuration>
255
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
256
						</configuration>
257 219
					</execution>
258 220
				</executions>
259
			</plugin>
260
			<plugin>
261
				<groupId>org.apache.maven.plugins</groupId>
262
				<artifactId>maven-jar-plugin</artifactId>
263
				<configuration>
264
					<archive>
265
						<!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
266
						<addMavenDescriptor>false</addMavenDescriptor>
267
						<manifest>
268
							<!--是否要把第三方jar放到manifest的classpath中-->
269
							<addClasspath>true</addClasspath>
270
							<!--生成的manifest中classpath的前缀,lib存放第三方jar-->
271
							<classpathPrefix>lib/</classpathPrefix>
272
							<!--应用的main class-->
273
							<mainClass>${start-class}</mainClass>
274
							<!-- 去掉jar后的时间戳 -->
275
							<useUniqueVersions>false</useUniqueVersions>
276
						</manifest>
277
						<!-- 自定义的MANIFEST.MF参数 -->
278
						<manifestEntries>
279
							<!-- 增加classpath目录config -->
280
							<Class-Path>./config/</Class-Path>
281
						</manifestEntries>
282
					</archive>
283
					<!--过滤掉不希望包含在jar中的文件-->
284
					<excludes>
285
						<exclude>**/*.properties</exclude>
286
						<exclude>**/*.xml</exclude>
287
						<exclude>**/*.yaml</exclude>
288
						<exclude>**/*.yml</exclude>
289
						<exclude>**/*.txt</exclude>
290
					</excludes>
291
				</configuration>
292
			</plugin>
293

294
			<plugin>
295
				<groupId>org.apache.maven.plugins</groupId>
296
				<artifactId>maven-assembly-plugin</artifactId>
297
				<version>2.4</version>
298
				<!-- The configuration of the plugin -->
299 221
				<configuration>
300
					<!-- Specifies the configuration file of the assembly plugin -->
301
					<descriptors>
302
						<descriptor>src/main/assembly-package.xml</descriptor>
303
					</descriptors>
222
					<mainClass>${start-class}</mainClass>
304 223
				</configuration>
305
				<executions>
306
					<execution>
307
						<id>make-assembly</id>
308
						<phase>package</phase>
309
						<goals>
310
							<goal>single</goal>
311
						</goals>
312
					</execution>
313
				</executions>
314 224
			</plugin>
315 225
		</plugins>
316 226
		<finalName>${project.artifactId}</finalName>

+ 228 - 0
ebc-sea-platform/pom_full.xml

@ -0,0 +1,228 @@
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4

5
	<parent>
6
		<groupId>com.ai.ipu.server</groupId>
7
		<artifactId>ipu-rest-libs</artifactId>
8
		<version>3.1-SNAPSHOT</version>
9
	</parent>
10

11
	<artifactId>ebc-sea-platform</artifactId>
12
	<packaging>jar</packaging>
13

14
	<properties>
15
		<start-class>com.ai.ipu.server.EbcSeaPlatformStart</start-class>
16
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17
		<mongo.java.driver>3.11.2</mongo.java.driver>
18
		<ipu>3.1-SNAPSHOT</ipu>
19
		<jdk>1.8</jdk>
20
		<junit>4.12</junit>
21
		<spring-session.version>1.3.2.RELEASE</spring-session.version>
22
		<nacos.version>0.1.1</nacos.version>
23
		<poi.version>3.14</poi.version>
24
		<swagger.version>2.6.1</swagger.version>
25
	</properties>
26

27
	<repositories>
28
		<!-- 阿里私服 -->
29
		<repository>
30
			<id>ali</id>
31
			<url>http://maven.aliyun.com/nexus/content/groups/public</url>
32
			<releases>
33
				<enabled>true</enabled>
34
			</releases>
35
			<snapshots>
36
				<enabled>true</enabled>
37
				<updatePolicy>always</updatePolicy>
38
				<checksumPolicy>fail</checksumPolicy>
39
			</snapshots>
40
		</repository>
41
		<!-- IPU仓库 -->
42
		<repository>
43
			<id>ipu</id>
44
			<name>ipu repository</name>
45
			<url>http://114.215.100.48/nexus/content/groups/public/</url>
46
			<releases>
47
				<enabled>true</enabled>
48
			</releases>
49
			<snapshots>
50
				<enabled>true</enabled>
51
				<updatePolicy>always</updatePolicy>
52
			</snapshots>
53
		</repository>
54
	</repositories>
55

56
	<dependencies>
57
		<dependency>
58
			<groupId>com.ai.ipu</groupId>
59
			<artifactId>ipu-sql-mgmt</artifactId>
60
			<version>${ipu}</version>
61
			<!-- 屏蔽以后Idea可能启动报错 -->
62
<!--			<scope>provided</scope>-->
63
		</dependency>
64
		<dependency>
65
			<groupId>com.ai.ipu.server</groupId>
66
			<artifactId>ipu-restful</artifactId>
67
		</dependency>
68
		<!--uspa start-->
69
		<dependency>
70
			<groupId>org.springframework</groupId>
71
			<artifactId>spring-orm</artifactId>
72
			<version>4.1.9.RELEASE</version>
73
		</dependency>
74
		<!-- apache start -->
75
		<dependency>
76
			<groupId>commons-configuration</groupId>
77
			<artifactId>commons-configuration</artifactId>
78
			<version>1.10</version>
79
		</dependency>
80
		<dependency>
81
			<groupId>commons-fileupload</groupId>
82
			<artifactId>commons-fileupload</artifactId>
83
			<version>1.3.2</version>
84
		</dependency>
85
		<dependency>
86
			<groupId>oro</groupId>
87
			<artifactId>oro</artifactId>
88
			<version>2.0.8</version>
89
		</dependency>
90
		<dependency>
91
			<groupId>commons-net</groupId>
92
			<artifactId>commons-net</artifactId>
93
			<version>3.6</version>
94
		</dependency>
95
		<!-- apache end -->
96
		<dependency>
97
			<groupId>org.hibernate</groupId>
98
			<artifactId>hibernate-core</artifactId>
99
			<version>4.2.5.Final</version>
100
		</dependency>
101
		<!-- swagger start -->
102
		<dependency>
103
			<groupId>io.springfox</groupId>
104
			<artifactId>springfox-swagger2</artifactId>
105
			<version>${swagger.version}</version>
106
		</dependency>
107
		<dependency>
108
			<groupId>io.springfox</groupId>
109
			<artifactId>springfox-swagger-ui</artifactId>
110
			<version>${swagger.version}</version>
111
		</dependency>
112
		<!-- swagger end -->
113
		<dependency>
114
			<groupId>com.thoughtworks.xstream</groupId>
115
			<artifactId>xstream</artifactId>
116
			<version>1.4.10</version>
117
		</dependency>
118
		<!--	poi start  -->
119
		<dependency>
120
			<groupId>org.apache.poi</groupId>
121
			<artifactId>poi-ooxml</artifactId>
122
			<version>${poi.version}</version>
123
		</dependency>
124
		<dependency>
125
			<groupId>org.apache.poi</groupId>
126
			<artifactId>poi-ooxml-schemas</artifactId>
127
			<version>${poi.version}</version>
128
		</dependency>
129
		<dependency>
130
			<groupId>org.apache.poi</groupId>
131
			<artifactId>poi-scratchpad</artifactId>
132
			<version>${poi.version}</version>
133
		</dependency>
134
		<dependency>
135
			<groupId>org.apache.poi</groupId>
136
			<artifactId>poi-excelant</artifactId>
137
			<version>${poi.version}</version>
138
		</dependency>
139
		<dependency>
140
			<groupId>org.apache.poi</groupId>
141
			<artifactId>poi-contrib</artifactId>
142
			<version>3.6</version>
143
		</dependency>
144
		<dependency>
145
			<groupId>commons-digester</groupId>
146
			<artifactId>commons-digester</artifactId>
147
			<version>2.1</version>
148
		</dependency>
149
		<!-- poi end -->
150
		<dependency>
151
			<groupId>commons-httpclient</groupId>
152
			<artifactId>commons-httpclient</artifactId>
153
			<version>3.1</version>
154
		</dependency>
155
		<dependency>
156
			<groupId>org.projectlombok</groupId>
157
			<artifactId>lombok</artifactId>
158
			<version>1.16.10</version>
159
			<scope>provided</scope>
160
		</dependency>
161
		<!--  IPU 镜屏 -->
162
		<dependency>
163
			<groupId>com.ai.ipu.server</groupId>
164
			<artifactId>iot-stomp-server</artifactId>
165
			<version>${ipu}</version>
166
			<exclusions>
167
				<exclusion>
168
					<groupId>org.apache.logging.log4j</groupId>
169
					<artifactId>log4j-slf4j-impl</artifactId>
170
				</exclusion>
171
			</exclusions>
172
		</dependency>
173
	</dependencies>
174

175
	<!--<build>
176
		<plugins>
177
			<plugin>
178
				<groupId>org.springframework.boot</groupId>
179
				<artifactId>spring-boot-maven-plugin</artifactId>
180
				<configuration>
181
					<fork>true</fork>
182
				</configuration>
183
			</plugin>
184
		</plugins>
185
	</build>-->
186

187
	<build>
188
		<plugins>
189
			<plugin>
190
				<artifactId>maven-compiler-plugin</artifactId>
191
				<configuration>
192
					<source>${compiler-version}</source>
193
					<target>${compiler-version}</target>
194
					<encoding>${encoding}</encoding>
195
					<!-- 通过此方法添加本地jar -->
196
					<compilerArguments>
197
	 					<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
198
	 					<extdirs>${project.basedir}/libs</extdirs>
199
					</compilerArguments>
200
				</configuration>
201
			</plugin>
202
			<plugin>
203
                <groupId>org.apache.maven.plugins</groupId>
204
                <artifactId>maven-surefire-plugin</artifactId>
205
                <configuration>
206
                    <skip>true</skip>
207
                </configuration>
208
            </plugin>
209
			<!-- 比spring-boot-dependencies中多了build-info -->
210
			<plugin>
211
				<groupId>org.springframework.boot</groupId>
212
				<artifactId>spring-boot-maven-plugin</artifactId>
213
				<executions>
214
					<execution>
215
						<goals>
216
							<goal>repackage</goal>
217
							<goal>build-info</goal>
218
						</goals>
219
					</execution>
220
				</executions>
221
				<configuration>
222
					<mainClass>${start-class}</mainClass>
223
				</configuration>
224
			</plugin>
225
		</plugins>
226
		<finalName>${project.artifactId}</finalName>
227
	</build>
228
</project>

+ 318 - 0
ebc-sea-platform/pom_part.xml

@ -0,0 +1,318 @@
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4

5
	<parent>
6
		<groupId>com.ai.ipu.server</groupId>
7
		<artifactId>ipu-rest-libs</artifactId>
8
		<version>3.1-SNAPSHOT</version>
9
	</parent>
10

11
	<artifactId>ebc-sea-platform</artifactId>
12
	<packaging>jar</packaging>
13

14
	<properties>
15
		<start-class>com.ai.ipu.server.EbcSeaPlatformStart</start-class>
16
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17
		<mongo.java.driver>3.11.2</mongo.java.driver>
18
		<ipu>3.1-SNAPSHOT</ipu>
19
		<jdk>1.8</jdk>
20
		<junit>4.12</junit>
21
		<spring-session.version>1.3.2.RELEASE</spring-session.version>
22
		<nacos.version>0.1.1</nacos.version>
23
		<poi.version>3.14</poi.version>
24
		<swagger.version>2.6.1</swagger.version>
25
	</properties>
26

27
	<repositories>
28
		<!-- 阿里私服 -->
29
		<repository>
30
			<id>ali</id>
31
			<url>http://maven.aliyun.com/nexus/content/groups/public</url>
32
			<releases>
33
				<enabled>true</enabled>
34
			</releases>
35
			<snapshots>
36
				<enabled>true</enabled>
37
				<updatePolicy>always</updatePolicy>
38
				<checksumPolicy>fail</checksumPolicy>
39
			</snapshots>
40
		</repository>
41
		<!-- IPU仓库 -->
42
		<repository>
43
			<id>ipu</id>
44
			<name>ipu repository</name>
45
			<url>http://114.215.100.48/nexus/content/groups/public/</url>
46
			<releases>
47
				<enabled>true</enabled>
48
			</releases>
49
			<snapshots>
50
				<enabled>true</enabled>
51
				<updatePolicy>always</updatePolicy>
52
			</snapshots>
53
		</repository>
54
	</repositories>
55

56
	<dependencies>
57
		<dependency>
58
			<groupId>com.ai.ipu</groupId>
59
			<artifactId>ipu-sql-mgmt</artifactId>
60
			<version>${ipu}</version>
61
			<!-- 屏蔽以后Idea可能启动报错 -->
62
<!--			<scope>provided</scope>-->
63
		</dependency>
64
		<dependency>
65
			<groupId>com.ai.ipu.server</groupId>
66
			<artifactId>ipu-restful</artifactId>
67
		</dependency>
68
		<!--uspa start-->
69
		<dependency>
70
			<groupId>org.springframework</groupId>
71
			<artifactId>spring-orm</artifactId>
72
			<version>4.1.9.RELEASE</version>
73
		</dependency>
74
		<!-- apache start -->
75
		<dependency>
76
			<groupId>commons-configuration</groupId>
77
			<artifactId>commons-configuration</artifactId>
78
			<version>1.10</version>
79
		</dependency>
80
		<dependency>
81
			<groupId>commons-fileupload</groupId>
82
			<artifactId>commons-fileupload</artifactId>
83
			<version>1.3.2</version>
84
		</dependency>
85
		<dependency>
86
			<groupId>oro</groupId>
87
			<artifactId>oro</artifactId>
88
			<version>2.0.8</version>
89
		</dependency>
90
		<dependency>
91
			<groupId>commons-net</groupId>
92
			<artifactId>commons-net</artifactId>
93
			<version>3.6</version>
94
		</dependency>
95
		<!-- apache end -->
96
		<dependency>
97
			<groupId>org.hibernate</groupId>
98
			<artifactId>hibernate-core</artifactId>
99
			<version>4.2.5.Final</version>
100
		</dependency>
101
		<!-- swagger start -->
102
		<dependency>
103
			<groupId>io.springfox</groupId>
104
			<artifactId>springfox-swagger2</artifactId>
105
			<version>${swagger.version}</version>
106
		</dependency>
107
		<dependency>
108
			<groupId>io.springfox</groupId>
109
			<artifactId>springfox-swagger-ui</artifactId>
110
			<version>${swagger.version}</version>
111
		</dependency>
112
		<!-- swagger end -->
113
		<dependency>
114
			<groupId>com.thoughtworks.xstream</groupId>
115
			<artifactId>xstream</artifactId>
116
			<version>1.4.10</version>
117
		</dependency>
118
		<!--	poi start  -->
119
		<dependency>
120
			<groupId>org.apache.poi</groupId>
121
			<artifactId>poi-ooxml</artifactId>
122
			<version>${poi.version}</version>
123
		</dependency>
124
		<dependency>
125
			<groupId>org.apache.poi</groupId>
126
			<artifactId>poi-ooxml-schemas</artifactId>
127
			<version>${poi.version}</version>
128
		</dependency>
129
		<dependency>
130
			<groupId>org.apache.poi</groupId>
131
			<artifactId>poi-scratchpad</artifactId>
132
			<version>${poi.version}</version>
133
		</dependency>
134
		<dependency>
135
			<groupId>org.apache.poi</groupId>
136
			<artifactId>poi-excelant</artifactId>
137
			<version>${poi.version}</version>
138
		</dependency>
139
		<dependency>
140
			<groupId>org.apache.poi</groupId>
141
			<artifactId>poi-contrib</artifactId>
142
			<version>3.6</version>
143
		</dependency>
144
		<dependency>
145
			<groupId>commons-digester</groupId>
146
			<artifactId>commons-digester</artifactId>
147
			<version>2.1</version>
148
		</dependency>
149
		<!-- poi end -->
150
		<dependency>
151
			<groupId>commons-httpclient</groupId>
152
			<artifactId>commons-httpclient</artifactId>
153
			<version>3.1</version>
154
		</dependency>
155
		<dependency>
156
			<groupId>org.projectlombok</groupId>
157
			<artifactId>lombok</artifactId>
158
			<version>1.16.10</version>
159
			<scope>provided</scope>
160
		</dependency>
161
		<!--  IPU 镜屏 -->
162
		<dependency>
163
			<groupId>com.ai.ipu.server</groupId>
164
			<artifactId>iot-stomp-server</artifactId>
165
			<version>${ipu}</version>
166
			<exclusions>
167
				<exclusion>
168
					<groupId>org.apache.logging.log4j</groupId>
169
					<artifactId>log4j-slf4j-impl</artifactId>
170
				</exclusion>
171
			</exclusions>
172
		</dependency>
173
	</dependencies>
174

175
	<!--<build>
176
		<plugins>
177
			<plugin>
178
				<groupId>org.springframework.boot</groupId>
179
				<artifactId>spring-boot-maven-plugin</artifactId>
180
				<configuration>
181
					<fork>true</fork>
182
				</configuration>
183
			</plugin>
184
		</plugins>
185
	</build>-->
186

187
	<build>
188
		<plugins>
189
			<plugin>
190
				<artifactId>maven-compiler-plugin</artifactId>
191
				<configuration>
192
					<source>${compiler-version}</source>
193
					<target>${compiler-version}</target>
194
					<encoding>${encoding}</encoding>
195
					<!-- 通过此方法添加本地jar -->
196
					<compilerArguments>
197
						<!--suppress UnresolvedMavenProperty -->
198
						<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
199
						<extdirs>${project.basedir}/libs</extdirs>
200
					</compilerArguments>
201
				</configuration>
202
			</plugin>
203
			<plugin>
204
				<groupId>org.apache.maven.plugins</groupId>
205
				<artifactId>maven-surefire-plugin</artifactId>
206
				<configuration>
207
					<skip>true</skip>
208
				</configuration>
209
			</plugin>
210
			<!-- ==========应用包和依赖包分离的打包方法================ -->
211
			<plugin>
212
				<groupId>org.apache.maven.plugins</groupId>
213
				<artifactId>maven-resources-plugin</artifactId>
214
				<executions>
215
					<execution>
216
						<id>copy-resources</id>
217
						<phase>compile</phase>
218
						<goals>
219
							<goal>copy-resources</goal>
220
						</goals>
221
						<configuration>
222
							<encoding>${encoding}</encoding>
223
							<resources>
224
								<resource>
225
									<directory>${project.build.directory}/classes</directory>
226
									<includes>
227
										<include>**/*.properties</include>
228
										<include>**/*.xml</include>
229
										<include>**/*.yaml</include>
230
										<include>**/*.yml</include>
231
										<include>**/*.txt</include>
232
									</includes>
233
								</resource>
234
							</resources>
235
							<!-- 表示把配置文件拷到和jar包同一个路径下 -->
236
							<outputDirectory>
237
								${project.build.directory}/config
238
							</outputDirectory>
239
						</configuration>
240
					</execution>
241
				</executions>
242
			</plugin>
243
			<!-- 复制依赖包 -->
244
			<plugin>
245
				<groupId>org.apache.maven.plugins</groupId>
246
				<artifactId>maven-dependency-plugin</artifactId>
247
				<executions>
248
					<execution>
249
						<id>copy-dependencies</id>
250
						<phase>package</phase>
251
						<goals>
252
							<goal>copy-dependencies</goal>
253
						</goals>
254
						<configuration>
255
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
256
						</configuration>
257
					</execution>
258
				</executions>
259
			</plugin>
260
			<plugin>
261
				<groupId>org.apache.maven.plugins</groupId>
262
				<artifactId>maven-jar-plugin</artifactId>
263
				<configuration>
264
					<archive>
265
						<!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
266
						<addMavenDescriptor>false</addMavenDescriptor>
267
						<manifest>
268
							<!--是否要把第三方jar放到manifest的classpath中-->
269
							<addClasspath>true</addClasspath>
270
							<!--生成的manifest中classpath的前缀,lib存放第三方jar-->
271
							<classpathPrefix>lib/</classpathPrefix>
272
							<!--应用的main class-->
273
							<mainClass>${start-class}</mainClass>
274
							<!-- 去掉jar后的时间戳 -->
275
							<useUniqueVersions>false</useUniqueVersions>
276
						</manifest>
277
						<!-- 自定义的MANIFEST.MF参数 -->
278
						<manifestEntries>
279
							<!-- 增加classpath目录config -->
280
							<Class-Path>./config/</Class-Path>
281
						</manifestEntries>
282
					</archive>
283
					<!--过滤掉不希望包含在jar中的文件-->
284
					<excludes>
285
						<exclude>**/*.properties</exclude>
286
						<exclude>**/*.xml</exclude>
287
						<exclude>**/*.yaml</exclude>
288
						<exclude>**/*.yml</exclude>
289
						<exclude>**/*.txt</exclude>
290
					</excludes>
291
				</configuration>
292
			</plugin>
293

294
			<plugin>
295
				<groupId>org.apache.maven.plugins</groupId>
296
				<artifactId>maven-assembly-plugin</artifactId>
297
				<version>2.4</version>
298
				<!-- The configuration of the plugin -->
299
				<configuration>
300
					<!-- Specifies the configuration file of the assembly plugin -->
301
					<descriptors>
302
						<descriptor>src/main/assembly-package.xml</descriptor>
303
					</descriptors>
304
				</configuration>
305
				<executions>
306
					<execution>
307
						<id>make-assembly</id>
308
						<phase>package</phase>
309
						<goals>
310
							<goal>single</goal>
311
						</goals>
312
					</execution>
313
				</executions>
314
			</plugin>
315
		</plugins>
316
		<finalName>${project.artifactId}</finalName>
317
	</build>
318
</project>

+ 12 - 9
ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/ReceiveSubscribeController.java

@ -77,17 +77,20 @@ public class ReceiveSubscribeController {
77 77
		
78 78
		//报警类型
79 79
		switch (detailInfo.getJSONObject("alarmType").getIntValue("value")) {
80
		case 1: //自动报警
81
			dataMap.put("locationStatus",EbcConstant.location_status_autosos);//报警类型
82
			dataMap.put("alarmType",EbcConstant.alarm_type_autosos);//报警类型
80
		case EbcConstant.alarm_type_autosos_beidou: 
81
			//自动报警
82
			dataMap.put("locationStatus",EbcConstant.location_status_autosos);//定位状态
83
			dataMap.put("alarmType",EbcConstant.alarm_type_autosos_ZH);//报警类型
83 84
			break;
84
		case 2: //手动报警
85
			dataMap.put("locationStatus",EbcConstant.location_status_jogsos);//报警类型
86
			dataMap.put("alarmType",EbcConstant.alarm_type_jogsos);//报警类型
85
		case EbcConstant.alarm_type_jogsos_beidou: 
86
			//手动报警
87
			dataMap.put("locationStatus",EbcConstant.location_status_jogsos);//定位状态
88
			dataMap.put("alarmType",EbcConstant.alarm_type_jogsos_ZH);//报警类型
87 89
			break;
88
		case 4: //离线
89
			dataMap.put("locationStatus",EbcConstant.location_status_offline);//报警类型
90
			dataMap.put("alarmType",EbcConstant.alarm_type_offline);//报警类型
90
		case EbcConstant.alarm_type_offline_beidou: 
91
			//离线
92
			dataMap.put("locationStatus",EbcConstant.location_status_offline);//定位状态
93
			dataMap.put("alarmType",EbcConstant.alarm_type_offline_ZH);//报警类型
91 94
			break;
92 95
		default:
93 96
			logger.error("告警消息的内容错误,消息为:" +msg);

+ 6 - 0
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/DeviceManageDaoImpl.java

@ -231,6 +231,12 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
231 231
			detailInfoMap.put("longitude", detailInfo.getJSONObject("longitude").getString("value"));// 经度
232 232
			detailInfoMap.put("latitude", detailInfo.getJSONObject("latitude").getString("value"));// 纬度
233 233
			detailInfoMap.put("newDate", detailInfo.getJSONObject("msgDate").getString("value"));// 最新定位时间
234
			
235
			// 报警类型
236
			if (detailInfo.getJSONObject("alarmType")!=null) {
237
				detailInfoMap.put("alarmType", detailInfo.getJSONObject("alarmType").getString("value"));
238
			}
239
			
234 240
			list.add(detailInfoMap);
235 241
		}
236 242
		

+ 23 - 10
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/RescueDaoImpl.java

@ -34,7 +34,7 @@ public class RescueDaoImpl extends AbstractBizDao implements RescueDao {
34 34
	public List<Map<String, Object>> queryNoCloseRescueLog(List<String> deviceIdsList) throws Exception {
35 35
		Map<String, Object> dataMap=new HashMap<String, Object>();
36 36
		dataMap.put("deviceIdsList", deviceIdsList);//设备ID
37
		dataMap.put("offlineType", EbcConstant.alarm_type_offline);//不属于离线告警
37
		dataMap.put("offlineType", EbcConstant.alarm_type_offline_ZH);//不属于离线告警
38 38
		
39 39
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
40 40
		return mgmtDao.executeSelect("ipu.RescueDao",  "queryNoCloseRescueLog", dataMap);
@ -52,21 +52,32 @@ public class RescueDaoImpl extends AbstractBizDao implements RescueDao {
52 52
	 */
53 53
	@Override
54 54
	public boolean addRescueLog(Map<String, Object> dataMap) throws Exception {
55
		dataMap.put("dataStatus", "1");
55
		dataMap.put("DATA_STATUS", "1");
56 56
		//TODO 创建人和操作人的编号和部门
57
		dataMap.put("departmentId", 1);
58
		dataMap.put("createDate", TimeUtil.getSysTime());
59
		dataMap.put("createOpId", "");
60
		dataMap.put("createOrgId", "");
61
		dataMap.put("doneDate", TimeUtil.getSysTime());
62
		dataMap.put("opId", "");
63
		dataMap.put("orgId", "");
57
		dataMap.put("CREATE_DATE", TimeUtil.getSysTime());
58
		dataMap.put("CREATE_OP_ID", "");
59
		dataMap.put("CREATE_ORG_ID", "");
60
		dataMap.put("DONE_DATE", TimeUtil.getSysTime());
61
		dataMap.put("OP_ID", "");
62
		dataMap.put("ORG_ID", "");
64 63
65 64
		int num=dao.insert("LR_RESCUE_LOG", dataMap);
66 65
		
67 66
		return num > 0;
68 67
	}
69
68
	
69
	@Override
70
	public boolean modifyRescueLog(Map<String, Object> dataMap) throws Exception {
71
		//TODO 操作人的编号和部门
72
		dataMap.put("DONE_DATE", TimeUtil.getSysTime());
73
		dataMap.put("OP_ID", "");
74
		dataMap.put("ORG_ID", "");
75
		
76
		int num=dao.update("LR_RESCUE_LOG", dataMap);
77
		
78
		return num > 0;
79
	}
80
	
70 81
	@Override
71 82
	public boolean assignRescuer(JMap params) throws Exception {
72 83
		// TODO Auto-generated method stub
@ -78,5 +89,7 @@ public class RescueDaoImpl extends AbstractBizDao implements RescueDao {
78 89
		// TODO Auto-generated method stub
79 90
		return false;
80 91
	}
92
	
93
	
81 94
82 95
}

+ 8 - 0
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/RescueDao.java

@ -42,6 +42,14 @@ public interface RescueDao {
42 42
	boolean addRescueLog(Map<String, Object> dataMap) throws Exception;
43 43
44 44
	/**
45
	 * 修改报警救援日志
46
	 * @param dataMap
47
	 * @return
48
	 * @throws Exception
49
	 */
50
	boolean modifyRescueLog(Map<String, Object> dataMap) throws Exception;
51
	
52
	/**
45 53
	 * 指派救援
46 54
	 * @return
47 55
	 * @throws Exception

+ 33 - 87
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/DeviceManageServiceImpl.java

@ -18,6 +18,7 @@ import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
18 18
import com.ai.ipu.server.dao.interfaces.RescueDao;
19 19
import com.ai.ipu.server.enums.UserEnums;
20 20
import com.ai.ipu.server.service.interfaces.DeviceManageService;
21
import com.ai.ipu.server.util.DateUtil;
21 22
import com.ai.ipu.server.util.EbcConstant;
22 23
import com.ai.ipu.server.util.JingPingSendDateUtil;
23 24
import com.alibaba.fastjson.JSON;
@ -189,83 +190,6 @@ public class DeviceManageServiceImpl implements DeviceManageService {
189 190
		return num > 0;
190 191
	}
191 192
192
	
193
	public List<Map<String, String>> queryCurrentDeviceLocationInfo11(JMap params) throws Exception {
194
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
195
196
		Map<String, String> map1 = new HashMap<String, String>();
197
		map1.put("userName", "张三");// 人员姓名
198
		map1.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
199
		map1.put("deviceId", "999571");// 终端ID
200
		map1.put("deviceNo", "999571");// 终端编号
201
		map1.put("longitude", "123.7709439");// 经度
202
		map1.put("latitude", "31.5847745");// 纬度
203
		map1.put("newDate", "2020-10-27 13:14:15");// 最新定位时间
204
		list.add(map1);
205
206
		Map<String, String> map2 = new HashMap<String, String>();
207
		map2.put("userName", "李四");// 人员姓名
208
		map2.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
209
		map2.put("deviceId", "981489");// 终端ID
210
		map2.put("deviceNo", "981489");// 终端编号
211
		map2.put("longitude", "125.4221927");// 经度
212
		map2.put("latitude", "32.0453331");// 纬度
213
		map2.put("newDate", "2020-10-26 11:22:33");// 最新定位时间
214
		list.add(map2);
215
216
		Map<String, String> map3 = new HashMap<String, String>();
217
		map3.put("userName", "王五");// 人员姓名
218
		map3.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
219
		map3.put("deviceId", "981453");// 终端ID
220
		map3.put("deviceNo", "981453");// 终端编号
221
		map3.put("longitude", "122.0221926");// 经度
222
		map3.put("latitude", "33.5453331");// 纬度
223
		map3.put("newDate", "2020-10-27 12:31:45");// 最新定位时间
224
		list.add(map3);
225
226
		Map<String, String> map4 = new HashMap<String, String>();
227
		map4.put("userName", "赵六");// 人员姓名
228
		map4.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
229
		map4.put("deviceId", "23125");// 终端ID
230
		map4.put("deviceNo", "23125");// 终端编号
231
		map4.put("longitude", "125.3221927");// 经度
232
		map4.put("latitude", "33.3453331");// 纬度
233
		map4.put("newDate", "2020-10-27 13:40:40");// 最新定位时间
234
		list.add(map4);
235
236
		Map<String, String> map5 = new HashMap<String, String>();
237
		map5.put("userName", "田七");// 人员姓名
238
		map5.put("locationStatus", EbcConstant.location_status_normal);// 状态: 0定位
239
		map5.put("deviceId", "23126");// 终端ID
240
		map5.put("deviceNo", "23126");// 终端编号
241
		map5.put("longitude", "125.4221927");// 经度
242
		map5.put("latitude", "32.9453331");// 纬度
243
		map5.put("newDate", "2020-10-27 18:20:30");// 最新定位时间
244
		list.add(map5);
245
246
		Map<String, String> map6 = new HashMap<String, String>();
247
		map6.put("userName", "周八");// 人员姓名
248
		map6.put("locationStatus", EbcConstant.location_status_exclusion);// 状态:3违规(禁区)
249
		map6.put("deviceId", "23128");// 终端ID
250
		map6.put("deviceNo", "23128");// 终端编号
251
		map6.put("longitude", "124.5309335");// 经度
252
		map6.put("latitude", "33.7753425");// 纬度
253
		map6.put("newDate", "2020-10-27 14:28:38");// 最新定位时间
254
		list.add(map6);
255
256
		Map<String, String> map7 = new HashMap<String, String>();
257
		map7.put("userName", "吴九");// 人员姓名
258
		map7.put("locationStatus", EbcConstant.location_status_offline);// 状态:1离线
259
		map7.put("deviceId", "23129");// 终端ID
260
		map7.put("deviceNo", "23129");// 终端编号
261
		map7.put("longitude", "122.4221927");// 经度
262
		map7.put("latitude", "32.6453331");// 纬度
263
		map7.put("newDate", "2020-10-27 14:15:22");// 最新定位时间
264
		list.add(map7);
265
266
		return list;
267
	}
268
	
269 193
	@Override
270 194
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(JMap params) throws Exception {
271 195
		// 获取已绑定的设备列表
@ -300,34 +224,58 @@ public class DeviceManageServiceImpl implements DeviceManageService {
300 224
			map.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
301 225
			
302 226
			boolean flag = true;
303
			// 设备绑定的信息
227
			
228
			// 人员名称
304 229
			for (Map<String, Object> bindDeviceMap : bindUserDeviceList) {
305 230
				if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
306 231
					map.put("userName", String.valueOf(bindDeviceMap.get("NAME")));
307 232
					break;
308 233
				}
309 234
			}
310
235
			
236
			//离线信息
237
			if (map.get("alarmType")!=null&&EbcConstant.alarm_type_offline_beidou==Integer.parseInt(String.valueOf(map.get("alarmType")))) {
238
				map.put("locationStatus",EbcConstant.location_status_offline);//定位状态
239
				map.put("alarmType",EbcConstant.alarm_type_offline_ZH);//报警类型
240
				flag = false;
241
			}
242
			
243
			// 求救信息
311 244
			if (alarmMapList != null && flag) {
312
				// 求救信息
313 245
				for (int i = 0; i < alarmMapList.size() && flag; i++) {
314 246
					Map<String, Object> alarmMap = alarmMapList.get(i);
315 247
					if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
316 248
						// 求救时间
317 249
						String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
318
						map.put("alarmDate", alarmDate);
250
						map.put("alarmDate", DateUtil.formatStrDate(alarmDate));
319 251
320 252
						// 计算求救时长
321
						int alarmLong = JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, map.get("newDate"));
253
						int alarmLong = DateUtil.getDifferenceMinute(alarmDate, map.get("newDate"));
322 254
						map.put("alarmLong", String.valueOf(alarmLong));
323
255
						
256
						//定位状态
257
						switch (String.valueOf(alarmMap.get("ALARM_TYPE"))) {
258
						case EbcConstant.alarm_type_autosos_ZH:
259
							//自动报警
260
							map.put("locationStatus",EbcConstant.location_status_autosos);
261
							map.put("alarmType",EbcConstant.alarm_type_autosos_ZH);
262
							break;
263
						case EbcConstant.alarm_type_jogsos_ZH:
264
							//手动报警
265
							map.put("locationStatus",EbcConstant.location_status_jogsos);
266
							map.put("alarmType",EbcConstant.alarm_type_jogsos_ZH);
267
							break;
268
						default:
269
							break;
270
						}
271
						
324 272
						flag = false;
325 273
					}
326 274
				}
327 275
			}
328 276
277
			// 违规信息
329 278
			if (areaViolationMapList != null && flag) {
330
				// 违规信息
331 279
				int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
332 280
				long minInAreaLong = System.currentTimeMillis();// 进入围栏最早的时间戳
333 281
				Map<String, Object> areaInfoMap = null;// 用于计算时间的围栏信息
@ -365,15 +313,13 @@ public class DeviceManageServiceImpl implements DeviceManageService {
365 313
366 314
				// 判断是否在违规
367 315
				if (maxMapTagGrade == 5) {
368
					logger.info("镜屏推送进入电子围栏的信息");
369 316
					// 进入电子围栏(禁区),需显示进入时间
370 317
					map.put("inDate", simpleDateFormat.format(areaInfoMap.get("IN_DATE"))); // 进入时间
371 318
					map.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
372 319
373 320
				} else if (maxMapTagGrade == 3) {
374 321
					// 进入定点(限时),需计算是否超时
375
					int fixedLong = JingPingSendDateUtil
376
							.getBetweenMinuteValue(String.valueOf(areaInfoMap.get("IN_DATE")), map.get("newDate"));
322
					int fixedLong = DateUtil.getDifferenceMinute(String.valueOf(areaInfoMap.get("IN_DATE")), map.get("newDate"));
377 323
378 324
					if (fixedLong > 0) {
379 325
						// 围栏要求定点时间

+ 19 - 6
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/ReceiveSubscribeServiceImpl.java

@ -22,6 +22,7 @@ import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
22 22
import com.ai.ipu.server.dao.interfaces.MapTagManageDao;
23 23
import com.ai.ipu.server.dao.interfaces.RescueDao;
24 24
import com.ai.ipu.server.service.interfaces.ReceiveSubscribeService;
25
import com.ai.ipu.server.util.DateUtil;
25 26
import com.ai.ipu.server.util.EbcConstant;
26 27
import com.ai.ipu.server.util.JingPingSendDateUtil;
27 28
import com.alibaba.fastjson.JSON;
@ -51,6 +52,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
51 52
			public void run() {
52 53
				try {
53 54
					logger.debug("启动定位信息新线程:" + Thread.currentThread().getName());
55
					// 处理定位数据
54 56
					executeReceiveIotLocationData(dataMap);
55 57
56 58
					logger.debug("数据库连接全量提交");
@ -75,6 +77,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
75 77
			public void run() {
76 78
				try {
77 79
					logger.debug("启动报警信息新线程:" + Thread.currentThread().getName());
80
					// 处理报警数据
78 81
					executeReceiveIotAlarmData(dataMap);
79 82
80 83
					logger.debug("数据库连接全量提交");
@ -103,6 +106,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
103 106
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(params.getString("deviceId"), null);
104 107
105 108
		if (bindInfoMap != null) {
109
			// 设备与人员绑定
106 110
			logger.debug("定位信息的对象为人员: " + bindInfoMap.get("NAME"));
107 111
			params.put("userName", bindInfoMap.get("NAME"));
108 112
			params.put("userCode", bindInfoMap.get("CODE"));
@ -110,6 +114,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
110 114
		} else {
111 115
			bindInfoMap = deviceManageDao.queryOneBindShip(params.getString("deviceId"), null);
112 116
			if (bindInfoMap != null) {
117
				// 设备与船舶绑定
113 118
				logger.info("定位信息的对象为船舶: " + bindInfoMap.get("NAME"));
114 119
				params.put("shipName", bindInfoMap.get("NAME"));
115 120
				params.put("shipCode", bindInfoMap.get("CODE"));
@ -119,6 +124,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
119 124
				logger.debug("推送镜屏数据:" + jingpingData);
120 125
				JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_ship, jingpingData);
121 126
			} else {
127
				// 设备未绑定
122 128
				logger.error("定位设备未绑定");
123 129
			}
124 130
			return;
@ -168,10 +174,10 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
168 174
169 175
		// 求救时间
170 176
		String alarmDate = String.valueOf(alarmList.get(0).get("CALLER_DATE"));
171
		params.put("alarmDate", alarmDate);
177
		params.put("alarmDate", DateUtil.formatStrDate(alarmDate));
172 178
173 179
		// 计算求救时长
174
		params.put("alarmLong", JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, params.getString("newDate")));
180
		params.put("alarmLong", DateUtil.getDifferenceMinute(alarmDate, params.getString("newDate")));
175 181
176 182
		params.put("isNewAlarm", "0");
177 183
@ -180,6 +186,12 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
180 186
		logger.debug("推送镜屏数据:" + jingpingData);
181 187
		JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_personnel, jingpingData);
182 188
189
		// 修改最后定位时间
190
		Map<String, Object> dataMap = new HashMap<String, Object>();
191
		dataMap.put("LOG_ID", alarmList.get(0).get("LOG_ID")); // 日志ID
192
		dataMap.put("LAST_LOCATION_DATE", params.get("newDate")); // 最后定位时间
193
		rescueDao.modifyRescueLog(dataMap);
194
183 195
		return true;
184 196
	}
185 197
@ -265,7 +277,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
265 277
		if (!beforeAreaMapList.isEmpty()) {
266 278
			List<String> outAreaIdList = new ArrayList<String>();
267 279
			for (Map<String, Object> beforeAreaMap : beforeAreaMapList) {
268
				outAreaIdList.add(String.valueOf(beforeAreaMap.get("MAP_TAG_ID")));
280
				outAreaIdList.add(String.valueOf(beforeAreaMap.get("RECORD_ID")));
269 281
			}
270 282
271 283
			areaInOutRecordDao.updateSameOutTimeAreaOutRecord(params.getString("newDate"), outAreaIdList);
@ -333,12 +345,12 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
333 345
		if (maxMapTagGrade == 5) {
334 346
			logger.info("镜屏推送进入电子围栏的信息");
335 347
			// 进入电子围栏(禁区),需显示进入时间
336
			params.put("inDate", simpleDateFormat.format(sendDataAreaInfo.get("inAreaDate"))); // 进入时间
348
			params.put("inDate", sendDataAreaInfo.get("inAreaDate")); // 进入时间
337 349
			params.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
338 350
339 351
		} else if (maxMapTagGrade == 3) {
340 352
			// 进入定点(限时),需计算是否超时
341
			int fixedLong = JingPingSendDateUtil.getBetweenMinuteValue(
353
			int fixedLong = DateUtil.getDifferenceMinute(
342 354
					String.valueOf(sendDataAreaInfo.get("inAreaDate")), params.getString("newDate"));
343 355
344 356
			if (fixedLong > 0) {
@ -417,7 +429,8 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
417 429
		dataMap.put("ALARM_TYPE", params.get("alarmType")); // 告警类型
418 430
		dataMap.put("LONGITUDE", params.get("longitude")); // 报警经度
419 431
		dataMap.put("LATITUDE", params.get("latitude")); // 报警纬度
420
		dataMap.put("CALLER_DATE", params.get("msgDate")); // 报警时间
432
		dataMap.put("CALLER_DATE", params.get("newDate")); // 报警时间
433
		dataMap.put("LAST_LOCATION_DATE", params.get("newDate")); // 最后定位时间
421 434
422 435
		// 报警位置
423 436
		if (currentAreaInfoJMap.getInt("mapTagNum") > 0) {

+ 193 - 0
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/DateUtil.java

@ -0,0 +1,193 @@
1
package com.ai.ipu.server.util;
2
3
import java.math.BigDecimal;
4
import java.text.ParseException;
5
import java.text.SimpleDateFormat;
6
import java.util.Date;
7
8
import com.ai.ipu.common.date.TimeUtil;
9
10
/**
11
 * 时间工具类
12
 * @author konghl@asiainfo.com
13
 * 2020-11-2
14
 */
15
public class DateUtil {
16
17
	/**
18
	 * 比较日期大小
19
	 * @param dateStr0
20
	 * @param dateStr1
21
	 * @return
22
	 */
23
	public static int compareDate(String dateStr0, String dateStr1) {
24
		Date date1 = convertDate(dateStr0);
25
		Date date2 = convertDate(dateStr1);
26
		int result = date1.compareTo(date2);
27
		return result;
28
	}
29
30
	/**
31
	 * 格式化字符串时间
32
	 * @param date
33
	 * @return yyyy-MM-dd HH:mm:ss
34
	 */
35
	public static String formatStrDate(String dateStr) {
36
		Date date = convertDate(dateStr);
37
		return formatDate(date, "yyyy-MM-dd HH:mm:ss");
38
	}
39
40
	/**
41
	 * 时间转字符串 
42
	 * @param date
43
	 * @return yyyy-MM-dd HH:mm:ss
44
	 */
45
	public static String formatDate(Date date) {
46
		return formatDate(date, "yyyy-MM-dd HH:mm:ss");
47
	}
48
49
	/**
50
	 * 时间转字符串
51
	 * @param date
52
	 * @param pattern 时间格式
53
	 * @return
54
	 */
55
	public static String formatDate(Date date, String pattern) {
56
		if (date == null) {
57
			return "";
58
		}
59
60
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
61
		return formatter.format(date);
62
	}
63
64
	/**
65
	 * 字符串转时间
66
	 * @param dateStr
67
	 * @return
68
	 */
69
	public static Date convertDate(String dateStr) {
70
		if (dateStr == null || "".equals(dateStr)) {
71
			return null;
72
		}
73
		String pattern = TimeUtil.getTimestampFormat(dateStr);
74
		return convertDate(dateStr, pattern);
75
	}
76
77
	/**
78
	 * 字符串转时间
79
	 * @param dateStr
80
	 * @param pattern
81
	 * @return
82
	 */
83
	public static Date convertDate(String dateStr, String pattern) {
84
		if (dateStr == null || "".equals(dateStr)) {
85
			return null;
86
		}
87
88
		if (pattern == null || "".equals(pattern)) {
89
			pattern = TimeUtil.getTimestampFormat(dateStr);
90
		}
91
92
		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
93
		Date date = null;
94
		try {
95
			date = formatter.parse(dateStr);
96
		} catch (ParseException e) {
97
			e.printStackTrace();
98
		}
99
		return date;
100
	}
101
102
	/**
103
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
104
	 * @param beginDate
105
	 * @param endDate
106
	 * @return 
107
	 * @throws ParseException
108
	 */
109
	public static long getDifferenceMillisecond(Date beginDate, Date endDate) throws ParseException {
110
		long beginDateLong = 0L;
111
		long endDateLong = 0L;
112
		if (beginDate != null) {
113
			beginDateLong = beginDate.getTime();
114
		}
115
		if (endDate != null) {
116
			endDateLong = endDate.getTime();
117
		}
118
119
		return endDateLong - beginDateLong;
120
	}
121
122
	/**
123
	 * 计算两个时间差,返回毫秒数(endDate-beginDate)
124
	 * @param beginDateStr
125
	 * @param endDateStr
126
	 * @return 
127
	 * @throws ParseException
128
	 */
129
	public static long getDifferenceMillisecond(String beginDateStr, String endDateStr) throws ParseException {
130
		Date beginDate = convertDate(beginDateStr);
131
		Date endDate = convertDate(endDateStr);
132
		return getDifferenceMillisecond(beginDate, endDate);
133
	}
134
135
	/**
136
	 * 计算两个时间差,返回分钟数(endDate-beginDate)
137
	 * @param beginDate
138
	 * @param endDate
139
	 * @return
140
	 * @throws ParseException 
141
	 */
142
	public static int getDifferenceMinute(String beginDateStr, String endDateStr) throws ParseException {
143
		long diffMillisecond = getDifferenceMillisecond(beginDateStr, endDateStr);
144
		if (diffMillisecond > 0) {
145
			BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
146
			// 单位为分,四舍五入不保留小数
147
			BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
148
					BigDecimal.ROUND_HALF_UP);
149
			return diffMinuteBigDecimal.intValue();
150
		} else {
151
			return 0;
152
		}
153
154
	}
155
156
	/**
157
	 * 计算两个时间差,返回字符串(endDate-beginDate)
158
	 * @param beginDateStr
159
	 * @param endDateStr
160
	 * @return
161
	 * @throws ParseException
162
	 */
163
	public static String getDifferenceString(String beginDateStr, String endDateStr) throws ParseException {
164
		long diffMillisecond = getDifferenceMillisecond(beginDateStr, endDateStr);
165
166
		if (diffMillisecond <= 60000) {
167
			return "0分钟";
168
		}
169
170
		BigDecimal diffMillisecondBigDecimal = new BigDecimal(diffMillisecond);
171
		BigDecimal diffMinuteBigDecimal = diffMillisecondBigDecimal.divide(new BigDecimal("60000"), 0,
172
				BigDecimal.ROUND_DOWN);
173
		BigDecimal diffHourBigDecimal = diffMinuteBigDecimal.divide(new BigDecimal("60"), 0, BigDecimal.ROUND_DOWN);
174
		BigDecimal diffdayBigDecimal = diffHourBigDecimal.divide(new BigDecimal("24"), 0, BigDecimal.ROUND_DOWN);
175
176
		int diffMinute = diffMinuteBigDecimal.subtract(diffHourBigDecimal.multiply(new BigDecimal("60"))).intValue();
177
		int diffHour = diffHourBigDecimal.subtract(diffdayBigDecimal.multiply(new BigDecimal("24"))).intValue();
178
		int diffDay = diffHourBigDecimal.subtract(diffdayBigDecimal.multiply(new BigDecimal("24"))).intValue();
179
180
		StringBuilder diffStr = new StringBuilder();
181
		if (diffDay > 0) {
182
			diffStr.append(diffDay).append("天");
183
		}
184
		if (diffHour > 0) {
185
			diffStr.append(diffHour).append("小时");
186
		}
187
		if (diffMinute > 0) {
188
			diffStr.append(diffMinute).append("分钟");
189
		}
190
191
		return diffStr.toString();
192
	}
193
}

+ 20 - 16
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/EbcConstant.java

@ -42,39 +42,45 @@ public class EbcConstant {
42 42
	// 围栏标记类型:定点
43 43
	public static final String area_type_temporariness = "4";
44 44
45
	//定位状态:正常
45
	//人员定位状态:正常
46 46
	public static final String location_status_normal="0";
47 47
	
48
	//定位状态:离线
48
	//人员定位状态:离线
49 49
	public static final String location_status_offline="1";
50 50
	
51
	//定位状态:定点(超时)违规
51
	//人员定位状态:定点(超时)违规
52 52
	public static final String location_status_overtime="2";
53 53
	
54
	//定位状态:电子围栏(禁区)违规
54
	//人员定位状态:电子围栏(禁区)违规
55 55
	public static final String location_status_exclusion ="3";
56 56
	
57
	//人员状态:SOS(自动)
57
	//人员定位状态:SOS(自动)
58 58
	public static final String location_status_autosos="4";
59 59
	
60
	//人员状态:SOS(手动)
60
	//人员定位状态:SOS(手动)
61 61
	public static final String location_status_jogsos="5";
62 62
	
63
	//人员状态:救援人员
63
	//人员定位状态:救援人员
64 64
	public static final String location_status_rescuers="6";
65 65
	
66
	//告警类型:SOS(手动)
67
	public static final int alarm_type_jogsos_beidou=2;
68
	
69
	//告警类型:SOS(自动)
70
	public static final int alarm_type_autosos_beidou=1;
71
	
66 72
	//告警类型:离线
67
	public static final String alarm_type_offline="离线告警";
73
	public static final int alarm_type_offline_beidou=4;
68 74
	
69 75
	//告警类型:SOS(手动)
70
	public static final String alarm_type_jogsos="手动告警";
71
	
72
	//人员状态:SOS(手动)
73
	public static final String location_status_jogsos_ZH="手动告警";
76
	public static final String alarm_type_jogsos_ZH="手动告警";
74 77
	
75
	//人员状态:SOS(自动)
76
	public static final String location_status_autosos_ZH="落水告警";
78
	//告警类型:SOS(动)
79
	public static final String alarm_type_autosos_ZH="落水告警";
77 80
81
	//告警类型:离线
82
	public static final String alarm_type_offline_ZH="离线告警";
83
	
78 84
	//考勤查询日
79 85
	public static final String  AREA_IN_OUT_RECORD_DAY="day";
80 86
@ -83,7 +89,5 @@ public class EbcConstant {
83 89
84 90
	//考勤查询月
85 91
	public static final String AREA_IN_OUT_RECORD_MONTH="month";
86
	//告警类型:SOS(自动)
87
	public static final String alarm_type_autosos="落水告警";
88 92
89 93
}

+ 0 - 28
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/JingPingSendDateUtil.java

@ -1,9 +1,5 @@
1 1
package com.ai.ipu.server.util;
2 2
3
import java.math.BigDecimal;
4
import java.text.ParseException;
5
import java.text.SimpleDateFormat;
6
7 3
import com.ai.ipu.server.connect.ps.EventChannelTool;
8 4
import com.ai.ipu.server.connect.ps.EventChannelTool.PublisherEvent;
9 5
import com.ai.ipu.server.connect.ps.ISubscriber;
@ -38,28 +34,4 @@ public class JingPingSendDateUtil {
38 34
		};
39 35
		publisher.publish(topic, publisherEvent);
40 36
	}
41
42
	/**
43
	 * 计算两个时间相隔的分钟数(endDate-beginDate)
44
	 * @param beginDate
45
	 * @param endDate
46
	 * @return
47
	 * @throws ParseException 
48
	 */
49
	public static int getBetweenMinuteValue(String beginDate, String endDate) throws ParseException {
50
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
51
		long endDateLong = simpleDateFormat.parse(endDate).getTime();
52
		long beginDateLong = simpleDateFormat.parse(beginDate).getTime();
53
		long alarmLong = endDateLong - beginDateLong;
54
		if (alarmLong>0) {
55
			BigDecimal alarmLongBigDecimal = new BigDecimal(alarmLong);
56
			// 单位为分,四舍五入不保留小数
57
			alarmLongBigDecimal = alarmLongBigDecimal.divide(new BigDecimal("60000"), 0, BigDecimal.ROUND_HALF_UP);
58
			return alarmLongBigDecimal.intValue();
59
		}else {
60
			return 0;
61
		}
62
		
63
	}
64
65 37
}