|
@@ -1,5 +1,7 @@
|
|
|
package com.ssj.dao.sys.homework.dao.impl;
|
|
package com.ssj.dao.sys.homework.dao.impl;
|
|
|
|
|
|
|
|
|
|
+import com.ssj.api.domain.vo.homework.StudentListVO;
|
|
|
|
|
+import com.ssj.api.domain.vo.homework.TeacherListVO;
|
|
|
import com.ssj.dao.sys.homework.dao.HomeworkQueryDao;
|
|
import com.ssj.dao.sys.homework.dao.HomeworkQueryDao;
|
|
|
import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
|
|
import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
|
|
|
import com.ssj.framework.core.util.StringUtil;
|
|
import com.ssj.framework.core.util.StringUtil;
|
|
@@ -7,6 +9,7 @@ import com.ssj.service.conch.conch.vo.HomeworkVO;
|
|
|
import com.ssj.service.conch.student.dto.AppWrongTopicBookDto;
|
|
import com.ssj.service.conch.student.dto.AppWrongTopicBookDto;
|
|
|
import com.ssj.service.conch.student.dto.WrongTopicBookDto;
|
|
import com.ssj.service.conch.student.dto.WrongTopicBookDto;
|
|
|
import com.ssj.service.conch.teacher.dto.HomeworkDTO;
|
|
import com.ssj.service.conch.teacher.dto.HomeworkDTO;
|
|
|
|
|
+import com.ssj.service.kmt.dto.ExerciseQuestionDto;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
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;
|
|
@@ -268,7 +271,7 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
|
|
|
List<Object> paramList = new ArrayList<>();
|
|
List<Object> paramList = new ArrayList<>();
|
|
|
StringBuilder sql = new StringBuilder();
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append("SELECT t.child_name as studentName,t12.homework_id as homeworkId,\n ");
|
|
sql.append("SELECT t.child_name as studentName,t12.homework_id as homeworkId,\n ");
|
|
|
- sql.append("SEC_TO_TIME(timestampdiff(SECOND,min(t12.create_time),NOW())) as waitTime,t12.`subject`,t13.grade \n ");
|
|
|
|
|
|
|
+ sql.append("concat(SEC_TO_TIME(timestampdiff(SECOND,min(t12.create_time),NOW())),'') as waitTime,t12.`subject`,t13.grade \n ");
|
|
|
sql.append(" from tb_lib_vip t \n ");
|
|
sql.append(" from tb_lib_vip t \n ");
|
|
|
sql.append("join tb_lib_vip_service t11 on t.id = t11.vip_id and t11.correct_type=100\n ");
|
|
sql.append("join tb_lib_vip_service t11 on t.id = t11.vip_id and t11.correct_type=100\n ");
|
|
|
sql.append("join scon_homework_picture t12 on t.id = t12.vip_id\n ");
|
|
sql.append("join scon_homework_picture t12 on t.id = t12.vip_id\n ");
|
|
@@ -279,11 +282,11 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Page<Map<String, Object>> teacherList(Map<String, Object> params, Pageable initPage) {
|
|
|
|
|
|
|
+ public Page<TeacherListVO> teacherList(Map<String, Object> params, Pageable initPage) {
|
|
|
List<Object> paramList = new ArrayList<>();
|
|
List<Object> paramList = new ArrayList<>();
|
|
|
StringBuilder sql = new StringBuilder();
|
|
StringBuilder sql = new StringBuilder();
|
|
|
- sql.append("SELECT t.name as teacherName,t.user_id as teacherId,t.is_online as state, \n ");
|
|
|
|
|
- sql.append("(select count(1) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_feedback = 0) as waitNums \n ");
|
|
|
|
|
|
|
+ sql.append("SELECT t.name as teacher_name,t.user_id as teacher_id,t.is_online as state, \n ");
|
|
|
|
|
+ sql.append("(select count(1) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_feedback = 0) as wait_nums \n ");
|
|
|
sql.append("from tb_lib_manager t \n ");
|
|
sql.append("from tb_lib_manager t \n ");
|
|
|
sql.append("where t.type=30 \n ");
|
|
sql.append("where t.type=30 \n ");
|
|
|
if(Objects.nonNull(params.get("subject")) && StringUtil.isEmpty(params.get("subject").toString())){
|
|
if(Objects.nonNull(params.get("subject")) && StringUtil.isEmpty(params.get("subject").toString())){
|
|
@@ -299,47 +302,103 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
|
|
|
paramList.add(params.get("teacherName"));
|
|
paramList.add(params.get("teacherName"));
|
|
|
}
|
|
}
|
|
|
sql.append("order by t.is_online desc \n ");
|
|
sql.append("order by t.is_online desc \n ");
|
|
|
- return dao.findPage(sql.toString(), paramList.toArray(),initPage);
|
|
|
|
|
|
|
+ return dao.findPage(sql.toString(), paramList.toArray(),initPage,TeacherListVO.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public List<Map<String, Object>> teacherStudentList(String teacherId) {
|
|
|
|
|
|
|
+ public List<StudentListVO> teacherStudentList(String teacherId, String beginTime) {
|
|
|
StringBuilder selSQL = new StringBuilder();
|
|
StringBuilder selSQL = new StringBuilder();
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
- selSQL.append("SELECT b.homework_id,b.student_name,b.`subject`,b.grade,b.correctNums,b.totalNums ,\n");
|
|
|
|
|
|
|
+ selSQL.append("SELECT b.homework_id,b.student_name ,b.`subject`,b.grade,b.correctNums as correct_nums,b.totalNums as total_nums,\n");
|
|
|
selSQL.append("case when state in (4,5) then concat(DATE_FORMAT(SEC_TO_TIME(b.next_1),'%i分%s秒'),'/张') \n");
|
|
selSQL.append("case when state in (4,5) then concat(DATE_FORMAT(SEC_TO_TIME(b.next_1),'%i分%s秒'),'/张') \n");
|
|
|
- selSQL.append("when state = 3 then concat(DATE_FORMAT(SEC_TO_TIME(b.next_1),'%i:%s'),'开始批注')\n");
|
|
|
|
|
|
|
+ selSQL.append("when state = 3 then concat(DATE_FORMAT(SEC_TO_TIME(b.start_time),'%i:%s'),'开始批注')\n");
|
|
|
selSQL.append("when state = 2 then concat('等待',DATE_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,b.allot_time,NOW())),'%i:%s'))\n");
|
|
selSQL.append("when state = 2 then concat('等待',DATE_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,b.allot_time,NOW())),'%i:%s'))\n");
|
|
|
- selSQL.append("else '作业已超时' end stateMsg,b.state \n");
|
|
|
|
|
|
|
+ selSQL.append("else '作业已超时' end state_msg,b.state \n");
|
|
|
selSQL.append("from (\n");
|
|
selSQL.append("from (\n");
|
|
|
selSQL.append("SELECT a.homework_id,a.student_name,a.`subject`,a.grade,a.correctNums,a.totalNums, \n");
|
|
selSQL.append("SELECT a.homework_id,a.student_name,a.`subject`,a.grade,a.correctNums,a.totalNums, \n");
|
|
|
- selSQL.append("case when a.correctNums = a.totalNums and a.next_1 <=120 then 5\n");
|
|
|
|
|
- selSQL.append("when a.correctNums = a.totalNums and a.next_1 >120 then 4\n");
|
|
|
|
|
- selSQL.append("when a.correctNums<a.totalNums and a.start_time is not null then 3\n");
|
|
|
|
|
- selSQL.append("when a.correctNums<a.totalNums and a.start_time is null then 2\n");
|
|
|
|
|
|
|
+ selSQL.append("case when a.type = 1 and a.correctNums = a.totalNums and a.next_1 <=120 then 5\n");
|
|
|
|
|
+ selSQL.append("when a.type = 1 and a.correctNums = a.totalNums and a.next_1 >120 then 4\n");
|
|
|
|
|
+ selSQL.append("when a.type = 1 and a.correctNums<a.totalNums and a.start_time is not null then 3\n");
|
|
|
|
|
+ selSQL.append("when a.type = 1 and a.correctNums<a.totalNums and a.start_time is null then 2\n");
|
|
|
selSQL.append("else 1 end as state ,\n");
|
|
selSQL.append("else 1 end as state ,\n");
|
|
|
selSQL.append("a.start_time,\n");
|
|
selSQL.append("a.start_time,\n");
|
|
|
selSQL.append("a.allot_time,\n");
|
|
selSQL.append("a.allot_time,\n");
|
|
|
selSQL.append("a.next_1\n");
|
|
selSQL.append("a.next_1\n");
|
|
|
selSQL.append("from (\n");
|
|
selSQL.append("from (\n");
|
|
|
selSQL.append("select t.homework_id,t12.child_name as student_name, t14.`subject`,t14.grade,\n");
|
|
selSQL.append("select t.homework_id,t12.child_name as student_name, t14.`subject`,t14.grade,\n");
|
|
|
|
|
+ selSQL.append("count(if(t11.start_time is not null and t11.end_time is not null,true,null)) as correctNums,\n");
|
|
|
|
|
+ selSQL.append("count(1) as totalNums,\n");
|
|
|
|
|
+ selSQL.append("min(t.allot_time) as allot_time,\n");
|
|
|
|
|
+ selSQL.append("0 as start_time,\n");
|
|
|
|
|
+ selSQL.append("0 as correction_time,\n");
|
|
|
|
|
+ selSQL.append("0 as next_1,\n");
|
|
|
|
|
+ selSQL.append("0 as type\n");
|
|
|
|
|
+ selSQL.append("from scon_homework_picture t\n");
|
|
|
|
|
+ selSQL.append("left join scon_homework t14 on t.homework_id = t14.id\n");
|
|
|
|
|
+ selSQL.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id\n");
|
|
|
|
|
+ selSQL.append("left join tb_lib_vip t12 on t.vip_id = t12.id\n");
|
|
|
|
|
+ selSQL.append(" where t.teacher_id=? \n");
|
|
|
|
|
+ queryParams.add(teacherId);
|
|
|
|
|
+ selSQL.append("and t.is_mark in (0,2) and (t.is_feedback = 0 or (t11.start_time is not null and t11.end_time is null))\n");
|
|
|
|
|
+ selSQL.append("group by t.homework_id\n");
|
|
|
|
|
+ selSQL.append(" union all \n");
|
|
|
|
|
+ selSQL.append("select t.homework_id,t12.child_name as student_name, t14.`subject`,t14.grade,\n");
|
|
|
selSQL.append("count(if(t.is_feedback = 1,true,null)) as correctNums,\n");
|
|
selSQL.append("count(if(t.is_feedback = 1,true,null)) as correctNums,\n");
|
|
|
selSQL.append("count(1) as totalNums,\n");
|
|
selSQL.append("count(1) as totalNums,\n");
|
|
|
selSQL.append("min(t.allot_time) as allot_time,\n");
|
|
selSQL.append("min(t.allot_time) as allot_time,\n");
|
|
|
selSQL.append("min(t11.start_time) as start_time,\n");
|
|
selSQL.append("min(t11.start_time) as start_time,\n");
|
|
|
selSQL.append("sum(t11.correction_time) as correction_time,\n");
|
|
selSQL.append("sum(t11.correction_time) as correction_time,\n");
|
|
|
- selSQL.append("floor(sum(t11.correction_time)/ count(1)) as next_1\n");
|
|
|
|
|
|
|
+ selSQL.append("floor(sum(t11.correction_time)/ count(1)) as next_1,\n");
|
|
|
|
|
+ selSQL.append("1 as type\n");
|
|
|
selSQL.append("from scon_homework_picture t\n");
|
|
selSQL.append("from scon_homework_picture t\n");
|
|
|
selSQL.append("left join scon_homework t14 on t.homework_id = t14.id\n");
|
|
selSQL.append("left join scon_homework t14 on t.homework_id = t14.id\n");
|
|
|
selSQL.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id\n");
|
|
selSQL.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id\n");
|
|
|
selSQL.append("left join tb_lib_vip t12 on t.vip_id = t12.id\n");
|
|
selSQL.append("left join tb_lib_vip t12 on t.vip_id = t12.id\n");
|
|
|
- selSQL.append(" where t.teacher_id=?\n");
|
|
|
|
|
|
|
+ selSQL.append(" where t.teacher_id=? and t.create_time > ?\n");
|
|
|
queryParams.add(teacherId);
|
|
queryParams.add(teacherId);
|
|
|
- selSQL.append("where t.is_mark in (0,2)\n");
|
|
|
|
|
|
|
+ queryParams.add(beginTime);
|
|
|
|
|
+ selSQL.append("and t.is_mark in (0,2)\n");
|
|
|
selSQL.append("group by t.homework_id\n");
|
|
selSQL.append("group by t.homework_id\n");
|
|
|
selSQL.append(") a \n");
|
|
selSQL.append(") a \n");
|
|
|
selSQL.append(") b order by b.state asc \n");
|
|
selSQL.append(") b order by b.state asc \n");
|
|
|
- return dao.findMap(selSQL.toString(),queryParams.toArray());
|
|
|
|
|
|
|
+ return dao.findList(selSQL.toString(),queryParams.toArray(),StudentListVO.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<ExerciseQuestionDto> findQuestionByBookIdAndPage(String bookId, String unitId, String bookCourseId, List pageIndex, int bookYear) {
|
|
|
|
|
+ List<Object> params = new ArrayList<>();
|
|
|
|
|
+ String sql = "select id question_id, big_question_index, small_question_name small_question_index, option_answer, answer_json answer_json, book_course_id\n" +
|
|
|
|
|
+ " from kmt_exercise_questions\n" +
|
|
|
|
|
+ " where (deal_status = 4 or deal_status = 5 or deal_status > 7) " +
|
|
|
|
|
+ " and book_id = ? and (is_common_flag = 0 or question_year=?)";
|
|
|
|
|
+ params.add(bookId);
|
|
|
|
|
+ params.add(bookYear);
|
|
|
|
|
+ if (StringUtils.isNotBlank(unitId)){
|
|
|
|
|
+ sql += " and unit_id=?";
|
|
|
|
|
+ params.add(unitId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(bookCourseId)){
|
|
|
|
|
+ sql += " and book_course_id=?";
|
|
|
|
|
+ params.add(bookCourseId);
|
|
|
|
|
+ }
|
|
|
|
|
+ sql +=" and page_index in (" + StringUtil.join(pageIndex, ",") + ")"+
|
|
|
|
|
+ " and answer_json is not null and answer_json != '' and answer_json != '[]' " +
|
|
|
|
|
+ " order by num, create_time";
|
|
|
|
|
+ return dao.findList(sql, params.toArray(), ExerciseQuestionDto.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<ExerciseQuestionDto> findAnswerByExerciseBookCourseId(String exerciseBookCourseId, int bookYear) {
|
|
|
|
|
+ String sql = "select id question_id, big_question_index, small_question_name small_question_index, option_answer, answer_json answer_json, book_course_id\n" +
|
|
|
|
|
+ "from kmt_exercise_questions\n" +
|
|
|
|
|
+ "where (deal_status = 4 or deal_status = 5 or deal_status > 7) " +
|
|
|
|
|
+ "and book_course_id = ? and (is_common_flag=0 or question_year=?) and answer_json is not null and answer_json != '' and answer_json != '[]' " +
|
|
|
|
|
+ "order by num, create_time";
|
|
|
|
|
+
|
|
|
|
|
+ List<Object> paramList = new ArrayList<>();
|
|
|
|
|
+ paramList.add(exerciseBookCourseId);
|
|
|
|
|
+ paramList.add(bookYear);
|
|
|
|
|
+ return dao.findList(sql, paramList.toArray(), ExerciseQuestionDto.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|