|
@@ -9,6 +9,7 @@ import com.xhkjedu.sapi.model.notice.TNoticeUser;
|
9
|
9
|
import com.xhkjedu.sapi.mapper.notice.*;
|
10
|
10
|
import com.xhkjedu.sapi.model.notice.TNoticeFile;
|
11
|
11
|
import com.xhkjedu.sapi.model.notice.TNotice;
|
|
12
|
+import com.xhkjedu.sapi.vo.notice.NoticeClassVo;
|
12
|
13
|
import com.xhkjedu.utils.N_Utils;
|
13
|
14
|
import com.xhkjedu.sapi.vo.notice.NoticeVo;
|
14
|
15
|
import org.springframework.stereotype.Service;
|
|
@@ -265,27 +266,39 @@ public class NoticeService {
|
265
|
266
|
List<TNoticeUser> users = noticeUserMapper.listSubjectAndClass(noticeid);
|
266
|
267
|
List<Map<String, Integer>> grades = new ArrayList<>();
|
267
|
268
|
List<Map<String, Object>> subjects = new ArrayList<>();
|
268
|
|
- List<Map<String, Object>> classes = new ArrayList<>();
|
|
269
|
+ List<NoticeClassVo> classes = new ArrayList<>();
|
269
|
270
|
for (TNoticeUser user : users) {
|
270
|
271
|
String subjectid = user.getSubjectid();
|
271
|
272
|
Integer gradeid = user.getGradeid();
|
272
|
273
|
Map<String, Integer> g = new LinkedHashMap<>();
|
273
|
274
|
g.put("gradeid", gradeid);
|
274
|
275
|
grades.add(g);
|
275
|
|
- Map<String, Object> sc = new LinkedHashMap<>();
|
276
|
|
- String username = user.getUsername();
|
|
276
|
+ String[] username = user.getUsername().split("_");
|
277
|
277
|
if (N_Utils.isEmpty(subjectid)) {
|
278
|
|
- sc.put("gradeid", gradeid);
|
279
|
|
- sc.put("classid", user.getClassid());
|
280
|
|
- sc.put("classname", username);
|
281
|
|
- classes.add(sc);
|
|
278
|
+ NoticeClassVo c = new NoticeClassVo();
|
|
279
|
+ c.setGradeid(gradeid);
|
|
280
|
+ c.setClassid(user.getClassid());
|
|
281
|
+ c.setClassname(username[0]);
|
|
282
|
+ String[] typeOrder = username[1].split("-");
|
|
283
|
+ c.setClasstype(N_Utils.str2Int(typeOrder[0]));
|
|
284
|
+ c.setClassorder(N_Utils.str2Int(typeOrder[1]));
|
|
285
|
+ classes.add(c);
|
282
|
286
|
} else {
|
|
287
|
+ Map<String, Object> sc = new LinkedHashMap<>();
|
283
|
288
|
sc.put("subjectid", subjectid);
|
284
|
|
- sc.put("subjectname", username);
|
|
289
|
+ sc.put("subjectname", username[0]);
|
|
290
|
+ sc.put("subjectorder", username[1]);
|
285
|
291
|
subjects.add(sc);
|
286
|
292
|
}
|
287
|
293
|
}
|
288
|
294
|
grades.sort(Comparator.comparing(m -> m.get("gradeid")));
|
|
295
|
+ subjects.sort(Comparator.comparing(m -> N_Utils.str2Int(m.get("subjectorder").toString())));
|
|
296
|
+ classes = classes.stream().sorted(
|
|
297
|
+ Comparator.comparingInt(NoticeClassVo::getGradeid)
|
|
298
|
+ .thenComparing(NoticeClassVo::getClasstype)
|
|
299
|
+ .thenComparing(NoticeClassVo::getClassorder)
|
|
300
|
+ .thenComparing(NoticeClassVo::getClassname)
|
|
301
|
+ ).collect(Collectors.toList());
|
289
|
302
|
map.put("grades", grades.stream().distinct().collect(Collectors.toList()));
|
290
|
303
|
map.put("subjects", subjects.stream().distinct().collect(Collectors.toList()));
|
291
|
304
|
map.put("classes", classes);
|