diff --git a/common/pom.xml b/common/pom.xml index 49428ec..735b599 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -91,10 +91,10 @@ aliyun-java-sdk-core - - com.aliyun - aliyun-sdk-vod-upload - + + + + com.aliyun diff --git a/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java b/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java index a4eafbd..5abfd65 100644 --- a/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java +++ b/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java @@ -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; diff --git a/nakadai/pom.xml b/nakadai/pom.xml index a262848..dfe5eee 100644 --- a/nakadai/pom.xml +++ b/nakadai/pom.xml @@ -22,11 +22,11 @@ - - com.huoran.parent - websocket - 1.0-SNAPSHOT - + + + + + org.springframework.boot diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java index 362c5c0..9949790 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java @@ -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(); } diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java index 5879ae9..8d5bf34 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java @@ -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); +// } /** * 发送指定的用户队列 diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java index 2a4118e..679aeb3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java @@ -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; } diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java index 3b70974..59d66b1 100644 --- a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java @@ -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; } diff --git a/pom.xml b/pom.xml index 15db464..d2a842f 100644 --- a/pom.xml +++ b/pom.xml @@ -200,11 +200,11 @@ ${aliyun-java-sdk-vod.version} - - com.aliyun - aliyun-sdk-vod-upload - ${aliyun-sdk-vod-upload.version} - + + + + +