mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-08 02:16:49 +08:00
调试修复课程状态
This commit is contained in:
@@ -28,7 +28,17 @@ public class StudyExamApi extends ApiBaseController{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IStudyExamService sexamService;
|
IStudyExamService sexamService;
|
||||||
|
|
||||||
|
/**2024.04.24
|
||||||
|
* 矫正学员课程进度及完成状态
|
||||||
|
* */
|
||||||
|
@GetMapping("/correctStstus")
|
||||||
|
public void correctStstus(){
|
||||||
|
log.info("---------矫正学员课程进度及完成状态--correctStstus---开始-----");
|
||||||
|
sexamService.correctStstus();
|
||||||
|
log.info("---------矫正学员课程进度及完成状态--correctStstus---结束-----");
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public JsonResponse<StudyExam> save(@RequestBody StudyExam exam){
|
public JsonResponse<StudyExam> save(@RequestBody StudyExam exam){
|
||||||
if(StringUtils.isBlank(exam.getCourseId())) {
|
if(StringUtils.isBlank(exam.getCourseId())) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.xboe.school.study.dao;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
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.StudyCourse;
|
||||||
import com.xboe.school.study.entity.StudyCourseItem;
|
import com.xboe.school.study.entity.StudyCourseItem;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Repository
|
@Repository
|
||||||
public class StudyCourseDao extends BaseDao<StudyCourse> {
|
public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||||
|
|
||||||
@@ -39,17 +41,19 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
|||||||
//以下注意,float类型,是否等于100对应
|
//以下注意,float类型,是否等于100对应
|
||||||
float percent=n*100/total;
|
float percent=n*100/total;
|
||||||
if(n>=total) {
|
if(n>=total) {
|
||||||
|
log.info(" 100进度 CourseId = " + courseId + " , StudyId = " + studyId + " , total = " + total + ",已完成 = " + n);
|
||||||
//自主报名的课程,代表学习完成
|
//自主报名的课程,代表学习完成
|
||||||
super.updateMultiFieldById(studyId,
|
// super.updateMultiFieldById(studyId,
|
||||||
UpdateBuilder.create("progress",100f),
|
// UpdateBuilder.create("progress",100f),
|
||||||
UpdateBuilder.create("lastTime",now),
|
// UpdateBuilder.create("lastTime",now),
|
||||||
UpdateBuilder.create("finishTime",now),
|
// UpdateBuilder.create("finishTime",now),
|
||||||
UpdateBuilder.create("status",StudyCourse.STATUS_FINISH));
|
// UpdateBuilder.create("status",StudyCourse.STATUS_FINISH));
|
||||||
}else {
|
}else {
|
||||||
super.updateMultiFieldById(studyId,
|
log.info("进度=" + percent + " ,CourseId = " + courseId + " , StudyId = " + studyId + " , total = " + total + ",已完成 = " + n);
|
||||||
UpdateBuilder.create("progress",percent),
|
// super.updateMultiFieldById(studyId,
|
||||||
UpdateBuilder.create("lastTime",LocalDateTime.now()),
|
// UpdateBuilder.create("progress",percent),
|
||||||
UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING));
|
// 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.core.orm.BaseDao;
|
||||||
import com.xboe.school.study.entity.StudyExam;
|
import com.xboe.school.study.entity.StudyExam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class StudyExamDao extends BaseDao<StudyExam> {
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
List<StudyExam> getByStudyIdAndContentId(String studyId,String contentId);
|
List<StudyExam> getByStudyIdAndContentId(String studyId,String contentId);
|
||||||
|
|
||||||
|
void correctStstus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
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.entity.StudyExam;
|
||||||
import com.xboe.school.study.service.IStudyExamService;
|
import com.xboe.school.study.service.IStudyExamService;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class StudyExamServiceImpl implements IStudyExamService{
|
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));
|
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