From 1295c58e706a74ad68d3c2c84b2bdde779507fb5 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 23 十月 2023 21:15:44 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server

---
 ycl-platform/src/main/java/com/ycl/util/VideoUtil.java                     |    5 ++---
 ycl-platform/src/main/resources/application-dev.yml                        |    2 +-
 ycl-platform/pom.xml                                                       |    5 +++++
 ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java |   22 ++++++++++++++++++++--
 ycl-platform/src/main/java/com/ycl/task/SynchronizeHKVideo.java            |    6 +++---
 5 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/ycl-platform/pom.xml b/ycl-platform/pom.xml
index a573f41..c8f0758 100644
--- a/ycl-platform/pom.xml
+++ b/ycl-platform/pom.xml
@@ -50,6 +50,11 @@
             <scope>system</scope>
             <systemPath>${project.basedir}/src/main/resources/libs/artemis-http-client-1.1.8.jar</systemPath>
         </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.14</version>
+        </dependency>
     </dependencies>
 
 <!--    <build>-->
diff --git a/ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java b/ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java
index b017b3d..ba9b287 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java
@@ -2,8 +2,11 @@
 
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.xxpt.gateway.shared.api.request.OapiMediaUploadRequest;
+import com.alibaba.xxpt.gateway.shared.api.response.OapiMediaUploadResponse;
 import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
 import com.alibaba.xxpt.gateway.shared.client.http.GetClient;
+import com.alibaba.xxpt.gateway.shared.client.http.IntelligentPostClient;
 import com.alibaba.xxpt.gateway.shared.client.http.PostClient;
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
@@ -188,8 +191,23 @@
     @GetMapping("/getVideo/{mediaId}")
     public CommonResult<String> getVideo(@PathVariable String mediaId) {
         String accessToken = getToken();
-        String ticket = getTiker(accessToken);
-        MultipartFile file = getDownload(ticket, mediaId);
+
+
+        //executableClient淇濊瘉鍗曚緥
+        IntelligentPostClient intelligentPostClient = executableClient.newIntelligentPostClient("/media/upload");
+        OapiMediaUploadRequest oapiMediaUploadRequest = new OapiMediaUploadRequest();
+        //璋冪敤鎺ュ彛鍑瘉
+        oapiMediaUploadRequest.setAccess_token(accessToken);
+        //濯掍綋鏂囦欢绫诲瀷锛屽垎鍒湁鍥剧墖锛坕mage锛夈�佽闊筹紙voice锛夈�佹櫘閫氭枃浠�(file)
+        oapiMediaUploadRequest.setType("file");
+        //orm-data涓獟浣撴枃浠舵爣璇嗭紝鏈塮ilename銆乫ilelength銆乧ontent-type绛変俊鎭�
+        oapiMediaUploadRequest.setMedia("filename");
+        intelligentPostClient.addFile(new File("F:\\瑙嗛\\7鏈�29鏃�.mp4"));
+        //鑾峰彇缁撴灉
+        OapiMediaUploadResponse apiResult = intelligentPostClient.post(oapiMediaUploadRequest);
+
+
+        MultipartFile file = getDownload(accessToken, mediaId);
         String url = ossService.uploadImages(file);
         return CommonResult.success(url);
     }
diff --git a/ycl-platform/src/main/java/com/ycl/task/SynchronizeHKVideo.java b/ycl-platform/src/main/java/com/ycl/task/SynchronizeHKVideo.java
index d06fefc..5e7244a 100644
--- a/ycl-platform/src/main/java/com/ycl/task/SynchronizeHKVideo.java
+++ b/ycl-platform/src/main/java/com/ycl/task/SynchronizeHKVideo.java
@@ -25,13 +25,13 @@
     @Autowired
     private VideoUtil videoUtil;
 
-//    @Scheduled(cron = "0/9 * * * * ?")   // 姣忕鎵ц
-//    @Scheduled(cron = "0 0/1 * ?")
+//    @Scheduled(cron = "0 */5 * * * ?")   // 姣�5鍒嗛挓鎵ц
+    @Scheduled(cron = "0 0 1 * * ?")
     @Transactional(rollbackFor = Exception.class)
     public void scheduledTask() {
         System.out.println("娴峰悍锛氬紑濮嬫墽琛�");
 
-        findVideoList(1, 20);
+        findVideoList(1, 5);
 
     }
 
diff --git a/ycl-platform/src/main/java/com/ycl/util/VideoUtil.java b/ycl-platform/src/main/java/com/ycl/util/VideoUtil.java
index 0906ea8..ab5e2fc 100644
--- a/ycl-platform/src/main/java/com/ycl/util/VideoUtil.java
+++ b/ycl-platform/src/main/java/com/ycl/util/VideoUtil.java
@@ -135,13 +135,12 @@
     private final String APP_SECRET = "LElVf9Ct3ykStZHCmFNZ";
 
     public PageResult<Camera> callPostCameras(Integer pageNo, Integer pageSize, String treeCode) throws Exception {
-        System.out.println("娴峰悍瑙嗛-callPostCameras");
+
         ArtemisConfig config = new ArtemisConfig();
-        System.out.println("娴峰悍瑙嗛-config");
         config.setHost(HOST); // 浠g悊API缃戝叧nginx鏈嶅姟鍣╥p绔彛
         config.setAppKey(APP_KEY);  // 绉橀挜appkey
         config.setAppSecret(APP_SECRET);// 绉橀挜appSecret
-        System.out.println("娴峰悍瑙嗛-鍒濆鍖朿onfig");
+
         final String getSecurityApi = ARTEMIS_PATH + "/api/resource/v1/cameras"; // 鎺ュ彛璺緞
         Map<String, String> path = new HashMap<String, String>(2) {
             {
diff --git a/ycl-platform/src/main/resources/application-dev.yml b/ycl-platform/src/main/resources/application-dev.yml
index bd06cc6..2ea872f 100644
--- a/ycl-platform/src/main/resources/application-dev.yml
+++ b/ycl-platform/src/main/resources/application-dev.yml
@@ -35,7 +35,7 @@
         timeout: 0
 
   datasource:
-    url: jdbc:mysql://42.193.1.25:3306/sccg?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
+    url: jdbc:mysql://42.193.1.25:3306/sccg1020?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
     username: root
     password: 321$YcYl@1970!
     type: com.alibaba.druid.pool.DruidDataSource

--
Gitblit v1.8.0