From 577107bf478b4d2fb7da1b7b0d9f0f87fef5b2be Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 09 七月 2024 10:19:27 +0800
Subject: [PATCH] feat:封装优云接口

---
 ycl-pojo/src/main/java/com/ycl/platform/domain/result/OnlineResult.java         |    5 
 ycl-pojo/src/main/java/com/ycl/platform/domain/param/OnlineParam.java           |   34 ++++++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/param/RecordMetaDSumParam.java   |   25 ++++--
 ycl-pojo/src/main/java/com/ycl/platform/domain/param/CameraParam.java           |   29 +++++++
 ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java                       |   53 +++++-------
 ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml                  |    1 
 ycl-server/src/main/java/com/ycl/web/UYClient.java                              |   51 ++++++++++++
 ycl-server/src/main/java/com/ycl/PlatformApplication.java                       |    2 
 pom.xml                                                                         |    8 ++
 ycl-pojo/src/main/java/com/ycl/platform/domain/result/CameraResult.java         |    4 
 ycl-pojo/src/main/java/com/ycl/platform/domain/result/RecordMetaDSumResult.java |    5 
 ycl-pojo/src/main/java/com/ycl/platform/domain/result/OsdMonitorResult.java     |    4 
 12 files changed, 171 insertions(+), 50 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2598e4c..614ed78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,6 +252,14 @@
             <artifactId>easyexcel</artifactId>
             <version>${easyexcel.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+            <version>${spring-boot.version}</version>
+        </dependency>
+
+
     </dependencies>
 
     <build>
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/param/CameraParam.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/CameraParam.java
new file mode 100644
index 0000000..5ffff60
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/CameraParam.java
@@ -0,0 +1,29 @@
+package com.ycl.platform.domain.param;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 鎽勫儚澶村弬鏁�
+ *
+ * @author gonghl
+ * @since 2024/7/1 涓嬪崍 4:52
+ */
+
+@Data
+@Accessors(chain = true)
+public class CameraParam {
+
+    /**
+     * 鍒嗛〉
+     */
+    private String offset;
+
+    private String limit;
+
+    /**
+     * 鎽勫儚鏈哄浗鏍囩紪鐮�
+     */
+    private String code;
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/param/OnlineParam.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/OnlineParam.java
new file mode 100644
index 0000000..bd90411
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/OnlineParam.java
@@ -0,0 +1,34 @@
+package com.ycl.platform.domain.param;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 鐐逛綅鍦ㄧ嚎鍙傛暟
+ *
+ * @author gonghl
+ * @since 2024/7/1 涓嬪崍 4:52
+ */
+
+@Data
+@Accessors(chain = true)
+public class OnlineParam {
+
+    /**
+     * 琛屾斂鍖哄煙缂栫爜
+     */
+    private String arealayerno;
+
+    private Object[] dbConditionItems;
+
+    /**
+     * 鍔ㄦ�佹潯浠讹紝json 鏍煎紡
+     */
+    private String dynamicConditionJson;
+
+    /**
+     * 鎺掑簭瀛楁
+     */
+    private String sortFiled;
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/RecordMetaDSumParam.java
similarity index 67%
copy from ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java
copy to ycl-pojo/src/main/java/com/ycl/platform/domain/param/RecordMetaDSumParam.java
index f79c665..5c8492d 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/param/RecordMetaDSumParam.java
@@ -1,14 +1,20 @@
-package com.ycl.platform.domain.dto;
+package com.ycl.platform.domain.param;
 
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.util.Date;
 
 /**
- * 褰曞儚鍙敤鎬�
+ * 褰曞儚鍙敤鍙傛暟
+ *
+ * @author gonghl
+ * @since 2024/7/2 涓婂崍 11:38
  */
+
 @Data
-public class VideoAvailabilityDTO {
+@Accessors(chain = true)
+public class RecordMetaDSumParam {
 
     /**
      * 琛屾斂鍖哄煙鍚嶇О
@@ -21,7 +27,7 @@
     private String arealayerno;
 
     /**
-     * 鍒涘缓鏃堕棿锛屾牸寮忎负鏃ユ湡鏃堕棿瀛楃涓�
+     * 鍒涘缓鏃堕棿
      */
     private Date createTime;
 
@@ -41,7 +47,7 @@
     private String id;
 
     /**
-     * 缂哄け鏃堕暱锛屾暟鍊肩被鍨嬩负鍙岀簿搴︽诞鐐规暟
+     * 缂哄け鏃堕暱
      */
     private Double missDuration;
 
@@ -51,17 +57,17 @@
     private String platId;
 
     /**
-     * 褰曞儚鏃堕暱锛屾暟鍊肩被鍨嬩负鍙岀簿搴︽诞鐐规暟
+     * 褰曞儚鏃堕暱
      */
     private Double recordDuration;
 
     /**
-     * 褰曞儚瀹屾暣鐘舵�侊紝1锛氬畬鏁达紝0锛氶棿姝囷紝-1锛氬紓甯�
+     * 褰曞儚瀹屾暣鐘舵�� 1锛氬畬鏁� 0锛氶棿姝� -1锛氬紓甯�
      */
     private Integer recordStatus;
 
     /**
-     * 缁熻鏃堕棿锛屾牸寮忎负鏃ユ湡瀛楃涓�
+     * 缁熻鏃堕棿
      */
     private Date statTime;
 
@@ -70,4 +76,5 @@
      */
     private String tenantId;
 
-}
\ No newline at end of file
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/DeviceInfoDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/CameraResult.java
similarity index 98%
rename from ycl-pojo/src/main/java/com/ycl/platform/domain/dto/DeviceInfoDTO.java
rename to ycl-pojo/src/main/java/com/ycl/platform/domain/result/CameraResult.java
index c9dbf8c..386e1dd 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/DeviceInfoDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/CameraResult.java
@@ -1,4 +1,4 @@
-package com.ycl.platform.domain.dto;
+package com.ycl.platform.domain.result;
 
 import lombok.Data;
 
@@ -11,7 +11,7 @@
  * @since 2024-4-19 11:33:34
  */
 @Data
-public class DeviceInfoDTO {
+public class CameraResult {
 
     /**
      * 璁惧缂栫爜锛�20浣嶏細涓績缂栫爜銆佽涓氱紪鐮併�佽澶囩被鍨嬨�佺綉缁滄爣璇嗐�佽澶囧簭鍙凤紝涓庤仈缃戝钩鍙�/鍏变韩骞冲彴鍥芥爣缂栫爜涓�鑷淬��
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/OnlineStatisticsDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/OnlineResult.java
similarity index 93%
rename from ycl-pojo/src/main/java/com/ycl/platform/domain/dto/OnlineStatisticsDTO.java
rename to ycl-pojo/src/main/java/com/ycl/platform/domain/result/OnlineResult.java
index cef0b07..78b2a56 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/OnlineStatisticsDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/OnlineResult.java
@@ -1,4 +1,4 @@
-package com.ycl.platform.domain.dto;
+package com.ycl.platform.domain.result;
 
 import lombok.Data;
 
@@ -9,8 +9,7 @@
  * @since 2024-4-19 11:37:30
  */
 @Data
-public class OnlineStatisticsDTO {
-
+public class OnlineResult {
 
     /**
      * 琛屾斂鍖哄垝缂栫爜
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAnnotationDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/OsdMonitorResult.java
similarity index 95%
rename from ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAnnotationDTO.java
rename to ycl-pojo/src/main/java/com/ycl/platform/domain/result/OsdMonitorResult.java
index 81e00b7..c3af8b7 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAnnotationDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/OsdMonitorResult.java
@@ -1,4 +1,4 @@
-package com.ycl.platform.domain.dto;
+package com.ycl.platform.domain.result;
 
 import lombok.Data;
 
@@ -11,7 +11,7 @@
  * @since 2024-4-19 11:52:09
  */
 @Data
-public class VideoAnnotationDTO {
+public class OsdMonitorResult {
 
     /**
      * 鍖哄煙璺緞淇℃伅
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/RecordMetaDSumResult.java
similarity index 91%
rename from ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java
rename to ycl-pojo/src/main/java/com/ycl/platform/domain/result/RecordMetaDSumResult.java
index f79c665..cad1c88 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoAvailabilityDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/result/RecordMetaDSumResult.java
@@ -1,4 +1,4 @@
-package com.ycl.platform.domain.dto;
+package com.ycl.platform.domain.result;
 
 import lombok.Data;
 
@@ -6,9 +6,10 @@
 
 /**
  * 褰曞儚鍙敤鎬�
+ * @author gonghl
  */
 @Data
-public class VideoAvailabilityDTO {
+public class RecordMetaDSumResult {
 
     /**
      * 琛屾斂鍖哄煙鍚嶇О
diff --git a/ycl-server/src/main/java/com/ycl/PlatformApplication.java b/ycl-server/src/main/java/com/ycl/PlatformApplication.java
index ba6a7ac..242b7ba 100644
--- a/ycl-server/src/main/java/com/ycl/PlatformApplication.java
+++ b/ycl-server/src/main/java/com/ycl/PlatformApplication.java
@@ -4,11 +4,13 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @Slf4j
 @EnableCaching
 @EnableTransactionManagement
+@EnableFeignClients(basePackages = {"com.ycl.web"})
 @SpringBootApplication
 public class PlatformApplication {
     public static void main(String[] args) {
diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
index 78cb310..85ab0ec 100644
--- a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
+++ b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -86,50 +86,31 @@
                 //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�浜鸿劯鏁版嵁
                 List<CheckIndexFace> checkIndexFaces = faceService.selectCheckIndexFaceList(checkIndexFace);
                 for (CheckIndexFace indexFace : checkIndexFaces) {
-                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face);
+                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace,CheckConstants.Rule_Category_Face);
                 }
             }
 
             //鍌ㄥ瓨鍒嗘暟
             scoreMapper.saveBatch(scoreList);
+            //TODO锛氭牴鎹姤璀﹀垎鏁伴槇鍊硷紝娣诲姞鎶ヨ淇℃伅
 
-
-            log.info("妯℃澘鎵ц瀹屾垚");
         }
-        log.info("瀹氭椂浠诲姟鎵ц瀹屾垚");
     }
 
-
-    //鏌ongo鏁版嵁褰掓。鍒癿ysql
-    public void dataArchiving() {
-        //TODO:褰掓。check_index_car,鍖哄垎鐪佸巺甯傚眬锛屾瘡涓尯鍘夸竴鏉℃暟鎹�
-        CheckIndexCar checkIndexCar = new CheckIndexCar();
-        //TODO:褰掓。check_index_face
-        CheckIndexFace checkIndexFace = new CheckIndexFace();
-        //TODO:褰掓。check_index_video
-        CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
-
-    }
-
-    private <T extends CheckIndex> void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject, Short checkCategory) {
+    private <T extends CheckIndex>void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject,Short checkCategory) {
         CheckScore checkScore = new CheckScore();
         BigDecimal scoreFinal = BigDecimal.ZERO;
-        BigDecimal alarmScore = checkTemplate.getAlarmScore();
         for (CheckTemplateRule templateRule : templateRuleList) {
             //璁$畻鍒嗘暟
             scoreFinal = getScoreFinal(indexObject, scoreFinal, templateRule);
-            //TODO:鏍规嵁鎶ヨ鍒嗘暟闃堝�硷紝娣诲姞鎶ヨ淇℃伅
-            if(scoreFinal.compareTo(alarmScore)<0){
-
-            }
         }
         //琛ュ厖checkScore
-        fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal, checkCategory);
+        fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal,checkCategory);
         scoreList.add(checkScore);
     }
 
     //閫氱敤鏂规硶璁$畻鍒嗘暟
-    private <T> BigDecimal getScoreFinal(T object, BigDecimal scoreFinal, CheckTemplateRule templateRule) {
+    private <T>BigDecimal getScoreFinal(T object, BigDecimal scoreFinal, CheckTemplateRule templateRule) {
         String ruleIndex = templateRule.getRuleIndex();
         //灏哸_b_c杞崲涓篴BC
         String camelRuleIndex = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, ruleIndex);
@@ -142,27 +123,37 @@
             BigDecimal score = index.multiply(templateRule.getWeight());
             scoreFinal = scoreFinal.add(score);
         } catch (Exception e) {
-            log.info("鍙嶅皠寮傚父", e);
+            log.info("鍙嶅皠寮傚父",e);
         }
         return scoreFinal;
     }
-
     //璁剧疆checkScore瀵硅薄
-    private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal, Short checkCategory) {
+    private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal,Short checkCategory) {
         //鏍规嵁璋冩暣绯绘暟璋冩暣鏈�缁堝垎鏁板ぇ灏�
         String adjustWay = checkTemplate.getAdjustWay();
         BigDecimal adjustCoefficient = checkTemplate.getAdjustCoefficient();
-        if (CheckConstants.Multiply.equals(adjustWay)) {
+        if(CheckConstants.Multiply.equals(adjustWay)){
             scoreFinal = adjustCoefficient.multiply(scoreFinal).multiply(new BigDecimal(100));
-        } else if (CheckConstants.Divided.equals(adjustWay)) {
+        }else if(CheckConstants.Divided.equals(adjustWay)){
             //鍥涜垗浜斿叆淇濈暀灏忔暟鍚庡洓浣�
-            scoreFinal = scoreFinal.divide(adjustCoefficient, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+            scoreFinal = scoreFinal.divide(adjustCoefficient,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
         }
         checkScore.setCreateTime(new Date());
-        checkScore.setExamineTag(Integer.parseInt(examineTag + ""));
+        checkScore.setExamineTag(Integer.parseInt(examineTag +""));
         checkScore.setExamineCategory(checkCategory);
         checkScore.setDeptId(checkIndex.getDeptId());
         checkScore.setTemplateId(templateId);
         checkScore.setScore(scoreFinal);
     }
+
+    //鏌ongo鏁版嵁褰掓。鍒癿ysql
+    public void dataArchiving() {
+        //TODO:褰掓。check_index_car,鍖哄垎鐪佸巺甯傚眬锛屾瘡涓尯鍘夸竴鏉℃暟鎹�
+        CheckIndexCar checkIndexCar = new CheckIndexCar();
+        //TODO:褰掓。check_index_face
+        CheckIndexFace checkIndexFace = new CheckIndexFace();
+        //TODO:褰掓。check_index_video
+        CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
+
+    }
 }
diff --git a/ycl-server/src/main/java/com/ycl/web/UYClient.java b/ycl-server/src/main/java/com/ycl/web/UYClient.java
new file mode 100644
index 0000000..8b05e2d
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/web/UYClient.java
@@ -0,0 +1,51 @@
+package com.ycl.web;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ycl.platform.domain.param.CameraParam;
+import com.ycl.platform.domain.param.OnlineParam;
+import com.ycl.platform.domain.param.RecordMetaDSumParam;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @author gonghl
+ * @since 2024/7/1 涓嬪崍 4:01
+ */
+
+@Component
+@FeignClient(name = "UYClient", url = "${request.youYunDomain}")
+public interface UYClient {
+
+    /**
+     * 涓�鏈轰竴妗�
+     *
+     * @param cameraParam 璇锋眰鍙傛暟
+     * @return 鏌ヨ鎽勫儚鏈烘竻鍗曢泦鍚�
+     */
+    @GetMapping("/VIID/Cameras")
+    JSONObject cameraList(CameraParam cameraParam);
+
+    /**
+     * 鐐逛綅鍦ㄧ嚎
+     *
+     * @param onlineParam 璇锋眰鍙傛暟
+     * @return 鏌ヨ鍦ㄧ嚎缁熻鍒楄〃
+     */
+    @GetMapping("/openapi/v1/report/online/list")
+    JSONObject onlineList(OnlineParam onlineParam);
+
+    /**
+     * 褰曞儚鍙敤
+     *
+     * @param recordMetaDSumParam 璇锋眰鍙傛暟
+     * @return 鏌ヨ婊¤冻鏉′欢鐨勫綍鍍忔眹鎬讳俊鎭�
+     */
+    @PostMapping("/report/recordMetaDSum/list")
+    JSONObject recordMetaDSumList(RecordMetaDSumParam recordMetaDSumParam);
+
+    @GetMapping("/api/v1/app/osdMonitor/list")
+    JSONObject osdMonitorList();
+
+}
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
index 9622183..45fc2ec 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -35,7 +35,6 @@
             <if test="deptId != null "> and tcs.dept_id = #{deptId}</if>
             ${params.dataScope}
         </where>
-        order by create_time desc
     </select>
     
     <select id="selectCheckScoreById" parameterType="Long" resultMap="CheckScoreResult">

--
Gitblit v1.8.0