Compare commits

...

12 Commits

Author SHA1 Message Date
zhaolongfei
fc98025a3a 视频暂存为空判断 2024-07-29 19:21:26 +08:00
zhaolongfei
e2c697f860 修改bug 2024-06-19 16:43:08 +08:00
zhaolongfei
c6a785bb4f 添加视频暂存点 2024-06-19 13:55:54 +08:00
zhaolongfei
8567fa9ecc content表添加processVideo字段,添加判断 2024-06-18 13:47:46 +08:00
zhaolongfei
359b66e48a content表添加processVideo字段,添加判断 2024-06-18 13:31:39 +08:00
zhaolongfei
8125a6bd77 content表添加processVideo字段,添加判断 2024-06-18 11:12:08 +08:00
zhaolongfei
9b37e8a73d content表添加processVideo字段,添加判断 2024-06-18 09:09:52 +08:00
zhaolongfei
2fa3378e94 content表添加processVideo字段 2024-06-17 16:16:29 +08:00
zhaolongfei
0b7784779f item添加processVideo字段 2024-06-13 15:28:13 +08:00
zhaolongfei
e03118275d 修改项目下考试结束时间并未生效修复 2024-06-06 18:10:28 +08:00
zhaolongfei
1b1cb17861 Merge branch 'zcwy0525-llf' into zcwy0606-llf 2024-06-06 16:35:40 +08:00
zhaolongfei
a35c1faa49 学员在线删除失败的bug修复 2024-06-06 16:32:33 +08:00
7 changed files with 65 additions and 14 deletions

View File

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

View File

@@ -82,4 +82,7 @@ public interface ICourseContentService{
* @return
*/
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;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.Resource;
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
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
@Transactional
public void updateName(String id, String name) {

View File

@@ -2,6 +2,7 @@ package com.xboe.module.exam.api;
import javax.annotation.Resource;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -81,12 +82,25 @@ public class ExamTestApi extends ApiBaseController {
if(StringUtil.isBlank(examTest.getTestName())){
return badRequest("标题为空");
}
// 确保examTest有一个有效的主键ID如果适用
// 这取决于您的业务逻辑是否允许更新主键
// 通常,更新操作不会改变主键
if (examTest.getId() == null) {
return badRequest("更新操作需要有效的主键ID");
}
try {
examTestService.update(examTest);
return success(examTest);
} catch (ConstraintViolationException e) {
// 捕获约束违反异常,并返回一个更具体的错误消息
log.error("修改失败,违反了约束条件", e);
return error("修改失败,违反了约束条件(可能是主键已存在)");
} catch (Exception e) {
log.error("修改失败",e);
return error("修改失败",e.getMessage());
// 捕获其他所有异常
log.error("修改失败", e);
return error("修改失败", e.getMessage());
}
}
/**、

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;
/**
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
/**
* 考试时长 分钟
* */
@Column(name = "test_duration",nullable = false)
@Column(name = "test_duration")
private Integer testDuration;
/**
* 显示解析
@@ -101,19 +101,19 @@ public class ExamTest extends BaseEntity {
/**
* 试卷的ID
*/
@Column(name = "paper_id",nullable = false,length=20)
@Column(name = "paper_id",length=20)
private String paperId;
/**
* 考试的类型
* */
@Column(name = "test_type",nullable = false)
@Column(name = "test_type")
private Integer testType;
/**
* 发布状态 ,是否已发布
*/
@Column(name = "published",length = 1,nullable = false)
@Column(name = "published",length = 1)
private Boolean published;
/**
* 发布时间
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
/**
* 范围1表独立使用2表课程内部
* */
@Column(name = "range_type",nullable = false)
@Column(name = "range_type")
private Integer rangeType;
/**
@@ -173,9 +173,11 @@ public class ExamTest extends BaseEntity {
/**启用的,上架*/
@Column(name = "enabled", nullable = false, length = 1)
@Column(name = "enabled", length = 1)
private Boolean enabled;
@Transient
private String paperName;
}

View File

@@ -70,7 +70,18 @@ public class ExamTestServiceImpl implements IExamTestService {
@Override
public void update(ExamTest examTest) {
examTestDao.update(examTest);
if (examTest.getId() == null) {
throw new IllegalArgumentException("ID must not be null");
}
String sql = "update boe_exam_test set arrange = "+ examTest.getArrange() +", deadline_time = '"+examTest.getDeadlineTime() +"' , " +
"entrance_time = '"+examTest.getEntranceTime() +"' , paper_id = "+examTest.getPaperId() +",pass_line = "+examTest.getPassLine() +
", percent_score = "+examTest.getPercentScore() +" ,publish_time = '"+examTest.getPublishTime()+"' , published = "+examTest.getPublished()+
",random_count = "+examTest.getRandomCount()+" ,random_mode = "+examTest.getRandomMode()+",range_type = "+examTest.getRangeType() +
",scoring_type = "+examTest.getScoringType() +",show_analysis="+examTest.getShowAnalysis() +",show_answer = "+examTest.getShowAnswer() +
",test_duration = "+examTest.getTestDuration() +",test_name = '"+examTest.getTestName() +"',test_remark= '"+examTest.getTestRemark() +
"',test_type= '"+examTest.getTestType() +"' ,test_up = '"+examTest.getTestUp() +"' ,test_front= '"+examTest.getTestFront() +
"',times = '"+examTest.getTimes() +"' where id = "+examTest.getId()+"";
examTestDao.sqlUpdate(sql);
}
@Override

View File

@@ -529,7 +529,7 @@ public class StudyCourseApi extends ApiBaseController{
* @return
*/
@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)){
return error("参数错误");
@@ -539,7 +539,10 @@ public class StudyCourseApi extends ApiBaseController{
}
//检查是否已存在
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);
}catch(Exception e) {
log.error("记录最后学习时间错误",e);