oss去除,依赖整理

main
cheney 11 months ago
parent 9c49a1c448
commit 75c1b4038d
  1. 8
      common/pom.xml
  2. 4
      common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java
  3. 10
      nakadai/pom.xml
  4. 25
      nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java
  5. 67
      nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java
  6. 35
      nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java
  7. 32
      occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java
  8. 10
      pom.xml

@ -91,10 +91,10 @@
<artifactId>aliyun-java-sdk-core</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-sdk-vod-upload</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aliyun</groupId>-->
<!-- <artifactId>aliyun-sdk-vod-upload</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.aliyun</groupId>

@ -7,9 +7,7 @@ import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.*;
import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadStreamRequest;
import com.aliyun.vod.upload.resp.UploadStreamResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest;
import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse;

@ -22,11 +22,11 @@
<dependencies>
<dependency>
<groupId>com.huoran.parent</groupId>
<artifactId>websocket</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.huoran.parent</groupId>-->
<!-- <artifactId>websocket</artifactId>-->
<!-- <version>1.0-SNAPSHOT</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>

@ -12,8 +12,7 @@ import com.huoran.nakadai.entity.Notify;
import com.huoran.nakadai.entity.res.CommentRes;
import com.huoran.nakadai.service.CommentService;
import com.huoran.nakadai.service.NotifyService;
import com.huoran.websocket.model.dto.WebsocketMsgDTO;
import com.huoran.websocket.service.WebsocketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -42,8 +41,8 @@ public class CommentController {
@Autowired
private NotifyService notifyService;
@Autowired
private WebsocketService webSocketService;
// @Autowired
// private WebsocketService webSocketService;
@Autowired
private UserClient userClient;
@ -95,15 +94,15 @@ public class CommentController {
}
// 发送webSocket消息
if (comment.getReplyAccountId()!=null){
WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
websocketMsgDTO.setForm(accountId);
websocketMsgDTO.setUsername(accountId);
websocketMsgDTO.setTo(comment.getReplyAccountId().toString());
websocketMsgDTO.setContent(comment.getContent());
websocketMsgDTO.setExtras(null);
webSocketService.send(websocketMsgDTO);
}
// if (comment.getReplyAccountId()!=null){
// WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
// websocketMsgDTO.setForm(accountId);
// websocketMsgDTO.setUsername(accountId);
// websocketMsgDTO.setTo(comment.getReplyAccountId().toString());
// websocketMsgDTO.setContent(comment.getContent());
// websocketMsgDTO.setExtras(null);
// webSocketService.send(websocketMsgDTO);
// }
return save ? R.ok() : R.error();
}

@ -3,9 +3,6 @@ package com.huoran.nakadai.controller;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.service.MessageService;
import com.huoran.websocket.model.dto.WebsocketMsgDTO;
import com.huoran.websocket.model.vo.SendMsgVO;
import com.huoran.websocket.service.WebsocketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -28,38 +25,38 @@ public class MessageController {
@Autowired
private MessageService messageService;
@Autowired
private WebsocketService webSocketService;
@ApiOperation(value = "所有在线用户接收消息通知",response = SendMsgVO.class)
@PostMapping("/refreshPageNotification")
public void refreshPageNotification(
@ApiParam(name = "username", value = "发送者名称", required = false)
@RequestParam(required = false) String username,
@ApiParam(name = "to", value = "发给谁(默认发送给所有在线用户)", required = false)
@RequestParam(required = false) String to,
@ApiParam(name = "content", value = "消息通知", required = false)
@RequestParam(required = false) String content) {
WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
websocketMsgDTO.setForm("系统消息");
if (StringUtils.isEmpty(username)){
websocketMsgDTO.setUsername("系统通知机器人");
}else {
websocketMsgDTO.setUsername(username);
}
if (StringUtils.isEmpty(to)){
websocketMsgDTO.setTo("all");
}else {
websocketMsgDTO.setTo(to);
}
if (StringUtils.isEmpty(content)){
websocketMsgDTO.setContent("refresh");
}else {
websocketMsgDTO.setContent(content);
}
websocketMsgDTO.setExtras(null);
webSocketService.send(websocketMsgDTO);
}
// @Autowired
// private WebsocketService webSocketService;
// @ApiOperation(value = "所有在线用户接收消息通知",response = SendMsgVO.class)
// @PostMapping("/refreshPageNotification")
// public void refreshPageNotification(
// @ApiParam(name = "username", value = "发送者名称", required = false)
// @RequestParam(required = false) String username,
// @ApiParam(name = "to", value = "发给谁(默认发送给所有在线用户)", required = false)
// @RequestParam(required = false) String to,
// @ApiParam(name = "content", value = "消息通知", required = false)
// @RequestParam(required = false) String content) {
// WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
// websocketMsgDTO.setForm("系统消息");
// if (StringUtils.isEmpty(username)){
// websocketMsgDTO.setUsername("系统通知机器人");
// }else {
// websocketMsgDTO.setUsername(username);
// }
// if (StringUtils.isEmpty(to)){
// websocketMsgDTO.setTo("all");
// }else {
// websocketMsgDTO.setTo(to);
// }
// if (StringUtils.isEmpty(content)){
// websocketMsgDTO.setContent("refresh");
// }else {
// websocketMsgDTO.setContent(content);
// }
// websocketMsgDTO.setExtras(null);
// webSocketService.send(websocketMsgDTO);
// }
/**
* 发送指定的用户队列

@ -1,9 +1,6 @@
package com.huoran.nakadai.service.impl;
import com.aliyun.oss.ClientException;
import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadStreamRequest;
import com.aliyun.vod.upload.resp.UploadStreamResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest;
import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse;
@ -70,8 +67,8 @@ public class OSSFileServiceImpl implements OSSFileService {
filesResult.setFileSize(fileSize);
//上传流请求
UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID,
ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream);
// UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID,
// ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream);
/* 是否使用默认水印(可选),指定模板组ID时,根据模板组配置确定是否使用默认水印*/
//request.setShowWaterMark(true);
@ -104,20 +101,20 @@ public class OSSFileServiceImpl implements OSSFileService {
/* ECS部署区域*/
// request.setEcsRegionId("cn-shanghai");
UploadVideoImpl uploader = new UploadVideoImpl();
UploadStreamResponse response = uploader.uploadStream(request);
//如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。
// 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因
String videoId = response.getVideoId();
if (!response.isSuccess()) {
String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage();
log.error(errorMessage);
if (StringUtils.isEmpty(videoId)) {
throw new CustomException(ExceptionEnum.UNKNOWN_EXCEPTION);
}
}
filesResult.setFileId(videoId);
// UploadVideoImpl uploader = new UploadVideoImpl();
// UploadStreamResponse response = uploader.uploadStream(request);
//
// //如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。
// // 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因
// String videoId = response.getVideoId();
// if (!response.isSuccess()) {
// String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage();
// log.error(errorMessage);
// if (StringUtils.isEmpty(videoId)) {
// throw new CustomException(ExceptionEnum.UNKNOWN_EXCEPTION);
// }
// }
// filesResult.setFileId(videoId);
return filesResult;
}

@ -1,8 +1,6 @@
package com.huoran.occupationlab.service.impl;
import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadStreamRequest;
import com.aliyun.vod.upload.resp.UploadStreamResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest;
@ -91,23 +89,23 @@ public class OSSFileServiceImpl implements OSSFileService {
filesResult.setFileType(fileType);
//上传流请求
UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream);
UploadVideoImpl uploader = new UploadVideoImpl();
UploadStreamResponse response = uploader.uploadStream(request);
// UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream);
//
//
// UploadVideoImpl uploader = new UploadVideoImpl();
// UploadStreamResponse response = uploader.uploadStream(request);
//如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。
// 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因
String videoId = response.getVideoId();
if (!response.isSuccess()) {
String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage();
log.error(errorMessage);
if (StringUtils.isEmpty(videoId)) {
throw new CustomException(201, errorMessage);
}
}
filesResult.setFileId(videoId);
// String videoId = response.getVideoId();
// if (!response.isSuccess()) {
// String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage();
// log.error(errorMessage);
// if (StringUtils.isEmpty(videoId)) {
// throw new CustomException(201, errorMessage);
// }
// }
// filesResult.setFileId(videoId);
return filesResult;
}

@ -200,11 +200,11 @@
<version>${aliyun-java-sdk-vod.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-sdk-vod-upload</artifactId>
<version>${aliyun-sdk-vod-upload.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aliyun</groupId>-->
<!-- <artifactId>aliyun-sdk-vod-upload</artifactId>-->
<!-- <version>${aliyun-sdk-vod-upload.version}</version>-->
<!-- </dependency>-->
<!-- Easy poi-->
<!-- excle导入导出依赖包 start -->

Loading…
Cancel
Save