Compare commits

..

5 Commits

Author SHA1 Message Date
670788339
52cd846750 日志 2024-09-02 15:22:01 +08:00
670788339
89fb61b9d0 日志 2024-09-02 15:15:59 +08:00
670788339
e67b2db8df 日志 2024-09-02 14:46:58 +08:00
670788339
66225736e6 Keyword 日志 2024-09-02 12:02:07 +08:00
670788339
ee93a0c0dc Keyword null显示'' 2024-09-02 11:49:11 +08:00
13 changed files with 55 additions and 56 deletions

View File

@@ -12,10 +12,13 @@ import com.xboe.module.dict.entity.DictDto;
import com.xboe.module.exam.entity.ExamTest; import com.xboe.module.exam.entity.ExamTest;
import com.xboe.school.study.entity.StudyCourse; import com.xboe.school.study.entity.StudyCourse;
import com.xboe.system.user.dao.UserDao; import com.xboe.system.user.dao.UserDao;
import com.xboe.system.user.entity.User;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;

View File

@@ -83,13 +83,8 @@ 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
private Integer status; private Integer status;

View File

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

View File

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

View File

@@ -142,6 +142,9 @@ public class AloneExamServiceImpl implements IAloneExamService{
if(StringUtils.isNotBlank(aea.getTestId())) { if(StringUtils.isNotBlank(aea.getTestId())) {
query.addFilter(FieldFilters.eq("testId",aea.getTestId())); query.addFilter(FieldFilters.eq("testId",aea.getTestId()));
} }
if(StringUtils.isNotBlank(aea.getTestName())) {
query.addFilter(FieldFilters.eq("testName",aea.getTestName()));
}
if(StringUtils.isNotBlank(aea.getAid())) { if(StringUtils.isNotBlank(aea.getAid())) {
query.addFilter(FieldFilters.eq("aid",aea.getAid())); query.addFilter(FieldFilters.eq("aid",aea.getAid()));
} }

View File

@@ -95,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
@Override @Override
public Boolean has(String paperId) { public Boolean has(String paperId) {
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId),FieldFilters.eq("deleted", false)); ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId));
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId)); //String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
if(et==null){ if(et==null){
return true; return true;

View File

@@ -11,7 +11,6 @@ import com.xboe.api.vo.*;
import com.xboe.module.course.vo.TeacherVo; import com.xboe.module.course.vo.TeacherVo;
import com.xboe.module.usergroup.entity.UserGroupItem; import com.xboe.module.usergroup.entity.UserGroupItem;
import com.xboe.module.usergroup.service.IUserGroupService; import com.xboe.module.usergroup.service.IUserGroupService;
import com.xboe.school.study.dao.StudyCourseDao;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -66,9 +65,7 @@ import javax.servlet.http.HttpServletRequest;
@RestController @RestController
@RequestMapping(value="/xboe/school/study/course") @RequestMapping(value="/xboe/school/study/course")
public class StudyCourseApi extends ApiBaseController{ public class StudyCourseApi extends ApiBaseController{
@Autowired @Autowired
IStudyCourseService service; IStudyCourseService service;
@@ -532,7 +529,7 @@ public class StudyCourseApi extends ApiBaseController{
* @return * @return
*/ */
@PostMapping("/study-video-time") @PostMapping("/study-video-time")
public JsonResponse<Boolean> study(String itemId,Integer videoTime,String contentId , String courseId,Float progressVideo){ public JsonResponse<Boolean> study(String studyId,String itemId,Integer videoTime){
if(StringUtils.isBlank(itemId)){ if(StringUtils.isBlank(itemId)){
return error("参数错误"); return error("参数错误");
@@ -542,10 +539,7 @@ 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);
@@ -696,10 +690,9 @@ public class StudyCourseApi extends ApiBaseController{
return error("查询失败",e.getMessage()); return error("查询失败",e.getMessage());
} }
} }
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST}) @RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId, HttpServletRequest request){ public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId){
if(StringUtils.isBlank(studyId)){ if(StringUtils.isBlank(studyId)){
return error("无学习信息"); return error("无学习信息");
} }

View File

@@ -7,7 +7,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.xboe.api.ThirdApi; import com.xboe.api.ThirdApi;
import com.xboe.school.study.dao.StudyCourseDao;
import com.xboe.school.study.entity.StudyCourse; import com.xboe.school.study.entity.StudyCourse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -33,8 +32,6 @@ import javax.servlet.http.HttpServletRequest;
@RestController @RestController
@RequestMapping(value="/xboe/school/study/exam") @RequestMapping(value="/xboe/school/study/exam")
public class StudyExamApi extends ApiBaseController{ public class StudyExamApi extends ApiBaseController{
@Autowired
StudyCourseDao scDao;
@Autowired @Autowired
IStudyExamService sexamService; IStudyExamService sexamService;

View File

@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
LocalDateTime ldt=LocalDateTime.now(); LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(assess.getStudyId()); sci.setStudyId(assess.getStudyId());
sci.setContentId(assess.getContentId()); sci.setContentId(assess.getContentId());
sci.setContentName("评估"); //sci.setContentName(homework.getContentName());
sci.setCourseId(assess.getCourseId()); sci.setCourseId(assess.getCourseId());
//sci.setCsectionId(homework.getCsectionId()); //sci.setCsectionId(homework.getCsectionId());
sci.setProgress(100);//直接设置为学习完成 sci.setProgress(100);//直接设置为学习完成

View File

@@ -82,7 +82,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
LocalDateTime ldt=LocalDateTime.now(); LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(exam.getStudyId()); sci.setStudyId(exam.getStudyId());
sci.setContentId(exam.getContentId()); sci.setContentId(exam.getContentId());
sci.setContentName("考试"); //sci.setContentName(homework.getContentName());
sci.setCourseId(exam.getCourseId()); sci.setCourseId(exam.getCourseId());
//sci.setCsectionId(homework.getCsectionId()); //sci.setCsectionId(homework.getCsectionId());
sci.setProgress(prog);//直接设置为学习完成 sci.setProgress(prog);//直接设置为学习完成

View File

@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
LocalDateTime ldt=LocalDateTime.now(); LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(homework.getStudyId()); sci.setStudyId(homework.getStudyId());
sci.setContentId(homework.getContentId()); sci.setContentId(homework.getContentId());
sci.setContentName(homework.getHwName()); //sci.setContentName(homework.getContentName());
sci.setCourseId(homework.getCourseId()); sci.setCourseId(homework.getCourseId());
//sci.setCsectionId(homework.getCsectionId()); //sci.setCsectionId(homework.getCsectionId());
sci.setProgress(100);//直接设置为学习完成 sci.setProgress(100);//直接设置为学习完成
@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
//只是保留一条作业记录,不再保存多条记录了 //只是保留一条作业记录,不再保存多条记录了
//dao.save(homework); //dao.save(homework);
//设置id。然后进行悠 //设置id。然后进行悠
homework.setId(homework.getStudyItemId()); homework.setId(obj.toString());
dao.update(homework); dao.update(homework);
} }
} }

View File

@@ -182,7 +182,7 @@ public class StudyServiceImpl implements IStudyService{
if(StringUtils.isNotBlank(name)) { if(StringUtils.isNotBlank(name)) {
query.addFilter(FieldFilters.eq("aname", name)); query.addFilter(FieldFilters.eq("aname", name));
} }
int pageIndex2 = (pageIndex-1)*10; int pageIndex2 = pageIndex-1;
if(status!=null) { if(status!=null) {
if(status==3) { if(status==3) {
query.addFilter(FieldFilters.eq("status", 2)); query.addFilter(FieldFilters.eq("status", 2));
@@ -193,16 +193,16 @@ public class StudyServiceImpl implements IStudyService{
}else if (status == 1) { }else if (status == 1) {
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " + String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" + " left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" + " where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
" select item.study_id from boe_study_course_item item " + " select item.study_id from boe_study_course_item item " +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
" ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";"; " ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";";
String sql2 = "select count(*) as total from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " + String sql2 = "select count(*) as total from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" + " left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" + " where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
" select item.study_id from boe_study_course_item item " + " select item.study_id from boe_study_course_item item " +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
" ) group by bsc.id) as total"; " ) group by bsc.id) as total";
log.info("资源完成情况未开始sql"+sql); log.info("资源完成情况未开始sql"+sql);
List<Object[]> list = scDao.sqlFindList(sql); List<Object[]> list = scDao.sqlFindList(sql);
@@ -224,22 +224,46 @@ public class StudyServiceImpl implements IStudyService{
return pageList; return pageList;
} }
} }
// String sql = "select * from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
// " UNION ALL " +
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
// " select bsc.id from boe_study_course bsc " +
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
// " )group by bsc.id) a group by a.id limit "+ pageIndex+","+ pageSize+";";
// String sql2 = "select count(*) from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
// " UNION ALL " +
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
// " select bsc.id from boe_study_course bsc " +
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
// " )group by bsc.id) a group by a.id";
String sql = "select a.id, a.course_id, a.course_name, a.aname, " + String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " + "IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " + "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
"left join " + "left join " +
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " + "(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " + "from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " + "where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
"on a.course_id = b.course_id and a.id = b.id " + "on a.course_id = b.course_id and a.id = b.id " +
"group by a.id limit "+ pageIndex2+","+ pageSize+";"; "group by a.id limit "+ pageIndex2+","+ pageSize+";";
String sql2 = "select count(*) as total from (select a.id, a.course_id, a.course_name, a.aname, " + String sql2 = "select count(*) as total from (select a.id, a.course_id, a.course_name, a.aname, " +
"IFNULL(b.finish_time, 0) as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " + "IFNULL(b.finish_time, 0) as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " + "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
"left join " + "left join " +
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " + "(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " + "from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " + "where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
"on a.course_id = b.course_id and a.id = b.id " + "on a.course_id = b.course_id and a.id = b.id " +
"group by a.id) as total"; "group by a.id) as total";
log.info("资源完成情况全部sql"+sql); log.info("资源完成情况全部sql"+sql);