Browse Source

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式版本
王宁 2 years ago
parent
commit
6dd86face2

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

172
         String examcomm = vo.getExamcomm();
172
         String examcomm = vo.getExamcomm();
173
         Integer createid = vo.getHandleid();
173
         Integer createid = vo.getHandleid();
174
         Integer examid = vo.getExamid();
174
         Integer examid = vo.getExamid();
175
-        N_Utils.validation(new Object[]{examid, "考试id", 1, examcomm, "考试公告", 2, createid, "操作人id"});
175
+        N_Utils.validation(new Object[]{examid, "考试id", 1, examcomm, "考试公告", 2, createid, "操作人id", 1});
176
         EBaseVo exam = eBaseService.getExamStateById(examid);//根据考试id获取考试状态
176
         EBaseVo exam = eBaseService.getExamStateById(examid);//根据考试id获取考试状态
177
         String examname = exam.getExamname();
177
         String examname = exam.getExamname();
178
         Integer schoolid = exam.getSchoolid();
178
         Integer schoolid = exam.getSchoolid();

+ 34
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectSearchController.java View File

56
     public ResultVo listQuickTeacher(@RequestBody ESubjectInvigilate subject) {
56
     public ResultVo listQuickTeacher(@RequestBody ESubjectInvigilate subject) {
57
         String username = subject.getCreatename();
57
         String username = subject.getCreatename();
58
         Integer classid = subject.getClassid();
58
         Integer classid = subject.getClassid();
59
-        N_Utils.validation(new Object[]{username, "姓名", 2, classid, "班级id", 1});
59
+        N_Utils.validation(new Object[]{username, "姓名", 2});
60
         Map list = eSubjectSearchService.listQuickTeacher(username, classid);
60
         Map list = eSubjectSearchService.listQuickTeacher(username, classid);
61
         return new ResultVo(0, "获取成功", list);
61
         return new ResultVo(0, "获取成功", list);
62
     }
62
     }
93
         Map map = eSubjectSearchService.listSubject(examid);
93
         Map map = eSubjectSearchService.listSubject(examid);
94
         return new ResultVo(0, "获取成功", map);
94
         return new ResultVo(0, "获取成功", map);
95
     }
95
     }
96
+
97
+    /**
98
+     * 主监考人查找
99
+     *
100
+     * @return com.xhkjedu.vo.ResultVo
101
+     * @Param [base]
102
+     * @Author ywx
103
+     * @Date 2022/7/29 14:32
104
+     **/
105
+    @PostMapping("/list_zt")
106
+    public ResultVo listMasterTeacher(@RequestBody EBase base) {
107
+        Integer schoolid = base.getSchoolid();
108
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1});
109
+        List<Map> list = eSubjectSearchService.listMasterTeacher(schoolid);
110
+        return new ResultVo(0, "获取成功", list);
111
+    }
112
+
113
+    /**
114
+     * 主监考人快捷查找
115
+     *
116
+     * @return com.xhkjedu.vo.ResultVo
117
+     * @Param [base]
118
+     * @Author ywx
119
+     * @Date 2022/7/29 15:25
120
+     **/
121
+    @PostMapping("/list_qzt")
122
+    public ResultVo listQuickMasterTeacher(@RequestBody EBase base) {
123
+        Integer schoolid = base.getSchoolid();
124
+        String username = base.getCreatename();
125
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1, username, "姓名", 2});
126
+        Map list = eSubjectSearchService.listQuickMasterTeacher(schoolid, username);
127
+        return new ResultVo(0, "获取成功", list);
128
+    }
96
 }
129
 }

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/system/UserMapper.java View File

4
 import org.apache.ibatis.annotations.Param;
4
 import org.apache.ibatis.annotations.Param;
5
 
5
 
6
 import java.util.List;
6
 import java.util.List;
7
+import java.util.Map;
7
 
8
 
8
 public interface UserMapper {
9
 public interface UserMapper {
9
     //根据用户ids查找手机号
10
     //根据用户ids查找手机号
14
 
15
 
15
     //获取考试班级任教老师
16
     //获取考试班级任教老师
16
     List<UserVo> listTeacherByClassIds(@Param("classids") String classids);
17
     List<UserVo> listTeacherByClassIds(@Param("classids") String classids);
18
+
19
+    //主监考人查找
20
+    List<Map> listMasterTeacher(@Param("schoolid") Integer schoolid);
21
+
22
+    //主监考人快捷查找
23
+    List<Map> listQuickMasterTeacher(@Param("usernames") String[] usernames, @Param("schoolid") Integer schoolid);
17
 }
24
 }

+ 36
- 4
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectSearchService.java View File

3
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
3
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
4
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
4
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
5
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
5
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
6
+import com.xhkjedu.sexam.mapper.system.UserMapper;
6
 import com.xhkjedu.sexam.vo.exam.CTeacherVo;
7
 import com.xhkjedu.sexam.vo.exam.CTeacherVo;
7
 import org.springframework.stereotype.Service;
8
 import org.springframework.stereotype.Service;
8
 
9
 
22
     private EBaseMapper eBaseMapper;
23
     private EBaseMapper eBaseMapper;
23
     @Resource
24
     @Resource
24
     private ESubjectMapper eSubjectMapper;
25
     private ESubjectMapper eSubjectMapper;
26
+    @Resource
27
+    private UserMapper userMapper;
25
 
28
 
26
     //查找设置
29
     //查找设置
27
     public List<Map> listSearchTeacher(Integer examid, Integer schoolid) {
30
     public List<Map> listSearchTeacher(Integer examid, Integer schoolid) {
28
         List<Map> classes = eClassMapper.listByExamId(examid);
31
         List<Map> classes = eClassMapper.listByExamId(examid);
29
         String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
32
         String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
30
         List<CTeacherVo> teachers = eClassMapper.listTeacherByClassIds(classids);//获取班级教师
33
         List<CTeacherVo> teachers = eClassMapper.listTeacherByClassIds(classids);//获取班级教师
31
-        String teacherids = teachers.stream().map((CTeacherVo::getTeacherid)).map(String::valueOf).distinct().collect(Collectors.joining(","));
34
+        String teacherids =
35
+                teachers.stream().map((CTeacherVo::getTeacherid)).map(String::valueOf).distinct().collect(Collectors.joining(","
36
+                ));
32
         List<CTeacherVo> subjects = eClassMapper.listSubjectByTeacherIds(teacherids);//获取教师科目
37
         List<CTeacherVo> subjects = eClassMapper.listSubjectByTeacherIds(teacherids);//获取教师科目
33
         String subjectids = subjects.stream().map(CTeacherVo::getSubjectid).distinct().collect(Collectors.joining("','"));
38
         String subjectids = subjects.stream().map(CTeacherVo::getSubjectid).distinct().collect(Collectors.joining("','"));
34
         List<CTeacherVo> subjects2 = eClassMapper.listSubjectBySubjectIds(subjectids);
39
         List<CTeacherVo> subjects2 = eClassMapper.listSubjectBySubjectIds(subjectids);
35
-        Map<String, String> subjectNameMap = subjects2.stream().collect(Collectors.toMap(CTeacherVo::getSubjectid, CTeacherVo::getSubjectname));
36
-        Map<Integer, String> subjectMap = subjects.stream().collect(Collectors.toMap(CTeacherVo::getTeacherid, CTeacherVo::getSubjectid));
40
+        Map<String, String> subjectNameMap = subjects2.stream().collect(Collectors.toMap(CTeacherVo::getSubjectid,
41
+                CTeacherVo::getSubjectname));
42
+        Map<Integer, String> subjectMap = subjects.stream().collect(Collectors.toMap(CTeacherVo::getTeacherid,
43
+                CTeacherVo::getSubjectid));
37
         List<CTeacherVo> users = eClassMapper.listTeacherBySchoolId(schoolid);//获取学校所有教师
44
         List<CTeacherVo> users = eClassMapper.listTeacherBySchoolId(schoolid);//获取学校所有教师
38
         for (CTeacherVo teacher : teachers) {
45
         for (CTeacherVo teacher : teachers) {
39
             CTeacherVo vo = users.stream().filter(u -> u.getTeacherid().equals(teacher.getTeacherid())).findFirst().orElse(null);
46
             CTeacherVo vo = users.stream().filter(u -> u.getTeacherid().equals(teacher.getTeacherid())).findFirst().orElse(null);
68
         Map map = new HashMap();
75
         Map map = new HashMap();
69
         String[] usernames = username.split(",");
76
         String[] usernames = username.split(",");
70
         List<Map> teachers = eClassMapper.listSearchTeacher(usernames, classid);
77
         List<Map> teachers = eClassMapper.listSearchTeacher(usernames, classid);
71
-        Map<String, Object> nameMap = teachers.stream().collect(Collectors.toMap(t -> t.get("username").toString(), t -> t.get("teacherid")));
78
+        Map<String, Object> nameMap = teachers.stream().collect(Collectors.toMap(t -> t.get("username").toString(), t -> t.get(
79
+                "teacherid")));
72
         StringBuilder sb = new StringBuilder();
80
         StringBuilder sb = new StringBuilder();
73
         for (String name : usernames) {
81
         for (String name : usernames) {
74
             if (nameMap.get(name) == null) {
82
             if (nameMap.get(name) == null) {
99
         map.put("subjects", subjects);
107
         map.put("subjects", subjects);
100
         return map;
108
         return map;
101
     }
109
     }
110
+
111
+    //主监考人查找
112
+    public List<Map> listMasterTeacher(Integer schoolid) {
113
+        return userMapper.listMasterTeacher(schoolid);
114
+    }
115
+
116
+    //主监考人快捷查找
117
+    public Map listQuickMasterTeacher(Integer schoolid, String username) {
118
+        Map map = new HashMap();
119
+        String[] usernames = username.split(",");
120
+        List<Map> teachers = userMapper.listQuickMasterTeacher(usernames, schoolid);
121
+        Map<String, Object> nameMap = teachers.stream().collect(Collectors.toMap(t -> t.get("username").toString(), t -> t.get(
122
+                "teacherid")));
123
+        StringBuilder sb = new StringBuilder();
124
+        for (String name : usernames) {
125
+            if (nameMap.get(name) == null) {
126
+                sb.append(name).append(",");
127
+            }
128
+        }
129
+        map.put("teachers", teachers);//匹配的教师
130
+        String notExist = sb.toString();//未匹配的教师
131
+        map.put("notExist", notExist.substring(0, notExist.length() - 1));
132
+        return map;
133
+    }
102
 }
134
 }

+ 4
- 1
sexam/src/main/resources/mapper/exam/EClassMapper.xml View File

40
     </select>
40
     </select>
41
     <!--班级教师查找-->
41
     <!--班级教师查找-->
42
     <select id="listSearchTeacher" resultType="java.util.Map">
42
     <select id="listSearchTeacher" resultType="java.util.Map">
43
-        select ct.teacherid,u.username
43
+        select ct.teacherid,u.username,u.loginname,u.usersex,sb.subjectid
44
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
44
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
45
+        left join t_teacher_powersb tp on tp.teacherid=ct.teacherid
46
+        left join t_subject_book sb on tp.lsbid = sb.lsbid
45
         where ct.classid=#{classid} and u.usertype=1 and u.userstate=1 and u.username in
47
         where ct.classid=#{classid} and u.usertype=1 and u.userstate=1 and u.username in
46
         <foreach collection="usernames" item="username" open="(" separator="," close=")">
48
         <foreach collection="usernames" item="username" open="(" separator="," close=")">
47
             #{username}
49
             #{username}
48
         </foreach>
50
         </foreach>
51
+        group by ct.teacherid
49
     </select>
52
     </select>
50
 
53
 
51
     <!--按班设置教师列表-->
54
     <!--按班设置教师列表-->

+ 8
- 5
sexam/src/main/resources/mapper/paper/EPaperCorrectTeacherMapper.xml View File

4
     <!--待阅卷列表-->
4
     <!--待阅卷列表-->
5
     <select id="listPending" resultType="java.util.Map">
5
     <select id="listPending" resultType="java.util.Map">
6
         select a.*,eb.examname,eb.gradeid,eb.examtype,es.sdate,es.begintime,es.endtime,es.subjectname
6
         select a.*,eb.examname,eb.gradeid,eb.examtype,es.sdate,es.begintime,es.endtime,es.subjectname
7
-        ,truncate(count(case when ps.sstate=2 and ps.checked=2 then ps.epsid else null end)*100/
8
-                  count(case when ps.sstate=2 then ps.epsid else null end),2)pgrate
7
+        ,truncate(a.pynum*100/a.tjnum,2)pgrate
9
         from(select p.esid,p.epid,group_concat(distinct pq.qn order by pq.qorder)qns
8
         from(select p.esid,p.epid,group_concat(distinct pq.qn order by pq.qorder)qns
10
         ,group_concat(distinct pq.qorder order by pq.qorder)qorders,group_concat(pc.classid)classids
9
         ,group_concat(distinct pq.qorder order by pq.qorder)qorders,group_concat(pc.classid)classids
10
+        ,count(case when psq.answered=1 then psq.epsqid else null end)tjnum
11
+        ,count(case when psq.answered=1 and psq.checked=2 then psq.epsqid else null end)pynum
11
         from e_paper p left join e_paper_qtype_question pq on p.epid = pq.epid
12
         from e_paper p left join e_paper_qtype_question pq on p.epid = pq.epid
12
         left join e_paper_correctclass pc on p.epid = pc.epid
13
         left join e_paper_correctclass pc on p.epid = pc.epid
14
+        left join e_paper_student_question psq on psq.epid = pc.epid and psq.classid=pc.classid and psq.qorder=pq.qorder
13
         where pc.teacherid=#{teacherid} and pq.ctype in(3,14,15)
15
         where pc.teacherid=#{teacherid} and pq.ctype in(3,14,15)
14
         union
16
         union
15
         select p.esid,p.epid,group_concat(distinct pq.qn order by pq.qorder)qns
17
         select p.esid,p.epid,group_concat(distinct pq.qn order by pq.qorder)qns
16
         ,group_concat(distinct pq.qorder order by pq.qorder)qorders,0 classids
18
         ,group_concat(distinct pq.qorder order by pq.qorder)qorders,0 classids
19
+        ,count(case when psq.answered=1 then psq.epsqid else null end)tjnum
20
+        ,count(case when psq.answered=1 and psq.checked=2 then psq.epsqid else null end)pynum
17
         from e_paper p left join e_paper_correctquestion pq on p.epid = pq.epid
21
         from e_paper p left join e_paper_correctquestion pq on p.epid = pq.epid
22
+        left join e_paper_student_question psq on psq.epid = pq.epid and psq.qorder=pq.qorder
18
         where pq.teacherid=#{teacherid})a left join e_subject es on a.esid = es.esid
23
         where pq.teacherid=#{teacherid})a left join e_subject es on a.esid = es.esid
19
         left join e_base eb on es.examid = eb.examid
24
         left join e_base eb on es.examid = eb.examid
20
-        left join e_paper_student ps on a.epid=ps.epid
21
-        group by a.epid
22
-        having count(case when ps.checked!=2 then ps.epsid else null end)>0
25
+        where a.tjnum!=a.pynum group by a.epid
23
     </select>
26
     </select>
24
     <!--已阅卷列表-->
27
     <!--已阅卷列表-->
25
     <select id="listMarked" resultType="java.util.Map">
28
     <select id="listMarked" resultType="java.util.Map">

+ 19
- 0
sexam/src/main/resources/mapper/system/UserMapper.xml View File

22
         where ct.classid in(${classids}) and u.userstate=1
22
         where ct.classid in(${classids}) and u.userstate=1
23
         group by u.userid
23
         group by u.userid
24
     </select>
24
     </select>
25
+    <!--主监考人查找-->
26
+    <select id="listMasterTeacher" resultType="java.util.Map">
27
+        select u.userid teacherid,u.username,u.loginname,u.usersex,sb.subjectid
28
+        from t_user u left join t_teacher_powersb tp on tp.teacherid=u.userid
29
+        left join t_subject_book sb on tp.lsbid = sb.lsbid
30
+        where u.schoolid=#{schoolid} and u.usertype=1 and u.userstate=1
31
+        group by u.userid
32
+    </select>
33
+    <!--主监考人快捷查找-->
34
+    <select id="listQuickMasterTeacher" resultType="java.util.Map">
35
+        select u.userid teacherid,u.username,u.loginname,u.usersex,sb.subjectid
36
+        from t_user u left join t_teacher_powersb tp on tp.teacherid=u.userid
37
+        left join t_subject_book sb on tp.lsbid = sb.lsbid
38
+        where u.schoolid=#{schoolid} and u.usertype=1 and u.userstate=1 and u.username in
39
+        <foreach collection="usernames" item="username" open="(" separator="," close=")">
40
+            #{username}
41
+        </foreach>
42
+        group by u.userid
43
+    </select>
25
 </mapper>
44
 </mapper>

Loading…
Cancel
Save