Merge branch 'zcwy0716-llf' into master-0705

This commit is contained in:
nisen
2024-07-26 21:20:05 +08:00

View File

@@ -2,6 +2,7 @@ package com.xboe.school.study.service.impl;
import java.math.BigInteger; import java.math.BigInteger;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -198,12 +199,12 @@ public class StudyServiceImpl implements IStudyService{
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' 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 "+ pageIndex+","+ pageSize+";"; " ) group by bsc.id limit "+ pageIndex+","+ pageSize+";";
String sql2 = "select count(*) 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.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+"' group by item.study_id" + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
" ) group by bsc.id"; " ) 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);
log.info("资源完成情况人数"+list); log.info("资源完成情况人数"+list);
@@ -255,21 +256,24 @@ public class StudyServiceImpl implements IStudyService{
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' 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"; "group by a.id";
String sql2 = "select count(*) " + 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 " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') 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 + "' 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"; "group by a.id) as total";
log.info("资源完成情况全部sql"+sql); log.info("资源完成情况全部sql"+sql);
List<Object[]> list = scDao.sqlFindList(sql); List<Object[]> list = scDao.sqlFindList(sql);
log.info("资源完成情况人数"+list); log.info("资源完成情况人数"+list);
List<StudyCourseItem> item = new ArrayList<>(); List<StudyCourseItem> item = new ArrayList<>();
for (Object[] objs : list) { for (Object[] objs : list) {
StudyCourseItem sc = new StudyCourseItem(); StudyCourseItem sc = new StudyCourseItem();
sc.setFinishTime(LocalDateTime.parse(objs[4].toString())); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime finishTime = LocalDateTime.parse(objs[4].toString(), formatter);
sc.setFinishTime(finishTime);
sc.setProgress(Integer.valueOf(objs[5].toString())); sc.setProgress(Integer.valueOf(objs[5].toString()));
sc.setStatus(Integer.valueOf(objs[6].toString())); sc.setStatus(Integer.valueOf(objs[6].toString()));
sc.setAname(objs[3].toString()); sc.setAname(objs[3].toString());