|
@@ -288,7 +288,7 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
|
|
sql.append("SELECT t.name as teacher_name,t.user_id as teacher_id,t.is_online as state, \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("(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 and t.state = 1 \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())){
|
|
sql.append(" and t.course_name like concat('%',?,'%')");
|
|
sql.append(" and t.course_name like concat('%',?,'%')");
|
|
paramList.add(params.get("subject"));
|
|
paramList.add(params.get("subject"));
|
|
@@ -310,57 +310,52 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
|
|
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 as correct_nums,b.totalNums as total_nums,\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("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("case when state in (6,7) then concat(DATE_FORMAT(SEC_TO_TIME(b.next_1),'%i分%s秒'),'/张') \n");
|
|
|
|
+ selSQL.append("when state in (2,5) then concat(DATE_FORMAT(SEC_TO_TIME(b.start_time),'%i:%s'),'开始批注')\n");
|
|
|
|
+ selSQL.append("when state = 4 then concat('等待',DATE_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,b.allot_time,NOW())),'%i:%s'))\n");
|
|
selSQL.append("else '作业已超时' end state_msg,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.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("case when a.is_feedback = 1 and \n");
|
|
|
|
+ selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00')) or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
|
|
|
|
+ selSQL.append(" then 3\n");
|
|
|
|
+ selSQL.append("when a.is_feedback = 1 and a.next_1 > 120 then 6 \n");
|
|
|
|
+ selSQL.append("when a.is_feedback = 1 then 7\n");
|
|
|
|
+ selSQL.append("when a.is_feedback = 0 and a.start_time is not null and \n");
|
|
|
|
+ selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
|
|
|
|
+ selSQL.append(" or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),'23:59:59')))\n");
|
|
|
|
+ selSQL.append("then 2\n");
|
|
|
|
+ selSQL.append("when a.is_feedback = 0 and a.start_time is null and \n");
|
|
|
|
+ selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
|
|
|
|
+ selSQL.append(" or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
|
|
|
|
+ selSQL.append("then 1\n");
|
|
|
|
+ selSQL.append("when a.is_feedback = 0 and a.start_time is not null then 5\n");
|
|
|
|
+ selSQL.append("else 4 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("max(t11.end_time) as end_time,\n");
|
|
|
|
+ selSQL.append("min(t.create_time) as create_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("min(t.is_feedback) as is_feedback\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=? and t.create_time > ?\n");
|
|
|
|
- queryParams.add(teacherId);
|
|
|
|
- queryParams.add(beginTime);
|
|
|
|
|
|
+ selSQL.append(" where t.teacher_id=? and ((t11.end_time > ? and t.is_feedback=1) or t.is_feedback=0)\n");
|
|
selSQL.append("and t.is_mark in (0,2)\n");
|
|
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");
|
|
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 ");
|
|
|
|
+ queryParams.add(teacherId);
|
|
|
|
+ queryParams.add(beginTime);
|
|
return dao.findList(selSQL.toString(),queryParams.toArray(),StudentListVO.class);
|
|
return dao.findList(selSQL.toString(),queryParams.toArray(),StudentListVO.class);
|
|
}
|
|
}
|
|
|
|
|