Преглед изворни кода

新增教学视频接口修改

wwl пре 3 година
родитељ
комит
83708dea45

+ 2 - 1
zzjs-admin/src/main/java/com/miaxis/pc/controller/teachingVideo/TeachingVideoInfoController.java

@@ -6,6 +6,7 @@ import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.common.enums.BusinessTypeEnum;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.dto.TeachingVideoInfoDto;
 import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
 import io.swagger.annotations.*;
@@ -66,7 +67,7 @@ public class TeachingVideoInfoController extends BaseController {
     @Log(title = "教学视频", businessType = BusinessTypeEnum.INSERT)
     @PostMapping
     @ApiOperation("新增教学视频")
-    public Response add(@RequestBody TeachingVideoInfo teachingVideoInfo){
+    public Response add(@RequestBody TeachingVideoInfoDto teachingVideoInfo){
         return teachingVideoInfoService.saveTeachingVideo(teachingVideoInfo);
     }
 

+ 0 - 45
zzjs-admin/src/test/java/com/miaxis/test/UpdateCarTest.java

@@ -9,12 +9,7 @@ import com.miaxis.car.domain.CarParameterData;
 import com.miaxis.car.mapper.CarParameterDataMapper;
 import com.miaxis.car.service.ICarBrandInfoService;
 import com.miaxis.common.enums.FileUploadTypeEnum;
-import com.miaxis.common.utils.TencentCloudAPIDemo;
-import com.miaxis.common.utils.TencentCloudAPITC3;
-import com.miaxis.common.utils.VodSignature;
-import com.miaxis.feign.dto.TencentCosCommonParameters;
 import com.miaxis.feign.service.ICarService;
-import com.miaxis.feign.service.ITencentCosService;
 import com.qcloud.cos.COSClient;
 import com.qcloud.cos.model.ObjectMetadata;
 import com.qcloud.cos.model.PutObjectRequest;
@@ -45,9 +40,6 @@ public class UpdateCarTest {
     @Autowired
     private ICarService carService;
 
-    @Autowired
-    private ITencentCosService tencentCosService;
-
     @Autowired
     private ICarBrandInfoService carBrandInfoService;
 
@@ -254,41 +246,4 @@ public class UpdateCarTest {
     }
 
 
-    /**
-     * 获取第三方汽车品牌接口
-     * @return
-     */
-    @Test
-    public void getVideoInfo() throws Exception{
-
-        //当前unix时间戳
-        String dateStr = Long.toString(System.currentTimeMillis()/1000L);
-        String random = String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
-
-        TencentCosCommonParameters tencentCosCommonParameters = new TencentCosCommonParameters();
-        tencentCosCommonParameters.setAction("GetVideoInfo");
-        tencentCosCommonParameters.setRegion("sh");
-        tencentCosCommonParameters.setTimestamp(dateStr);
-        tencentCosCommonParameters.setNonce(random);
-        tencentCosCommonParameters.setSecretId("AKIDwISNOFsJXYGjy89FJI9UnzuZFgTtRgFe");
-
-        String signature = TencentCloudAPITC3.getSignature();
-        tencentCosCommonParameters.setSignature(signature);
-
-        String resultJson = tencentCosService.getVideoInfo("3701925920237204036",
-                "basicInfo",
-                "GetVideoInfo",
-                "sh",
-                dateStr,
-                random,
-                "AKIDwISNOFsJXYGjy89FJI9UnzuZFgTtRgFe",
-                "curl -H 'Host: cvm.tencentcloudapi.com' -H 'X-TC-Action: DescribeZones' -H 'X-TC-RequestClient: APIExplorer' -H 'X-TC-Timestamp: 1625550644' -H 'X-TC-Version: 2017-03-12' -H 'X-TC-Region: ap-shanghai' -H 'X-TC-Language: zh-CN' -H 'Content-Type: application/json' -H 'Authorization: TC3-HMAC-SHA256 Credential=AKIDwISNOFsJXYGjy89FJI9UnzuZFgTtRgFe/2021-07-06/cvm/tc3_request, SignedHeaders=content-type;host, Signature=a4c9101cbd62f5bc2696a435d8dc9fa51982070e41e6e258efdaa3417f1a8596' -d '{}' 'https://cvm.tencentcloudapi.com/'"
-                );
-//        String resultJson = tencentCosService.getVideoInfo2("3701925920237204036","basicInfo",tencentCosCommonParameters);
-        JSONObject jsonString = JSONObject.parseObject(resultJson);
-        System.out.println("jsonString"+jsonString);
-
-    }
-
-
 }

+ 4 - 6
zzjs-admin/src/test/java/com/miaxis/test/VodTest.java

@@ -1,11 +1,9 @@
 package com.miaxis.test;
 
+import com.alibaba.fastjson.JSONObject;
 import com.miaxis.ZzjsApplication;
 import com.miaxis.common.utils.VodSignature;
-import com.tencentcloudapi.common.Credential;
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
-import com.tencentcloudapi.common.profile.ClientProfile;
-import com.tencentcloudapi.common.profile.HttpProfile;
 import com.tencentcloudapi.vod.v20180717.VodClient;
 import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest;
 import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse;
@@ -45,14 +43,14 @@ public class VodTest {
     @Test
     public void get1() throws Exception {
         try{
-
             DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
-            String[] fileIds1 = {"3701925920237204036"};
-            String[] filter1 = {"basicInfo"};
+            String[] fileIds1 = {"3701925920473528049"};
+            String[] filter1 = {"basicInfo","metaData"};
             req.setFileIds(fileIds1);
             req.setFilters(filter1);
             DescribeMediaInfosResponse resp = vodClient.DescribeMediaInfos(req);
 
+            JSONObject jsonObject = JSONObject.parseObject(DescribeMediaInfosResponse.toJsonString(resp));
             System.out.println(DescribeMediaInfosResponse.toJsonString(resp));
         } catch (TencentCloudSDKException e) {
             System.out.println(e.toString());

+ 0 - 66
zzjs-common/src/main/java/com/miaxis/common/utils/TencentCloudAPIDemo.java

@@ -1,66 +0,0 @@
-package com.miaxis.common.utils;
-
-import org.springframework.context.annotation.Configuration;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Random;
-import java.util.TreeMap;
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
-
-/**
- * @author wwl
- * @version 1.0
- * @date 2021/7/6 10:44
- */
-@Configuration
-public class TencentCloudAPIDemo {
-    private final static String CHARSET = "UTF-8";
-
-    public static String sign(String s, String key, String method) throws Exception {
-        Mac mac = Mac.getInstance(method);
-        SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(CHARSET), mac.getAlgorithm());
-        mac.init(secretKeySpec);
-        byte[] hash = mac.doFinal(s.getBytes(CHARSET));
-        return DatatypeConverter.printBase64Binary(hash);
-    }
-
-    public static String getStringToSign(TreeMap<String, Object> params) {
-        StringBuilder s2s = new StringBuilder("GETcvm.tencentcloudapi.com/?");
-        // 签名时要求对参数进行字典排序,此处用TreeMap保证顺序
-        for (String k : params.keySet()) {
-            s2s.append(k).append("=").append(params.get(k).toString()).append("&");
-        }
-        return s2s.toString().substring(0, s2s.length() - 1);
-    }
-
-    public static String getUrl(TreeMap<String, Object> params) throws UnsupportedEncodingException {
-        StringBuilder url = new StringBuilder("https://cvm.tencentcloudapi.com/?");
-        // 实际请求的url中对参数顺序没有要求
-        for (String k : params.keySet()) {
-            // 需要对请求串进行urlencode,由于key都是英文字母,故此处仅对其value进行urlencode
-            url.append(k).append("=").append(URLEncoder.encode(params.get(k).toString(), CHARSET)).append("&");
-        }
-        return url.toString().substring(0, url.length() - 1);
-    }
-
-    public static String getSignature() throws Exception {
-        TreeMap<String, Object> params = new TreeMap<String, Object>(); // TreeMap可以自动排序
-        // 实际调用时应当使用随机数,例如:params.put("Nonce", new Random().nextInt(java.lang.Integer.MAX_VALUE));
-        params.put("Nonce", new Random().nextInt(java.lang.Integer.MAX_VALUE)); // 公共参数
-        // 实际调用时应当使用系统当前时间,例如:   params.put("Timestamp", System.currentTimeMillis() / 1000);
-        params.put("Timestamp", System.currentTimeMillis() / 1000); // 公共参数
-        params.put("SecretId", "AKIDwISNOFsJXYGjy89FJI9UnzuZFgTtRgFe"); // 公共参数
-        params.put("Action", "GetVideoInfo"); // 公共参数
-        params.put("Version", "2017-03-12"); // 公共参数
-        params.put("Region", "ap-guangzhou"); // 公共参数
-        params.put("Limit", 20); // 业务参数
-        params.put("Offset", 0); // 业务参数
-        params.put("InstanceIds.0", "ins-09dx96dg"); // 业务参数
-        params.put("Signature", sign(getStringToSign(params), "IK5af8MJzPoKbdQxDCtKWR5T5PSEkyDB", "HmacSHA1")); // 公共参数
-        System.out.println(getUrl(params));
-        return getUrl(params);
-    }
-}

+ 0 - 115
zzjs-common/src/main/java/com/miaxis/common/utils/TencentCloudAPITC3.java

@@ -1,115 +0,0 @@
-package com.miaxis.common.utils;
-
-import org.springframework.context.annotation.Configuration;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.TreeMap;
-
-/**
- * @author wwl
- * @version 1.0
- * @date 2021/7/2 15:25
- */
-@Configuration
-public class TencentCloudAPITC3 {
-
-    private final static Charset UTF8 = StandardCharsets.UTF_8;
-    private final static String SECRET_KEY = "IK5af8MJzPoKbdQxDCtKWR5T5PSEkyDB";
-    private final static String SECRET_ID = "AKIDwISNOFsJXYGjy89FJI9UnzuZFgTtRgFe";
-    private final static String CT_JSON = "application/json; charset=utf-8";
-
-
-    public static String getSignature() throws Exception {
-        String service = "cvm";
-        String host = "vod.api.qcloud.com";
-        String region = "sh";
-        String action = "GetVideoInfo";
-        String version = "2017-03-12";
-        String algorithm = "TC3-HMAC-SHA256";
-        String timestamp = "1551113065";
-        //String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        // 注意时区,否则容易出错
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
-        String date = sdf.format(new Date(Long.valueOf(timestamp + "000")));
-
-        // ************* 步骤 1:拼接规范请求串 *************
-        String httpRequestMethod = "GET";
-        String canonicalUri = "/";
-        String canonicalQueryString = "";
-        String canonicalHeaders = "content-type:application/json; charset=utf-8\n" + "host:" + host + "\n";
-        String signedHeaders = "content-type;host";
-
-        String payload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"\\u672a\\u547d\\u540d\"], \"Name\": \"instance-name\"}]}";
-        String hashedRequestPayload = sha256Hex(payload);
-        String canonicalRequest = httpRequestMethod + "\n" + canonicalUri + "\n" + canonicalQueryString + "\n"
-                + canonicalHeaders + "\n" + signedHeaders + "\n" + hashedRequestPayload;
-        System.out.println(canonicalRequest);
-
-        // ************* 步骤 2:拼接待签名字符串 *************
-        String credentialScope = date + "/" + service + "/" + "tc3_request";
-        String hashedCanonicalRequest = sha256Hex(canonicalRequest);
-        String stringToSign = algorithm + "\n" + timestamp + "\n" + credentialScope + "\n" + hashedCanonicalRequest;
-        System.out.println("待签名字符串----------"+stringToSign);
-
-        // ************* 步骤 3:计算签名 *************
-        byte[] secretDate = hmac256(("TC3" + SECRET_KEY).getBytes(UTF8), date);
-        byte[] secretService = hmac256(secretDate, service);
-        byte[] secretSigning = hmac256(secretService, "tc3_request");
-        String signature = DatatypeConverter.printHexBinary(hmac256(secretSigning, stringToSign)).toLowerCase();
-        System.out.println("签名----------"+signature);
-
-        // ************* 步骤 4:拼接 Authorization *************
-        String authorization = algorithm + " " + "Credential=" + SECRET_ID + "/" + credentialScope + ", "
-                + "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;
-        System.out.println(authorization);
-
-        TreeMap<String, String> headers = new TreeMap<>();
-        headers.put("Authorization", authorization);
-        headers.put("Content-Type", CT_JSON);
-        headers.put("Host", host);
-        headers.put("X-TC-Action", action);
-        headers.put("X-TC-Timestamp", timestamp);
-        headers.put("X-TC-Version", version);
-        headers.put("X-TC-Region", region);
-
-        StringBuilder sb = new StringBuilder();
-        sb.append("curl -X POST https://").append(host)
-                .append(" -H \"Authorization: ").append(authorization).append("\"")
-                .append(" -H \"Content-Type: application/json; charset=utf-8\"")
-                .append(" -H \"Host: ").append(host).append("\"")
-                .append(" -H \"X-TC-Action: ").append(action).append("\"")
-                .append(" -H \"X-TC-Timestamp: ").append(timestamp).append("\"")
-                .append(" -H \"X-TC-Version: ").append(version).append("\"")
-                .append(" -H \"X-TC-Region: ").append(region).append("\"")
-                .append(" -d '").append(payload).append("'");
-        System.out.println("sb-------"+sb.toString());
-
-        return signature;
-
-    }
-
-
-    public static byte[] hmac256(byte[] key, String msg) throws Exception {
-        Mac mac = Mac.getInstance("HmacSHA256");
-        SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
-        mac.init(secretKeySpec);
-        return mac.doFinal(msg.getBytes(UTF8));
-    }
-
-    public static String sha256Hex(String s) throws Exception {
-        MessageDigest md = MessageDigest.getInstance("SHA-256");
-        byte[] d = md.digest(s.getBytes(UTF8));
-        return DatatypeConverter.printHexBinary(d).toLowerCase();
-    }
-
-
-}

+ 0 - 40
zzjs-service/src/main/java/com/miaxis/feign/service/ITencentCosService.java

@@ -1,40 +0,0 @@
-package com.miaxis.feign.service;
-
-import com.miaxis.common.config.FeignConfig;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * 腾讯云点播接口
- * @author wwl
- * @version 1.0
- * @date 2021/7/2 16:23
- */
-@FeignClient(name="tencentCosService",
-        url = "https://vod.api.qcloud.com",
-        configuration = FeignConfig.class)
-@Component
-public interface ITencentCosService {
-
-
-    /**
-     * 获取视频信息
-     * @param fileId 要获取的视频 ID
-     * @param infoFilter 指定需要返回的信息,可同时指定多个信息,n从0开始递增。如果未填写该字段,默认返回所有信息
-
-     * @return
-     */
-    @GetMapping(value = "/v2/index.php?Action=GetVideoInfo")
-    String getVideoInfo(@RequestParam("fileId") String fileId,
-                          @RequestParam("infoFilter.0") String infoFilter,
-                          @RequestParam("action") String action,
-                          @RequestParam("Region") String region ,
-                          @RequestParam("Timestamp") String timestamp,
-                          @RequestParam("Nonce") String nonce,
-                          @RequestParam("SecretId") String secretId,
-                        @RequestParam("Signature") String signature);
-
-
-}

+ 12 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/domain/TeachingVideoInfo.java

@@ -45,6 +45,18 @@ public class TeachingVideoInfo extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频时长")
     private String videoDuration;
 
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private String videoSize;
+
+    @TableField("video_width")
+    @ApiModelProperty(value = "视频宽度")
+    private Integer videoWidth;
+
+    @TableField("video_height")
+    @ApiModelProperty(value = "视频高度")
+    private Integer videoHeight;
+
     @TableField("teaching_video_type_id")
     @ApiModelProperty(value = "教学视频分类id (关联teaching_video_type_info表)")
     private Long teachingVideoTypeId;

+ 2 - 11
zzjs-service/src/main/java/com/miaxis/teachingVideo/dto/TeachingVideoInfoDto.java

@@ -17,13 +17,8 @@ import lombok.Data;
 @ApiModel(value = "TeachingVideoInfoDto", description = "教学视频对象入参")
 public class TeachingVideoInfoDto extends BaseBusinessEntity {
 
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "媒体播放地址")
-    private String MediaUrl;
-
-    @ApiModelProperty(value = "封面图片id")
-    private Long coverFileId;
+    @ApiModelProperty(value = "文件id")
+    private String fileId;
 
     @ApiModelProperty(value = "视频标题")
     private String title;
@@ -32,10 +27,6 @@ public class TeachingVideoInfoDto extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频描述")
     private String videoDescribe;
 
-    @TableField("video_duration")
-    @ApiModelProperty(value = "视频时长")
-    private String videoDuration;
-
     @TableField("teaching_video_type_id")
     @ApiModelProperty(value = "教学视频分类id (关联teaching_video_type_info表)")
     private Long teachingVideoTypeId;

+ 2 - 1
zzjs-service/src/main/java/com/miaxis/teachingVideo/service/ITeachingVideoInfoService.java

@@ -3,6 +3,7 @@ package com.miaxis.teachingVideo.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.dto.TeachingVideoInfoDto;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
 
 import java.util.List;
@@ -35,7 +36,7 @@ public interface ITeachingVideoInfoService extends IService<TeachingVideoInfo> {
      * @param teachingVideoInfo
      * @return
      */
-    Response saveTeachingVideo(TeachingVideoInfo teachingVideoInfo);
+    Response saveTeachingVideo(TeachingVideoInfoDto teachingVideoInfo);
 
     /**
      * 删除教学视频(伪删除)

+ 68 - 10
zzjs-service/src/main/java/com/miaxis/teachingVideo/service/impl/TeachingVideoInfoServiceImpl.java

@@ -1,15 +1,22 @@
 package com.miaxis.teachingVideo.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.core.domain.Response;
-import com.miaxis.feign.service.ITencentCosService;
+import com.miaxis.common.enums.FileUploadTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.file.domain.FileInfo;
 import com.miaxis.file.service.IFileInfoService;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.dto.TeachingVideoInfoDto;
 import com.miaxis.teachingVideo.mapper.TeachingVideoInfoMapper;
 import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
+import com.tencentcloudapi.vod.v20180717.VodClient;
+import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest;
+import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -28,10 +35,10 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
 
     private final TeachingVideoInfoMapper teachingVideoInfoMapper;
 
-    private final ITencentCosService tencentCosService;
-
     private final IFileInfoService fileInfoService;
 
+    private final VodClient vodClient;
+
     /**
      * 查询教学视频列表
      *
@@ -60,15 +67,66 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
      * @return
      */
     @Override
-    public Response saveTeachingVideo(TeachingVideoInfo teachingVideoInfo) {
-
-
-        //根据fileId获取云点播视频信息
-        //tencentCosService.getVideoInfo(teachingVideoInfo.getFileId(),"basicInfo")
+    @Transactional(rollbackFor = Exception.class)
+    public Response saveTeachingVideo(TeachingVideoInfoDto teachingVideoInfo) {
+
+        try{
+            //根据fileId获取云点播视频信息
+            DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
+            String[] fileId = {teachingVideoInfo.getFileId()};
+            String[] filter = {"basicInfo","metaData"};
+            req.setFileIds(fileId);
+            req.setFilters(filter);
+            DescribeMediaInfosResponse resp = vodClient.DescribeMediaInfos(req);
+            JSONObject jsonObject = JSONObject.parseObject(DescribeMediaInfosResponse.toJsonString(resp));
+            JSONArray mediaInfoSetArr = (JSONArray)jsonObject.get("MediaInfoSet");
+            JSONObject mediaInfoSetObj = (JSONObject)mediaInfoSetArr.get(0);
+            JSONObject basicInfo = (JSONObject)mediaInfoSetObj.get("BasicInfo");
+            JSONObject metaData = (JSONObject)mediaInfoSetObj.get("MetaData");
+
+            //获取视频、封面基础信息
+            String coverUrl = (String)basicInfo.get("CoverUrl");//封面访问路径
+            String mediaUrl = (String)basicInfo.get("MediaUrl");//视频访问路径
+            String size = String.valueOf(metaData.get("Size"));//视频文件大小
+            String duration =  String.valueOf(metaData.get("Duration"));//视屏时长
+            Integer height =  (Integer)metaData.get("Height");//视屏高度
+            Integer width =  (Integer)metaData.get("Width");//视屏宽度
+
+            //保存视频、封面文件信息
+            FileInfo cover = new FileInfo();
+            cover.setFileType(FileUploadTypeEnum.STUDY_MOVIE.getFileType());
+            cover.setFileUrl(coverUrl);
+            cover.setRemark("视频封面");
+
+            FileInfo media = new FileInfo();
+            media.setFileType(FileUploadTypeEnum.STUDY_MOVIE.getFileType());
+            media.setFileUrl(mediaUrl);
+            media.setRemark(FileUploadTypeEnum.STUDY_MOVIE.getInfo());
+
+            fileInfoService.save(cover);
+            fileInfoService.save(media);
+
+            //保存教学视频详细信息
+            TeachingVideoInfo videoInfo = new TeachingVideoInfo();
+            videoInfo.setFileId(media.getFileId());
+            videoInfo.setCoverFileId(cover.getFileId());
+            videoInfo.setTitle(teachingVideoInfo.getTitle());
+            videoInfo.setVideoDescribe(teachingVideoInfo.getVideoDescribe());
+            videoInfo.setTeachingVideoTypeId(teachingVideoInfo.getTeachingVideoTypeId());
+            videoInfo.setVideoDuration(duration);
+            videoInfo.setVideoSize(String.valueOf((Integer.valueOf(size) / 1024) / 1024));
+            videoInfo.setVideoHeight(height);
+            videoInfo.setVideoWidth(width);
+            teachingVideoInfoMapper.insert(videoInfo);
+
+            return Response.success();
+        } catch (Exception e) {
+            throw new CustomException("系统错误");
+        }
 
-        return null;
     }
 
+
     /**
      * 删除教学视频(伪删除)
      * @param ids

+ 12 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoVo.java

@@ -42,6 +42,18 @@ public class TeachingVideoInfoVo extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频时长")
     private String videoDuration;
 
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private String videoSize;
+
+    @TableField("video_width")
+    @ApiModelProperty(value = "视频宽度")
+    private Integer videoWidth;
+
+    @TableField("video_height")
+    @ApiModelProperty(value = "视频高度")
+    private Integer videoHeight;
+
     @TableField("teaching_video_type_id")
     @ApiModelProperty(value = "教学视频分类id (关联teaching_video_type_info表)")
     private Long teachingVideoTypeId;

+ 9 - 0
zzjs-service/src/main/resources/mapper/teachingVideo/TeachingVideoInfoMapper.xml

@@ -13,7 +13,10 @@
         <result property="videoDuration"    column="video_duration"    />
         <result property="teachingVideoTypeId"    column="teaching_video_type_id"    />
         <result property="shelfStatus"    column="shelf_status"    />
+        <result property="videoSize"    column="video_size"    />
+        <result property="videoHeight"    column="video_height"    />
         <result property="status"    column="status"    />
+        <result property="videoWidth"    column="video_width"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
     </resultMap>
@@ -28,6 +31,9 @@
         vi.title,
         vi.video_describe,
         vi.video_duration,
+        vi.video_size,
+        vi.video_width,
+        vi.video_height,
         vi.teaching_video_type_id,
         ti.type_name as teachingVideoTypeName,
         vi.create_time,
@@ -59,6 +65,9 @@
         vi.title,
         vi.video_describe,
         vi.video_duration,
+        vi.video_size,
+        vi.video_width,
+        vi.video_height,
         vi.teaching_video_type_id,
         ti.type_name as teachingVideoTypeName,
         vi.create_time,