From 0df53f85ccbd7dc6ec7aec10a0d7982caa62932d Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 14:12:03 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=9Acsectionid=20=E5=9C=A8boe=5Fcourse=5Fsection=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E8=A6=81=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=8E=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xboe/module/course/dao/CourseContentDao.java | 6 ++++++ .../main/java/com/xboe/school/study/dao/StudyCourseDao.java | 3 ++- .../school/study/service/impl/StudyExamServiceImpl.java | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java index d138889b..5f684030 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java @@ -13,4 +13,10 @@ public class CourseContentDao extends BaseDao { int sum=count(hql, courseId); return sum; } + + public int getCount(String courseId) { + String hql="SELECT count(*) from boe_base.boe_course_content c left join boe_base.boe_course_section s on c.csection_id = s.id where c.course_id = ?1 and c.deleted =0 and s.id is not null"; + int count=count(hql, courseId); + return count; + } } diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java index 2de719e8..2913d1a9 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java @@ -32,7 +32,8 @@ public class StudyCourseDao extends BaseDao { //已完成的内容 int n=scItemDao.count(FieldFilters.eq("studyId",studyId),FieldFilters.eq("status",StudyCourseItem.STATUS_FINISH)); if(total==null) { - total=courseContentDao.count(FieldFilters.eq("courseId", courseId),FieldFilters.eq("deleted",false)); +// total=courseContentDao.count(FieldFilters.eq("courseId", courseId),FieldFilters.eq("deleted",false)); + total = courseContentDao.getCount(courseId); } //以下注意,float类型,是否等于100对应 diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index 6daf2dc7..af22a33a 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -71,7 +71,8 @@ public class StudyExamServiceImpl implements IStudyExamService{ //更新最终成绩 //if(exam.get) //检查是否全部学习完成 - int totalContent=courseContentDao.count(FieldFilters.eq("courseId", exam.getCourseId()),FieldFilters.eq("deleted",false)); +// int totalContent=courseContentDao.count(FieldFilters.eq("courseId", exam.getCourseId()),FieldFilters.eq("deleted",false)); + int totalContent = courseContentDao.getCount(exam.getCourseId()); scDao.finishCheck(exam.getStudyId(),exam.getCourseId(),totalContent); }else { exam.setStudyItemId(obj.toString());//此项就是学习条目的id From d5becfcae0fa808b0247d58636ca22cdf79c9031 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 17:45:39 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xboe/school/study/api/StudyExamApi.java | 12 +++++++++- .../xboe/school/study/dao/StudyCourseDao.java | 22 +++++++++++-------- .../xboe/school/study/dao/StudyExamDao.java | 8 +++++++ .../study/service/IStudyExamService.java | 2 ++ .../service/impl/StudyExamServiceImpl.java | 16 ++++++++++++++ 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyExamApi.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyExamApi.java index 36747cde..bdc697d6 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyExamApi.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyExamApi.java @@ -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 save(@RequestBody StudyExam exam){ if(StringUtils.isBlank(exam.getCourseId())) { diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java index 2913d1a9..291285fc 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java @@ -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 { @@ -39,17 +41,19 @@ public class StudyCourseDao extends BaseDao { //以下注意,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)); } } diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java index 78697d50..1b7eb5f8 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java @@ -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 { + + public List getAllStudyExamByStudyId() { + String hql1 = "SELECT course_id,study_id,student_id FROM boe_study_exam GROUP BY study_id"; + List listByHql = super.findListByHql(hql1); + return listByHql; + } } diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/IStudyExamService.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/IStudyExamService.java index adeaeebc..d3c900a2 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/IStudyExamService.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/IStudyExamService.java @@ -29,4 +29,6 @@ public interface IStudyExamService { * @return */ List getByStudyIdAndContentId(String studyId,String contentId); + + void correctStstus(); } diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index af22a33a..2713f795 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -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 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); + } + + + } + } From dcecd846d648dab2cb02b747164c3136e59e896f Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 17:58:16 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xboe/school/study/dao/StudyExamDao.java | 2 +- .../study/service/impl/StudyExamServiceImpl.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java index 1b7eb5f8..f1bb62e8 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java @@ -11,7 +11,7 @@ import java.util.List; public class StudyExamDao extends BaseDao { public List getAllStudyExamByStudyId() { - String hql1 = "SELECT course_id,study_id,student_id FROM boe_study_exam GROUP BY study_id"; + String hql1 = "SELECT courseId,studyId,studentId FROM boe_study_exam GROUP BY study_id"; List listByHql = super.findListByHql(hql1); return listByHql; } diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index 2713f795..a247a654 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -6,6 +6,8 @@ import java.util.List; import javax.annotation.Resource; import javax.transaction.Transactional; +import com.xboe.core.orm.QueryBuilder; +import com.xboe.system.user.entity.Message; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -110,7 +112,19 @@ public class StudyExamServiceImpl implements IStudyExamService{ @Override public void correctStstus() { - List list = dao.getAllStudyExamByStudyId(); + List list = null; + try { + list = dao.getAllStudyExamByStudyId(); + } catch (Exception exception) { + exception.printStackTrace(); + } + + QueryBuilder builder = QueryBuilder.from(StudyExam.class); + builder.addGroupBy("studyId"); + builder.addOrder(OrderCondition.desc("msgTime")); + List list1 = dao.findList(builder.builder()); + + log.info("QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0)); 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()); From 57a6bf6fa4438ebc9379fca7d80e4dd8a735d300 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:01:45 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xboe/school/study/service/impl/StudyExamServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index a247a654..c78cc438 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -115,17 +115,16 @@ public class StudyExamServiceImpl implements IStudyExamService{ List list = null; try { list = dao.getAllStudyExamByStudyId(); + log.info("list.size = " + list.size() + ",0 = " + list.get(0)); } catch (Exception exception) { exception.printStackTrace(); } QueryBuilder builder = QueryBuilder.from(StudyExam.class); builder.addGroupBy("studyId"); - builder.addOrder(OrderCondition.desc("msgTime")); List list1 = dao.findList(builder.builder()); log.info("QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0)); - 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()); From 52adf9d3fbbf0b3090e51dcb51c435711095b7c1 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:28:56 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../study/service/impl/StudyExamServiceImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index c78cc438..8d3bf4bd 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -115,18 +115,22 @@ public class StudyExamServiceImpl implements IStudyExamService{ List list = null; try { list = dao.getAllStudyExamByStudyId(); - log.info("list.size = " + list.size() + ",0 = " + list.get(0)); + log.info("------------list.size = " + list.size() + ",0 = " + list.get(0)); } catch (Exception exception) { exception.printStackTrace(); } - QueryBuilder builder = QueryBuilder.from(StudyExam.class); - builder.addGroupBy("studyId"); - List list1 = dao.findList(builder.builder()); + try { + QueryBuilder builder = QueryBuilder.from(StudyExam.class); + builder.addGroupBy("studyId"); + List list1 = dao.findList(builder.builder()); + log.info("------------QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0)); + } catch (Exception exception) { + exception.printStackTrace(); + } - log.info("QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0)); for(StudyExam item : list){ - log.info("CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId()); + log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId()); int totalContent = courseContentDao.getCount(item.getCourseId()); scDao.finishCheck(item.getStudyId(),item.getCourseId(),totalContent); } From d7262b47ab897bf49c9bfc27a97206bb6c674403 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:35:00 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StudyExamServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index 8d3bf4bd..4b991555 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -116,6 +116,12 @@ public class StudyExamServiceImpl implements IStudyExamService{ try { 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); + } } catch (Exception exception) { exception.printStackTrace(); } @@ -125,15 +131,17 @@ public class StudyExamServiceImpl implements IStudyExamService{ builder.addGroupBy("studyId"); List list1 = dao.findList(builder.builder()); log.info("------------QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0)); + + for(StudyExam item : list1){ + log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId()); + int totalContent = courseContentDao.getCount(item.getCourseId()); + scDao.finishCheck(item.getStudyId(),item.getCourseId(),totalContent); + } } catch (Exception exception) { exception.printStackTrace(); } - 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); - } + } From 3020673bac781f8cefaabf86563b2d82c0c9b9bd Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:35:45 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/xboe/school/study/dao/StudyExamDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java index f1bb62e8..b7c56aea 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyExamDao.java @@ -11,7 +11,7 @@ import java.util.List; public class StudyExamDao extends BaseDao { public List getAllStudyExamByStudyId() { - String hql1 = "SELECT courseId,studyId,studentId FROM boe_study_exam GROUP BY study_id"; + String hql1 = "SELECT courseId,studyId,studentId FROM StudyExam GROUP BY studyId"; List listByHql = super.findListByHql(hql1); return listByHql; } From 47f624c88e28d9ca9af9fd37d0dc760796c1b50f Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:42:47 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../school/study/service/impl/StudyExamServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index 4b991555..399b18b3 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -112,7 +112,7 @@ public class StudyExamServiceImpl implements IStudyExamService{ @Override public void correctStstus() { - List list = null; + /* List list = null; try { list = dao.getAllStudyExamByStudyId(); log.info("------------list.size = " + list.size() + ",0 = " + list.get(0)); @@ -124,7 +124,7 @@ public class StudyExamServiceImpl implements IStudyExamService{ } } catch (Exception exception) { exception.printStackTrace(); - } + }*/ try { QueryBuilder builder = QueryBuilder.from(StudyExam.class); @@ -135,10 +135,13 @@ public class StudyExamServiceImpl implements IStudyExamService{ for(StudyExam item : list1){ log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId()); int totalContent = courseContentDao.getCount(item.getCourseId()); + log.info("----------准备判断进度-------totalContent = " + totalContent); scDao.finishCheck(item.getStudyId(),item.getCourseId(),totalContent); + log.info("------判断进度完毕----------------------"); } } catch (Exception exception) { exception.printStackTrace(); + log.info("------异常----------------------:" +exception.getMessage()); } From b1deabe7be99d6994833b621be390cc6b5935dbc Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:49:52 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xboe/module/course/dao/CourseContentDao.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java index 5f684030..b945ea63 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/dao/CourseContentDao.java @@ -15,7 +15,8 @@ public class CourseContentDao extends BaseDao { } public int getCount(String courseId) { - String hql="SELECT count(*) from boe_base.boe_course_content c left join boe_base.boe_course_section s on c.csection_id = s.id where c.course_id = ?1 and c.deleted =0 and s.id is not null"; +// String hql="SELECT count(*) from boe_course_content c left join boe_base.boe_course_section s on c.csection_id = s.id where c.course_id = ?1 and c.deleted =0 and s.id is not null"; + String hql="SELECT count(*) from CourseContent c left join CourseSection s on c.csectionId = s.id where c.courseId = ?1 and c.deleted =0 and s.id is not null"; int count=count(hql, courseId); return count; } From 44c0bf2e444d035d93284ba825e3f0b8356299cc Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 18:57:48 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xboe/school/study/dao/StudyCourseDao.java | 39 +++++++++++++++++-- .../service/impl/StudyExamServiceImpl.java | 4 +- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java index 291285fc..a4a7836f 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java @@ -41,22 +41,53 @@ public class StudyCourseDao extends BaseDao { //以下注意,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)); + }else { + super.updateMultiFieldById(studyId, + UpdateBuilder.create("progress",percent), + UpdateBuilder.create("lastTime",LocalDateTime.now()), + UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING)); + } + } + + public void finishCheck1(String studyId,String courseId,Integer total){ + LocalDateTime now=LocalDateTime.now(); + //已完成的内容 + int n=scItemDao.count(FieldFilters.eq("studyId",studyId),FieldFilters.eq("status",StudyCourseItem.STATUS_FINISH)); + if(total==null) { +// total=courseContentDao.count(FieldFilters.eq("courseId", courseId),FieldFilters.eq("deleted",false)); + total = courseContentDao.getCount(courseId); + } + if (total != 0){ + + //以下注意,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)); - }else { - log.info("进度=" + percent + " ,CourseId = " + courseId + " , StudyId = " + studyId + " , total = " + total + ",已完成 = " + n); + }else { + 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)); + } + + }else { + log.info("----------分母等于0-------total = " + total); } + } - /** * 仅仅是更新学习进度,不做其它的处理 * @param studyId diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java index 399b18b3..1b1a764a 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyExamServiceImpl.java @@ -136,8 +136,8 @@ public class StudyExamServiceImpl implements IStudyExamService{ log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId()); int totalContent = courseContentDao.getCount(item.getCourseId()); log.info("----------准备判断进度-------totalContent = " + totalContent); - scDao.finishCheck(item.getStudyId(),item.getCourseId(),totalContent); - log.info("------判断进度完毕----------------------"); + scDao.finishCheck1(item.getStudyId(),item.getCourseId(),totalContent); + log.info("----------判断进度完毕----------------------"); } } catch (Exception exception) { exception.printStackTrace(); From 19957bc674cf80b185767fd3f86de3904b1f2fa7 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Wed, 24 Apr 2024 19:15:26 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xboe/school/study/dao/StudyCourseDao.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java index a4a7836f..916f9be7 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/StudyCourseDao.java @@ -70,17 +70,17 @@ public class StudyCourseDao extends BaseDao { 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 { 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)); + super.updateMultiFieldById(studyId, + UpdateBuilder.create("progress",percent), + UpdateBuilder.create("lastTime",LocalDateTime.now()), + UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING)); } }else {