Bladeren bron

批注接口提交

shenhao 3 jaren geleden
bovenliggende
commit
07601adcd3

+ 27 - 32
src/main/java/com/ssj/dao/sys/homework/dao/impl/HomeworkQueryDaoImpl.java

@@ -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 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("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())){
             sql.append(" and t.course_name like concat('%',?,'%')");
             paramList.add(params.get("subject"));
@@ -310,57 +310,52 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
         StringBuilder selSQL = new StringBuilder();
         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("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("from (\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.allot_time,\n");
         selSQL.append("a.next_1\n");
         selSQL.append("from (\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(1) as totalNums,\n");
         selSQL.append("min(t.allot_time) as allot_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("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("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=? 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("group by t.homework_id\n");
+        selSQL.append("group by t.homework_id");
         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);
     }
 

+ 11 - 5
src/main/java/com/ssj/dao/weixin/library/dao/impl/LibJoinQueryDaoImpl.java

@@ -1308,18 +1308,24 @@ public class LibJoinQueryDaoImpl implements ILibJoinQueryDao{
 		StringBuilder selSQL = new StringBuilder();
 		List<Object> queryParams = new ArrayList<Object>();
 		selSQL.append("SELECT a.wait_nums,a.state,a.teacher_id,a.teacher_name,a.wait_max_time,a.today_correct_time,a.efficiency,(ifnull(a.wait_nums,0)+ifnull(a.wait_nums2,0)) as homework_count from ( SELECT  \n");
-		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0 and  homework_id not in (select homework_id  from scon_homework_picture_correct x where x.homework_picture_id = a.id and x.start_time is not null)) as wait_nums, \n");
-		selSQL.append("(SELECT count(1) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2)  and t.create_time > ? and a.is_feedback=1 group by homework_id ) as wait_nums2, \n");
+		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0 and  \n" +
+				"homework_id not in (select homework_id  from scon_homework_picture_correct x where x.homework_picture_id = a.id and x.start_time is not null and x.type=8) ) as wait_nums, \n");
+		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a join scon_homework_picture_correct b on b.homework_picture_id = a.id where a.teacher_id = t.user_id and a.is_mark in (0,2) and b.type=8  \n" +
+				"and ((b.end_time > ? and a.is_feedback=1) or a.is_feedback=0) ) as wait_nums2, \n");
 		queryParams.add(params.get("beginTime"));
 		selSQL.append("(SELECT ifnull(concat(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,min(a.allot_time),NOW())),''),0)   from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0) as wait_max_time, \n");
 		selSQL.append("t.user_id as teacher_id,t.name as teacher_name, \n");
-		selSQL.append("(select ifnull(concat(SEC_TO_TIME(sum(a.correction_time)),''),0) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback=1 and t.create_time > ?) as today_correct_time, \n");
+		selSQL.append("(select ifnull(concat(SEC_TO_TIME(sum(a.correction_time)),''),0) from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback=1 and b.end_time >?) as today_correct_time, \n");
 		queryParams.add(params.get("beginTime"));
-		selSQL.append("(select ifnull(concat(SEC_TO_TIME(floor(sum(TIMESTAMPDIFF(SECOND,a.allot_time,b.start_time))/count(1))),''),0) from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id and b.type=8 where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback=1 and t.create_time > ?) as efficiency, \n");
+		selSQL.append("(select ifnull(concat(SEC_TO_TIME(floor(sum(TIMESTAMPDIFF(SECOND,a.allot_time,b.start_time))/count(1))),''),0) from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id and b.type=8 where a.teacher_id = t.user_id and a.is_mark in (0,2) and b.start_time is not null and ((a.is_feedback=1 and b.end_time > ?) or a.is_feedback=0)) as efficiency, \n");
 		queryParams.add(params.get("beginTime"));
 		selSQL.append("t.is_online as state  \n");
 		selSQL.append("from tb_lib_manager t  \n");
-		selSQL.append("where t.type=30 \n");
+		selSQL.append("where t.type=30 and t.state=1 \n");
+		if (params.get("name") != null && !params.get("name").equals("")) {
+			selSQL.append(" and   t.name like CONCAT('%',?,'%') ");
+			queryParams.add(params.get("name"));
+		}
 		selSQL.append(") a order by a.state desc,a.wait_nums desc  \n");
 		return  dao.findPage(selSQL.toString(), queryParams.toArray(),initPage,HomeworkListVO.class);
 	}

+ 1 - 1
src/main/java/com/ssj/statistics/dao/impl/StatisticsQueryImpl.java

@@ -135,7 +135,7 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         StringBuffer sql = new StringBuffer();
         sql.append("select ifnull(sum(a.overtimeNums),0) as correctTotalNums,ifnull(sum(overtimeNums),0) as overtimeTotalNums, ");
         sql.append("ifnull(sum(a.notCorrectNums),0) as notCorrectTotalNums,ifnull(sum(notCommentNums),0) as notCommentTotalNums, ");
-        sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,ifnull(avg(accuracy),0) as accuracyTotal ");
+        sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,round(ifnull(avg(accuracy),0),2) as accuracyTotal ");
         sql.append(" from (");
         List<Object> queryParams = new ArrayList<>();
         listInfo(params,queryParams,sql);