瀏覽代碼

批注接口提交

shenhao 4 年之前
父節點
當前提交
f56f74e278

+ 1 - 1
src/main/java/com/ssj/dao/sys/homework/dao/HomeworkQueryDao.java

@@ -99,7 +99,7 @@ public interface HomeworkQueryDao {
      * @param teacherId
      * @return
      */
-    List<Map<String, Object>> teacherStudentList(String teacherId);
+    List<Map<String, Object>> teacherStudentList(String teacherId,String beginTime);
 
     List<ExerciseQuestionDto> findQuestionByBookIdAndPage(String bookId, String unitId, String s, List resultList2, int bookYear);
 

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

@@ -304,38 +304,57 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
     }
 
     @Override
-    public List<Map<String, Object>> teacherStudentList(String teacherId) {
+    public List<Map<String, Object>> teacherStudentList(String teacherId,String beginTime) {
         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,b.totalNums ,\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("else '作业已超时' end stateMsg,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.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("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("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("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");
+        selSQL.append(" where t.teacher_id=? and t.create_time > ?\n");
         queryParams.add(teacherId);
+        queryParams.add(beginTime);
         selSQL.append("and t.is_mark in (0,2)\n");
         selSQL.append("group by t.homework_id\n");
         selSQL.append(") a \n");

+ 1 - 1
src/main/java/com/ssj/service/sys/homework/service/impl/HomeworkPictureServiceImpl.java

@@ -215,7 +215,7 @@ public class HomeworkPictureServiceImpl extends BaseServiceImpl<HomeworkPicture,
 
     @Override
     public List<Map<String, Object>> teacherStudentList(String teacherId) {
-        return queryDao.teacherStudentList(teacherId);
+        return queryDao.teacherStudentList(teacherId,getBeginTime());
     }
 
     public Map<String, Object> findRecognitionResult(String pictureId) {