mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
调试修复课程状态
This commit is contained in:
@@ -28,7 +28,17 @@ public class StudyExamApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
IStudyExamService sexamService;
|
||||
|
||||
|
||||
/**2024.04.24
|
||||
* 矫正学员课程进度及完成状态
|
||||
* */
|
||||
@GetMapping("/correctStstus")
|
||||
public void correctStstus(){
|
||||
log.info("---------矫正学员课程进度及完成状态--correctStstus---开始-----");
|
||||
sexamService.correctStstus();
|
||||
log.info("---------矫正学员课程进度及完成状态--correctStstus---结束-----");
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public JsonResponse<StudyExam> save(@RequestBody StudyExam exam){
|
||||
if(StringUtils.isBlank(exam.getCourseId())) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xboe.school.study.dao;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -12,6 +13,7 @@ import com.xboe.module.course.dao.CourseContentDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
|
||||
@@ -39,17 +41,19 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
//以下注意,float类型,是否等于100对应
|
||||
float percent=n*100/total;
|
||||
if(n>=total) {
|
||||
log.info(" 100进度 CourseId = " + courseId + " , StudyId = " + studyId + " , total = " + total + ",已完成 = " + n);
|
||||
//自主报名的课程,代表学习完成
|
||||
super.updateMultiFieldById(studyId,
|
||||
UpdateBuilder.create("progress",100f),
|
||||
UpdateBuilder.create("lastTime",now),
|
||||
UpdateBuilder.create("finishTime",now),
|
||||
UpdateBuilder.create("status",StudyCourse.STATUS_FINISH));
|
||||
// super.updateMultiFieldById(studyId,
|
||||
// UpdateBuilder.create("progress",100f),
|
||||
// UpdateBuilder.create("lastTime",now),
|
||||
// UpdateBuilder.create("finishTime",now),
|
||||
// UpdateBuilder.create("status",StudyCourse.STATUS_FINISH));
|
||||
}else {
|
||||
super.updateMultiFieldById(studyId,
|
||||
UpdateBuilder.create("progress",percent),
|
||||
UpdateBuilder.create("lastTime",LocalDateTime.now()),
|
||||
UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING));
|
||||
log.info("进度=" + percent + " ,CourseId = " + courseId + " , StudyId = " + studyId + " , total = " + total + ",已完成 = " + n);
|
||||
// super.updateMultiFieldById(studyId,
|
||||
// UpdateBuilder.create("progress",percent),
|
||||
// UpdateBuilder.create("lastTime",LocalDateTime.now()),
|
||||
// UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ import org.springframework.stereotype.Repository;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class StudyExamDao extends BaseDao<StudyExam> {
|
||||
|
||||
public List<StudyExam> getAllStudyExamByStudyId() {
|
||||
String hql1 = "SELECT course_id,study_id,student_id FROM boe_study_exam GROUP BY study_id";
|
||||
List<StudyExam> listByHql = super.findListByHql(hql1);
|
||||
return listByHql;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface IStudyExamService {
|
||||
* @return
|
||||
*/
|
||||
List<StudyExam> getByStudyIdAndContentId(String studyId,String contentId);
|
||||
|
||||
void correctStstus();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,6 +22,7 @@ import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
import com.xboe.school.study.service.IStudyExamService;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StudyExamServiceImpl implements IStudyExamService{
|
||||
|
||||
@@ -105,4 +107,18 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
return dao.findList(OrderCondition.desc("id"),FieldFilters.eq("studyId", studyId),FieldFilters.eq("contentId", contentId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctStstus() {
|
||||
|
||||
List<StudyExam> list = dao.getAllStudyExamByStudyId();
|
||||
log.info("list.size = " + list.size() + ",0 = " + list.get(0));
|
||||
for(StudyExam item : list){
|
||||
log.info("CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
scDao.finishCheck(item.getStudyId(),item.getCourseId(),totalContent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user