获取视频
parent
8ab9529030
commit
00d4f131f1
7
pom.xml
7
pom.xml
|
@ -52,6 +52,13 @@
|
||||||
<version>${mybatis-plus-boot-starter.version}</version>
|
<version>${mybatis-plus-boot-starter.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.freemarker</groupId>
|
||||||
|
<artifactId>freemarker</artifactId>
|
||||||
|
<version>2.3.28</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-generator</artifactId>
|
<artifactId>mybatis-plus-generator</artifactId>
|
||||||
|
|
|
@ -35,10 +35,10 @@ public class Constants {
|
||||||
//科目四
|
//科目四
|
||||||
public static String SUBJECT_FOUR = "4";
|
public static String SUBJECT_FOUR = "4";
|
||||||
|
|
||||||
//单选题
|
//判断题
|
||||||
public static String QUESTION_TYPE_ONE = "1";
|
public static String QUESTION_TYPE_ONE = "1";
|
||||||
|
|
||||||
//判断题
|
//单选题
|
||||||
public static String QUESTION_TYPE_TWO = "2";
|
public static String QUESTION_TYPE_TWO = "2";
|
||||||
|
|
||||||
//多选题
|
//多选题
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.jwl.driver.server.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.ProjectDto;
|
||||||
|
import com.jwl.driver.server.response.BaseResponse;
|
||||||
|
import com.jwl.driver.server.service.ITdProjectService;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 考试项目表; 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
@Api(tags = "考试项目")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/tdTestProject")
|
||||||
|
@Slf4j
|
||||||
|
public class TdProjectController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITdProjectService projectService;
|
||||||
|
|
||||||
|
@ApiOperation("获取项目列表 (考试项目和基础操作)")
|
||||||
|
@PostMapping("/queryProjectList")
|
||||||
|
public BaseResponse list(@RequestBody ProjectDto projectDto) {
|
||||||
|
log.info("获取考试项目=========》projectDto{}",projectDto);
|
||||||
|
return BaseResponse.success(projectService.queryProjectList(projectDto));
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.jwl.driver.server.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||||
|
import com.jwl.driver.server.dto.TestQueryDto;
|
||||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
import com.jwl.driver.server.response.BaseResponse;
|
import com.jwl.driver.server.response.BaseResponse;
|
||||||
import com.jwl.driver.server.service.ITdQuestionService;
|
import com.jwl.driver.server.service.ITdQuestionService;
|
||||||
|
@ -40,7 +41,10 @@ public class TdQuestionTestController {
|
||||||
return BaseResponse.success(testService.testSubmit(submitDto));
|
return BaseResponse.success(testService.testSubmit(submitDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取考试统计")
|
||||||
|
@PostMapping("/testTotal")
|
||||||
|
public BaseResponse testTotal(@RequestBody @Valid TestQueryDto queryDto) {
|
||||||
|
log.info("考试统计查询======>queryDto:{}", queryDto);
|
||||||
|
return BaseResponse.success(testService.testTotal(queryDto));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.jwl.driver.server.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 考试项目表; 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("//tdTestProject")
|
|
||||||
public class TdTestProjectController {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.jwl.driver.server.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 视频标识表; 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("//tdTestProjectVideos")
|
|
||||||
public class TdTestProjectVideosController {
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.jwl.driver.server.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 考试项目查询;
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("考试项目查询入参")
|
||||||
|
public class ProjectDto implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试项目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考试项目")
|
||||||
|
private Integer projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("类型 1:考试项目 2:基础操作")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属科目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("所属科目")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型标识")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾驶类型,手动挡,自动挡,A2:B2等(在字典表里配置)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("驾驶类型")
|
||||||
|
private String driveType;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.jwl.driver.server.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹林
|
||||||
|
* @description 成绩查询入参
|
||||||
|
* @create 2023/8/14 21:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("成绩查询入参")
|
||||||
|
public class TestQueryDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "车型标识",required = true)
|
||||||
|
@NotNull(message = "车型标识不能为空")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "科目",required = true)
|
||||||
|
@NotNull(message = "考试科目不能为空")
|
||||||
|
private String subject ;
|
||||||
|
}
|
|
@ -28,6 +28,13 @@ public class TestSubmitDto {
|
||||||
@NotNull(message = "车型标识不能为空")
|
@NotNull(message = "车型标识不能为空")
|
||||||
private Integer carTypeId;
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "科目",required = true)
|
||||||
|
@NotNull(message = "考试科目不能为空")
|
||||||
|
private String subject ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试得分
|
* 考试得分
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -76,8 +76,8 @@ public class TdMember implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 会员描述
|
* 会员描述
|
||||||
*/
|
*/
|
||||||
@TableField("DESC")
|
@TableField("DESCRIPTION")
|
||||||
private String desc;
|
private String DESCRIPTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
|
|
@ -19,15 +19,21 @@ import lombok.experimental.Accessors;
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class TdTestProject implements Serializable {
|
public class TdProject implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试项目
|
* 考试项目
|
||||||
*/
|
*/
|
||||||
@TableId("TEST_PROJECT_ID")
|
@TableId("PROJECT_ID")
|
||||||
private Integer testProjectId;
|
private Integer projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@TableField("TYPE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属科目
|
* 所属科目
|
||||||
|
@ -47,6 +53,12 @@ public class TdTestProject implements Serializable {
|
||||||
@TableField("DRIVE_TYPE")
|
@TableField("DRIVE_TYPE")
|
||||||
private String driveType;
|
private String driveType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@TableField("DESCRIPTION")
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
|
@ -36,6 +36,12 @@ public class TdQuestionTest implements Serializable {
|
||||||
@TableField("CAR_TYPE_ID")
|
@TableField("CAR_TYPE_ID")
|
||||||
private Integer carTypeId;
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试科目
|
||||||
|
*/
|
||||||
|
@TableField("SUBJECT")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户标识
|
* 用户标识
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
package com.jwl.driver.server.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 视频标识表;
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class TdTestProjectVideos implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频标识
|
|
||||||
*/
|
|
||||||
@TableId(value = "VIDEO_ID", type = IdType.AUTO)
|
|
||||||
private Integer videoId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 考试项目
|
|
||||||
*/
|
|
||||||
@TableField("TEST_PROJECT_ID")
|
|
||||||
private Integer testProjectId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频图片
|
|
||||||
*/
|
|
||||||
private String videoImage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频链接
|
|
||||||
*/
|
|
||||||
private String videoUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField("CREATE_TIME")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否生效
|
|
||||||
*/
|
|
||||||
@TableField("IS_ACTIVE")
|
|
||||||
private String isActive;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +1,15 @@
|
||||||
package com.jwl.driver.server.generator;
|
package com.jwl.driver.server.generator;
|
||||||
|
|
||||||
public class MysqlParamGenerator {
|
public class MysqlParamGenerator {
|
||||||
private static final String host = "127.0.0.1:3306";
|
private static final String host = "118.31.23.45";
|
||||||
private static final String database = "driver_test";
|
private static final String database = "driver_server";
|
||||||
private static final String url = "jdbc:mysql://" + host + "/" + database + "?characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&failOverReadOnly=false";
|
private static final String url = "jdbc:mysql://" + host + "/" + database + "?characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&failOverReadOnly=false";
|
||||||
private static final String userName = "root";
|
private static final String userName = "root";
|
||||||
private static final String password = "123456";
|
private static final String password = "admin231280";
|
||||||
|
|
||||||
private static final String module = "com.jwl.driver.server";
|
private static final String module = "com.jwl.driver.server";
|
||||||
// projectPath项为空即可
|
// projectPath项为空即可
|
||||||
private static final String projectPath = "/driver-server";
|
private static final String projectPath = "";
|
||||||
|
|
||||||
// todo 实体类是否继承基础类-具备开始时间和结束时间实体类的基础属性
|
// todo 实体类是否继承基础类-具备开始时间和结束时间实体类的基础属性
|
||||||
private static final String superEntityClass = "";
|
private static final String superEntityClass = "";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.jwl.driver.server.mapper;
|
package com.jwl.driver.server.mapper;
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProject;
|
import com.jwl.driver.server.entity.TdProject;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
* @author Automated procedures
|
* @author Automated procedures
|
||||||
* @since 2023-08-10
|
* @since 2023-08-10
|
||||||
*/
|
*/
|
||||||
public interface TdTestProjectMapper extends BaseMapper<TdTestProject> {
|
public interface TdProjectMapper extends BaseMapper<TdProject> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
package com.jwl.driver.server.mapper;
|
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 视频标识表; Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
public interface TdTestProjectVideosMapper extends BaseMapper<TdTestProjectVideos> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.jwl.driver.server.service;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.ProjectDto;
|
||||||
|
import com.jwl.driver.server.entity.TdProject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jwl.driver.server.vo.ProjectVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 考试项目表; 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
public interface ITdProjectService extends IService<TdProject> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取考试项目列表
|
||||||
|
* @param queryDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ProjectVo> queryProjectList(ProjectDto queryDto);
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
package com.jwl.driver.server.service;
|
package com.jwl.driver.server.service;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.TestQueryDto;
|
||||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jwl.driver.server.vo.TestTotalVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -19,5 +21,12 @@ public interface ITdQuestionTestService extends IService<TdQuestionTest> {
|
||||||
* @param submitDto
|
* @param submitDto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean testSubmit(TestSubmitDto submitDto);
|
TdQuestionTest testSubmit(TestSubmitDto submitDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试成绩统计
|
||||||
|
* @param queryDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TestTotalVo testTotal(TestQueryDto queryDto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.jwl.driver.server.service;
|
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProject;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 考试项目表; 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
public interface ITdTestProjectService extends IService<TdTestProject> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.jwl.driver.server.service;
|
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 视频标识表; 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
public interface ITdTestProjectVideosService extends IService<TdTestProjectVideos> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.jwl.driver.server.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.jwl.driver.server.constant.Constants;
|
||||||
|
import com.jwl.driver.server.dto.ProjectDto;
|
||||||
|
import com.jwl.driver.server.entity.TdProject;
|
||||||
|
import com.jwl.driver.server.entity.TdVideos;
|
||||||
|
import com.jwl.driver.server.mapper.TdProjectMapper;
|
||||||
|
import com.jwl.driver.server.service.ITdProjectService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jwl.driver.server.service.ITdVideosService;
|
||||||
|
import com.jwl.driver.server.vo.ProjectVo;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 考试项目表; 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TdProjectServiceImpl extends ServiceImpl<TdProjectMapper, TdProject> implements ITdProjectService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITdVideosService videosService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProjectVo> queryProjectList(ProjectDto queryDto) {
|
||||||
|
|
||||||
|
List<ProjectVo> resultList = new ArrayList<>();
|
||||||
|
LambdaQueryWrapper<TdProject> queryWrapper = new LambdaQueryWrapper<TdProject>()
|
||||||
|
.eq(TdProject::getProjectId,queryDto.getProjectId())
|
||||||
|
.eq(TdProject::getType,queryDto.getType())
|
||||||
|
.eq(TdProject::getCarTypeId,queryDto.getCarTypeId())
|
||||||
|
.eq(TdProject::getSubject,queryDto.getSubject())
|
||||||
|
.eq(TdProject::getDriveType,queryDto.getDriveType())
|
||||||
|
.eq(TdProject::getIsActive, Constants.IS_ACTIVE_TRUE)
|
||||||
|
.orderByAsc(TdProject::getShowOrder);
|
||||||
|
List<TdProject> tdProjects = this.getBaseMapper().selectList(queryWrapper);
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(tdProjects)){
|
||||||
|
for (TdProject tdProject : tdProjects) {
|
||||||
|
ProjectVo projectVo = new ProjectVo();
|
||||||
|
BeanUtils.copyProperties(tdProject,projectVo);
|
||||||
|
//查询项目视频
|
||||||
|
List<TdVideos> videoList = videosService.list(new QueryWrapper<TdVideos>().lambda().eq(TdVideos::getTypeId, tdProject.getProjectId()).orderByAsc(TdVideos::getShowOrder));
|
||||||
|
if (CollectionUtil.isNotEmpty(videoList)){
|
||||||
|
projectVo.setVideoList(videoList);
|
||||||
|
projectVo.setImageUrl(videoList.get(0).getVideoImage());
|
||||||
|
}
|
||||||
|
resultList.add(projectVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,11 +67,11 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
||||||
if (StrUtil.equals(Constants.SUBJECT_ONE,queryDto.getSubject())){
|
if (StrUtil.equals(Constants.SUBJECT_ONE,queryDto.getSubject())){
|
||||||
//40道判断题 60道单选 每题1分
|
//40道判断题 60道单选 每题1分
|
||||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||||
.setNum(60);
|
.setNum(40);
|
||||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||||
|
|
||||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||||
.setNum(40);
|
.setNum(60);
|
||||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||||
|
|
||||||
}else if(StrUtil.equals(Constants.SUBJECT_FOUR,queryDto.getSubject())){
|
}else if(StrUtil.equals(Constants.SUBJECT_FOUR,queryDto.getSubject())){
|
||||||
|
@ -145,7 +145,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
||||||
for (QuestionVo questionVo : questionVos) {
|
for (QuestionVo questionVo : questionVos) {
|
||||||
//如果选项A没有值 则为判断题
|
//如果选项A没有值 则为判断题
|
||||||
List<QuestionVo.QuestionOption> optionList = new ArrayList<>();
|
List<QuestionVo.QuestionOption> optionList = new ArrayList<>();
|
||||||
if (StrUtil.isBlank(questionVo.getChooseA())){
|
if (StrUtil.isBlank(questionVo.getChooseA()) || StrUtil.equals(questionVo.getType(),Constants.QUESTION_TYPE_ONE)){
|
||||||
optionList.add(new QuestionVo.QuestionOption("A","正确","1"));
|
optionList.add(new QuestionVo.QuestionOption("A","正确","1"));
|
||||||
optionList.add(new QuestionVo.QuestionOption("B","错误","2"));
|
optionList.add(new QuestionVo.QuestionOption("B","错误","2"));
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
package com.jwl.driver.server.service.impl;
|
package com.jwl.driver.server.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.jwl.driver.server.dto.SecurityUser;
|
import com.jwl.driver.server.dto.SecurityUser;
|
||||||
|
import com.jwl.driver.server.dto.TestQueryDto;
|
||||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||||
import com.jwl.driver.server.mapper.TdQuestionTestMapper;
|
import com.jwl.driver.server.mapper.TdQuestionTestMapper;
|
||||||
import com.jwl.driver.server.service.ITdQuestionTestService;
|
import com.jwl.driver.server.service.ITdQuestionTestService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jwl.driver.server.util.SecurityUtil;
|
import com.jwl.driver.server.util.SecurityUtil;
|
||||||
|
import com.jwl.driver.server.vo.TestTotalVo;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.OptionalDouble;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -26,13 +35,43 @@ public class TdQuestionTestServiceImpl extends ServiceImpl<TdQuestionTestMapper,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean testSubmit(TestSubmitDto submitDto) {
|
public TdQuestionTest testSubmit(TestSubmitDto submitDto) {
|
||||||
|
|
||||||
TdQuestionTest questionTest = new TdQuestionTest();
|
TdQuestionTest questionTest = new TdQuestionTest();
|
||||||
BeanUtils.copyProperties(submitDto,questionTest);
|
BeanUtils.copyProperties(submitDto, questionTest);
|
||||||
questionTest.setUserId(SecurityUtil.getUserId())
|
questionTest.setUserId(SecurityUtil.getUserId())
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
|
|
||||||
return this.save(questionTest);
|
return questionTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TestTotalVo testTotal(TestQueryDto queryDto) {
|
||||||
|
TestTotalVo testTotalVo = new TestTotalVo();
|
||||||
|
LambdaQueryWrapper<TdQuestionTest> queryWrapper = new LambdaQueryWrapper<TdQuestionTest>()
|
||||||
|
.eq(TdQuestionTest::getCarTypeId, queryDto.getCarTypeId())
|
||||||
|
.eq(TdQuestionTest::getSubject, queryDto.getSubject())
|
||||||
|
.eq(TdQuestionTest::getUserId, SecurityUtil.getUserId())
|
||||||
|
.orderByDesc(TdQuestionTest::getCreateTime);
|
||||||
|
|
||||||
|
List<TdQuestionTest> list = this.list(queryWrapper);
|
||||||
|
Long passNum = list.stream().filter(s -> s.getScore() >= 90).count();
|
||||||
|
testTotalVo.setTestNum(list.size())
|
||||||
|
.setPassNum(passNum.intValue());
|
||||||
|
//取最近的五次
|
||||||
|
if (CollectionUtil.isNotEmpty(list) && list.size() > 5) {
|
||||||
|
list = list.subList(0, 5);
|
||||||
|
}
|
||||||
|
List<TdQuestionTest> recentTestList = CollectionUtil.reverse(list);
|
||||||
|
//最近五次的平均分
|
||||||
|
OptionalDouble averaged = recentTestList.stream().mapToInt(TdQuestionTest::getScore).average();
|
||||||
|
Integer average = 0;
|
||||||
|
if (averaged.isPresent()){
|
||||||
|
Double averageScore = averaged.getAsDouble();
|
||||||
|
average = averageScore.intValue();
|
||||||
|
}
|
||||||
|
testTotalVo.setRecentTestList(recentTestList)
|
||||||
|
.setRecentAverageScore(average);
|
||||||
|
return testTotalVo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.jwl.driver.server.service.impl;
|
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProject;
|
|
||||||
import com.jwl.driver.server.mapper.TdTestProjectMapper;
|
|
||||||
import com.jwl.driver.server.service.ITdTestProjectService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 考试项目表; 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TdTestProjectServiceImpl extends ServiceImpl<TdTestProjectMapper, TdTestProject> implements ITdTestProjectService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.jwl.driver.server.service.impl;
|
|
||||||
|
|
||||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
|
||||||
import com.jwl.driver.server.mapper.TdTestProjectVideosMapper;
|
|
||||||
import com.jwl.driver.server.service.ITdTestProjectVideosService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 视频标识表; 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TdTestProjectVideosServiceImpl extends ServiceImpl<TdTestProjectVideosMapper, TdTestProjectVideos> implements ITdTestProjectVideosService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -89,7 +89,7 @@ public class MemberVo {
|
||||||
* 会员描述
|
* 会员描述
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("会员描述")
|
@ApiModelProperty("会员描述")
|
||||||
private String desc;
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否生效
|
* 是否生效
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.jwl.driver.server.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.jwl.driver.server.entity.TdVideos;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 考试项目表;
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("考试项目出参")
|
||||||
|
public class ProjectVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试项目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考试项目")
|
||||||
|
private Integer projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属科目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("所属科目")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型标识")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾驶类型,手动挡,自动挡,A2:B2等(在字典表里配置)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("驾驶类型")
|
||||||
|
private String driveType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生效
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否生效")
|
||||||
|
private String isActive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示序号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("显示序号")
|
||||||
|
private Integer showOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片url
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("图片url")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty("视频列表")
|
||||||
|
private List<TdVideos> videoList;
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.jwl.driver.server.vo;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹林
|
||||||
|
* @description 考试成绩统计出参
|
||||||
|
* @create 2023/8/21 0:39
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("考试成绩统计出参")
|
||||||
|
public class TestTotalVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考试次数")
|
||||||
|
private Integer testNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("合格次数")
|
||||||
|
private Integer passNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近考试平均得分(超过五次按最近五次计算)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("最近考试平均得分(超过五次按最近五次计算)")
|
||||||
|
private Integer recentAverageScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近考试情况(超过五次返回最近五次)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("最近考试情况(超过五次返回最近五次)")
|
||||||
|
private List<TdQuestionTest> recentTestList;
|
||||||
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
tm.DURATION,
|
tm.DURATION,
|
||||||
tm.SUBJECTS,
|
tm.SUBJECTS,
|
||||||
tm.UNIT,
|
tm.UNIT,
|
||||||
tm.DESC,
|
tm.DESCRIPTION,
|
||||||
tm.IS_ACTIVE
|
tm.IS_ACTIVE
|
||||||
from
|
from
|
||||||
td_member tm
|
td_member tm
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
tm.DURATION,
|
tm.DURATION,
|
||||||
tm.SUBJECTS,
|
tm.SUBJECTS,
|
||||||
tm.UNIT,
|
tm.UNIT,
|
||||||
tm.DESC,
|
tm.DESCRIPTION,
|
||||||
tm.IS_ACTIVE
|
tm.IS_ACTIVE
|
||||||
from
|
from
|
||||||
td_sys_user_member tsum
|
td_sys_user_member tsum
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.jwl.driver.server.mapper.TdTestProjectMapper">
|
<mapper namespace="com.jwl.driver.server.mapper.TdProjectMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,5 +0,0 @@
|
||||||
<?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="com.jwl.driver.server.mapper.TdTestProjectVideosMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue