From e89d76539cc91bd13acabbf25a12312d2f8bba56 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期二, 16 十二月 2025 21:27:06 +0800
Subject: [PATCH] 超过17点不接受报警
---
ycl-platform/src/main/java/com/ycl/controller/dingding/DingController.java | 53 +++++++++++++++++------------------------------------
1 files changed, 17 insertions(+), 36 deletions(-)
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 13002eb..206ea90 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
@@ -18,6 +18,7 @@
import com.ycl.config.DdTest;
import com.ycl.config.DingConfig;
import com.ycl.controller.BaseController;
+import com.ycl.dto.video.OssFileDto;
import com.ycl.entity.dingding.DingUserInfo;
import com.ycl.service.auth.AuthService;
import com.ycl.service.ding.BookRemarkService;
@@ -93,10 +94,12 @@
@ApiOperation(value = "鏍规嵁閽夐拤鎺堟潈鐮佽幏鍙杢oken")
@GetMapping("/dingLogin")
public CommonResult<Map> dingLogin(@RequestParam String code) {
+ log.info("涓�閿櫥褰曞弬鏁癱ode--------------->{}", code);
HashMap<String, Object> map = new HashMap<>();
//鑾峰彇鐢ㄦ埛淇℃伅
DingUserInfo dingUser = dingCommon.getDingUserInfo(code);
//鎸塪ing鐧诲綍
+ log.info("鐢ㄦ埛淇℃伅------------------->{}", dingUser);
String token = authService.dingLogin(dingUser);
map.put("token", token);
map.put("tokenHead", tokenHead);
@@ -191,14 +194,18 @@
@PostMapping("/oss/sign")
- public CommonResult ossSign(@RequestParam("mediaId") String mediaId, @RequestParam("extension") String extension) {
- log.info("鎺ユ敹鍒癴ile");
- if (StringUtils.isNullOrEmpty(mediaId) || StringUtils.isNullOrEmpty(extension)) {
+ public CommonResult ossSign(@RequestBody OssFileDto dto) {
+
+ if (StringUtils.isNullOrEmpty(dto.getMediaId()) || StringUtils.isNullOrEmpty(dto.getExtension())) {
return CommonResult.failed("鍙傛暟涓嶈兘涓虹┖锛�");
}
ExecutableClient executableClient = DdTest.getExecutableClient();
CloseableHttpResponse response = null;
OSS ossClient = null;
+
+ DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ System.out.println("寮�濮嬭幏鍙�--" + dtf2.format(LocalDateTime.now()));
try {
//浠庨拤閽夎幏鍙栬棰戞祦
String api = "/media/download";
@@ -207,17 +214,14 @@
String token = getToken();
//璁剧疆鍙傛暟
getClient.addParameter("access_token", token);
- getClient.addParameter("media_id", mediaId);
+ getClient.addParameter("media_id", dto.getMediaId());
response = getClient.getB();
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
- DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
- String strDate2 = dtf2.format(LocalDateTime.now());
+// MultipartFile file = getMultipartFile(is, fileName);
- String fileName = strDate2 + RandomUtils.generateRandomInt(4) + "." + extension;
- MultipartFile file = getMultipartFile(is, fileName);
- String url = ossService.uploadImages(file);
+ String url = ossService.uploadImages(is, dto.getExtension(),0);
return CommonResult.success(url);
} catch (Exception e) {
e.printStackTrace();
@@ -242,21 +246,6 @@
public CommonResult<String> getVideo(@PathVariable String mediaId) {
String accessToken = getToken();
-
- //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);
@@ -275,17 +264,7 @@
response = getClient.getB();
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
-// File voice = new File("D:/IMG_4401.MOV");
-// OutputStream fos = new FileOutputStream(voice);
-// int cache = 10 * 1024;
-// byte[] buffer = new byte[cache];
-// int ch = 0;
-// while ((ch = is.read(buffer)) != -1) {
-// fos.write(buffer, 0, ch);
-// }
-// is.close();
-// fos.flush();
-// fos.close();
+
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
String strDate2 = dtf2.format(LocalDateTime.now());
@@ -330,7 +309,9 @@
*/
public FileItem createFileItem(InputStream inputStream, String fileName) {
FileItemFactory factory = new DiskFileItemFactory(16, null);
- String textFieldName = "file";
+ DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ String strDate2 = dtf2.format(LocalDateTime.now());
+ String textFieldName = strDate2 + RandomUtils.generateRandomInt(4);
FileItem item = factory.createItem(textFieldName, MediaType.MULTIPART_FORM_DATA_VALUE, true, fileName);
int bytesRead = 0;
byte[] buffer = new byte[8192];
--
Gitblit v1.8.0