Ver Código Fonte

Merge remote-tracking branch 'origin/master'

wangchao 4 anos atrás
pai
commit
ffb3b16b49
29 arquivos alterados com 1092 adições e 448 exclusões
  1. 4 0
      ebc-middle-platform/src/conf/services.js
  2. 1 1
      ebc-middle-platform/src/constants.js
  3. 3 0
      ebc-middle-platform/src/ipu-stomp.js
  4. 230 66
      ebc-middle-platform/src/modules/attendance/attendance.vue
  5. 76 0
      ebc-middle-platform/src/modules/orientation/orientation.vue
  6. 5 5
      ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/DeviceManageController.java
  7. 0 1
      ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/ReceiveSubscribeController.java
  8. 6 14
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/AreaInOutRecordDaoImpl.java
  9. 86 117
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/DeviceManageDaoImpl.java
  10. 8 14
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/EquipmentManageDaoImpl.java
  11. 10 14
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/RescueDaoImpl.java
  12. 3 2
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/AreaInOutRecordDao.java
  13. 47 11
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/DeviceManageDao.java
  14. 3 3
      ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/RescueDao.java
  15. 0 36
      ebc-sea-platform/src/main/java/com/ai/ipu/server/enums/IotUrlEnums.java
  16. 220 10
      ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/DeviceManageServiceImpl.java
  17. 76 35
      ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/EquipmentManageServiceImpl.java
  18. 85 54
      ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/ReceiveSubscribeServiceImpl.java
  19. 1 1
      ebc-sea-platform/src/main/java/com/ai/ipu/server/service/interfaces/DeviceManageService.java
  20. 6 6
      ebc-sea-platform/src/main/java/com/ai/ipu/server/util/HttpServiceUtil.java
  21. 2 2
      ebc-sea-platform/src/main/java/com/ai/ipu/server/util/JingPingSendDateUtil.java
  22. 30 0
      ebc-sea-platform/src/main/java/com/ai/ipu/server/util/NorthboundInterfaceConstant.java
  23. 29 29
      ebc-sea-platform/src/main/java/com/ai/ipu/server/util/NorthboundInterfaceUtil.java
  24. 3 3
      ebc-sea-platform/src/main/resources/dev/application.properties
  25. 19 12
      ebc-sea-platform/src/main/resources/pro/application.properties
  26. 29 0
      ebc-sea-platform/src/main/resources/sql/ipu/AreaInOutRecordDao.xml
  27. 68 0
      ebc-sea-platform/src/main/resources/sql/ipu/DeviceManageDao.xml
  28. 25 0
      ebc-sea-platform/src/main/resources/sql/ipu/RescueDao.xml
  29. 17 12
      ebc-sea-platform/src/main/resources/test/application.properties

+ 4 - 0
ebc-middle-platform/src/conf/services.js

@ -169,6 +169,10 @@ export default {
169 169
  history: {
170 170
    GET_HISTORICAL_ALARM: '/history/queryHistoricalAlarm' // 查询历史报警信息
171 171
  },
172
  areaInOutRecord: {
173
    GET_ATTENDANCE: '/areaInOutRecord/queryPageAttendanceCount', // 分页查询考勤统计分析
174
    GET_ATTENDANCE_DETAILE: '/areaInOutRecord/queryPageAttendanceRecordDetaile' // 分页查询考勤统计分析
175
  },
172 176
  excel: {
173 177
    EXPROT_MAP_TAG: '/ExportToExcel/exportMapTagInfoToExcel' // 导出地图标记信息
174 178
  }

+ 1 - 1
ebc-middle-platform/src/constants.js

@ -16,4 +16,4 @@ export const GIS_SEA_LAYER_URL = 'http://192.168.74.189:9999/tdtvector' // 海
16 16
export const GIS_SEA_URL = 'http://192.168.74.216:5071/gisserver/dzht/dzht/wmts' // 海图地址
17 17
export const GIS_CENTER = [33.597844, 123.647472] // 海图中心点
18 18
export const GIS_ZOOM = 7 // 海图默认缩放
19
export const socketUrl = 'ws://127.0.0.1:7100/stomp'
19
export const socketUrl = 'ws://10.19.90.34:7100/stomp'

+ 3 - 0
ebc-middle-platform/src/ipu-stomp.js

@ -25,4 +25,7 @@ function successCallback() {
25 25
  stompClient.subscribe('personnel', msg => {
26 26
    EventBus.$emit('person', msg)
27 27
  })
28
  stompClient.subscribe('ship', msg => {
29
    EventBus.$emit('ship', msg)
30
  })
28 31
}

+ 230 - 66
ebc-middle-platform/src/modules/attendance/attendance.vue

@ -10,17 +10,20 @@
10 10
            <t-button v-for="(item,index) in queryCondition.type" :class="index==queryCondition.currentIndex?'active':''" :key="index" color="secondary" @click="changeType(index)">{{ item }}</t-button>
11 11
          </t-button-group>
12 12
        </div>
13
        <div>
14
          <t-date-picker v-model="queryCondition.singleDateVal" style="width:120px" placeholder="时间" @date-change="onChangeDate"
13
        <div v-if="queryCondition.dateType">
14
          <t-date-picker v-model="queryCondition.singleDateVal" type= "date" style="width:120px" placeholder="时间" @date-change="onChangeDate"
15 15
          ></t-date-picker>
16 16
        </div>
17
        <div v-if="!queryCondition.dateType">
18
          <div>
19
            <t-date-picker v-model="queryCondition.singleDateVal" type="month" style="width:120px" placeholder="时间" @date-change="onChangeDate"
20
            ></t-date-picker>
21
          </div>
22
        </div>
17 23
        <div>
18 24
          <div class="label">姓名:</div>
19 25
          <div class="input-rule">
20
            <t-select v-model="queryCondition.alarmPerson" width="200" placeholder="请输入...">
21
              <t-option>张三</t-option>
22
              <t-option>李四</t-option>
23
            </t-select>
26
            <t-input v-model="queryCondition.alarmPerson" placeholder="请输入..."></t-input>
24 27
          </div>
25 28
        </div>
26 29
        <div class="btns">
@ -32,12 +35,12 @@
32 35
    </div>
33 36
    <div>
34 37
      <t-table :data="table.data">
35
        <t-table-column prop="name" label="姓名"></t-table-column>
36
        <t-table-column prop="job" label="职务"></t-table-column>
37
        <t-table-column v-if="queryCondition.currentIndex === 0" prop="time" label="打卡时间"></t-table-column>
38
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="attendance" label="出勤天数(天)"></t-table-column>
38
        <t-table-column prop="userName" label="姓名"></t-table-column>
39
        <t-table-column prop="duty" label="职务"></t-table-column>
40
        <t-table-column v-if="queryCondition.currentIndex === 0" prop="IN_DATE" label="打卡时间"></t-table-column>
41
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="gateDays" label="出勤天数(天)"></t-table-column>
39 42
        <t-table-column
40
          v-if="queryCondition.currentIndex !== 0"
43
          v-if="queryCondition.currentIndex === 1"
41 44
          fixed="right"
42 45
          label="操作"
43 46
          width="120"
@ -46,6 +49,16 @@
46 49
            <a href="javascript:void(0)" size="sm" @click="detail(scope.row)">详情</a>
47 50
          </template>
48 51
        </t-table-column>
52
        <t-table-column
53
          v-if="queryCondition.currentIndex === 2"
54
          fixed="right"
55
          label="操作"
56
          width="120"
57
        >
58
          <template slot-scope="scope">
59
            <a href="javascript:void(0)" size="sm" @click="monthDetail(scope.row)">详情</a>
60
          </template>
61
        </t-table-column>
49 62
      </t-table>
50 63
      <t-pager :total="table.pager.total" :current.sync="table.pager.currentPage"
51 64
               :page-size.sync="table.pager.size"
@ -58,46 +71,50 @@
58 71
    </div>
59 72
    <t-modal :visibled.sync="modal" :footer-visibled="false" class="modal" title="考勤详情" width="1200px">
60 73
      <div class="title">
61
        <div>姓名:张三</div>
62
        <div>职务:运维人员</div>
63
        <div>考勤时间:2020-08-01 ~ 2020-08-07</div>
64
        <div>出勤天数:7天</div>
74
        <div>姓名:{{ modalData.userName }}</div>
75
        <div>职务:{{ modalData.duty }}</div>
76
        <div>考勤时间:{{ modalData.date }}</div>
77
        <div>出勤天数:{{ modalData.days }}</div>
65 78
      </div>
66 79
      <div>
67 80
        <t-table :data="modalData.table">
68 81
          <t-table-column prop="date" label="日期"></t-table-column>
69
          <t-table-column prop="time" label="打卡时间" ></t-table-column>
82
          <t-table-column prop="printTime" label="打卡时间" ></t-table-column>
83
        </t-table>
84
      </div>
85
    </t-modal>
86
    <t-modal :visibled.sync="monthModal" :footer-visibled="false" class="modal" title="考勤详情" width="1200px">
87
      <div class="title">
88
        <div>姓名:{{ monthModalData.userName }}</div>
89
        <div>职务:{{ monthModalData.duty }}</div>
90
        <div>考勤时间:{{ monthModalData.date }}</div>
91
        <div>出勤天数:{{ monthModalData.days }}</div>
92
      </div>
93
      <div>
94
        <t-table :data="monthModalData.table.data">
95
          <t-table-column prop="date" label="日期"></t-table-column>
96
          <t-table-column prop="printTime" label="打卡时间" ></t-table-column>
70 97
        </t-table>
98
        <t-pager :total="monthModalData.table.pager.total" :current.sync="monthModalData.table.pager.currentPage"
99
                 :page-size.sync="monthModalData.table.pager.size"
100
                 :sizer-range="[10,20,50]"
101
                 class="px-24 pt-16 float-right"
102
                 show-elevator show-sizer
103
                 @on-size-change="onModalSizeChange"
104
                 @on-change="onModalPagerChange">
105
        </t-pager>
71 106
      </div>
72 107
    </t-modal>
73 108
  </div>
74 109
</template>
75 110
<script>
76 111
import './attendance.scss'
112
import services from "../../conf/services";
77 113
export default {
78 114
  data() {
79 115
    return {
80 116
      table: {
81
        data: [
82
          {
83
            name: '王小明',
84
            job: '运维人员',
85
            time: '08:18',
86
            attendance: '7'
87
          },
88
          {
89
            name: '王小明',
90
            job: '运维人员',
91
            time: '08:18',
92
            attendance: '7'
93
          },
94
          {
95
            name: '王小明',
96
            job: '运维人员',
97
            time: '08:18',
98
            attendance: '7'
99
          }
100
        ],
117
        data: [],
101 118
        pager: {
102 119
          currentPage: 1,
103 120
          size: 10,
@ -105,8 +122,9 @@ export default {
105 122
        }
106 123
      },
107 124
      queryCondition: {
125
        dateType: true,
108 126
        type: [
109
          '日', '', ''
127
          '日', '', ''
110 128
        ],
111 129
        currentIndex: 0,
112 130
        singleDateVal: '',
@ -114,71 +132,217 @@ export default {
114 132
      },
115 133
      modal: false,
116 134
      modalData: {
117
        table: [{
118
          date: '2020-08-01',
119
          time: '08:18'
120
        }, {
121
          date: '2020-08-02',
122
          time: '08:18'
123
        }, {
124
          date: '2020-08-03',
125
          time: '08:18'
126
        }, {
127
          date: '2020-08-04',
128
          time: '08:18'
129
        }, {
130
          date: '2020-08-05',
131
          time: '08:18'
132
        }, {
133
          date: '2020-08-06',
134
          time: '08:18'
135
        }, {
136
          date: '2020-08-07',
137
          time: '08:18'
138
        }]
135
        userName: '',
136
        duty: '',
137
        date: '',
138
        days: '',
139
        table: []
140
      },
141
      monthModal: false,
142
      monthModalData: {
143
        userName: '',
144
        EMPLOYEE_ID: '',
145
        duty: '',
146
        date: '',
147
        days: '',
148
        table: {
149
          data: [],
150
          pager: {
151
            currentPage: 1,
152
            size: 10,
153
            total: 0
154
          }
155
        }
139 156
      }
140 157
    }
141 158
  },
142 159
  mounted() {
143
    this.table.data = this.table.data.concat(this.table.data)
144
    this.table.pager.total = this.table.data.length
160
    this.getList()
145 161
  },
146 162
  methods: {
147 163
    changeType(index) {
148 164
      this.queryCondition.currentIndex = index
165
      this.queryCondition.singleDateVal = ''
166
      this.queryCondition.dateType = !(index === 2)
167
      this.getList()
149 168
    },
150 169
    onChangeDate(value) {
151 170
      console.log(value)
152
      this.singleDateVal = value
171
      this.onSearch()
153 172
    },
154 173
    onChange(value) {
155 174
      console.log('date change:' + value)
156 175
    },
157 176
    onReset() {
158 177
      this.queryCondition = {
178
        dateType: true,
159 179
        type: [
160
          '日', '', ''
180
          '日', '', ''
161 181
        ],
162 182
        currentIndex: 0,
163 183
        singleDateVal: '',
164 184
        alarmPerson: ''
165 185
      }
186
      this.table.pager.currentPage = 1
187
      this.table.pager.size = 10
188
      this.getList()
189
    },
190
    getList() {
191
      var mark
192
      if (this.queryCondition.currentIndex === 0) {
193
        mark = 'day'
194
      } else if (this.queryCondition.currentIndex === 1) {
195
        mark = 'week'
196
      } else {
197
        mark = 'month'
198
      }
199
      var params = new FormData()
200
      params.append(
201
        'data',
202
        JSON.stringify({
203
          currentDate: this.queryCondition.singleDateVal,
204
          mark: mark,
205
          userName: this.queryCondition.alarmPerson,
206
          pageNum: this.table.pager.currentPage,
207
          pageSize: this.table.pager.size
208
        })
209
      )
210
      this.$test
211
        .post(services.areaInOutRecord.GET_ATTENDANCE, params)
212
        .then((res) => {
213
          // 请求成功处理...
214
          this.table.data = res.data.list
215
          this.table.pager.total = res.data.total
216
        })
217
        .catch((res) => {
218
          // 请求失败处理...
219
        })
166 220
    },
167 221
    onSearch() {
168
222
      this.table.pager.currentPage = 1
223
      this.getList()
169 224
    },
170 225
    toExport() {
171 226
172 227
    },
173 228
    onPagerChange(page) {
174
229
      this.table.pager.currentPage = page
230
      this.getList()
175 231
    },
176 232
    onSizeChange(number) {
177
233
      this.table.pager.currentPage = 1
234
      this.table.pager.size = number
235
      this.getList()
236
    },
237
    onModalPagerChange(page) {
238
      this.monthModalData.table.pager.currentPage = page
239
      this.getMonthDetail()
240
    },
241
    onModalSizeChange(number) {
242
      this.monthModalData.table.pager.currentPage = 1
243
      this.monthModalData.table.pager.size = number
244
      this.getMonthDetail()
178 245
    },
179 246
    detail(row) {
180 247
      this.modal = true
248
      var data
249
      if (this.queryCondition.singleDateVal === '') {
250
        data = this.getTime(2)
251
      } else {
252
        data = this.queryCondition.singleDateVal
253
      }
254
      this.modalData.date = this.getBeforeDate(6, data) + ' ~ ' + data
255
      this.modalData.userName = row.userName
256
      this.modalData.duty = row.duty
257
      this.modalData.days = row.gateDays
258
      var params = new FormData()
259
      params.append(
260
        'data',
261
        JSON.stringify({
262
          EMPLOYEE_ID: row.EMPLOYEE_ID,
263
          mark: 'week',
264
          currentDate: this.queryCondition.singleDateVal
265
        })
266
      )
267
      this.$test
268
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, params)
269
        .then((res) => {
270
          // 请求成功处理...
271
          this.modalData.table = res.data.list
272
        })
273
        .catch((res) => {
274
          // 请求失败处理...
275
        })
276
    },
277
    monthDetail(row) {
278
      this.monthModal = true
279
      if (this.queryCondition.singleDateVal === '') {
280
        this.monthModalData.date = this.getTime(1)
281
      } else {
282
        this.monthModalData.date = this.queryCondition.singleDateVal
283
      }
284
      this.monthModalData.userName = row.userName
285
      this.monthModalData.duty = row.duty
286
      this.monthModalData.days = row.gateDays
287
      this.monthModalData.EMPLOYEE_ID = row.EMPLOYEE_ID
288
      this.getMonthDetail()
289
    },
290
    getMonthDetail() {
291
      var params = new FormData()
292
      params.append(
293
        'data',
294
        JSON.stringify({
295
          EMPLOYEE_ID: this.monthModalData.EMPLOYEE_ID,
296
          mark: 'month',
297
          currentDate: this.queryCondition.singleDateVal,
298
          pageNum: this.monthModalData.table.pager.currentPage,
299
          pageSize: this.monthModalData.table.pager.size
300
        })
301
      )
302
      this.$test
303
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, params)
304
        .then((res) => {
305
          debugger;
306
          // 请求成功处理...
307
          this.monthModalData.table.data = res.data.list
308
          this.monthModalData.table.pager.total = res.data.total
309
        })
310
        .catch((res) => {
311
          // 请求失败处理...
312
        })
313
    },
314
    getTime(type) {
315
      var date = new Date()
316
      var year = date.getFullYear()
317
      var mon = date.getMonth() + 1
318
      var da = date.getDate()
319
      mon = mon < 10 ? '0' + mon : mon
320
      da = da < 10 ? '0' + da : da
321
      if (type === 1) {
322
        return year + '-' + mon
323
      } else {
324
        return year + '-' + mon + '-' + da
325
      }
326
    },
327
    // 根据传入的整数和时间计算一周前的日期
328
    getBeforeDate(days, date) {
329
      var now
330
      if (date !== '') {
331
        var arr = date.split('-')
332
        now = new Date(arr[0], arr[1], arr[2]).getTime()
333
      } else {
334
        now = new Date().getTime()
335
      }
336
      var ago = now - 86400000 * days // 一天的毫秒数为86400000
337
      var agoData = new Date(ago)
338
      var year = agoData.getFullYear()
339
      var mon = agoData.getMonth() + 1
340
      var day = agoData.getDate()
341
      mon = mon < 10 ? '0' + mon : mon
342
      day = day < 10 ? '0' + day : day
343
      return year + '-' + mon + '-' + day
181 344
    }
182 345
  }
183 346
}
184 347
</script>
348

+ 76 - 0
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -331,6 +331,10 @@ export default {
331 331
    EventBus.$on('person', (msg) => { // 获取镜屏推送消息
332 332
      this.changeLocation(msg)
333 333
    })
334
    EventBus.$on('ship', (msg) => { // 获取镜屏推送消息
335
      console.log(msg)
336
      this.changeShip(msg)
337
    })
334 338
  },
335 339
  methods: {
336 340
    async getGisToken() {
@ -345,6 +349,7 @@ export default {
345 349
    },
346 350
    changeLocation(msg) { // 修改人员信息状态等
347 351
      var obj = JSON.parse(msg.body)
352
      console.log('person' + obj)
348 353
      var flag = false
349 354
      this.layer.personLayer.eachLayer((e) => {
350 355
        if (e.getAttributes().deviceId == obj.deviceId) {
@ -368,6 +373,49 @@ export default {
368 373
        this.popupContent(obj, point)
369 374
      }
370 375
    },
376
    changeShip(msg) {
377
      var obj = JSON.parse(msg.body)
378
      console.log('ship' + obj)
379
      this.layer.equipmentLayer.eachLayer((point) => {
380
        if (point.getAttributes().DEVICE_NO == obj.deviceNo) {
381
          point.setLatLng([obj.latitude, obj.longitude])
382
          this.popupContentShip(obj, point)
383
        }
384
      })
385
    },
386
    popupContentShip(e, point) {
387
      point.on('click', (pointE) => {
388
        var content =
389
                  '<div class="tips-item"><div class="top"><div>' + e.shipName + '</div></div><div class="middle"><div class="row">' +
390
                  '<div>设备编号</div>' +
391
                  '<div>' + e.deviceNo + '</div>' +
392
                  '</div>' +
393
                  '<div class="row">' +
394
                  '<div>经度</div>' +
395
                  '<div>' + e.longitude + '</div>' +
396
                  '</div>' +
397
                  '<div class="row">' +
398
                  '<div>纬度</div>' +
399
                  '<div>' + e.latitude + '</div>' +
400
                  '</div>' +
401
                  '<div class="row">' +
402
                  '<div>最新定位时间</div>' +
403
                  '<div>' + e.newDate + '</div>' +
404
                  '</div>' +
405
                  '</div></div>' +
406
                  '</div></div>'
407
        Ai.Popup({
408
          minWidth: 300,
409
          offset: [0, -10],
410
          autoClose: true
411
        })
412
        // 设置弹出框弹出位置
413
          .setLatLng(point.getLatLng())
414
        // 设置弹出框弹出内容
415
          .setContent(content)
416
          .openOn(this.map)
417
      })
418
    },
371 419
    popupContent(e, point) { // 修改点的信息
372 420
      console.log(e, point)
373 421
      window.Vue = this
@ -589,6 +637,34 @@ export default {
589 637
              })
590 638
            })
591 639
            point.setAttributes(e)
640
            point.on('click', (pointE) => {
641
              var deviceContent = e.DEVICE_NO ? ('<div class="row"><div>设备编号</div><div>' + e.DEVICE_NO + '</div></div>') : ''
642
              var dateCOntent = e.NEW_DATE ? ('<div class="row"><div>最新定位时间</div><div>' + e.NEW_DATE + '</div></div>') : ''
643
              var content =
644
                  '<div class="tips-item"><div class="top"><div>' + e.FACILITY_NAME + '</div></div><div class="middle">' +
645
                  deviceContent +
646
                  '<div class="row">' +
647
                  '<div>经度</div>' +
648
                  '<div>' + e.LONGITUDE + '</div>' +
649
                  '</div>' +
650
                  '<div class="row">' +
651
                  '<div>纬度</div>' +
652
                  '<div>' + e.LATITUDE + '</div>' +
653
                  '</div>' +
654
                  dateCOntent +
655
                  '</div></div>' +
656
                  '</div></div>'
657
              Ai.Popup({
658
                minWidth: 300,
659
                offset: [0, -10],
660
                autoClose: true
661
              })
662
                // 设置弹出框弹出位置
663
                .setLatLng(point.getLatLng())
664
                // 设置弹出框弹出内容
665
                .setContent(content)
666
                .openOn(this.map)
667
            })
592 668
            if (['001', '002', '003'].indexOf(e.FACILITY_TYPE) !== -1) {
593 669
              this.layer.equipmentLayer.addLayer(point)
594 670
            }

+ 5 - 5
ebc-sea-platform/src/main/java/com/ai/ipu/server/controller/DeviceManageController.java

@ -14,7 +14,7 @@ import com.ai.ipu.data.JMap;
14 14
import com.ai.ipu.data.impl.JsonMap;
15 15
import com.ai.ipu.server.service.interfaces.DeviceManageService;
16 16
import com.ai.ipu.server.util.EbcConstant;
17
import com.ai.ipu.server.util.NorthboundInterfaceUtil;
17
import com.ai.ipu.server.util.NorthboundInterfaceConstant;
18 18
19 19
/**
20 20
 * 终端管理
@ -107,7 +107,7 @@ public class DeviceManageController {
107 107
108 108
		Map<String, String> resultMap = deviceManageService.addDeviceInfo(params);
109 109
110
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
110
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
111 111
			result.put("result", true);
112 112
		} else {
113 113
			result.put("result", false);
@ -137,7 +137,7 @@ public class DeviceManageController {
137 137
138 138
		Map<String, String> resultMap = deviceManageService.modifyDeviceInfo(params);
139 139
140
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
140
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
141 141
			result.put("result", true);
142 142
		} else {
143 143
			result.put("result", false);
@ -167,7 +167,7 @@ public class DeviceManageController {
167 167
168 168
		Map<String, String> resultMap = deviceManageService.deleteDeviceInfo(params);
169 169
170
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(resultMap.get("resultCode"))) {
170
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(resultMap.get("resultCode"))) {
171 171
			result.put("result", true);
172 172
		} else {
173 173
			result.put("result", false);
@ -252,7 +252,7 @@ public class DeviceManageController {
252 252
	public JMap queryCurrentDeviceLocationInfo(JMap params) throws Exception {
253 253
		JMap result = new JsonMap();
254 254
255
		List<Map<String, Object>> resultList = deviceManageService.queryCurrentDeviceLocationInfo(params);
255
		List<Map<String, String>> resultList = deviceManageService.queryCurrentDeviceLocationInfo(params);
256 256
		result.put("dataList", resultList);
257 257
		return result;
258 258
	}

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

@ -48,7 +48,6 @@ public class ReceiveSubscribeController {
48 48
		dataMap.put("longitude",detailInfo.getJSONObject("longitude").getString("value"));//经度
49 49
		dataMap.put("latitude",detailInfo.getJSONObject("latitude").getString("value"));//纬度
50 50
		dataMap.put("newDate",detailInfo.getJSONObject("msgDate").getString("value"));//最新定位时间
51
		dataMap.put("locationStatus",EbcConstant.location_status_normal);//定位状态
52 51
		
53 52
		//分析并推送定位数据
54 53
		receiveSubscribeService.receiveIotLocationData(dataMap);

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

@ -84,21 +84,13 @@ public class AreaInOutRecordDaoImpl extends AbstractBizDao implements AreaInOutR
84 84
	}
85 85
86 86
	@Override
87
	public List<Map<String, Object>> getBeforeAreaInfo(JMap params) throws Exception {
87
	public List<Map<String, Object>> getBeforeInAreaInfo(String deviceId,List<String> mapTagTypeList) throws Exception {
88 88
		Map<String, Object> dataMap = new HashMap<String, Object>();
89
90
		StringBuilder sql = new StringBuilder();
91
		sql.append(" SELECT a.RECORD_ID,a.MAP_TAG_ID,a.IN_DATE, ");
92
		sql.append(" m.MAP_TAG_NAME,m.MAP_TAG_TYPE,m.RESIDENCE_TIME_LENGTH ");
93
		sql.append(" FROM LR_AREA_IN_OUT_RECORD a ");
94
		sql.append(" LEFT JOIN LR_MAP_TAG m ON m.MAP_TAG_ID=a.MAP_TAG_ID ");
95
		sql.append(" WHERE 1=1 ");
96
		sql.append(" AND a.OUT_DATE IS NULL ");
97
98
		sql.append(" AND a.DEVICE_ID = #{deviceId} ");
99
		dataMap.put("deviceId", params.get("deviceId"));
100
101
		return dao.executeSelect(sql.toString(), dataMap);
89
		dataMap.put("deviceId", deviceId);
90
		dataMap.put("mapTagTypeList", mapTagTypeList);
91
		
92
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
93
		return mgmtDao.executeSelect("ipu.AreaInOutRecordDao",  "getBeforeInAreaInfo", dataMap);
102 94
	}
103 95
104 96
	@Override

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

@ -6,28 +6,34 @@ import java.util.HashMap;
6 6
import java.util.List;
7 7
import java.util.Map;
8 8
9
import org.springframework.beans.factory.annotation.Autowired;
9 10
import org.springframework.stereotype.Component;
10 11
11 12
import com.ai.ipu.data.JMap;
12 13
import com.ai.ipu.data.impl.JsonMap;
13 14
import com.ai.ipu.database.dao.impl.AbstractBizDao;
14 15
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
15
import com.ai.ipu.server.enums.IotUrlEnums;
16 16
import com.ai.ipu.server.enums.ProductEnums;
17 17
import com.ai.ipu.server.util.EbcConstant;
18
import com.ai.ipu.server.util.NorthboundInterfaceConstant;
18 19
import com.ai.ipu.server.util.NorthboundInterfaceUtil;
19 20
import com.ai.ipu.sql.mgmt.ISqlMgmtDao;
20 21
import com.ai.ipu.sql.mgmt.SqlMgmtDaoFactory;
22
import com.alibaba.fastjson.JSON;
21 23
import com.alibaba.fastjson.JSONObject;
22 24
23 25
@Component
24 26
public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageDao {
25 27
28
	private String connName = "ebc";
29
	
26 30
	public DeviceManageDaoImpl() throws IOException {
27 31
		super("ebc");
28 32
	}
29 33
30
	private String connName = "ebc";
34
	@Autowired
35
	NorthboundInterfaceUtil northboundInterfaceUtil;
36
31 37
	private String userAndDevicetableName = "LR_PARTY_TERMINAL"; // 人员和终端关联表
32 38
	private String equipmentTableName = "LR_FACILITY"; // 设施表
33 39
@ -40,36 +46,16 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
40 46
		paramsMap.put("businessParams", params.get("businessParams"));
41 47
42 48
		// 拼接接口地址
43
		String url = IotUrlEnums.queryPageDevice.getUrl();
44
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
49
		String url = NorthboundInterfaceConstant.queryPageDevice;
50
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
45 51
		return map;
46 52
	}
47 53
48 54
	@Override
49
	public List<Map<String, Object>> getBindDeviceList() throws Exception {
50
		StringBuilder sql = new StringBuilder();
51
52
		sql.append(" SELECT FACILITY_NAME NAME,DEVICE_ID FROM LR_FACILITY ");
53
		sql.append(" WHERE 1=1 ");
54
		sql.append(" AND FACILITY_TYPE ='").append(ProductEnums.ship.getProductId()).append("' ");
55
		sql.append(" AND DEVICE_ID IS NOT NULL ");
56
57
		sql.append(" UNION ALL ");
58
59
		sql.append(" SELECT PARTY_NAME NAME,DEVICE_ID FROM LR_PARTY_TERMINAL ");
60
		sql.append(" WHERE 1=1 ");
61
		sql.append(" AND DEVICE_ID IS NOT NULL ");
62
63
		List<Map<String, Object>> list = dao.executeSelect(sql.toString());
64
65
		return list == null ? new ArrayList<Map<String, Object>>() : list;
66
	}
67
68
	@Override
69 55
	public JMap queryOneDeviceInfo(JMap params) throws Exception {
70 56
		// 拼接接口地址
71
		String url = IotUrlEnums.queryOneDevice.getUrl() + params.getString("deviceId");
72
		Map<String, String> map = NorthboundInterfaceUtil.iotGetCallUtil(url);
57
		String url = NorthboundInterfaceConstant.queryOneDevice + params.getString("deviceId");
58
		Map<String, String> map = northboundInterfaceUtil.iotGetCallUtil(url);
73 59
74 60
		JMap deviceInfoMap = new JsonMap(JSONObject.toJSONString(map.get("result")));
75 61
		String remarks = deviceInfoMap.getString("remarks") == null ? "" : deviceInfoMap.getString("remarks");
@ -90,8 +76,8 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
90 76
		paramsMap.put("remarks", params.getString("remarks")); // 备注
91 77
92 78
		// 拼接接口地址
93
		String url = IotUrlEnums.addDevice.getUrl();
94
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
79
		String url = NorthboundInterfaceConstant.addDevice;
80
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
95 81
		return map;
96 82
	}
97 83
@ -107,18 +93,18 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
107 93
		paramsMap.put("remarks", params.getString("remarks")); // 备注
108 94
109 95
		// 拼接接口地址
110
		String url = IotUrlEnums.updateDevice.getUrl();
111
		Map<String, String> map = NorthboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
96
		String url = NorthboundInterfaceConstant.updateDevice;
97
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
112 98
		return map;
113 99
	}
114 100
115 101
	@Override
116 102
	public Map<String, String> deleteDeviceInfo(JMap params) throws Exception {
117 103
		// 拼接接口地址
118
		String url = IotUrlEnums.deleteDevice.getUrl() + params.getString("deviceId");
119
		Map<String, String> map = NorthboundInterfaceUtil.iotGetCallUtil(url);
120
		//根据终端id删除终端关联信息
121
		if (NorthboundInterfaceUtil.resultCode_succeed.equals(map.get("resultCode"))) {
104
		String url = NorthboundInterfaceConstant.deleteDevice + params.getString("deviceId");
105
		Map<String, String> map = northboundInterfaceUtil.iotGetCallUtil(url);
106
		// 根据终端id删除终端关联信息
107
		if (NorthboundInterfaceConstant.resultCode_succeed.equals(map.get("resultCode"))) {
122 108
			HashMap<String, Object> paramsHashMap = new HashMap<>();
123 109
			paramsHashMap.put("DEVICE_ID", params.get("deviceId"));
124 110
			int i = unbindDevice(paramsHashMap);
@ -135,12 +121,49 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
135 121
	}
136 122
137 123
	@Override
138
	public Map<String, Object> queryOneBindDeviceInfo(Map<String, Object> dataMap) throws Exception {
139
		List<Map<String, Object>> userAndDeviceList = dao.selectByCond(userAndDevicetableName, dataMap);
140
		if (userAndDeviceList.isEmpty()) {
124
	public List<Map<String, Object>> queryAllBindShip() throws Exception {
125
		Map<String, Object> dataMap=new HashMap<String, Object>();
126
		dataMap.put("shipProductId",ProductEnums.ship.getProductId());
127
		
128
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
129
		return mgmtDao.executeSelect("ipu.DeviceManageDao", "queryAllBindShip", dataMap);
130
	}
131
	@Override
132
	public List<Map<String, Object>> queryAllBindUser() throws Exception {
133
		Map<String, Object> dataMap=new HashMap<String, Object>();
134
		
135
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
136
		return mgmtDao.executeSelect("ipu.DeviceManageDao", "queryAllBindUser", dataMap);
137
	}
138
	@Override
139
	public Map<String, Object> queryOneBindShip(String deviceId,String bindCode) throws Exception {
140
		Map<String, Object> dataMap=new HashMap<String, Object>();
141
		dataMap.put("shipProductId",ProductEnums.ship.getProductId());
142
		dataMap.put("deviceId",deviceId);
143
		dataMap.put("bindCode", bindCode);
144
		
145
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
146
		List<Map<String, Object>> list =  mgmtDao.executeSelect("ipu.DeviceManageDao", "queryOneBindShip", dataMap);
147
		
148
		if (list.isEmpty()) {
141 149
			return null;
142 150
		} else {
143
			return userAndDeviceList.get(0);
151
			return list.get(0);
152
		}
153
	}
154
	@Override
155
	public Map<String, Object> queryOneBindUser(String deviceId,String bindCode) throws Exception {
156
		Map<String, Object> dataMap=new HashMap<String, Object>();
157
		dataMap.put("deviceId",deviceId);
158
		dataMap.put("bindCode", bindCode);
159
		
160
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
161
		List<Map<String, Object>> list =  mgmtDao.executeSelect("ipu.DeviceManageDao", "queryOneBindUser", dataMap);
162
		
163
		if (list.isEmpty()) {
164
			return null;
165
		} else {
166
			return list.get(0);
144 167
		}
145 168
	}
146 169
@ -161,11 +184,11 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
161 184
			// 插入一条新的关联数据
162 185
			return dao.insert(userAndDevicetableName, params);
163 186
		} else if (EbcConstant.bind_device_type_ship.equals(type)) {
164
			//将之前的数据删除
187
			// 将之前的数据删除
165 188
			paramsMap.put("ORIGINAL_DEVICE_ID", params.get("DEVICE_ID"));
166 189
			paramsMap.put("DEVICE_ID", null);
167 190
			dao1.executeUpdate("ipu.EquipmentManageDao", "updateEquipmentInfo", paramsMap);
168
			//从新插入设备表
191
			// 从新插入设备表
169 192
			paramsHashMap.put("FACILITY_ID", params.get("FACILITY_ID"));
170 193
			paramsHashMap.put("DEVICE_ID", params.get("DEVICE_ID"));
171 194
			return dao.update(equipmentTableName, paramsHashMap);
@ -176,95 +199,41 @@ public class DeviceManageDaoImpl extends AbstractBizDao implements DeviceManageD
176 199
	@Override
177 200
	public int unbindDevice(Map params) throws Exception {
178 201
		HashMap<String, Object> paramsHashMap = new HashMap<>();
179
		//删除终端人员关联表
202
		// 删除终端人员关联表
180 203
		paramsHashMap.put("DEVICE_ID", params.get("DEVICE_ID"));
181 204
		ISqlMgmtDao dao1 = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
182 205
		int i = dao1.executeUpdate("ipu.EquipmentManageDao", "deletePartyTerminalForDeviceId", paramsHashMap);
183
		//修改设备表
206
		// 修改设备表
184 207
		paramsHashMap.put("ORIGINAL_DEVICE_ID", params.get("DEVICE_ID"));
185 208
		paramsHashMap.put("DEVICE_ID", null);
186 209
		int num = dao1.executeUpdate("ipu.EquipmentManageDao", "updateEquipmentInfo", paramsHashMap);
187
		return i>num?i:num;
188
210
		return i > num ? i : num;
189 211
190 212
	}
191 213
192 214
	@Override
193
	public List<Map<String, Object>> queryCurrentDeviceLocationInfo(JMap params) throws Exception {
194
		// TODO 调用北向接口获取当前终端位置
195
196
		List<Map<String, Object>> list=new ArrayList<Map<String, Object>>();
197
198
		Map<String, Object> map1=new HashMap<String, Object>();
199
		map1.put("userName", "张三");//人员姓名
200
		map1.put("locationStatus", EbcConstant.location_status_normal);//状态: 0定位
201
		map1.put("deviceId", "999571");//终端ID
202
		map1.put("deviceNo", "999571");//终端编号
203
		map1.put("longitude", "123.7709439");//经度
204
		map1.put("latitude", "31.5847745");//纬度
205
		map1.put("newDate", "2020-10-27 13:14:15");//最新定位时间
206
		list.add(map1);
215
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(List<String> deviceIdsList) throws Exception {
216
		Map<String, Object> paramsMap = new HashMap<String, Object>();
217
		paramsMap.put("resourceIdInArr", deviceIdsList);// 终端id
207 218
208
		Map<String, Object> map2=new HashMap<String, Object>();
209
		map2.put("userName", "李四");//人员姓名
210
		map2.put("locationStatus", EbcConstant.location_status_normal);//状态: 0定位
211
		map2.put("deviceId", "981489");//终端ID
212
		map2.put("deviceNo", "981489");//终端编号
213
		map2.put("longitude", "125.4221927");//经度
214
		map2.put("latitude", "32.0453331");//纬度
215
		map2.put("newDate", "2020-10-26 11:22:33");//最新定位时间
216
		list.add(map2);
217
		
218
		Map<String, Object> map3=new HashMap<String, Object>();
219
		map3.put("userName", "王五");//人员姓名
220
		map3.put("locationStatus", EbcConstant.location_status_normal);//状态: 0定位
221
		map3.put("deviceId", "981453");//终端ID
222
		map3.put("deviceNo", "981453");//终端编号
223
		map3.put("longitude", "122.0221926");//经度
224
		map3.put("latitude", "33.5453331");//纬度
225
		map3.put("newDate", "2020-10-27 12:31:45");//最新定位时间
226
		list.add(map3);
227
		
228
		Map<String, Object> map4=new HashMap<String, Object>();
229
		map4.put("userName", "赵六");//人员姓名
230
		map4.put("locationStatus", EbcConstant.location_status_normal);//状态: 0定位
231
		map4.put("deviceId", "23125");//终端ID
232
		map4.put("deviceNo", "23125");//终端编号
233
		map4.put("longitude", "125.3221927");//经度
234
		map4.put("latitude", "33.3453331");//纬度
235
		map4.put("newDate", "2020-10-27 13:40:40");//最新定位时间
236
		list.add(map4);
237
		
238
		Map<String, Object> map5=new HashMap<String, Object>();
239
		map5.put("userName", "田七");//人员姓名
240
		map5.put("locationStatus", EbcConstant.location_status_normal);//状态: 0定位
241
		map5.put("deviceId", "23126");//终端ID
242
		map5.put("deviceNo", "23126");//终端编号
243
		map5.put("longitude", "125.4221927");//经度
244
		map5.put("latitude", "32.9453331");//纬度
245
		map5.put("newDate", "2020-10-27 18:20:30");//最新定位时间
246
		list.add(map5);
247
		
248
		Map<String, Object> map6=new HashMap<String, Object>();
249
		map6.put("userName", "周八");//人员姓名
250
		map6.put("locationStatus", EbcConstant.location_status_exclusion);//状态:3违规(禁区)
251
		map6.put("deviceId", "23128");//终端ID
252
		map6.put("deviceNo", "23128");//终端编号
253
		map6.put("longitude", "124.5309335");//经度
254
		map6.put("latitude", "33.7753425");//纬度
255
		map6.put("newDate", "2020-10-27 14:28:38");//最新定位时间
256
		list.add(map6);
219
		// 拼接接口地址
220
		String url = NorthboundInterfaceConstant.queryMoreDeviceNewIncident;
221
		Map<String, String> map = northboundInterfaceUtil.iotPostCallUtil(url, paramsMap);
222
		List<Map> resultList = JSON.parseArray(JSONObject.toJSONString(map.get("result")), Map.class);
223
224
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
225
		for (Map resultMap : resultList) {
226
			String object = (String) resultMap.get("dataPointValue");
227
			JSONObject detailInfo = JSONObject.parseObject(object);
228
			Map<String, String> detailInfoMap = new HashMap<String, String>();
229
			detailInfoMap.put("deviceId", String.valueOf(resultMap.get("resourceId")));// 设备id
230
			detailInfoMap.put("deviceNo", String.valueOf(resultMap.get("resourceId")));// 设备编码
231
			detailInfoMap.put("longitude", detailInfo.getJSONObject("longitude").getString("value"));// 经度
232
			detailInfoMap.put("latitude", detailInfo.getJSONObject("latitude").getString("value"));// 纬度
233
			detailInfoMap.put("newDate", detailInfo.getJSONObject("msgDate").getString("value"));// 最新定位时间
234
			list.add(detailInfoMap);
235
		}
257 236
		
258
		Map<String, Object> map7=new HashMap<String, Object>();
259
		map7.put("userName", "吴九");//人员姓名
260
		map7.put("locationStatus", EbcConstant.location_status_offline);//状态:1离线
261
		map7.put("deviceId", "23129");//终端ID
262
		map7.put("deviceNo", "23129");//终端编号
263
		map7.put("longitude", "122.4221927");//经度
264
		map7.put("latitude", "32.6453331");//纬度
265
		map7.put("newDate", "2020-10-27 14:15:22");//最新定位时间
266
		list.add(map7);
267
268 237
		return list;
269 238
	}
270 239
}

+ 8 - 14
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/impl/EquipmentManageDaoImpl.java

@ -1,26 +1,20 @@
1 1
package com.ai.ipu.server.dao.impl;
2 2
3
import com.ai.ipu.data.JList;
3
import java.io.IOException;
4
import java.util.ArrayList;
5
import java.util.HashMap;
6
import java.util.List;
7
import java.util.Map;
8
9
import org.springframework.stereotype.Component;
10
4 11
import com.ai.ipu.data.JMap;
5
import com.ai.ipu.data.impl.JsonList;
6
import com.ai.ipu.data.impl.JsonMap;
7
import com.ai.ipu.database.dao.IpuDaoManager;
8 12
import com.ai.ipu.database.dao.impl.AbstractBizDao;
9 13
import com.ai.ipu.server.dao.interfaces.EquipmentManageDao;
10
import com.ai.ipu.server.dao.interfaces.MapTagManageDao;
11 14
import com.ai.ipu.sql.mgmt.ISqlMgmtDao;
12 15
import com.ai.ipu.sql.mgmt.SqlMgmtDaoFactory;
13
import com.alibaba.fastjson.JSON;
14
import com.alibaba.fastjson.JSONObject;
15 16
import com.github.pagehelper.PageHelper;
16 17
import com.github.pagehelper.PageInfo;
17
import org.springframework.stereotype.Component;
18
19
import java.io.IOException;
20
import java.util.ArrayList;
21
import java.util.HashMap;
22
import java.util.List;
23
import java.util.Map;
24 18
25 19
@Component
26 20
public class EquipmentManageDaoImpl extends AbstractBizDao implements EquipmentManageDao {

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

@ -12,10 +12,14 @@ import com.ai.ipu.data.JMap;
12 12
import com.ai.ipu.database.dao.impl.AbstractBizDao;
13 13
import com.ai.ipu.server.dao.interfaces.RescueDao;
14 14
import com.ai.ipu.server.util.EbcConstant;
15
import com.ai.ipu.sql.mgmt.ISqlMgmtDao;
16
import com.ai.ipu.sql.mgmt.SqlMgmtDaoFactory;
15 17
16 18
@Component
17 19
public class RescueDaoImpl extends AbstractBizDao implements RescueDao {
18
20
	
21
	private String connName = "ebc";
22
	
19 23
	public RescueDaoImpl() throws IOException {
20 24
		super("ebc");
21 25
	}
@ -27,21 +31,13 @@ public class RescueDaoImpl extends AbstractBizDao implements RescueDao {
27 31
	}
28 32
29 33
	@Override
30
	public Map<String, Object> queryNoCloseRescueLog(JMap params) throws Exception {
34
	public List<Map<String, Object>> queryNoCloseRescueLog(List<String> deviceIdsList) throws Exception {
31 35
		Map<String, Object> dataMap=new HashMap<String, Object>();
32
33
		StringBuilder sql=new StringBuilder();
34
		sql.append(" SELECT l.LOG_ID,l.CALLER_ID,l.DEVICE_ID,l.PARTY_TYPE,l.PARTY_CODE, ");
35
		sql.append(" l.PARTY_NAME,l.ALARM_TYPE,l.CALLER_DATE, ");
36
		sql.append(" l.RESCUERS_DATE,l.REMARKS ");
37
		sql.append(" FROM LR_RESCUE_LOG l ");
38
		sql.append(" WHERE 1=1 ");
39
		sql.append(" AND RESCUERS_DATE IS NULL ");//TODO 救援时间为空
40
		sql.append(" AND ALARM_TYPE <> '").append(EbcConstant.alarm_type_offline).append("' ");//不属于离线告警
41
		sql.append(" AND DEVICE_ID = #{deviceId} ");
42
		dataMap.put("deviceId", params.get("deviceId"));
36
		dataMap.put("deviceIdsList", deviceIdsList);//设备ID
37
		dataMap.put("offlineType", EbcConstant.alarm_type_offline);//不属于离线告警
43 38
		
44
		return dao.executeSelectOne(sql.toString(), dataMap);
39
		ISqlMgmtDao mgmtDao = SqlMgmtDaoFactory.createFileSqlMgmtDao(connName);
40
		return mgmtDao.executeSelect("ipu.RescueDao",  "queryNoCloseRescueLog", dataMap);
45 41
	}
46 42
47 43
	@Override

+ 3 - 2
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/AreaInOutRecordDao.java

@ -69,11 +69,12 @@ public interface AreaInOutRecordDao {
69 69
70 70
	/**
71 71
	 * 查询之前所在围栏的信息
72
	 * @param params
72
	 * @param deviceId 设备ID
73
	 * @param mapTagTypeList 围栏类型
73 74
	 * @return 
74 75
	 * @throws Exception
75 76
	 */
76
	List<Map<String, Object>> getBeforeAreaInfo(JMap params) throws Exception;
77
	List<Map<String, Object>> getBeforeInAreaInfo(String deviceId,List<String> mapTagTypeList) throws Exception;
77 78
78 79
	/**
79 80
	 * 插入进入围栏的日志

+ 47 - 11
ebc-sea-platform/src/main/java/com/ai/ipu/server/dao/interfaces/DeviceManageDao.java

@ -19,13 +19,6 @@ public interface DeviceManageDao {
19 19
	Map<String, String> queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception;
20 20
21 21
	/**
22
	 * 查询已和人员(船舶)绑定的终端信息
23
	 * @return
24
	 * @throws Exception
25
	 */
26
	List<Map<String, Object>> getBindDeviceList() throws Exception;
27
28
	/**
29 22
	 * 获取单个终端信息
30 23
	 * @param params
31 24
	 * @return
@ -60,16 +53,59 @@ public interface DeviceManageDao {
60 53
	List<Map<String, Object>> queryAssociatBoatInfo(JMap params) throws Exception;
61 54
62 55
	/**
63
	 * 查询单个终端绑定信息
64
	 * @param params
56
	 * 查询所有已和船舶绑定信息
57
	 * @return
58
	 * @throws Exception
59
	 */
60
	List<Map<String, Object>> queryAllBindShip() throws Exception;
61
	/**
62
	 * 查询所有已和人员绑定的信息
65 63
	 * @return
66 64
	 * @throws Exception
67 65
	 */
68
	Map<String, Object> queryOneBindDeviceInfo(Map<String, Object> dataMap) throws Exception;
66
	List<Map<String, Object>> queryAllBindUser() throws Exception;
69 67
68
	/**
69
	 * 查询单个船舶的绑定信息
70
	 * @param deviceId 设备ID
71
	 * @param bindCode 船舶的CODE
72
	 * @return
73
	 * @throws Exception
74
	 */
75
	Map<String, Object> queryOneBindShip(String deviceId,String bindCode) throws Exception;
76
	
77
	/**
78
	 * 查询单个人员的绑定信息
79
	 * @param deviceId 设备ID
80
	 * @param bindCode 人员的CODE
81
	 * @return
82
	 * @throws Exception
83
	 */
84
	Map<String, Object> queryOneBindUser(String deviceId,String bindCode) throws Exception;
85
	
86
	/**
87
	 * 绑定终端
88
	 * @param params
89
	 * @param type
90
	 * @return
91
	 * @throws Exception
92
	 */
70 93
	int bindDevice(Map params, String type) throws Exception;
71 94
95
	/**
96
	 * 解绑终端
97
	 * @param params
98
	 * @return
99
	 * @throws Exception
100
	 */
72 101
	int unbindDevice(Map params) throws Exception;
73 102
	
74
	List<Map<String, Object>> queryCurrentDeviceLocationInfo(JMap params) throws Exception;
103
	/**
104
	 * 获取终端的最新事件
105
	 * @param deviceIds
106
	 * @return
107
	 * @throws Exception
108
	 */
109
	List<Map<String, String>> queryCurrentDeviceLocationInfo(List<String> deviceIdsList) throws Exception;
110
	
75 111
}

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

@ -18,12 +18,12 @@ public interface RescueDao {
18 18
	JMap queryPageRescueLog(JMap params, int pageNum, int pageSize) throws Exception;
19 19
20 20
	/**
21
	 * 根据终端标识获取未关闭的报警救援日志
22
	 * @param params
21
	 * 根据终端ID获取未关闭的报警救援日志
22
	 * @param deviceIdsList
23 23
	 * @return
24 24
	 * @throws Exception
25 25
	 */
26
	Map<String, Object> queryNoCloseRescueLog(JMap params) throws Exception;
26
	List<Map<String, Object>> queryNoCloseRescueLog(List<String> deviceIdsList) throws Exception;
27 27
28 28
	/**
29 29
	 * 根据终端标识获取单个报警救援日志

+ 0 - 36
ebc-sea-platform/src/main/java/com/ai/ipu/server/enums/IotUrlEnums.java

@ -1,36 +0,0 @@
1
package com.ai.ipu.server.enums;
2
3
import org.springframework.beans.factory.annotation.Value;
4
5
/**
6
 * iot 北向接口业务数据的地址枚举
7
 * 
8
 * @author konghl@asiainfo.com
9
 * 2020-10-20
10
 */
11
public enum IotUrlEnums {
12
	// 分页查询终端
13
	queryPageDevice("findTerminal"),
14
	// 添加终端
15
	addDevice("device"),
16
	// 修改终端
17
	updateDevice("updateDevice"),
18
	// 删除终端
19
	deleteDevice("deleteDevice?deviceId="),
20
	// 查询单个设备
21
	queryOneDevice("deviceSimpleDetail?deviceId=");
22
23
	private String url;
24
25
	@Value("${url.iot.service}")
26
	private String iotServiceUrl;
27
28
	private IotUrlEnums(String url) {
29
		this.url = url;
30
	}
31
32
	public String getUrl() {
33
		return iotServiceUrl + "/" + url;
34
	}
35
36
}

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

@ -1,5 +1,6 @@
1 1
package com.ai.ipu.server.service.impl;
2 2
3
import java.text.SimpleDateFormat;
3 4
import java.util.ArrayList;
4 5
import java.util.HashMap;
5 6
import java.util.List;
@ -12,10 +13,13 @@ import org.springframework.stereotype.Service;
12 13
13 14
import com.ai.ipu.data.JMap;
14 15
import com.ai.ipu.data.impl.JsonMap;
16
import com.ai.ipu.server.dao.interfaces.AreaInOutRecordDao;
15 17
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
18
import com.ai.ipu.server.dao.interfaces.RescueDao;
16 19
import com.ai.ipu.server.enums.UserEnums;
17 20
import com.ai.ipu.server.service.interfaces.DeviceManageService;
18 21
import com.ai.ipu.server.util.EbcConstant;
22
import com.ai.ipu.server.util.JingPingSendDateUtil;
19 23
import com.alibaba.fastjson.JSON;
20 24
21 25
@Service
@ -25,6 +29,12 @@ public class DeviceManageServiceImpl implements DeviceManageService {
25 29
	@Autowired
26 30
	DeviceManageDao deviceManageDao;
27 31
32
	@Autowired
33
	RescueDao rescueDao;
34
35
	@Autowired
36
	AreaInOutRecordDao areaInOutRecordDao;
37
28 38
	@Override
29 39
	public JMap queryPageDeviceInfo(JMap params, int pageNum, int pageSize) throws Exception {
30 40
		String isBindDevice = params.getString("IsBindDevice");// 是否绑定设备
@ -32,7 +42,9 @@ public class DeviceManageServiceImpl implements DeviceManageService {
32 42
		boolean unBindDeviceBoolean = EbcConstant.bind_device_no.equals(isBindDevice);
33 43
34 44
		// 获取已绑定的设备列表
35
		List<Map<String, Object>> bindDeviceList = deviceManageDao.getBindDeviceList();
45
		List<Map<String, Object>> allBindInfoList = deviceManageDao.queryAllBindShip();
46
		List<Map<String, Object>> bindUserList = deviceManageDao.queryAllBindUser();
47
		allBindInfoList.addAll(bindUserList);
36 48
37 49
		// 查询条件
38 50
		Map<String, String> businessParams = new HashMap<String, String>();
@ -42,9 +54,9 @@ public class DeviceManageServiceImpl implements DeviceManageService {
42 54
		if (bindDeviceBoolean || unBindDeviceBoolean) {
43 55
			// 获取已绑定的设备ids(用逗号隔开)
44 56
			StringBuilder deviceIds = new StringBuilder();
45
			for (int i = 0; i < bindDeviceList.size(); i++) {
46
				deviceIds.append(bindDeviceList.get(i).get("DEVICE_ID"));
47
				if (i < bindDeviceList.size() - 1) {
57
			for (int i = 0; i < allBindInfoList.size(); i++) {
58
				deviceIds.append(allBindInfoList.get(i).get("DEVICE_ID"));
59
				if (i < allBindInfoList.size() - 1) {
48 60
					deviceIds.append(",");
49 61
				}
50 62
			}
@ -80,7 +92,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
80 92
				// 绑定信息
81 93
				dataMap.put("bindName", "--");
82 94
				if (!unBindDeviceBoolean) {
83
					for (Map bindDeviceMap : bindDeviceList) {
95
					for (Map bindDeviceMap : allBindInfoList) {
84 96
						if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
85 97
							dataMap.put("bindName", bindDeviceMap.get("NAME"));
86 98
							break;
@ -161,9 +173,7 @@ public class DeviceManageServiceImpl implements DeviceManageService {
161 173
	@Override
162 174
	public Map<String, Object> verifyUserOrBoatAssociatInfo(JMap params) throws Exception {
163 175
		// 查询用户与终端关联表,如果有数据返回,无数据返回空
164
		Map<String, Object> dataMap=new HashMap<String, Object>();
165
		dataMap.put("PARTY_CODE", params.get("PARTY_CODE"));
166
		Map<String, Object> userAndDeviceMap = deviceManageDao.queryOneBindDeviceInfo(dataMap);
176
		Map<String, Object> userAndDeviceMap = deviceManageDao.queryOneBindUser(null, params.getString("PARTY_CODE"));
167 177
		return userAndDeviceMap;
168 178
	}
169 179
@ -179,9 +189,209 @@ public class DeviceManageServiceImpl implements DeviceManageService {
179 189
		return num > 0;
180 190
	}
181 191
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
	
182 269
	@Override
183
	public List<Map<String, Object>> queryCurrentDeviceLocationInfo(JMap params) throws Exception {
184
		return deviceManageDao.queryCurrentDeviceLocationInfo(params);
270
	public List<Map<String, String>> queryCurrentDeviceLocationInfo(JMap params) throws Exception {
271
		// 获取已绑定的设备列表
272
		List<Map<String, Object>> bindUserDeviceList = deviceManageDao.queryAllBindUser();
273
274
		if (bindUserDeviceList == null || bindUserDeviceList.isEmpty()) {
275
			return new ArrayList<Map<String, String>>();
276
		}
277
278
		List<String> deviceIdsList = new ArrayList<String>();
279
		for (int i = 0; i < bindUserDeviceList.size(); i++) {
280
			deviceIdsList.add(String.valueOf(bindUserDeviceList.get(i).get("DEVICE_ID")));
281
		}
282
283
		// 获取设备当前位置信息
284
		List<Map<String, String>> list = deviceManageDao.queryCurrentDeviceLocationInfo(deviceIdsList);
285
286
		// 查询是否为需救援的人员
287
		List<Map<String, Object>> alarmMapList = rescueDao.queryNoCloseRescueLog(deviceIdsList);
288
289
		// 查询人员所在围栏信息
290
		List<String> mapTagTypeList = new ArrayList<String>();
291
		mapTagTypeList.add(EbcConstant.area_type_exclusion);
292
		mapTagTypeList.add(EbcConstant.area_type_temporariness);
293
		List<Map<String, Object>> areaViolationMapList = areaInOutRecordDao.getBeforeInAreaInfo(null, mapTagTypeList);
294
295
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
296
297
		// 拼接返回数据
298
		for (Map<String, String> map : list) {
299
			String deviceId = map.get("deviceId");
300
			map.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
301
			
302
			boolean flag = true;
303
			// 设备绑定的信息
304
			for (Map<String, Object> bindDeviceMap : bindUserDeviceList) {
305
				if (deviceId.equals(String.valueOf(bindDeviceMap.get("DEVICE_ID")))) {
306
					map.put("userName", String.valueOf(bindDeviceMap.get("NAME")));
307
					break;
308
				}
309
			}
310
311
			if (alarmMapList != null && flag) {
312
				// 求救信息
313
				for (int i = 0; i < alarmMapList.size() && flag; i++) {
314
					Map<String, Object> alarmMap = alarmMapList.get(i);
315
					if (deviceId.equals(String.valueOf(alarmMap.get("DEVICE_ID")))) {
316
						// 求救时间
317
						String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));
318
						map.put("alarmDate", alarmDate);
319
320
						// 计算求救时长
321
						int alarmLong = JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, map.get("newDate"));
322
						map.put("alarmLong", String.valueOf(alarmLong));
323
324
						flag = false;
325
					}
326
				}
327
			}
328
329
			if (areaViolationMapList != null && flag) {
330
				// 违规信息
331
				int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
332
				long minInAreaLong = System.currentTimeMillis();// 进入围栏最早的时间戳
333
				Map<String, Object> areaInfoMap = null;// 用于计算时间的围栏信息
334
335
				for (int i = 0; i < areaViolationMapList.size(); i++) {
336
					Map<String, Object> areaViolationMap = areaViolationMapList.get(i);
337
					if (deviceId.equals(String.valueOf(areaViolationMap.get("DEVICE_ID")))) {
338
						// 比较优先级
339
						int mapTagGrade = 0;
340
						switch (String.valueOf(areaViolationMap.get("MAP_TAG_TYPE"))) {
341
						case EbcConstant.area_type_exclusion:
342
							mapTagGrade = 5;
343
							break;
344
						case EbcConstant.area_type_temporariness:
345
							mapTagGrade = 3;
346
							break;
347
						}
348
349
						if (mapTagGrade == maxMapTagGrade) {
350
							// 比较进入时长时间
351
							long inAreaLong = simpleDateFormat.parse(String.valueOf(areaViolationMap.get("IN_DATE")))
352
									.getTime();
353
							if (inAreaLong < minInAreaLong) {
354
								minInAreaLong = inAreaLong;
355
								areaInfoMap = areaViolationMap;
356
							}
357
						} else if (mapTagGrade > maxMapTagGrade) {
358
							maxMapTagGrade = mapTagGrade;
359
							minInAreaLong = simpleDateFormat.parse(String.valueOf(areaViolationMap.get("IN_DATE")))
360
									.getTime();
361
							areaInfoMap = areaViolationMap;
362
						}
363
					}
364
				}
365
366
				// 判断是否在违规
367
				if (maxMapTagGrade == 5) {
368
					logger.info("镜屏推送进入电子围栏的信息");
369
					// 进入电子围栏(禁区),需显示进入时间
370
					map.put("inDate", simpleDateFormat.format(areaInfoMap.get("IN_DATE"))); // 进入时间
371
					map.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
372
373
				} else if (maxMapTagGrade == 3) {
374
					// 进入定点(限时),需计算是否超时
375
					int fixedLong = JingPingSendDateUtil
376
							.getBetweenMinuteValue(String.valueOf(areaInfoMap.get("IN_DATE")), map.get("newDate"));
377
378
					if (fixedLong > 0) {
379
						// 围栏要求定点时间
380
						int residenceTimeLength = Integer
381
								.parseInt(String.valueOf(areaInfoMap.get("RESIDENCE_TIME_LENGTH")));
382
383
						if (residenceTimeLength <= fixedLong) {
384
							// 已超时
385
							map.put("locationStatus", EbcConstant.location_status_overtime);// 定位状态
386
						}
387
					}
388
					map.put("fixedLong", String.valueOf(fixedLong));// 停留时长
389
				}
390
			}
391
		}
392
393
		return list;
394
185 395
	}
186 396
187 397
}

+ 76 - 35
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/impl/EquipmentManageServiceImpl.java

@ -1,5 +1,6 @@
1 1
package com.ai.ipu.server.service.impl;
2 2
3
import java.util.ArrayList;
3 4
import java.util.List;
4 5
import java.util.Map;
5 6
@ -9,58 +10,98 @@ import org.springframework.beans.factory.annotation.Autowired;
9 10
import org.springframework.stereotype.Service;
10 11
11 12
import com.ai.ipu.data.JMap;
13
import com.ai.ipu.server.dao.interfaces.DeviceManageDao;
12 14
import com.ai.ipu.server.dao.interfaces.EquipmentManageDao;
13 15
import com.ai.ipu.server.service.interfaces.EquipmentManageService;
14 16
import com.github.pagehelper.PageInfo;
15 17
16 18
@Service
17 19
public class EquipmentManageServiceImpl implements EquipmentManageService {
18
    Logger logger = LoggerFactory.getLogger(EquipmentManageServiceImpl.class);
20
	Logger logger = LoggerFactory.getLogger(EquipmentManageServiceImpl.class);
19 21
20
    @Autowired
21
    EquipmentManageDao equipmentManageDao;
22
	@Autowired
23
	EquipmentManageDao equipmentManageDao;
22 24
25
	@Autowired
26
	DeviceManageDao deviceManageDao;
23 27
28
	@Override
29
	public PageInfo queryEquipmentInfo(JMap params) throws Exception {
30
		return equipmentManageDao.queryEquipmentInfo(params);
31
	}
24 32
25
    @Override
26
    public PageInfo queryEquipmentInfo(JMap params) throws Exception {
27
        return equipmentManageDao.queryEquipmentInfo(params);
28
    }
29
30
    @Override
31
    public int modifyEquipmentInfo(JMap params) throws Exception{
32
        return equipmentManageDao.modifyEquipmentInfo(params);
33
    }
33
	@Override
34
	public int modifyEquipmentInfo(JMap params) throws Exception {
35
		return equipmentManageDao.modifyEquipmentInfo(params);
36
	}
34 37
35
    @Override
36
    public int addEquipmentInfo(JMap params) throws Exception{
37
        return equipmentManageDao.addEquipmentInfo(params);
38
    }
38
	@Override
39
	public int addEquipmentInfo(JMap params) throws Exception {
40
		return equipmentManageDao.addEquipmentInfo(params);
41
	}
39 42
40
    @Override
41
    public boolean deleteEquipmentInfo(JMap params) throws Exception{
42
        return equipmentManageDao.deleteEquipmentInfo(params);
43
    }
43
	@Override
44
	public boolean deleteEquipmentInfo(JMap params) throws Exception {
45
		return equipmentManageDao.deleteEquipmentInfo(params);
46
	}
44 47
45
    @Override
46
    public boolean deleteEquipmentsInfo(List<Map<String,Object>> paramsList) throws Exception {
47
        return equipmentManageDao.deleteEquipmentsInfo(paramsList);
48
    }
48
	@Override
49
	public boolean deleteEquipmentsInfo(List<Map<String, Object>> paramsList) throws Exception {
50
		return equipmentManageDao.deleteEquipmentsInfo(paramsList);
51
	}
49 52
50
    @Override
51
    public boolean importEquipmentInfo(List<Map<String,Object>> paramsList) throws Exception {
52
        return equipmentManageDao.importEquipmentInfo(paramsList);
53
    }
53
	@Override
54
	public boolean importEquipmentInfo(List<Map<String, Object>> paramsList) throws Exception {
55
		return equipmentManageDao.importEquipmentInfo(paramsList);
56
	}
54 57
55
    @Override
58
	@Override
56 59
	public List<Map<String, Object>> queryAllEquipmentInfo(JMap params) throws Exception {
57
		return equipmentManageDao.queryAllEquipmentInfo(params);
60
		// 获取所有设备列表
61
		List<Map<String, Object>> equipmentList = equipmentManageDao.queryAllEquipmentInfo(params);
62
63
		// 获取已绑定船舶的信息
64
		List<Map<String, Object>> bindInfoList = deviceManageDao.queryAllBindShip();
65
66
		if (bindInfoList != null) {
67
			// 获取定位信息
68
			List<String> deviceIdsList = new ArrayList<String>();
69
			for (Map<String, Object> bindInfoMap : bindInfoList) {
70
				deviceIdsList.add(String.valueOf(bindInfoMap.get("DEVICE_ID")));
71
			}
72
			List<Map<String, String>> deviceLocationInfoList = deviceManageDao
73
					.queryCurrentDeviceLocationInfo(deviceIdsList);
74
75
			// 拼接船舶最新的位置信息
76
			for (Map<String, Object> bindInfoMap : bindInfoList) {
77
				String code = String.valueOf(bindInfoMap.get("CODE"));
78
				String deviceId = String.valueOf(bindInfoMap.get("DEVICE_ID"));
79
80
				for (Map<String, Object> equipmentMap : equipmentList) {
81
					if (code.equals(String.valueOf(equipmentMap.get("FACILITY_CODE")))) {
82
						equipmentMap.put("DEVICE_ID", deviceId);// 设备ID
83
						equipmentMap.put("DEVICE_NO", deviceId);// 设备编码
84
						
85
						for (Map<String, String> deviceLocationInfoMap : deviceLocationInfoList) {
86
							if (deviceId.equals(deviceLocationInfoMap.get("deviceId"))) {
87
								equipmentMap.put("LONGITUDE", deviceLocationInfoMap.get("longitude"));// 经度
88
								equipmentMap.put("LATITUDE", deviceLocationInfoMap.get("latitude"));// 纬度
89
								equipmentMap.put("NEW_DATE", deviceLocationInfoMap.get("newDate"));// 最新定位时间
90
								break;
91
							}
92
						}
93
						break;
94
					}
95
				}
96
			}
97
		}
98
99
		return equipmentList;
58 100
	}
59
    
60
    @Override
61
    public Map<String, Object> verifyEquipmentInfoRepetition(JMap params) throws Exception{
62
        return equipmentManageDao.verifyEquipmentInfoRepetition(params);
63
    }
64 101
102
	@Override
103
	public Map<String, Object> verifyEquipmentInfoRepetition(JMap params) throws Exception {
104
		return equipmentManageDao.verifyEquipmentInfoRepetition(params);
105
	}
65 106
66 107
}

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

@ -98,20 +98,36 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
98 98
	 */
99 99
	private void executeReceiveIotLocationData(JMap params) throws Exception {
100 100
		// 1、获取人员信息
101
		Map<String, Object> dataMap=new HashMap<String, Object>();
101
		Map<String, Object> dataMap = new HashMap<String, Object>();
102 102
		dataMap.put("DEVICE_ID", params.get("deviceId"));
103
		Map<String, Object> deviceAndUser = deviceManageDao.queryOneBindDeviceInfo(dataMap);
104
		params.put("userName", deviceAndUser.get("PARTY_NAME"));
105
106
		// 2、查询是否为需救援的人员
107
		Map<String, Object> alarmMap = rescueDao.queryNoCloseRescueLog(params);
108
109
		// 当前已为报警信息
110
		if (alarmMap != null && !alarmMap.isEmpty()) {
111
			logger.info("定位信息为已报警人员:" + alarmMap.get("MAP_TAG_NAME"));
112
			// 执行对应方法
113
			beforeAlarmLocationData(params, alarmMap);
114
			// 报警人员不再进行围栏计算
103
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(params.getString("deviceId"), null);
104
105
		if (bindInfoMap != null) {
106
			logger.debug("定位信息的对象为人员: " + bindInfoMap.get("NAME"));
107
			params.put("userName", bindInfoMap.get("NAME"));
108
			params.put("userCode", bindInfoMap.get("CODE"));
109
			dataMap.put("locationStatus", EbcConstant.location_status_normal);// 定位状态
110
		} else {
111
			bindInfoMap = deviceManageDao.queryOneBindShip(params.getString("deviceId"), null);
112
			if (bindInfoMap != null) {
113
				logger.info("定位信息的对象为船舶: " + bindInfoMap.get("NAME"));
114
				params.put("shipName", bindInfoMap.get("NAME"));
115
				params.put("shipCode", bindInfoMap.get("CODE"));
116
117
				// 推送镜屏
118
				String jingpingData = JSON.toJSONString(params);
119
				logger.debug("推送镜屏数据:" + jingpingData);
120
				JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_ship, jingpingData);
121
			} else {
122
				logger.error("定位设备未绑定");
123
			}
124
			return;
125
		}
126
127
		// 2、是否为未被救援的信息
128
		if (IsAlarmNotRescued(params)) {
129
			logger.info("定位信息为已报警人员: " + params.get("userName"));
130
			// 已报警人员不进行围栏计算
115 131
			return;
116 132
		}
117 133
@ -121,7 +137,8 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
121 137
				params.getString("latitude"));
122 138
123 139
		// 4、查询人员之前所在围栏信息
124
		List<Map<String, Object>> beforeAreaMapList = areaInOutRecordDao.getBeforeAreaInfo(params);
140
		List<Map<String, Object>> beforeAreaMapList = areaInOutRecordDao
141
				.getBeforeInAreaInfo(params.getString("deviceId"), null);
125 142
126 143
		// 5、判断当前是否在围栏内
127 144
		if (currentAreaInfoJMap.getInt("mapTagNum") == 0) {
@ -134,23 +151,36 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
134 151
	}
135 152
136 153
	/**
137
	 * 当前已为报警信息
154
	 * 是否为未被救援的信息
138 155
	 * 
139 156
	 * @param params
140
	 * @param alarmMap
141 157
	 * @throws ParseException 
142 158
	 */
143
	private void beforeAlarmLocationData(JMap params, Map<String, Object> alarmMap) throws Exception {
144
		String alarmDate = String.valueOf(alarmMap.get("CALLER_DATE"));// 求救时间
159
	private boolean IsAlarmNotRescued(JMap params) throws Exception {
160
		// 查询是否为未被救援的人员
161
		List<String> deviceIdsList = new ArrayList<String>();
162
		deviceIdsList.add(params.getString("deviceId"));
163
		List<Map<String, Object>> alarmList = rescueDao.queryNoCloseRescueLog(deviceIdsList);
164
165
		if (alarmList == null || alarmList.isEmpty()) {
166
			return false;
167
		}
168
169
		// 求救时间
170
		String alarmDate = String.valueOf(alarmList.get(0).get("CALLER_DATE"));
145 171
		params.put("alarmDate", alarmDate);
146 172
147
		// 计算持续时长
173
		// 计算求救时长
148 174
		params.put("alarmLong", JingPingSendDateUtil.getBetweenMinuteValue(alarmDate, params.getString("newDate")));
149 175
176
		params.put("isNewAlarm", "0");
177
150 178
		// 推送镜屏
151 179
		String jingpingData = JSON.toJSONString(params);
152 180
		logger.debug("推送镜屏数据:" + jingpingData);
153 181
		JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_personnel, jingpingData);
182
183
		return true;
154 184
	}
155 185
156 186
	/**
@ -247,7 +277,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
247 277
		}
248 278
249 279
		// 推送镜屏
250
		currentInAreaSendData(params, currentAreaInfoList);
280
		currentInAreaSendJingping(params, currentAreaInfoList);
251 281
	}
252 282
253 283
	/**
@ -256,7 +286,7 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
256 286
	 * @param currentAreaInfoList
257 287
	 * @throws ParseException 
258 288
	 */
259
	private void currentInAreaSendData(JMap params, List<Map<String, Object>> currentAreaInfoList)
289
	private void currentInAreaSendJingping(JMap params, List<Map<String, Object>> currentAreaInfoList)
260 290
			throws ParseException {
261 291
262 292
		int maxMapTagGrade = 0; // 围栏优先级(电子围栏5>定点3>考勤1、作业1)
@ -299,12 +329,12 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
299 329
			}
300 330
		}
301 331
302
		//判断是否在违规(增加字段)
332
		// 判断是否在违规
303 333
		if (maxMapTagGrade == 5) {
304 334
			logger.info("镜屏推送进入电子围栏的信息");
305 335
			// 进入电子围栏(禁区),需显示进入时间
306
			params.put("inDate", simpleDateFormat.format(sendDataAreaInfo.get("inAreaDate"))); //进入时间
307
			params.put("locationStatus", EbcConstant.location_status_exclusion); //定位状态
336
			params.put("inDate", simpleDateFormat.format(sendDataAreaInfo.get("inAreaDate"))); // 进入时间
337
			params.put("locationStatus", EbcConstant.location_status_exclusion); // 定位状态
308 338
309 339
		} else if (maxMapTagGrade == 3) {
310 340
			// 进入定点(限时),需计算是否超时
@ -313,15 +343,16 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
313 343
314 344
			if (fixedLong > 0) {
315 345
				// 围栏要求定点时间
316
				int residenceTimeLength = Integer.parseInt(String.valueOf(sendDataAreaInfo.get("RESIDENCE_TIME_LENGTH")));
346
				int residenceTimeLength = Integer
347
						.parseInt(String.valueOf(sendDataAreaInfo.get("RESIDENCE_TIME_LENGTH")));
317 348
318 349
				if (residenceTimeLength <= fixedLong) {
319 350
					// 已超时
320 351
					logger.info("镜屏推送进入定点(限时)的信息:已超时");
321
					params.put("locationStatus", EbcConstant.location_status_overtime);//定位状态
352
					params.put("locationStatus", EbcConstant.location_status_overtime);// 定位状态
322 353
				}
323 354
			}
324
			params.put("fixedLong", fixedLong);//停留时长
355
			params.put("fixedLong", fixedLong);// 停留时长
325 356
		}
326 357
327 358
		String jingpingData = JSON.toJSONString(params);
@ -336,33 +367,33 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
336 367
	 */
337 368
	private void executeReceiveIotAlarmData(JMap params) throws Exception {
338 369
		// 1、获取人员信息
339
		Map<String, Object> dataMap=new HashMap<String, Object>();
370
		Map<String, Object> dataMap = new HashMap<String, Object>();
340 371
		dataMap.put("DEVICE_ID", params.get("deviceId"));
341
		Map<String, Object> deviceAndUser = deviceManageDao.queryOneBindDeviceInfo(dataMap);
342
		params.put("userName", deviceAndUser.get("PARTY_NAME"));
372
		Map<String, Object> bindInfoMap = deviceManageDao.queryOneBindUser(params.getString("deviceId"), null);
343 373
344
		// 2、查询是否为需救援的人员
345
		Map<String, Object> alarmMap = rescueDao.queryNoCloseRescueLog(params);
374
		logger.debug("报警信息的对象为人员: " + bindInfoMap.get("NAME"));
375
		params.put("userName", bindInfoMap.get("NAME"));
376
		params.put("userCode", bindInfoMap.get("CODE"));
346 377
347
		// 3判断是否存在未救援的报警信息
348
		if (alarmMap == null || alarmMap.isEmpty()) {
349
			logger.debug("新增报警信息");
350
			params.put("isNewAlarm", "1");
351
			params.put("alarmDate", params.getString("newDate"));//求救时间
352
			params.put("alarmLong", "0");//求救时长
353
354
			// 推送镜屏
355
			String jingpingData = JSON.toJSONString(params);
356
			logger.debug("推送镜屏数据:" + jingpingData);
357
			JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_personnel, jingpingData);
358
			
359
			// 保存报警数据
360
			saveAlarmData(params, deviceAndUser);
361
		} else {
362
			params.put("isNewAlarm", "0");
363
			logger.debug("报警信息未处理");
364
			beforeAlarmLocationData(params, alarmMap);
378
		// 2是否为未被救援的信息
379
		if (IsAlarmNotRescued(params)) {
380
			logger.debug("报警信息未处理: " + params.get("userName"));
381
			return;
365 382
		}
383
384
		// 3、判断是否存在未救援的报警信息
385
		logger.debug("新增报警信息");
386
		params.put("isNewAlarm", "1");
387
		params.put("alarmDate", params.getString("newDate"));// 求救时间
388
		params.put("alarmLong", "0");// 求救时长
389
390
		// 推送镜屏
391
		String jingpingData = JSON.toJSONString(params);
392
		logger.debug("推送镜屏数据:" + jingpingData);
393
		JingPingSendDateUtil.sendData(JingPingSendDateUtil.topic_personnel, jingpingData);
394
395
		// 保存报警数据
396
		saveAlarmData(params, bindInfoMap);
366 397
	}
367 398
368 399
	/**
@ -378,11 +409,11 @@ public class ReceiveSubscribeServiceImpl implements ReceiveSubscribeService {
378 409
379 410
		// 2、拼接添加数据
380 411
		Map<String, Object> dataMap = new HashMap<String, Object>();
381
		dataMap.put("CALLER_ID", deviceAndUser.get("PARTY_CODE")); // 报警人员标识
412
		dataMap.put("CALLER_ID", deviceAndUser.get("CODE")); // 报警人员标识
382 413
		dataMap.put("DEVICE_ID", params.get("deviceId")); // 终端标识
383
		dataMap.put("PARTY_TYPE", deviceAndUser.get("PARTY_TYPE")); // 参与人类型
384
		dataMap.put("PARTY_CODE", deviceAndUser.get("PARTY_CODE")); // 参与人业务编码
385
		dataMap.put("PARTY_NAME", deviceAndUser.get("PARTY_NAME")); // 参与人名称
414
		dataMap.put("PARTY_TYPE", deviceAndUser.get("TYPE")); // 参与人类型
415
		dataMap.put("PARTY_CODE", deviceAndUser.get("CODE")); // 参与人业务编码
416
		dataMap.put("PARTY_NAME", deviceAndUser.get("NAME")); // 参与人名称
386 417
		dataMap.put("ALARM_TYPE", params.get("alarmType")); // 告警类型
387 418
		dataMap.put("LONGITUDE", params.get("longitude")); // 报警经度
388 419
		dataMap.put("LATITUDE", params.get("latitude")); // 报警纬度

+ 1 - 1
ebc-sea-platform/src/main/java/com/ai/ipu/server/service/interfaces/DeviceManageService.java

@ -67,5 +67,5 @@ public interface DeviceManageService {
67 67
68 68
	Map<String, Object> verifyUserOrBoatAssociatInfo(JMap params) throws Exception;
69 69
	
70
	List<Map<String, Object>> queryCurrentDeviceLocationInfo(JMap params) throws Exception;
70
	List<Map<String, String>> queryCurrentDeviceLocationInfo(JMap params) throws Exception;
71 71
}

+ 6 - 6
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/HttpServiceUtil.java

@ -201,13 +201,13 @@ public class HttpServiceUtil {
201 201
		return responseEx(httpClient, response, encoding);
202 202
	}
203 203
204
	public static String sendPost(String url, Map<String, Object> params, Charset encoding) {
204
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding) {
205 205
		HttpClient httpClient = HttpClients.createDefault();
206 206
		String resp = "";
207 207
		HttpPost httpPost = new HttpPost(url);
208 208
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
209
		if (params != null && params.size() > 0) {
210
			StringEntity se = new StringEntity(JSONObject.toJSONString(params), encoding);
209
		if (paramsMap != null && paramsMap.size() > 0) {
210
			StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
211 211
			httpPost.setEntity(se);
212 212
		}
213 213
		CloseableHttpResponse response = null;
@ -219,7 +219,7 @@ public class HttpServiceUtil {
219 219
		return responseEx(httpClient, response, encoding);
220 220
	}
221 221
222
	public static String sendPost(String url, Map<String, Object> params, Charset encoding,
222
	public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding,
223 223
			Map<String, String> headerMap) {
224 224
		HttpClient httpClient = HttpClients.createDefault();
225 225
		String resp = "";
@ -235,8 +235,8 @@ public class HttpServiceUtil {
235 235
		}
236 236
237 237
		httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
238
		if (params != null && params.size() > 0) {
239
			StringEntity se = new StringEntity(JSONObject.toJSONString(params), encoding);
238
		if (paramsMap != null && paramsMap.size() > 0) {
239
			StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
240 240
			httpPost.setEntity(se);
241 241
		}
242 242
		CloseableHttpResponse response = null;

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

@ -19,8 +19,8 @@ public class JingPingSendDateUtil {
19 19
	// 人员定位topic
20 20
	public static final String topic_personnel = "personnel";
21 21
22
	// 救援定位topic
23
	//public static final String topic_alarm = "alarm";
22
	// 船舶定位topic
23
	public static final String topic_ship = "ship";
24 24
25 25
	public static void sendData(String topic, String msg) {
26 26
		if (!EventChannelTool.isExistSubscriber(topic)) {

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

@ -0,0 +1,30 @@
1
package com.ai.ipu.server.util;
2
3
/**
4
 * 北向接口的常量
5
 * @author konghl@asiainfo.com
6
 * 2020-10-29
7
 */
8
public class NorthboundInterfaceConstant {
9
	// 分页查询终端
10
	public static final String queryPageDevice="findTerminal";
11
	
12
	// 添加终端
13
	public static final String addDevice="device";
14
	
15
	// 修改终端
16
	public static final String updateDevice="updateDevice";
17
	
18
	// 删除终端
19
	public static final String deleteDevice="deleteDevice?deviceId=";
20
	
21
	// 查询单个设备
22
	public static final String queryOneDevice="deviceSimpleDetail?deviceId=";
23
	
24
	// 查询多个设备解析后的事件
25
	public static final String queryMoreDeviceNewIncident="findTerminalEventDataParseInResourceIdsLastData";
26
27
	// 调用成功标识
28
	public static final String resultCode_succeed = "0";
29
30
}

+ 29 - 29
ebc-sea-platform/src/main/java/com/ai/ipu/server/util/NorthboundInterfaceUtil.java

@ -24,22 +24,22 @@ public class NorthboundInterfaceUtil {
24 24
	private static final ILogger logger = IpuLoggerFactory.createLogger(NorthboundInterfaceUtil.class);
25 25
26 26
	@Value("${aap.iot.userCode}")
27
	private static String userCode;
27
	private String userCode;
28 28
	
29 29
	@Value("${aap.iot.passWord}")
30
	private static String passWord;
30
	private String passWord;
31 31
	
32 32
	@Value("${url.iot.login}")
33
	private static String iotLoginUrl;
34
35
	// 调用成功标识
36
	public static final String resultCode_succeed = "0";
37
33
	private String iotLoginUrl;
34
	
35
	@Value("${url.iot.service}")
36
	private String iotServiceUrl;
37
	
38 38
	// 定义静态存储map空间存放sign与sessionId
39 39
	private volatile static Map<String, String> cacheMap = new ConcurrentHashMap<String, String>();// 缓存map
40 40
41 41
	// set
42
	public static void setMapCache(Map<String, String> map) {
42
	public void setMapCache(Map<String, String> map) {
43 43
		Set<String> set = map.keySet();
44 44
		Iterator<String> it = set.iterator();
45 45
		while (it.hasNext()) {
@ -49,13 +49,13 @@ public class NorthboundInterfaceUtil {
49 49
	}
50 50
51 51
	// get
52
	public static Map<String, String> getMapCache() {
52
	public Map<String, String> getMapCache() {
53 53
54 54
		return cacheMap;
55 55
	}
56 56
57 57
	// 清除cache
58
	public static void clear() {
58
	public void clear() {
59 59
		cacheMap.clear();
60 60
	}
61 61
@ -67,22 +67,22 @@ public class NorthboundInterfaceUtil {
67 67
	 * @return
68 68
	 * @throws Exception
69 69
	 */
70
	public static Map<String, String> iotGetCallUtil(String url) throws Exception {
70
	public Map<String, String> iotGetCallUtil(String url) throws Exception {
71 71
		// 调用北向服务的接口
72 72
		logger.debug("GET调用北向接口");
73 73
74 74
		// 1.在缓存中获取sessionId与sign
75
		Map<String, String> mapCache = NorthboundInterfaceUtil.getMapCache();
76
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("sessionId") == null) {
75
		Map<String, String> mapCache = getMapCache();
76
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("session_id") == null) {
77 77
			// 2.如果没有调用登录接口从新获取
78
			NorthboundInterfaceUtil.iotLogin();
78
			iotLogin();
79 79
		}
80 80
81 81
		// 3.调用北向服务接口
82 82
		// (1)设置字符集
83 83
		Charset charset = Charset.forName("utf-8");
84 84
		// (2)调用接口
85
		String resultJson = HttpServiceUtil.sendGet(url, charset);
85
		String resultJson = HttpServiceUtil.sendGet(iotServiceUrl+url, charset);
86 86
		// (3)将参数转为Map<String,String>【将返回值统一为String】
87 87
		Map<String, String> resultMap = JSON.parseObject(resultJson, Map.class);
88 88
@ -91,11 +91,11 @@ public class NorthboundInterfaceUtil {
91 91
			logger.info("调用北向接口失败,需重新登录");
92 92
			// 4.调用不成功可能是登录过期
93 93
			// (1)清除缓存
94
			NorthboundInterfaceUtil.clear();
94
			clear();
95 95
			// (2)重新登录
96
			NorthboundInterfaceUtil.iotLogin();
96
			iotLogin();
97 97
			// (3)再次调用接口
98
			String fianlresultJson = HttpServiceUtil.sendGet(url, charset);
98
			String fianlresultJson = HttpServiceUtil.sendGet(iotServiceUrl+url, charset);
99 99
			// (4)获取返回值
100 100
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
101 101
		}
@ -114,19 +114,19 @@ public class NorthboundInterfaceUtil {
114 114
	 * POST请求调用北向接口方法
115 115
	 * 
116 116
	 * @param url
117
	 * @param params
117
	 * @param paramsMap
118 118
	 * @return
119 119
	 * @throws Exception
120 120
	 */
121
	public static Map<String, String> iotPostCallUtil(String url, Map<String, Object> params) throws Exception {
121
	public Map<String, String> iotPostCallUtil(String url, Map<String, Object> paramsMap) throws Exception {
122 122
		// 调用北向服务的接口
123 123
		logger.debug("POSt调用北向接口");
124 124
125 125
		// 1.在缓存中获取sessionId与sign
126
		Map<String, String> mapCache = NorthboundInterfaceUtil.getMapCache();
127
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("sessionId") == null) {
126
		Map<String, String> mapCache = getMapCache();
127
		if (mapCache.isEmpty() || mapCache.get("sign") == null || mapCache.get("session_id") == null) {
128 128
			// 2.如果没有调用登录接口从新获取
129
			NorthboundInterfaceUtil.iotLogin();
129
			iotLogin();
130 130
		}
131 131
132 132
		// 3.调用北向服务接口
@ -136,7 +136,7 @@ public class NorthboundInterfaceUtil {
136 136
		Map<String, String> resultMap = null;
137 137
		try {
138 138
			// (2)调用接口
139
			String resultJson = HttpServiceUtil.sendPost(url, params, charset, getMapCache());
139
			String resultJson = HttpServiceUtil.sendPost(iotServiceUrl+url, paramsMap, charset, getMapCache());
140 140
			// (3)将参数转为Map<String,String>【将返回值统一为String】
141 141
			resultMap = JSON.parseObject(resultJson, Map.class);
142 142
		} catch (Exception e) {
@ -153,11 +153,11 @@ public class NorthboundInterfaceUtil {
153 153
			logger.info("调用北向接口失败,需重新登录");
154 154
			// 4.调用不成功可能是登录过期
155 155
			// (1)清除缓存
156
			NorthboundInterfaceUtil.clear();
156
			clear();
157 157
			// (2)重新登录
158
			NorthboundInterfaceUtil.iotLogin();
158
			iotLogin();
159 159
			// (3)再次调用接口
160
			String fianlresultJson = HttpServiceUtil.sendPost(url, params, charset, getMapCache());
160
			String fianlresultJson = HttpServiceUtil.sendPost(iotServiceUrl+url, paramsMap, charset, getMapCache());
161 161
			// (4)获取返回值
162 162
			resultMap = JSON.parseObject(fianlresultJson, Map.class);
163 163
		}
@ -177,7 +177,7 @@ public class NorthboundInterfaceUtil {
177 177
	 * 
178 178
	 * @return
179 179
	 */
180
	private static Map<String, String> iotLogin() {
180
	private Map<String, String> iotLogin() {
181 181
		logger.debug("登录北向接口");
182 182
183 183
		// 调用登录接口获取sessionId与sign
@ -203,7 +203,7 @@ public class NorthboundInterfaceUtil {
203 203
			if ("0".equals(String.valueOf(mapType.get("resultCode")))) {
204 204
				logger.info("登录北向接口成功");
205 205
				// 将数据存到缓存中
206
				NorthboundInterfaceUtil.setMapCache(result);
206
				setMapCache(result);
207 207
			} else {
208 208
				logger.info("登录北向接口失败");
209 209
			}

+ 3 - 3
ebc-sea-platform/src/main/resources/dev/application.properties

@ -34,8 +34,8 @@ aap.gis.userName=EBC_PPRS
34 34
aap.gis.passwd=ITBS93wMYHosT
35 35
36 36
#gis\u7684token\u5730\u5740
37
url.gis.token = http://192.168.74.189:9999/gisIntf/account/gettoken
37
url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
38 38
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
39
url.iot.login = http://60.205.219.67:8300/sso/login
39
url.iot.login=http://60.205.219.67:8300/sso/login
40 40
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
41
url.iot.service = http://60.205.219.67:8300/dmp/terminalNorthApi
41
url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/

+ 19 - 12
ebc-sea-platform/src/main/resources/pro/application.properties

@ -1,31 +1,38 @@
1
######设置服务器端口
2
######也可以通过启动命令行参数实现:java -jar myproject.jar --server.port=9084
1
######\u8bbe\u7f6e\u670d\u52a1\u5668\u7aef\u53e3
2
######\u4e5f\u53ef\u4ee5\u901a\u8fc7\u542f\u52a8\u547d\u4ee4\u884c\u53c2\u6570\u5b9e\u73b0\uff1ajava -jar myproject.jar --server.port=9084
3 3
server.port=unknown
4 4
5
#会影响拦截器的配置exclude-mapping
5
#\u4f1a\u5f71\u54cd\u62e6\u622a\u5668\u7684\u914d\u7f6eexclude-mapping
6 6
spring.mvc.static-path-pattern=/**
7 7
8
######context-path默认/
8
######context-path\u9ed8\u8ba4/
9 9
server.context-path=/ipu
10
######注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
10
######\u6ce8\u518cDispatcherServlet\u5bf9\u5e94path\uff0c\u4ea6\u53ef\u901a\u8fc7dispatcherRegistration\u65b9\u6cd5\u914d\u7f6e
11 11
#server.servlet-path=/ipu1
12
#使用maven中的变量替换
12
#\u4f7f\u7528maven\u4e2d\u7684\u53d8\u91cf\u66ff\u6362
13 13
logging.file=target/logs/${project.artifactId}.log
14 14
spring.application.name=${project.artifactId}
15 15
16
######session使用默认
16
######session\u4f7f\u7528\u9ed8\u8ba4
17 17
spring.session.store-type=none
18 18
19
#设置开启热部署
19
#\u8bbe\u7f6e\u5f00\u542f\u70ed\u90e8\u7f72
20 20
spring.devtools.restart.enabled=true
21
#重启目录
21
#\u91cd\u542f\u76ee\u5f55
22 22
spring.devtools.restart.additional-paths=src/main/java
23 23
spring.devtools.restart.exclude=WEB-INF/**
24 24
25
#北向登录账号和密码
25
#\u5317\u5411\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
26 26
aap.iot.userCode=IOT_ADMIN
27 27
aap.iot.passWord=123456
28 28
29
#gis登录账号和密码
29
#gis\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
30 30
aap.gis.userName=EBC_PPRS
31
aap.gis.passwd=ITBS93wMYHosT
31
aap.gis.passwd=ITBS93wMYHosT
32
33
#gis\u7684token\u5730\u5740
34
url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
35
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
36
url.iot.login=http://60.205.219.67:8300/sso/login
37
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
38
url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/

+ 29 - 0
ebc-sea-platform/src/main/resources/sql/ipu/AreaInOutRecordDao.xml

@ -57,6 +57,35 @@
57 57
		]]>
58 58
	</sql>
59 59
60
	<sql name="getBeforeInAreaInfo">
61
		<![CDATA[
62
		<select id="queryNoCloseRescueLog" resultType="java.util.Map" >
63
	        SELECT a.RECORD_ID,a.MAP_TAG_ID,a.IN_DATE,a.DEVICE_ID,
64
	        m.MAP_TAG_NAME,m.MAP_TAG_TYPE,m.RESIDENCE_TIME_LENGTH
65
	        FROM LR_AREA_IN_OUT_RECORD a
66
	        LEFT JOIN LR_MAP_TAG m ON m.MAP_TAG_ID=a.MAP_TAG_ID
67
	        <where>
68
	        a.OUT_DATE IS NULL
69
	        
70
	        <if test="deviceId != null">
71
	        	AND a.DEVICE_ID = #{deviceId}
72
	        </if>
73
	        
74
	        <if test="mapTagTypeList != null">
75
	        	AND m.MAP_TAG_TYPE IN (
76
			
77
	    		<foreach collection="mapTagTypeList" item="item" separator=",">
78
	        		#{item}
79
	    		</foreach>
80
	    		
81
	    		)
82
	        </if>
83
	        
84
	        </where>
85
		</select>
86
		]]>
87
	</sql>
88
60 89
	<sql name="queryPageDayAttendanceCount">
61 90
		<![CDATA[
62 91
		<select id="queryPageDayAttendanceCount" resultType="java.util.Map">

+ 68 - 0
ebc-sea-platform/src/main/resources/sql/ipu/DeviceManageDao.xml

@ -0,0 +1,68 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<sqls>
3
4
	<sql name="queryAllBindShip">
5
		<![CDATA[
6
		<select id="queryAllBindShip" resultType="java.util.Map" >
7
		
8
			SELECT FACILITY_ID ID,FACILITY_TYPE TYPE,FACILITY_CODE CODE,FACILITY_NAME NAME,DEVICE_ID
9
			FROM LR_FACILITY
10
			WHERE DEVICE_ID IS NOT NULL
11
			AND FACILITY_TYPE = #{shipProductId}
12
		
13
		</select>
14
		]]>
15
	</sql>
16
	
17
	<sql name="queryAllBindUser">
18
		<![CDATA[
19
		<select id="queryAllBindUser" resultType="java.util.Map" >
20
		
21
			SELECT PARTY_TERMINAL_ID ID,PARTY_TYPE TYPE,PARTY_CODE CODE,PARTY_NAME NAME,DEVICE_ID
22
			FROM LR_PARTY_TERMINAL
23
			WHERE DEVICE_ID IS NOT NULL
24
		
25
		</select>
26
		]]>
27
	</sql>
28
	
29
	<sql name="queryOneBindShip">
30
		<![CDATA[
31
		<select id="queryOneBindShip" resultType="java.util.Map" >
32
		
33
			SELECT FACILITY_ID ID,FACILITY_TYPE TYPE,FACILITY_CODE CODE,FACILITY_NAME NAME,DEVICE_ID
34
			FROM LR_FACILITY
35
			WHERE 1=1
36
			AND FACILITY_TYPE = #{shipProductId}
37
			<if test="deviceId != null">
38
				AND DEVICE_ID = #{deviceId}
39
			</if>
40
			<if test="bindCode != null">
41
				AND FACILITY_ID = #{bindCode}
42
				AND DEVICE_ID IS NOT NULL
43
			</if>
44
			
45
		</select>
46
		]]>
47
	</sql>
48
	
49
	<sql name="queryOneBindUser">
50
		<![CDATA[
51
		<select id="queryOneBindUser" resultType="java.util.Map" >
52
			
53
			SELECT PARTY_TERMINAL_ID ID,PARTY_TYPE TYPE,PARTY_CODE CODE,PARTY_NAME NAME,DEVICE_ID
54
			FROM LR_PARTY_TERMINAL
55
			WHERE 1=1
56
			<if test="deviceId != null">
57
				AND DEVICE_ID = #{deviceId}
58
			</if>
59
			<if test="bindCode != null">
60
				AND PARTY_CODE = #{bindCode}
61
				AND DEVICE_ID IS NOT NULL
62
			</if>
63
		
64
		</select>
65
		]]>
66
	</sql>
67
68
</sqls>

+ 25 - 0
ebc-sea-platform/src/main/resources/sql/ipu/RescueDao.xml

@ -0,0 +1,25 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<sqls>
3
4
	<sql name="queryNoCloseRescueLog">
5
		<![CDATA[
6
		<select id="queryNoCloseRescueLog" resultType="java.util.Map" >
7
	        SELECT l.LOG_ID,l.CALLER_ID,l.DEVICE_ID,l.PARTY_TYPE,l.PARTY_CODE,
8
	        l.PARTY_NAME,l.ALARM_TYPE,l.CALLER_DATE,l.RESCUERS_DATE,l.REMARKS
9
	        FROM LR_RESCUE_LOG l
10
	        <where>
11
	        l.RESCUERS_DATE IS NULL
12
	        AND l.ALARM_TYPE <> #{offlineType}
13
	        AND l.DEVICE_ID IN (
14
			
15
    		<foreach collection="deviceIdsList" item="item" separator=",">
16
        		#{item}
17
    		</foreach>
18
    		
19
    		)
20
	        </where>
21
		</select>
22
		]]>
23
	</sql>
24
25
</sqls>

+ 17 - 12
ebc-sea-platform/src/main/resources/test/application.properties

@ -1,33 +1,38 @@
1
######设置服务器端口
2
######也可以通过启动命令行参数实现:java -jar myproject.jar --server.port=9084
1
######\u8bbe\u7f6e\u670d\u52a1\u5668\u7aef\u53e3
2
######\u4e5f\u53ef\u4ee5\u901a\u8fc7\u542f\u52a8\u547d\u4ee4\u884c\u53c2\u6570\u5b9e\u73b0\uff1ajava -jar myproject.jar --server.port=9084
3 3
server.port=unknown
4 4
5
#会影响拦截器的配置exclude-mapping
5
#\u4f1a\u5f71\u54cd\u62e6\u622a\u5668\u7684\u914d\u7f6eexclude-mapping
6 6
spring.mvc.static-path-pattern=/**
7 7
8
######context-path默认/
8
######context-path\u9ed8\u8ba4/
9 9
server.context-path=/ipu
10
######注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
10
######\u6ce8\u518cDispatcherServlet\u5bf9\u5e94path\uff0c\u4ea6\u53ef\u901a\u8fc7dispatcherRegistration\u65b9\u6cd5\u914d\u7f6e
11 11
#server.servlet-path=/ipu1
12
#使用maven中的变量替换
12
#\u4f7f\u7528maven\u4e2d\u7684\u53d8\u91cf\u66ff\u6362
13 13
logging.file=target/logs/${project.artifactId}.log
14 14
spring.application.name=${project.artifactId}
15 15
16
######session使用默认
16
######session\u4f7f\u7528\u9ed8\u8ba4
17 17
spring.session.store-type=none
18 18
19
#设置开启热部署
19
#\u8bbe\u7f6e\u5f00\u542f\u70ed\u90e8\u7f72
20 20
spring.devtools.restart.enabled=true
21
#重启目录
21
#\u91cd\u542f\u76ee\u5f55
22 22
spring.devtools.restart.additional-paths=src/main/java
23 23
spring.devtools.restart.exclude=WEB-INF/**
24 24
25
#北向登录账号和密码
25
#\u5317\u5411\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
26 26
aap.iot.userCode=IOT_ADMIN
27 27
aap.iot.passWord=123456
28 28
29
#gis登录账号和密码
29
#gis\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
30 30
aap.gis.userName=EBC_PPRS
31 31
aap.gis.passwd=ITBS93wMYHosT
32 32
33
url.gis.token = http://192.168.74.189:9999/gisIntf/account/gettoken
33
#gis\u7684token\u5730\u5740
34
url.gis.token=http://192.168.74.189:9999/gisIntf/account/gettoken
35
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
36
url.iot.login=http://60.205.219.67:8300/sso/login
37
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
38
url.iot.service=http://60.205.219.67:8300/dmp/terminalNorthApi/