Kaynağa Gözat

Merge branch 'master' of ssh://192.168.8.213:10022/miaxis/zzjs

Althars123 3 yıl önce
ebeveyn
işleme
ee281c9465
20 değiştirilmiş dosya ile 613 ekleme ve 304 silme
  1. 12 0
      zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletHomePageDataInfoController.java
  2. 64 0
      zzjs-admin/src/main/java/com/miaxis/app/controller/teachingVideo/AppletTeachingVideoInfoController.java
  3. 17 3
      zzjs-admin/src/main/java/com/miaxis/pc/controller/teachingVideo/TeachingVideoInfoController.java
  4. 0 45
      zzjs-admin/src/test/java/com/miaxis/test/UpdateCarTest.java
  5. 28 6
      zzjs-admin/src/test/java/com/miaxis/test/VodTest.java
  6. 0 66
      zzjs-common/src/main/java/com/miaxis/common/utils/TencentCloudAPIDemo.java
  7. 0 115
      zzjs-common/src/main/java/com/miaxis/common/utils/TencentCloudAPITC3.java
  8. 7 1
      zzjs-service/src/main/java/com/miaxis/carousel/service/IHomePageDataInfoService.java
  9. 38 0
      zzjs-service/src/main/java/com/miaxis/carousel/service/impl/HomePageDataInfoServiceImpl.java
  10. 0 40
      zzjs-service/src/main/java/com/miaxis/feign/service/ITencentCosService.java
  11. 0 5
      zzjs-service/src/main/java/com/miaxis/fulu/vo/FuluCommodityInfoAppletVo.java
  12. 18 0
      zzjs-service/src/main/java/com/miaxis/teachingVideo/domain/TeachingVideoInfo.java
  13. 7 13
      zzjs-service/src/main/java/com/miaxis/teachingVideo/dto/TeachingVideoInfoDto.java
  14. 17 0
      zzjs-service/src/main/java/com/miaxis/teachingVideo/mapper/TeachingVideoInfoMapper.java
  15. 32 1
      zzjs-service/src/main/java/com/miaxis/teachingVideo/service/ITeachingVideoInfoService.java
  16. 211 8
      zzjs-service/src/main/java/com/miaxis/teachingVideo/service/impl/TeachingVideoInfoServiceImpl.java
  17. 31 0
      zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/AppletTeachingVideoVo.java
  18. 57 0
      zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoAppletVo.java
  19. 18 1
      zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoVo.java
  20. 56 0
      zzjs-service/src/main/resources/mapper/teachingVideo/TeachingVideoInfoMapper.xml

+ 12 - 0
zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletHomePageDataInfoController.java

@@ -6,8 +6,10 @@ import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -36,5 +38,15 @@ public class AppletHomePageDataInfoController extends BaseController {
     }
 
 
+    /**
+     * 查询首页数据列表--字典参数
+     */
+    @GetMapping("/dictValueHomePageDataList/{dictValues}")
+    @ApiOperation("查询首页数据列表--字典参数")
+    public Response dictValueHomePageDataList(@ApiParam(name = "dictValues",value = "字典参数",required = true)
+                                    @PathVariable("dictValues") String[] dictValues){
+        return homePageDataInfoService.dictValueHomePageDataList(dictValues);
+    }
+
 
 }

+ 64 - 0
zzjs-admin/src/main/java/com/miaxis/app/controller/teachingVideo/AppletTeachingVideoInfoController.java

@@ -0,0 +1,64 @@
+package com.miaxis.app.controller.teachingVideo;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
+import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
+import com.miaxis.teachingVideo.service.ITeachingVideoTypeInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 【教学视频】Controller
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 14:49
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(Constants.STUDENT_PREFIX+"/teachingVideo/info")
+@Api(tags={"【小程序-教学视频】"})
+public class AppletTeachingVideoInfoController extends BaseController {
+
+    private final ITeachingVideoInfoService teachingVideoInfoService;
+
+    private final ITeachingVideoTypeInfoService videoTypeInfoService;
+
+
+    @GetMapping("/typeList")
+    @ApiOperation("查询教学视频一级分类列表")
+    public Response typeList(){
+        return Response.success(videoTypeInfoService.list(new QueryWrapper<TeachingVideoTypeInfo>().eq("pid",0).eq("status",0).orderByAsc("type_sort")));
+    }
+
+    /**
+     * 查询教学视频列表
+     */
+    @GetMapping("/list/{pid}")
+    @ApiOperation("查询教学视频列表")
+    public Response list(@ApiParam(name = "pid", value = "分类id", required = true)
+                             @PathVariable("pid") String pid){
+        return teachingVideoInfoService.queryTeachingVideoInfoList(pid);
+    }
+
+
+    /**
+     * 关键字搜索教学视频
+     */
+    @GetMapping("/search")
+    @ApiOperation("关键字搜索教学视频")
+    public Response search(String keyword){
+        return teachingVideoInfoService.searchTeachingVideoInfoByKeyword(keyword);
+    }
+
+
+
+}

+ 17 - 3
zzjs-admin/src/main/java/com/miaxis/pc/controller/teachingVideo/TeachingVideoInfoController.java

@@ -6,12 +6,14 @@ 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.*;
 import lombok.AllArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -66,10 +68,11 @@ 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);
     }
 
+
     /**
      * 修改教学视频
      */
@@ -77,8 +80,19 @@ public class TeachingVideoInfoController extends BaseController {
     @Log(title = "教学视频", businessType = BusinessTypeEnum.UPDATE)
     @PutMapping
     @ApiOperation("修改教学视频")
-    public Response<Integer> edit(@RequestBody TeachingVideoInfo teachingVideoInfo){
-        return toResponse(teachingVideoInfoService.updateById(teachingVideoInfo) ? 1 : 0);
+    public Response edit(@RequestBody TeachingVideoInfoDto teachingVideoInfo){
+        return teachingVideoInfoService.updateTeachingVideoById(teachingVideoInfo);
+    }
+
+    /**
+     * 封面上传
+     */
+    @Log(title = "教学视频", businessType = BusinessTypeEnum.INSERT)
+    @PutMapping("/coverUp")
+    @ApiOperation("封面上传")
+    public Response coverUp(MultipartFile coverFile,
+                            @ApiParam(name = "fileId",value = "云点播fileId",required = true) @RequestParam("fileId") String fileId){
+        return teachingVideoInfoService.coverUp(fileId,coverFile);
     }
 
     /**

+ 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);
-
-    }
-
-
 }

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

@@ -1,14 +1,16 @@
 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;
+import com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoRequest;
+import com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoResponse;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Value;
@@ -16,6 +18,7 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
+import java.io.File;
 
 @SpringBootTest(classes = ZzjsApplication.class)
 @RunWith(SpringRunner.class)
@@ -45,14 +48,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());
@@ -61,6 +64,25 @@ public class VodTest {
 
 
 
+    @Test
+    public void test5(){
+        try{
+            String docUploadPath = "C:\\Users\\wwl\\Desktop\\timg.jpg";
+            File file = new File(docUploadPath);
+            byte[] refereeFileOriginalBytes = FileUtils.readFileToByteArray(file);
+            byte[] refereeFileBase64Bytes = Base64.encodeBase64(refereeFileOriginalBytes);
+            String UpFile = new String(refereeFileBase64Bytes, "UTF-8");
+
+            ModifyMediaInfoRequest req = new ModifyMediaInfoRequest();
+            req.setFileId("3701925920473528049");
+            req.setCoverData(UpFile);
+
+            ModifyMediaInfoResponse resp = vodClient.ModifyMediaInfo(req);
+            System.out.println(ModifyMediaInfoResponse.toJsonString(resp));
+        } catch (Exception 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();
-    }
-
-
-}

+ 7 - 1
zzjs-service/src/main/java/com/miaxis/carousel/service/IHomePageDataInfoService.java

@@ -60,6 +60,13 @@ public interface IHomePageDataInfoService extends IService<HomePageDataInfo>{
      */
     Response getHomePageDataList();
 
+    /**
+     * 查询首页数据列表--字典参数
+     * @param dictValues
+     * @return
+     */
+    Response dictValueHomePageDataList(String[] dictValues);
+
 
     int updateHomePageDataByPictureName(HomePageDataInfoVo homePageDataInfoVo);
 
@@ -69,5 +76,4 @@ public interface IHomePageDataInfoService extends IService<HomePageDataInfo>{
      */
     Response synchroData();
 
-
 }

+ 38 - 0
zzjs-service/src/main/java/com/miaxis/carousel/service/impl/HomePageDataInfoServiceImpl.java

@@ -179,6 +179,44 @@ public class HomePageDataInfoServiceImpl extends ServiceImpl<HomePageDataInfoMap
         return Response.success(map);
     }
 
+
+    /**
+     * 查询首页数据列表--字典参数
+     * @param dictValues
+     * @return
+     */
+    @Override
+    public Response dictValueHomePageDataList(String[] dictValues) {
+        Map<String, List<HomePageDataInfoVo>> map = new HashMap<>();
+
+        for (String dictData : dictValues) {
+            List<HomePageDataInfoVo> newInfos = new ArrayList<>();
+            Set carouselChartkeys = redisTemplate.keys(Constants.HOME_PAGE_DATA_KEY + dictData+":*");
+            if (!carouselChartkeys.isEmpty()){
+                for (Object key : carouselChartkeys) {
+                    String jsonStr = (String) redisTemplate.opsForValue().get(key);
+                    HomePageDataInfoVo homePageDataInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(HomePageDataInfoVo.class);
+                    newInfos.add(homePageDataInfoVo);
+                }
+            }else {
+                //数据库获取(此处可不做查询!)
+                HomePageDataInfo homePageDataInfo = new HomePageDataInfo();
+                homePageDataInfo.setDataType(dictData);
+                homePageDataInfo.setStatus("0");//启用状态
+                newInfos = homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
+            }
+            //排序
+            List<HomePageDataInfoVo> infoVos = newInfos.stream()
+                    .sorted(Comparator.comparing(HomePageDataInfoVo::getWeight).reversed())
+                    .collect(Collectors.toList());
+
+            map.put(dictData,infoVos);
+        }
+
+        return Response.success(map);
+    }
+
+
     /**
      * 同步数据
      * @return

+ 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);
-
-
-}

+ 0 - 5
zzjs-service/src/main/java/com/miaxis/fulu/vo/FuluCommodityInfoAppletVo.java

@@ -1,15 +1,10 @@
 package com.miaxis.fulu.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
-import com.miaxis.fulu.domain.FuluCommodityInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  *  福禄商品对象applet返回参

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

@@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 教学视频对象 teaching_video_info
  * @author wwl
@@ -45,10 +47,26 @@ public class TeachingVideoInfo extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频时长")
     private String videoDuration;
 
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private BigDecimal 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;
 
+    @TableField("vod_video_file_id")
+    @ApiModelProperty(value = "云点播视频fileId")
+    private String vodVideoFileId;
+
     @TableField("shelf_status")
     @ApiModelProperty(value = "上架状态  0:已上架、1:未上架")
     private Integer shelfStatus;

+ 7 - 13
zzjs-service/src/main/java/com/miaxis/teachingVideo/dto/TeachingVideoInfoDto.java

@@ -1,12 +1,11 @@
 package com.miaxis.teachingVideo.dto;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.io.Serializable;
+
 /**
  * 教学视频对象入参
  * @author wwl
@@ -15,12 +14,13 @@ import lombok.Data;
  */
 @Data
 @ApiModel(value = "TeachingVideoInfoDto", description = "教学视频对象入参")
-public class TeachingVideoInfoDto extends BaseBusinessEntity {
+public class TeachingVideoInfoDto implements Serializable {
 
-    private static final long serialVersionUID = 1L;
+    @ApiModelProperty(value = "主键")
+    private Long id;
 
-    @ApiModelProperty(value = "媒体播放地址")
-    private String MediaUrl;
+    @ApiModelProperty(value = "视频文件id")
+    private String videoFileId;
 
     @ApiModelProperty(value = "封面图片id")
     private Long coverFileId;
@@ -28,15 +28,9 @@ public class TeachingVideoInfoDto extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频标题")
     private String title;
 
-    @TableField("video_describe")
     @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;
 

+ 17 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/mapper/TeachingVideoInfoMapper.java

@@ -2,7 +2,10 @@ package com.miaxis.teachingVideo.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
+import com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -28,4 +31,18 @@ public interface TeachingVideoInfoMapper extends BaseMapper<TeachingVideoInfo> {
      * @return
      */
     TeachingVideoInfoVo getTeachingVideoDetailsById(Long id);
+
+    /**
+     * 根据视频分类查询教学视频列表
+     * @param pid
+     * @return
+     */
+    List<TeachingVideoInfoAppletVo> getTeachingVideoDetailsByTypeIds(String pid);
+
+    /***
+     * 根据关键字搜索教学视频
+     * @param keyword
+     * @return
+     */
+    List<TeachingVideoInfoAppletVo> searchTeachingVideoInfoByKeyword(@Param("keyword") String keyword);
 }

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

@@ -3,7 +3,9 @@ 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 org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -35,7 +37,14 @@ public interface ITeachingVideoInfoService extends IService<TeachingVideoInfo> {
      * @param teachingVideoInfo
      * @return
      */
-    Response saveTeachingVideo(TeachingVideoInfo teachingVideoInfo);
+    Response saveTeachingVideo(TeachingVideoInfoDto teachingVideoInfo);
+
+    /**
+     * 修改教学视频
+     * @param teachingVideoInfo
+     * @return
+     */
+    Response updateTeachingVideoById(TeachingVideoInfoDto teachingVideoInfo);
 
     /**
      * 删除教学视频(伪删除)
@@ -59,4 +68,26 @@ public interface ITeachingVideoInfoService extends IService<TeachingVideoInfo> {
      */
     Response removeOffShelfByIds(Long[] ids);
 
+    /**
+     * applet
+     * 查询教学视频列表
+     * @param pid
+     * @return
+     */
+    Response queryTeachingVideoInfoList(String pid);
+
+    /**
+     * 根据关键字搜索教学视频
+     * @param keyword
+     * @return
+     */
+    Response searchTeachingVideoInfoByKeyword(String keyword);
+
+    /**
+     * 封面上传
+     * @param fileId
+     * @param coverFile
+     * @return
+     */
+    Response coverUp(String fileId, MultipartFile coverFile);
 }

+ 211 - 8
zzjs-service/src/main/java/com/miaxis/teachingVideo/service/impl/TeachingVideoInfoServiceImpl.java

@@ -1,20 +1,40 @@
 package com.miaxis.teachingVideo.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.common.utils.bean.BeanUtils;
+import com.miaxis.file.domain.FileInfo;
 import com.miaxis.file.service.IFileInfoService;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
+import com.miaxis.teachingVideo.dto.TeachingVideoInfoDto;
 import com.miaxis.teachingVideo.mapper.TeachingVideoInfoMapper;
 import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
+import com.miaxis.teachingVideo.service.ITeachingVideoTypeInfoService;
+import com.miaxis.teachingVideo.vo.AppletTeachingVideoVo;
+import com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo;
 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 com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoRequest;
+import com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoResponse;
 import lombok.AllArgsConstructor;
+import org.apache.commons.codec.binary.Base64;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 教学视频Service业务层处理
@@ -28,10 +48,12 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
 
     private final TeachingVideoInfoMapper teachingVideoInfoMapper;
 
-    private final ITencentCosService tencentCosService;
-
     private final IFileInfoService fileInfoService;
 
+    private final VodClient vodClient;
+
+    private final ITeachingVideoTypeInfoService videoTypeInfoService;
+
     /**
      * 查询教学视频列表
      *
@@ -60,15 +82,120 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
      * @return
      */
     @Override
-    public Response saveTeachingVideo(TeachingVideoInfo teachingVideoInfo) {
+    @Transactional(rollbackFor = Exception.class)
+    public Response saveTeachingVideo(TeachingVideoInfoDto teachingVideoInfo) {
+
+        try{
+            //教学视频详细信息
+            TeachingVideoInfo videoInfo = new TeachingVideoInfo();
+            BeanUtils.copyProperties(teachingVideoInfo,videoInfo);
+
+            //根据fileId获取云点播视频信息
+            DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
+            String[] fileId = {teachingVideoInfo.getVideoFileId()};
+            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 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 media = new FileInfo();
+            media.setFileType(FileUploadTypeEnum.STUDY_MOVIE.getFileType());
+            media.setFileUrl(mediaUrl);
+            media.setRemark(FileUploadTypeEnum.STUDY_MOVIE.getInfo());
+            fileInfoService.save(media);
+
+            videoInfo.setFileId(media.getFileId());
+            videoInfo.setVideoDuration(duration);
+            BigDecimal decimalSize = BigDecimal.valueOf(Double.valueOf(size))
+                    .divide(BigDecimal.valueOf(1024), 3, BigDecimal.ROUND_HALF_UP)
+                    .divide(BigDecimal.valueOf(1024), 2, BigDecimal.ROUND_HALF_UP);
+            videoInfo.setVideoSize(decimalSize);
+            videoInfo.setVideoHeight(height);
+            videoInfo.setVideoWidth(width);
+            videoInfo.setVodVideoFileId(teachingVideoInfo.getVideoFileId());
+            teachingVideoInfoMapper.insert(videoInfo);
+
+            return Response.success();
+        } catch (Exception e) {
+            throw new CustomException("系统错误");
+        }
+
+    }
+
+    /**
+     * 修改教学视频
+     * @param teachingVideoInfo
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Response updateTeachingVideoById(TeachingVideoInfoDto teachingVideoInfo) {
+        try {
+
+            TeachingVideoInfo info = new TeachingVideoInfo();
+            BeanUtils.copyProperties(teachingVideoInfo,info);
+
+            //判断文件id是否修改
+            TeachingVideoInfo videoInfo = this.getById(teachingVideoInfo.getId());
+            if (!teachingVideoInfo.getVideoFileId().equals(videoInfo.getVodVideoFileId())){
+                DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
+                String[] fileId = {teachingVideoInfo.getVideoFileId()};
+                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 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 media = new FileInfo();
+                media.setFileType(FileUploadTypeEnum.STUDY_MOVIE.getFileType());
+                media.setFileUrl(mediaUrl);
+                media.setRemark(FileUploadTypeEnum.STUDY_MOVIE.getInfo());
+                fileInfoService.save(media);
 
-        //根据fileId获取云点播视频信息
-        //tencentCosService.getVideoInfo(teachingVideoInfo.getFileId(),"basicInfo")
+                info.setFileId(media.getFileId());
+                info.setVideoDuration(duration);
+                BigDecimal decimalSize = BigDecimal.valueOf(Double.valueOf(size))
+                        .divide(BigDecimal.valueOf(1024), 3, BigDecimal.ROUND_HALF_UP)
+                        .divide(BigDecimal.valueOf(1024), 2, BigDecimal.ROUND_HALF_UP);
+                info.setVideoSize(decimalSize);
+                info.setVideoHeight(height);
+                info.setVideoWidth(width);
+                info.setVodVideoFileId(teachingVideoInfo.getVideoFileId());
+            }
 
-        return null;
+            teachingVideoInfoMapper.updateById(info);
+
+            return Response.success();
+        } catch (Exception e) {
+            throw new CustomException("系统错误");
+        }
     }
 
+
     /**
      * 删除教学视频(伪删除)
      * @param ids
@@ -111,4 +238,80 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
         return Response.success();
     }
 
+    /**
+     * applet
+     * 查询教学视频列表
+     * @param pid
+     * @return
+     */
+    @Override
+    public Response queryTeachingVideoInfoList(String pid) {
+
+        ArrayList<AppletTeachingVideoVo> appletVideoVos = new ArrayList<>();
+
+        //获取pid下的二级分类id
+        List<TeachingVideoTypeInfo> typeInfos = videoTypeInfoService.list(new QueryWrapper<TeachingVideoTypeInfo>().eq("pid", pid).eq("status", 0).orderByAsc("type_sort"));
+        List<TeachingVideoInfoAppletVo> appletVos = teachingVideoInfoMapper.getTeachingVideoDetailsByTypeIds(pid);
+
+        for (TeachingVideoTypeInfo typeInfo : typeInfos) {
+            AppletTeachingVideoVo videoVo = new AppletTeachingVideoVo();
+            videoVo.setTypeName(typeInfo.getTypeName());
+            videoVo.setList(appletVos
+                    .parallelStream()
+                    .filter(f -> f.getTeachingVideoTypeId().toString().equals(typeInfo.getId().toString()))
+                    .collect(Collectors.toList()));
+            appletVideoVos.add(videoVo);
+        }
+
+        return Response.success(appletVideoVos);
+    }
+
+    /**
+     * 根据关键字搜索教学视频
+     * @param keyword
+     * @return
+     */
+    @Override
+    public Response searchTeachingVideoInfoByKeyword(String keyword) {
+
+        return Response.success(teachingVideoInfoMapper.searchTeachingVideoInfoByKeyword(keyword));
+    }
+
+    /**
+     * 封面上传
+     * @param fileId
+     * @param coverFile
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Response coverUp(String fileId, MultipartFile coverFile) {
+        try{
+            byte[] refereeFileBase64Bytes = Base64.encodeBase64(coverFile.getBytes());
+            String UpFile = new String(refereeFileBase64Bytes, "UTF-8");
+            System.out.println(UpFile);
+
+            ModifyMediaInfoRequest req = new ModifyMediaInfoRequest();
+            req.setFileId(fileId);
+            req.setCoverData(UpFile);
+
+            ModifyMediaInfoResponse resp = vodClient.ModifyMediaInfo(req);
+            JSONObject jsonObject = JSONObject.parseObject(DescribeMediaInfosResponse.toJsonString(resp));
+            String coverUrl = (String) jsonObject.get("CoverUrl");//封面访问路径
+
+            //保存封面文件信息
+            FileInfo cover = new FileInfo();
+            cover.setFileType(FileUploadTypeEnum.STUDY_MOVIE.getFileType());
+            cover.setFileUrl(coverUrl);
+            cover.setRemark("视频封面");
+            fileInfoService.save(cover);
+
+            return Response.success(cover);
+        }catch (Exception e){
+            throw new CustomException("系统异常");
+        }
+
+    }
+
+
 }

+ 31 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/AppletTeachingVideoVo.java

@@ -0,0 +1,31 @@
+package com.miaxis.teachingVideo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * applet
+ * 教学视频对象返回参
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 14:43
+ */
+@Data
+@ApiModel(value = "AppletTeachingVideoVo", description = "教学视频对象返回参")
+public class AppletTeachingVideoVo implements Serializable {
+
+    @ApiModelProperty(value = "教学视频分类名称")
+    private String typeName;
+
+    @ApiModelProperty(value = "数据集合")
+    private List<TeachingVideoInfoAppletVo> list;
+
+
+
+
+}

+ 57 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoAppletVo.java

@@ -0,0 +1,57 @@
+package com.miaxis.teachingVideo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * applet
+ * 教学视频对象返回参
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 16:43
+ */
+@Data
+@ApiModel(value = "TeachingVideoInfoAppletVo", description = "教学视频对象返回参")
+public class TeachingVideoInfoAppletVo implements Serializable {
+
+    @TableId(value = "id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "视频文件访问地址")
+    private String fileUrl;
+
+    @ApiModelProperty(value = "封面图片访问地址")
+    private String coverFileUrl;
+
+    @TableField("title")
+    @ApiModelProperty(value = "视频标题")
+    private String title;
+
+    @TableField("video_describe")
+    @ApiModelProperty(value = "视频描述")
+    private String videoDescribe;
+
+    @TableField("video_duration")
+    @ApiModelProperty(value = "视频时长")
+    private String videoDuration;
+
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private BigDecimal videoSize;
+
+    @TableField("teaching_video_type_id")
+    @ApiModelProperty(value = "教学视频分类id (关联teaching_video_type_info表)")
+    private Long teachingVideoTypeId;
+
+    @ApiModelProperty(value = "视频分类pid")
+    private Long pid;
+
+
+}

+ 18 - 1
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoVo.java

@@ -2,12 +2,13 @@ package com.miaxis.teachingVideo.vo;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.miaxis.common.core.domain.BaseBusinessEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 教学视频对象返回参
  * @author wwl
@@ -42,6 +43,18 @@ public class TeachingVideoInfoVo extends BaseBusinessEntity {
     @ApiModelProperty(value = "视频时长")
     private String videoDuration;
 
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private BigDecimal 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;
@@ -49,6 +62,10 @@ public class TeachingVideoInfoVo extends BaseBusinessEntity {
     @ApiModelProperty(value = "教学视频分类名称")
     private String teachingVideoTypeName;
 
+    @TableField("vod_video_file_id")
+    @ApiModelProperty(value = "云点播视频fileId")
+    private String vodVideoFileId;
+
     @TableField("shelf_status")
     @ApiModelProperty(value = "上架状态  0:已上架、1:未上架")
     private Integer shelfStatus;

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

@@ -13,7 +13,11 @@
         <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="vodVideoFileId"    column="vod_video_file_id"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
     </resultMap>
@@ -28,12 +32,16 @@
         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,
         vi.update_time,
         f1.file_url as fileUrl,
         f2.file_url as coverFileUrl,
+        vi.vod_video_file_id,
         vi.shelf_status,
         vi.status
         from teaching_video_info vi
@@ -59,12 +67,16 @@
         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,
         vi.update_time,
         f1.file_url as fileUrl,
         f2.file_url as coverFileUrl,
+        vi.vod_video_file_id,
         vi.shelf_status,
         vi.status
         from teaching_video_info vi
@@ -74,4 +86,48 @@
         where vi.id = #{id}
     </select>
 
+
+    <select id="getTeachingVideoDetailsByTypeIds" resultType="com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo">
+        select
+        vi.id,
+        vi.title,
+        vi.video_describe,
+        vi.video_duration,
+        vi.video_size,
+        vti.pid,
+        vi.teaching_video_type_id,
+        f1.file_url as fileUrl,
+        f2.file_url as coverFileUrl
+        from teaching_video_info vi
+        LEFT JOIN file_info f1 on f1.file_id = vi.file_id
+        LEFT JOIN file_info f2 on f2.file_id = vi.cover_file_id
+        LEFT JOIN teaching_video_type_info vti ON vti.id = vi.teaching_video_type_id
+        WHERE
+	      vi.teaching_video_type_id IN ( SELECT ti.id FROM teaching_video_type_info ti WHERE ti.pid = #{pid} )
+          AND vi.`shelf_status` = 0
+          AND vi.`status` = 0
+    </select>
+
+
+    <select id="searchTeachingVideoInfoByKeyword" resultType="com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo">
+        select
+        vi.id,
+        vi.title,
+        vi.video_describe,
+        vi.video_duration,
+        vi.video_size,
+        vti.pid,
+        vi.teaching_video_type_id,
+        f1.file_url as fileUrl,
+        f2.file_url as coverFileUrl
+        from teaching_video_info vi
+        LEFT JOIN file_info f1 on f1.file_id = vi.file_id
+        LEFT JOIN file_info f2 on f2.file_id = vi.cover_file_id
+        LEFT JOIN teaching_video_type_info vti ON vti.id = vi.teaching_video_type_id
+        WHERE
+          vi.`shelf_status` = 0
+	      AND vi.`status` = 0
+	      AND vi.`title` like concat('%', #{keyword}, '%') or vi.`video_describe` like concat('%', #{keyword}, '%')
+    </select>
+
 </mapper>