From e5bf0d08d05f5c58224fe28cdf743a1bae88e3f0 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 30 十一月 2023 16:48:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ycl-platform/src/main/java/com/ycl/controller/platformApi/TranspondDHController.java   |   11 ++++++-----
 ycl-platform/src/main/resources/application-dev.yml                                    |    1 +
 ycl-platform/src/main/resources/application-prod.yml                                   |    1 +
 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java |   27 +++++++++++++++++++++++++--
 4 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/platformApi/TranspondDHController.java b/ycl-platform/src/main/java/com/ycl/controller/platformApi/TranspondDHController.java
index c360933..b388b2b 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/platformApi/TranspondDHController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/platformApi/TranspondDHController.java
@@ -28,7 +28,7 @@
 @RequestMapping("/API/videoService/eventCenter/messages")
 public class TranspondDHController {
 
-    @Value("${videoPoint.url}")
+    @Value("${videoPoint.web_url}")
     private String url;
 
     @Value("${videoPoint.userName}")
@@ -54,21 +54,22 @@
                                   @RequestParam(required = false) Integer msgNum,
                                   @RequestParam(required = false) Integer waitSec) {
         String url = "/videoService/eventCenter/messages/subscribe";
-        String param = "?type=" + type + "&msgId=" + msgId + "&msgNum=" + msgNum + "&waitSec=" + waitSec;
+        String param = "?type=" + type + "&msgId=" + msgId + "&waitSec=" + waitSec + "&msgNum=" + msgNum;
+
         return getResult(url, param);
     }
 
-    private CommonResult<?> getResult(String url, String param) {
+    private CommonResult<?> getResult(String reqUrl, String param) {
         try {
             String token = getToken();
-
+            System.out.println("瀹氫綅鎺ュ彛url:" + url + reqUrl + param);
             HttpHeaders deviceHeaders = new HttpHeaders();
             ObjectMapper objectMapper = new ObjectMapper();
             deviceHeaders.add("X-Subject-Token", token);
             HttpEntity<Object> deviceEntity = new HttpEntity<>(deviceHeaders);
 
             RestTemplate restTemplate = new RestTemplate();
-            ResponseEntity<String> exchange = restTemplate.exchange(url + param, HttpMethod.GET, deviceEntity, String.class);
+            ResponseEntity<String> exchange = restTemplate.exchange(url + reqUrl + param, HttpMethod.GET, deviceEntity, String.class);
             System.out.println(exchange);
             return CommonResult.success(exchange);
         } catch (Exception ex) {
diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java
index 0d77726..50db4c3 100644
--- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java
@@ -21,6 +21,7 @@
 import com.ycl.service.dict.IDataDictionaryService;
 import com.ycl.service.region.ISccgRegionService;
 import com.ycl.service.resources.IImageResourcesService;
+import com.ycl.service.video.IVideoAlarmReportService;
 import com.ycl.service.video.impl.IVideoPointService;
 import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +50,7 @@
     private IDataDictionaryService dataDictionaryService;
     private IImageResourcesService imageResourcesService;
     private ISccgRegionService regionService;
+    private IVideoAlarmReportService videoAlarmReportService;
     @Resource
     BaseCaseMapper baseCaseMapper;
 
@@ -78,6 +80,11 @@
     @Autowired
     public void setRegionService(ISccgRegionService regionService) {
         this.regionService = regionService;
+    }
+
+    @Autowired
+    public void setVideoAlarmReportService(IVideoAlarmReportService videoAlarmReportService) {
+        this.videoAlarmReportService = videoAlarmReportService;
     }
 
     @Override
@@ -133,10 +140,11 @@
         List<DataDictionary> dataDictionaries = dataDictionaryService.queryByRemark(alarmParam.getSubject());
 
         Instant instant = Instant.ofEpochMilli(Long.parseLong(alarmParam.getIncidentDate()));
+        LocalDateTime alarmTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
 
         BaseCase baseCase = BaseCase.builder().eventSource(1).category(QuestionCategory.VIOLATION.getCode())
                 .code(utilNumber.createCaseCode()).createTime(LocalDateTime.now()).createUser(0L).state(1).
-                alarmTime(LocalDateTime.ofInstant(instant, ZoneId.systemDefault())).build();
+                alarmTime(alarmTime).build();
         Violations violations = new Violations();
 
         baseCase.setLatitude(alarmParam.getLatitude());
@@ -159,8 +167,22 @@
         if (videoPoint != null) {
             violations.setVideoPointId(videoPoint.getId());
         }
-        baseMapper.insert(violations);
+
         String[] imgs = alarmParam.getFileUrl().split(",");
+
+        VideoAlarmReport videoAlarmReport = new VideoAlarmReport();
+        videoAlarmReport.setPlatResourceId(alarmParam.getEventNumber());
+        if (imgs.length > 0) {
+            videoAlarmReport.setPicData(imgs[0]);
+        }
+        videoAlarmReport.setAlarmTime(alarmTime);
+        videoAlarmReport.setAlarmId(alarmParam.getEventId());
+        videoAlarmReport.setAlgoName(alarmParam.getContact());
+        videoAlarmReport.setAlarmName(alarmParam.getSubject());
+        videoAlarmReportService.save(videoAlarmReport);
+
+        violations.setVideoAlarmReportId(videoAlarmReport.getId());
+        baseMapper.insert(violations);
 
         try {
             for (int i = 0; i < imgs.length; i++) {
@@ -175,6 +197,7 @@
         } catch (Exception ex) {
 
         }
+
     }
 
     @Override
diff --git a/ycl-platform/src/main/resources/application-dev.yml b/ycl-platform/src/main/resources/application-dev.yml
index 206594e..9469da4 100644
--- a/ycl-platform/src/main/resources/application-dev.yml
+++ b/ycl-platform/src/main/resources/application-dev.yml
@@ -68,6 +68,7 @@
 
 videoPoint:
   url: http://183.245.159.161:8281
+  web_url: http://172.28.194.185:8281
   port: 8281
   userName: suichang
   passWord: a12345677
diff --git a/ycl-platform/src/main/resources/application-prod.yml b/ycl-platform/src/main/resources/application-prod.yml
index e1181ec..550307c 100644
--- a/ycl-platform/src/main/resources/application-prod.yml
+++ b/ycl-platform/src/main/resources/application-prod.yml
@@ -67,6 +67,7 @@
 
 videoPoint:
   url: http://172.28.194.180:7901
+  web_url: http://172.28.194.185:8281
   port: 7901
   userName: suichang
   passWord: a12345677

--
Gitblit v1.8.0