xuzuoyun 5 лет назад
Родитель
Сommit
d37cf1ee57

+ 87 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonController.java

@@ -0,0 +1,87 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.manage.modules.edu.entity.EduLesson;
+import cn.com.ctop.manage.modules.edu.service.IEduLessonService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.ctop.entity.DramaInfo;
+import org.jeecg.modules.system.entity.SysCategory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Api(tags="在线培训")
+@RestController
+@RequestMapping("/ctop/edu")
+public class EduLessonController {
+    @Autowired
+    private IEduLessonService eduLessonService;
+    @GetMapping(value = "/kuaishou/lesson")
+    public Result<List<String>> getKuaishouLessonList(){
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTitleList("快手大学");
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+    @GetMapping(value = "/kuaishou/topic")
+    public Result<List<String>> getKuaishouTopicList(String title){
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTopicList("快手大学",title);
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+    @GetMapping(value = "/ocean/lesson")
+    public Result<List<String>> getOceanLessonList(){
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTitleList("巨量引擎");
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+    @GetMapping(value = "/ocean/topic")
+    public Result<List<String>> getOceanTopicList(String title){
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTopicList("巨量引擎",title);
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+    @GetMapping(value = "/detail")
+    public Result<EduLesson> detail(Long id){
+        Result<EduLesson> result = new Result<>();
+        EduLesson eduLesson = eduLessonService.getById(id);
+        result.setResult(eduLesson);
+        result.setSuccess(true);
+        return result;
+    }
+
+    @GetMapping(value = "/lesson/list")
+    public Result<List<EduLesson>> lessonList(String media,String title,String topic){
+        Result<List<EduLesson>> result = new Result<>();
+        QueryWrapper<EduLesson> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media",media);
+        queryWrapper.eq("title",title);
+        queryWrapper.eq("topic",topic);
+        List<EduLesson> list = eduLessonService.list(queryWrapper);
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+}

+ 91 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/entity/EduLesson.java

@@ -0,0 +1,91 @@
+package cn.com.ctop.manage.modules.edu.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 在线培训
+ * @author jeecg-boot
+ * @date   2020-03-19
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_edu_lesson")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_edu_lesson对象", description="在线培训")
+public class EduLesson {
+    
+	/**id*/
+	@TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "id")
+	private java.lang.Integer id;
+	/**mediaId*/
+	@Excel(name = "media", width = 15)
+    @ApiModelProperty(value = "media")
+	private java.lang.String media;
+	/**name*/
+	@Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+	private java.lang.String name;
+
+	private String title;
+	private String topic;
+	/**intro*/
+	@Excel(name = "intro", width = 15)
+    @ApiModelProperty(value = "intro")
+	private java.lang.String intro;
+	/**lessonId*/
+	@Excel(name = "lessonId", width = 15)
+    @ApiModelProperty(value = "lessonId")
+	private java.lang.String lessonId;
+	/**fileId*/
+	@Excel(name = "fileId", width = 15)
+    @ApiModelProperty(value = "fileId")
+	private java.lang.String fileId;
+	/**fileUrl*/
+	@Excel(name = "fileUrl", width = 15)
+    @ApiModelProperty(value = "fileUrl")
+	private java.lang.String fileUrl;
+	/**ossFileUrl*/
+	@Excel(name = "ossFileUrl", width = 15)
+    @ApiModelProperty(value = "ossFileUrl")
+	private java.lang.String ossFileUrl;
+	/**coverUrl*/
+	@Excel(name = "coverUrl", width = 15)
+    @ApiModelProperty(value = "coverUrl")
+	private java.lang.String coverUrl;
+	/**ossCoverUrl*/
+	@Excel(name = "ossCoverUrl", width = 15)
+    @ApiModelProperty(value = "ossCoverUrl")
+	private java.lang.String ossCoverUrl;
+	/**fileType*/
+	@Excel(name = "fileType", width = 15)
+    @ApiModelProperty(value = "fileType")
+	private java.lang.String fileType;
+	/**publicTime*/
+	@Excel(name = "publicTime", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "publicTime")
+	private java.util.Date publicTime;
+	/**creator*/
+	@Excel(name = "creator", width = 15)
+    @ApiModelProperty(value = "creator")
+	private java.lang.String creator;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private java.util.Date createTime;
+}

+ 20 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/job/BytedanceEduJob.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.manage.modules.edu.job;
+
+import cn.com.ctop.manage.modules.edu.service.IEduLessonService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class BytedanceEduJob implements Job {
+    @Autowired
+    private IEduLessonService eduLessonService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String url = "https://school.oceanengine.com/academy/v2/course/learning_path_json/";
+        for(int i = 1; i <=7;i++){
+            eduLessonService.getBytedanceEduLesson(url+i);
+        }
+
+    }
+}

+ 21 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/job/KuaishouEduJob.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.manage.modules.edu.job;
+
+import cn.com.ctop.manage.modules.edu.entity.EduLesson;
+import cn.com.ctop.manage.modules.edu.service.IEduLessonService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class KuaishouEduJob implements Job {
+    @Autowired
+    private IEduLessonService eduLessonService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String url = "https://daxue.kuaishou.com/api/commercial/path/course/list/";
+        for(int i=9;i<=11;i++){
+            eduLessonService.getKuaishouEduLesson(url+i);
+        }
+
+    }
+}

+ 18 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/mapper/EduLessonMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.manage.modules.edu.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.manage.modules.edu.entity.EduLesson;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 在线培训
+ * @author: jeecg-boot
+ * @date:   2020-03-19
+ * @cersion: V1.0
+ */
+public interface EduLessonMapper extends BaseMapper<EduLesson> {
+    public List<String> getTitleList(String media);
+    public List<String> getTopicList(String media,String title);
+}

+ 11 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/mapper/xml/EduLessonMapper.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.manage.modules.edu.mapper.EduLessonMapper">
+
+    <select id="getTitleList" resultType="java.lang.String">
+        SELECT DISTINCT title FROM ctop_edu_lesson WHERE media=#{media}
+    </select>
+    <select id="getTopicList" resultType="java.lang.String">
+        SELECT DISTINCT topic FROM ctop_edu_lesson WHERE media=#{media} and title=#{title}
+    </select>
+</mapper>

+ 19 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/IEduLessonService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.manage.modules.edu.service;
+
+import cn.com.ctop.manage.modules.edu.entity.EduLesson;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 在线培训
+ * @author jeecg-boot
+ * @date   2020-03-19
+ * @version V1.0
+ */
+public interface IEduLessonService extends IService<EduLesson> {
+    public void getBytedanceEduLesson(String url);
+    public void getKuaishouEduLesson(String url);
+    public List<String> getTitleList(String media);
+    public List<String> getTopicList(String media,String title);
+}

Разница между файлами не показана из-за своего большого размера
+ 169 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/impl/EduLessonServiceImpl.java


+ 3 - 3
pom.xml

@@ -121,9 +121,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
-        </dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-aop</artifactId>
+    </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>