update
This commit is contained in:
@@ -0,0 +1,61 @@
|
|||||||
|
package com.cool.store.dto.trtc.callback;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-06-29 01:17
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public class EventInfo {
|
||||||
|
@JsonProperty("RoomId")
|
||||||
|
private String roomId;
|
||||||
|
@JsonProperty("EventTs")
|
||||||
|
private long eventTs;
|
||||||
|
@JsonProperty("UserId")
|
||||||
|
private String userId;
|
||||||
|
@JsonProperty("TaskId")
|
||||||
|
private String taskId;
|
||||||
|
@JsonProperty("Payload")
|
||||||
|
private Payload payload;
|
||||||
|
|
||||||
|
public String getRoomId() {
|
||||||
|
return roomId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoomId(String roomId) {
|
||||||
|
this.roomId = roomId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEventTs() {
|
||||||
|
return eventTs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventTs(long eventTs) {
|
||||||
|
this.eventTs = eventTs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskId() {
|
||||||
|
return taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskId(String taskId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Payload getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPayload(Payload payload) {
|
||||||
|
this.payload = payload;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.cool.store.dto.trtc.callback;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-06-29 01:17
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public class Payload {
|
||||||
|
@JsonProperty("Status")
|
||||||
|
private int status;
|
||||||
|
@JsonProperty("TencentVod")
|
||||||
|
private TencentVod tencentVod;
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TencentVod getTencentVod() {
|
||||||
|
return tencentVod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTencentVod(TencentVod tencentVod) {
|
||||||
|
this.tencentVod = tencentVod;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.cool.store.dto.trtc.callback;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-06-29 01:18
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public class TencentVod {
|
||||||
|
@JsonProperty("UserId")
|
||||||
|
private String userId;
|
||||||
|
@JsonProperty("TrackType")
|
||||||
|
private String trackType;
|
||||||
|
@JsonProperty("MediaId")
|
||||||
|
private String mediaId;
|
||||||
|
@JsonProperty("FileId")
|
||||||
|
private String fileId;
|
||||||
|
@JsonProperty("VideoUrl")
|
||||||
|
private String videoUrl;
|
||||||
|
@JsonProperty("CacheFile")
|
||||||
|
private String cacheFile;
|
||||||
|
@JsonProperty("StartTimeStamp")
|
||||||
|
private long startTimeStamp;
|
||||||
|
@JsonProperty("EndTimeStamp")
|
||||||
|
private long endTimeStamp;
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrackType() {
|
||||||
|
return trackType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrackType(String trackType) {
|
||||||
|
this.trackType = trackType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaId() {
|
||||||
|
return mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaId(String mediaId) {
|
||||||
|
this.mediaId = mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileId() {
|
||||||
|
return fileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileId(String fileId) {
|
||||||
|
this.fileId = fileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideoUrl() {
|
||||||
|
return videoUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoUrl(String videoUrl) {
|
||||||
|
this.videoUrl = videoUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCacheFile() {
|
||||||
|
return cacheFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCacheFile(String cacheFile) {
|
||||||
|
this.cacheFile = cacheFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStartTimeStamp() {
|
||||||
|
return startTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTimeStamp(long startTimeStamp) {
|
||||||
|
this.startTimeStamp = startTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEndTimeStamp() {
|
||||||
|
return endTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTimeStamp(long endTimeStamp) {
|
||||||
|
this.endTimeStamp = endTimeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.cool.store.dto.trtc.callback;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-06-29 01:16
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public class VideoCallBackDTO {
|
||||||
|
@JsonProperty("EventGroupId")
|
||||||
|
private int eventGroupId;
|
||||||
|
@JsonProperty("EventType")
|
||||||
|
private int eventType;
|
||||||
|
@JsonProperty("CallbackTs")
|
||||||
|
private long callbackTs;
|
||||||
|
@JsonProperty("EventInfo")
|
||||||
|
private EventInfo eventInfo;
|
||||||
|
|
||||||
|
public int getEventGroupId() {
|
||||||
|
return eventGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventGroupId(int eventGroupId) {
|
||||||
|
this.eventGroupId = eventGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(int eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCallbackTs() {
|
||||||
|
return callbackTs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallbackTs(long callbackTs) {
|
||||||
|
this.callbackTs = callbackTs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventInfo getEventInfo() {
|
||||||
|
return eventInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventInfo(EventInfo eventInfo) {
|
||||||
|
this.eventInfo = eventInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.dto.trtc.callback.VideoCallBackDTO;
|
||||||
|
|
||||||
|
public interface TRTCVideoService {
|
||||||
|
|
||||||
|
void handleVideoCallBack(VideoCallBackDTO videoCallBackDTO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.dto.trtc.callback.VideoCallBackDTO;
|
||||||
|
import com.cool.store.service.TRTCVideoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TRTCVideoServiceImpl implements TRTCVideoService {
|
||||||
|
|
||||||
|
/*@Autowired
|
||||||
|
private HyPartnerInterviewMapper interviewMapper;*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleVideoCallBack(VideoCallBackDTO videoCallBackDTO) {
|
||||||
|
//防重
|
||||||
|
/*Boolean hasVideoUrl = interviewMapper.hasVideoUrls(videoCallBackDTO.getEventInfo().getPayload().getTencentVod().getVideoUrl());
|
||||||
|
if (hasVideoUrl) {
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
//将视频播放地址拼接到对应的面试信息字段中
|
||||||
|
String videoUrl = videoCallBackDTO.getEventInfo().getPayload().getTencentVod().getVideoUrl();
|
||||||
|
String roomId = videoCallBackDTO.getEventInfo().getRoomId();
|
||||||
|
//interviewMapper.addVideoUrl(roomId, videoUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.cool.store.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cool.store.dto.trtc.callback.VideoCallBackDTO;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.TRTCVideoService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/video")
|
||||||
|
@Api(tags = "腾讯音视频接口")
|
||||||
|
@Slf4j
|
||||||
|
public class VideoController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TRTCVideoService videoService;
|
||||||
|
|
||||||
|
@PostMapping("/callback")
|
||||||
|
@ApiOperation("音视频回调(腾讯云回调)")
|
||||||
|
public ResponseResult videoCallback(@RequestBody VideoCallBackDTO videoCallBackDTO) {
|
||||||
|
try {
|
||||||
|
log.info("腾讯音视频上传回调开始,request{}", JSONObject.toJSONString(videoCallBackDTO));
|
||||||
|
//不是音视频上传的回调
|
||||||
|
if (311 != videoCallBackDTO.getEventType()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (0 != videoCallBackDTO.getEventInfo().getPayload().getStatus()) {
|
||||||
|
log.error("腾讯音视频录制视频上传错误:request:\t{}", videoCallBackDTO);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
videoService.handleVideoCallBack(videoCallBackDTO);
|
||||||
|
return new ResponseResult(0, "腾讯云回调音视频回调数据接收成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("腾讯音视频录制视频上传回调错误:e:\t{}", e.toString());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -56,9 +56,9 @@ corp.id=171cddee76471740
|
|||||||
cdn.url=https://testhsaypic.coolstore.cn
|
cdn.url=https://testhsaypic.coolstore.cn
|
||||||
|
|
||||||
#TRTC
|
#TRTC
|
||||||
trtc.sdkAppId=1400811820
|
trtc.sdkAppId=1600026212
|
||||||
trtc.secretKey=4854bab106c2ca2a2fda16a8c966933e28a078a34e458999d6227e8cd8ab8219
|
trtc.secretKey=e036b654c665f649f053a01ff6f5652a826980027be298d4d49949f6e26434a5
|
||||||
trtc.video.callback.secretKey=1ECEAD34DBD84E838BF07FC7360EA4D8
|
trtc.video.callback.secretKey=ur4wq2iFbRI03Q35
|
||||||
|
|
||||||
weixin.appId=wx997f2206e276e513
|
weixin.appId=wx997f2206e276e513
|
||||||
weixin.appSecret=90a51574dde00480316f81a552e6b5cb
|
weixin.appSecret=90a51574dde00480316f81a552e6b5cb
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ corp.id=171cddee76471740
|
|||||||
cdn.url=https://testhsaypic.coolstore.cn
|
cdn.url=https://testhsaypic.coolstore.cn
|
||||||
|
|
||||||
#TRTC
|
#TRTC
|
||||||
trtc.sdkAppId=1400811820
|
trtc.sdkAppId=1600026212
|
||||||
trtc.secretKey=4854bab106c2ca2a2fda16a8c966933e28a078a34e458999d6227e8cd8ab8219
|
trtc.secretKey=e036b654c665f649f053a01ff6f5652a826980027be298d4d49949f6e26434a5
|
||||||
trtc.video.callback.secretKey=1ECEAD34DBD84E838BF07FC7360EA4D8
|
trtc.video.callback.secretKey=ur4wq2iFbRI03Q35
|
||||||
|
|
||||||
weixin.appId=wx997f2206e276e513
|
weixin.appId=wx997f2206e276e513
|
||||||
weixin.appSecret=90a51574dde00480316f81a552e6b5cb
|
weixin.appSecret=90a51574dde00480316f81a552e6b5cb
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring.application.name=hsay-partner-webb
|
spring.application.name=hsay-partner-webb
|
||||||
spring.profiles.active=test
|
spring.profiles.active=test
|
||||||
|
|
||||||
server.port=31000
|
server.port=40000
|
||||||
server.servlet.context-path=/xfsg/pc
|
server.servlet.context-path=/xfsg/pc
|
||||||
|
|
||||||
#logback
|
#logback
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring.application.name=hsay-partner-webc
|
spring.application.name=hsay-partner-webc
|
||||||
spring.profiles.active=test
|
spring.profiles.active=test
|
||||||
server.port=30900
|
server.port=40100
|
||||||
server.servlet.context-path=/xfsg/mini/program
|
server.servlet.context-path=/xfsg/mini/program
|
||||||
|
|
||||||
#logback
|
#logback
|
||||||
|
|||||||
Reference in New Issue
Block a user