|
@@ -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);
|