Browse Source

海康-事件报文变更

lyq 2 months ago
parent
commit
ae3c476ffc

+ 8 - 4
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/AlarmEventController.java

@@ -1,5 +1,7 @@
 package com.sooka.sponest.event.centereventteventcatalogue.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
@@ -37,10 +39,11 @@ public class AlarmEventController {
 
     @ApiOperation("火险事件上报")
     @PostMapping("/haikang@insertFireEvent")
-    public R insertFireEvent(@RequestBody JSONObject jsonObject) {
+    public R insertFireEvent(@RequestBody JSONArray jsonArray) {
         String eventCode = null;
+        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(jsonArray.get(0)));
         try {
-            HaiKangEventVo haiKangEventVo = JSONObject.toJavaObject(jsonObject.getJSONObject("params"), HaiKangEventVo.class);
+            HaiKangEventVo haiKangEventVo = JSONObject.toJavaObject(jsonObject.getJSONObject("sys_exclusive_original_data_message").getJSONObject("params"), HaiKangEventVo.class);
             eventCode = alarmEventService.insertHaiKangFireEvent(haiKangEventVo.getEvents()[0]);
         } catch (Exception e) {
             logger.error(e.getMessage());
@@ -62,10 +65,11 @@ public class AlarmEventController {
 
     @ApiOperation("城管事件上报")
     @PostMapping("/haikang@insertCityEvent")
-    public R insertCityEvent(@RequestBody JSONObject jsonObject) {
+    public R insertCityEvent(@RequestBody JSONArray jsonArray) {
         String eventCode = null;
+        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(jsonArray.get(0)));
         try {
-            HaiKangEventVo haiKangEventVo = JSONObject.toJavaObject(jsonObject.getJSONObject("params"), HaiKangEventVo.class);
+            HaiKangEventVo haiKangEventVo = JSONObject.toJavaObject(jsonObject.getJSONObject("sys_exclusive_original_data_message").getJSONObject("params"), HaiKangEventVo.class);
             eventCode = alarmEventService.insertHaiKangCityEvent(haiKangEventVo);
         } catch (Exception e) {
             logger.error(e.getMessage());