Sfoglia il codice sorgente

监控列表兼容集团校

tags/正式3.11.0
雍文秀 1 anno fa
parent
commit
2ea252128f

+ 44
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java Vedi File

@@ -164,6 +164,28 @@ public class ESubjectInvigilateController {
164 164
         return new ResultVo(0, "获取成功", pageResult);
165 165
     }
166 166
 
167
+    /**
168
+     * @Description 教师监考-监控列表(兼容集团校)
169
+     * @Date 2023/8/30 15:24
170
+     * @Author YWX
171
+     * @Param [subject]
172
+     * @Return com.xhkjedu.vo.ResultVo
173
+     **/
174
+    @PostMapping("/list_jkjt")
175
+    public ResultVo listJtJkSubject(@RequestBody ESubject subject) {
176
+        Integer teacherid = subject.getTeacherid();
177
+        Integer esstate = subject.getEsstate();
178
+        Integer schoolid = subject.getSchoolid();
179
+        Integer page = subject.getPage();
180
+        Integer pageSize = subject.getPageSize();
181
+        N_Utils.validation(new Object[]{teacherid, "教师id", 1, schoolid, "学校id", 1
182
+                , page, "页码", 1, pageSize, "显示条数", 1});
183
+        PageHelper.startPage(page, pageSize);
184
+        List<Map> list = eSubjectInvigilateService.listJtJkSubject(0, teacherid, esstate, schoolid);
185
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
186
+        return new ResultVo(0, "获取成功", pageResult);
187
+    }
188
+
167 189
     /*
168 190
      * 管理员监考-监控列表
169 191
      * @Param [subject]
@@ -184,6 +206,28 @@ public class ESubjectInvigilateController {
184 206
         return new ResultVo(0, "获取成功", pageResult);
185 207
     }
186 208
 
209
+    /**
210
+     * @Description 管理员监考-监控列表(兼容集团校)
211
+     * @Date 2023/8/30 15:44
212
+     * @Author YWX
213
+     * @Param [subject]
214
+     * @Return com.xhkjedu.vo.ResultVo
215
+     **/
216
+    @PostMapping("/list_ejkjt")
217
+    public ResultVo listExamJtJkSubject(@RequestBody ESubject subject) {
218
+        Integer examid = subject.getExamid();
219
+        Integer esstate = subject.getEsstate();
220
+        Integer schoolid = subject.getSchoolid();
221
+        Integer page = subject.getPage();
222
+        Integer pageSize = subject.getPageSize();
223
+        N_Utils.validation(new Object[]{examid, "考试id", 1, schoolid, "学校id", 1
224
+                , page, "页码", 1, pageSize, "显示条数", 1});
225
+        PageHelper.startPage(page, pageSize);
226
+        List<Map> list = eSubjectInvigilateService.listJtJkSubject(examid, 0, esstate, schoolid);
227
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
228
+        return new ResultVo(0, "获取成功", pageResult);
229
+    }
230
+
187 231
     /*
188 232
      * 缺考学生列表
189 233
      * @Param [vo]

+ 5
- 2
sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubject.java Vedi File

@@ -3,8 +3,7 @@ package com.xhkjedu.sexam.model.exam;
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;
5 5
 
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
6
+import javax.persistence.*;
8 7
 
9 8
 @Table(name = "e_subject")
10 9
 @Data
@@ -42,4 +41,8 @@ public class ESubject extends BaseBean {
42 41
 
43 42
     //科目名称
44 43
     private String subjectname;
44
+
45
+    @Transient
46
+    //学校id
47
+    private Integer schoolid;
45 48
 }

+ 60
- 4
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectInvigilateService.java Vedi File

@@ -14,10 +14,7 @@ import org.springframework.stereotype.Service;
14 14
 import org.springframework.transaction.annotation.Transactional;
15 15
 
16 16
 import javax.annotation.Resource;
17
-import java.util.ArrayList;
18
-import java.util.HashMap;
19
-import java.util.List;
20
-import java.util.Map;
17
+import java.util.*;
21 18
 import java.util.stream.Collectors;
22 19
 
23 20
 @Service
@@ -155,6 +152,65 @@ public class ESubjectInvigilateService {
155 152
         return list;
156 153
     }
157 154
 
155
+    /**
156
+     * @Description 教师监考-监控列表(兼容集团校)
157
+     * @Date 2023/8/30 15:24
158
+     * @Author YWX
159
+     * @Param [examid, teacherid, esstate, schoolid]
160
+     * @Return java.util.List<java.util.Map>
161
+     **/
162
+    public List<Map> listJtJkSubject(Integer examid, Integer teacherid, Integer esstate, Integer schoolid) {
163
+        int timestamp = N_Utils.getSecondTimestamp();
164
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm:ss");
165
+        List<Map> list = eSubjectInvigilateMapper.listJkSubject(examid, teacherid, esstate, strtime);
166
+        for (Map map : list) {
167
+            List<Map> classes = JSON.parseArray(map.get("classnames").toString(), Map.class);
168
+            List<Map> classList = new ArrayList<>();
169
+            Integer majored = (Integer) map.get("majored");
170
+            if (majored == 1) {//主监考
171
+                classList.addAll(classes);
172
+            } else {
173
+                String[] classids2 = map.get("classids").toString().split(",");
174
+                for (String classid : classids2) {
175
+                    Map cmap = classes.stream().filter(c -> c.get("classid").toString().equals(classid)).findFirst().orElse(null);
176
+                    if (cmap != null) classList.add(cmap);
177
+                }
178
+            }
179
+            map.remove("classids");
180
+            map.remove("classnames");
181
+            List<Map> schools = new ArrayList<>();
182
+            Map<Integer, List<Map>> collect = classList.stream().collect(Collectors.groupingBy(c -> (Integer) c.get("schoolid")));
183
+            for (Map.Entry<Integer, List<Map>> entry : collect.entrySet()) {
184
+                List<Map> clist = entry.getValue();
185
+                Map school = new HashMap();
186
+                school.put("schoolid", entry.getKey());
187
+                for (int i = 0; i < clist.size(); i++) {
188
+                    Map c = clist.get(i);
189
+                    if (i == 0) {
190
+                        school.put("schoolname", c.get("schoolname"));
191
+                    }
192
+                    c.remove("schoolid");
193
+                    c.remove("schoolname");
194
+                }
195
+                school.put("classes", clist);
196
+                schools.add(school);
197
+            }
198
+            if (schools.size() > 1) {
199
+                //把本校放在第一个位置
200
+                for (int i = 0; i < schools.size(); i++) {
201
+                    Map rtnMap = schools.get(i);
202
+                    Integer schoolid2 = Integer.parseInt(rtnMap.get("schoolid").toString());
203
+                    if (schoolid.equals(schoolid2)) {
204
+                        Collections.swap(schools, i, 0);
205
+                        break;
206
+                    }
207
+                }
208
+            }
209
+            map.put("schools", schools);
210
+        }
211
+        return list;
212
+    }
213
+
158 214
     //根据考试科目id获取考试科目基本信息
159 215
     public Map getESubjectByEsId(Integer esid) {
160 216
         return eSubjectMapper.getESubjectByEsId(esid);

+ 3
- 1
sexam/src/main/resources/mapper/exam/ESubjectInvigilateMapper.xml Vedi File

@@ -29,10 +29,12 @@
29 29
         from(select es.esid,es.sdate,es.begintime,es.endtime,es.esstate,es.subjectname,es.pstate
30 30
         ,eb.examname,eb.gradeid,eb.examtype,eb.examstate,max(ei.majored)majored
31 31
         ,(case when max(ei.majored)=0 then group_concat(distinct ei.classid) else group_concat(distinct ec.classid) end)classids
32
-        ,concat('[',group_concat(distinct json_object('classid',ec.classid,'classname',ec.classname)),']')classnames
32
+        ,concat('[',group_concat(distinct json_object('classid',ec.classid,'classname',ec.classname
33
+            ,'schoolid',ec.schoolid,'schoolname',s.schoolname)),']')classnames
33 34
         from e_subject_invigilate ei left join e_subject es on ei.esid=es.esid
34 35
         left join e_base eb on eb.examid = es.examid
35 36
         left join e_class ec on eb.examid = ec.examid
37
+        left join t_school s on ec.schoolid = s.schoolid
36 38
         where eb.deleted=1 and eb.examstate!=0 and eb.exammode=1 and eb.monitored=1
37 39
         <if test="teacherid!=null and teacherid!=0">
38 40
             and ei.teacherid=#{teacherid}

Loading…
Annulla
Salva