Merge remote-tracking branch 'java-servse-yx/zcwy0606-llf' into zcwy0729-llf

# Conflicts:
#	servers/boe-server-all/src/main/java/com/xboe/module/exam/api/ExamTestApi.java
#	servers/boe-server-all/src/main/java/com/xboe/module/exam/service/impl/ExamTestServiceImpl.java
This commit is contained in:
zhaolongfei
2024-07-29 19:52:50 +08:00
5 changed files with 35 additions and 9 deletions

View File

@@ -84,6 +84,11 @@ public class CourseContent extends BaseEntity {
@Column(name = "duration") @Column(name = "duration")
private Integer duration; private Integer duration;
/**
* 视频播放进度
* */
@Column(name = "progress_video")
private Float progressVideo;
/**用于学习时的状态显示,非存储字段*/ /**用于学习时的状态显示,非存储字段*/
@Transient @Transient

View File

@@ -82,4 +82,7 @@ public interface ICourseContentService{
* @return * @return
*/ */
CourseAssess getAssess(String ccid); CourseAssess getAssess(String ccid);
void updateProcessVideo(String contentId, String courseId, Float processVideo);
} }

View File

@@ -1,5 +1,7 @@
package com.xboe.module.course.service.impl; package com.xboe.module.course.service.impl;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
return assess; return assess;
} }
@Override
@Transactional
public void updateProcessVideo(String id, String courseId, Float progressVideo) {
// 处理 processVideo 为 null 的情况
if (progressVideo == null) {
progressVideo = 0.00f;
}
String sql = "UPDATE boe_course_content SET progress_video = "+ progressVideo+" WHERE id = "+ id+" AND course_id = "+ courseId+" ";
ccDao.sqlUpdate(sql);
}
@Override @Override
@Transactional @Transactional
public void updateName(String id, String name) { public void updateName(String id, String name) {

View File

@@ -28,7 +28,7 @@ public class ExamTest extends BaseEntity {
/** /**
* 考试名称 * 考试名称
* */ * */
@Column(name = "test_name",nullable = false,length = 50) @Column(name = "test_name",length = 50)
private String testName; private String testName;
/** /**
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
/** /**
* 考试时长 分钟 * 考试时长 分钟
* */ * */
@Column(name = "test_duration",nullable = false) @Column(name = "test_duration")
private Integer testDuration; private Integer testDuration;
/** /**
* 显示解析 * 显示解析
@@ -107,13 +107,13 @@ public class ExamTest extends BaseEntity {
/** /**
* 考试的类型 * 考试的类型
* */ * */
@Column(name = "test_type",nullable = false) @Column(name = "test_type")
private Integer testType; private Integer testType;
/** /**
* 发布状态 ,是否已发布 * 发布状态 ,是否已发布
*/ */
@Column(name = "published",length = 1,nullable = false) @Column(name = "published",length = 1)
private Boolean published; private Boolean published;
/** /**
* 发布时间 * 发布时间
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
/** /**
* 范围1表独立使用2表课程内部 * 范围1表独立使用2表课程内部
* */ * */
@Column(name = "range_type",nullable = false) @Column(name = "range_type")
private Integer rangeType; private Integer rangeType;
/** /**
@@ -178,4 +178,6 @@ public class ExamTest extends BaseEntity {
@Transient @Transient
private String paperName; private String paperName;
} }

View File

@@ -529,7 +529,7 @@ public class StudyCourseApi extends ApiBaseController{
* @return * @return
*/ */
@PostMapping("/study-video-time") @PostMapping("/study-video-time")
public JsonResponse<Boolean> study(String studyId,String itemId,Integer videoTime){ public JsonResponse<Boolean> study(String itemId,Integer videoTime,String contentId , String courseId,Float progressVideo){
if(StringUtils.isBlank(itemId)){ if(StringUtils.isBlank(itemId)){
return error("参数错误"); return error("参数错误");
@@ -539,7 +539,10 @@ public class StudyCourseApi extends ApiBaseController{
} }
//检查是否已存在 //检查是否已存在
try { try {
studyService.updateLastTime(itemId,videoTime,getCurrent().getAccountId()); studyService.updateLastTime(itemId,videoTime, getCurrent().getAccountId());
if (contentId != null && courseId != null && progressVideo != null){
contentService.updateProcessVideo(contentId, courseId, progressVideo);
}
return success(true); return success(true);
}catch(Exception e) { }catch(Exception e) {
log.error("记录最后学习时间错误",e); log.error("记录最后学习时间错误",e);