Browse Source

回调参数修改

pzc 4 years ago
parent
commit
1441d8090c

+ 6 - 0
ymall/pom.xml

@@ -260,6 +260,12 @@
 		  <artifactId>weixin-java-miniapp</artifactId>
 		  <version>3.7.0</version>
 	  </dependency>
+    <dependency>
+      <groupId>com.github.binarywang</groupId>
+      <artifactId>weixin-java-miniapp</artifactId>
+      <version>3.7.0</version>
+      <scope>compile</scope>
+    </dependency>
   </dependencies>
 
 	<build>

+ 11 - 5
ymall/src/main/java/com/liangjian11/ymall/controller/video/VideoDoctorController.java

@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Objects;
 
@@ -142,13 +143,18 @@ public class VideoDoctorController {
   }
 
   @PostMapping("/AliyunAranscoding")
-  @ApiOperation(value = "阿里云转码成功回调地址")
-  public void AliyunAranscoding(StreamTranscodeComplete streamTranscodeComplete) {
-    if (!StringUtils.isEmpty(streamTranscodeComplete.getVideoId()) && "success".equals(streamTranscodeComplete.getStatus())) {
-      Video video = videoService.getOne(new QueryWrapper<Video>().eq("video_id", streamTranscodeComplete.getVideoId()));
+  @ApiOperation(value = "阿里云转码成功回调地址")//StreamTranscodeComplete streamTranscodeComplete,
+  public void AliyunAranscoding(@RequestBody HashMap map, HttpServletRequest request) {
+//    if (!StringUtils.isEmpty(streamTranscodeComplete.getVideoId()) && "success".equals(streamTranscodeComplete.getStatus())) {
+    if (!StringUtils.isEmpty(map.get("VideoId").toString()) && "success".equals(map.get("Status").toString())) {
+      Video video = videoService.getOne(new QueryWrapper<Video>().eq("video_id",
+//        streamTranscodeComplete.getVideoId()
+        map.get("VideoId").toString()
+      ));
       video.setRecommendStatus(0);
       video.setUpdateTime(new Date());
-      video.setDuration(streamTranscodeComplete.getDuration());
+//      video.setDuration(streamTranscodeComplete.getDuration());
+      video.setDuration(Float.valueOf(map.get("Duration").toString()));
       ResultInfo resultInfo = videoService.updateVideo(video);
     }
   }

+ 147 - 3
ymall/src/main/java/com/liangjian11/ymall/model/video/event/StreamTranscodeComplete.java

@@ -4,9 +4,9 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 
-@Data
-@ToString
-@EqualsAndHashCode
+//@Data
+//@ToString
+//@EqualsAndHashCode
 /**
  * 单个视频转码完成
  */
@@ -29,4 +29,148 @@ public class StreamTranscodeComplete {
   Long Width;             //	视频流宽度,单位px
   String JobId;           //		转码作业ID
   String Extend;          //	用户自定义回调透传数据,详细请参考UserData
+
+  public String getEventTime() {
+    return EventTime;
+  }
+
+  public void setEventTime(String eventTime) {
+    EventTime = eventTime;
+  }
+
+  public String getEventType() {
+    return EventType;
+  }
+
+  public void setEventType(String eventType) {
+    EventType = eventType;
+  }
+
+  public String getVideoId() {
+    return VideoId;
+  }
+
+  public void setVideoId(String videoId) {
+    VideoId = videoId;
+  }
+
+  public String getStatus() {
+    return Status;
+  }
+
+  public void setStatus(String status) {
+    Status = status;
+  }
+
+  public String getBitrate() {
+    return Bitrate;
+  }
+
+  public void setBitrate(String bitrate) {
+    Bitrate = bitrate;
+  }
+
+  public String getDefinition() {
+    return Definition;
+  }
+
+  public void setDefinition(String definition) {
+    Definition = definition;
+  }
+
+  public Float getDuration() {
+    return Duration;
+  }
+
+  public void setDuration(Float duration) {
+    Duration = duration;
+  }
+
+  public Boolean getEncrypt() {
+    return Encrypt;
+  }
+
+  public void setEncrypt(Boolean encrypt) {
+    Encrypt = encrypt;
+  }
+
+  public String getErrorCode() {
+    return ErrorCode;
+  }
+
+  public void setErrorCode(String errorCode) {
+    ErrorCode = errorCode;
+  }
+
+  public String getErrorMessage() {
+    return ErrorMessage;
+  }
+
+  public void setErrorMessage(String errorMessage) {
+    ErrorMessage = errorMessage;
+  }
+
+  public String getFileUrl() {
+    return FileUrl;
+  }
+
+  public void setFileUrl(String fileUrl) {
+    FileUrl = fileUrl;
+  }
+
+  public String getFormat() {
+    return Format;
+  }
+
+  public void setFormat(String format) {
+    Format = format;
+  }
+
+  public String getFps() {
+    return Fps;
+  }
+
+  public void setFps(String fps) {
+    Fps = fps;
+  }
+
+  public Long getHeight() {
+    return Height;
+  }
+
+  public void setHeight(Long height) {
+    Height = height;
+  }
+
+  public Long getSize() {
+    return Size;
+  }
+
+  public void setSize(Long size) {
+    Size = size;
+  }
+
+  public Long getWidth() {
+    return Width;
+  }
+
+  public void setWidth(Long width) {
+    Width = width;
+  }
+
+  public String getJobId() {
+    return JobId;
+  }
+
+  public void setJobId(String jobId) {
+    JobId = jobId;
+  }
+
+  public String getExtend() {
+    return Extend;
+  }
+
+  public void setExtend(String extend) {
+    Extend = extend;
+  }
 }

+ 1 - 1
ymall/src/main/java/com/liangjian11/ymall/utils/video/UploadVideoUtils.java

@@ -45,7 +45,7 @@ public class UploadVideoUtils {
     //UserData回调部分设置
     JSONObject messageCallback = new JSONObject();
     messageCallback.put("CallbackURL", CallbackURL);
-    messageCallback.put("CallbackType", "http");
+    messageCallback.put("CallbackType", "https");
     userData.put("MessageCallback", messageCallback.toJSONString());
     //UserData透传数据部分设置
     //JSONObject extend = new JSONObject();