ExamRoomServiceImpl.java 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. package com.keao.edu.user.service.impl;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.keao.edu.auth.api.client.SysUserFeignService;
  5. import com.keao.edu.auth.api.entity.SysUser;
  6. import com.keao.edu.common.dal.BaseDAO;
  7. import com.keao.edu.common.enums.MessageTypeEnum;
  8. import com.keao.edu.common.exception.BizException;
  9. import com.keao.edu.common.page.PageInfo;
  10. import com.keao.edu.common.service.IdGeneratorService;
  11. import com.keao.edu.common.service.SysMessageService;
  12. import com.keao.edu.common.service.impl.BaseServiceImpl;
  13. import com.keao.edu.common.tenant.TenantContextHolder;
  14. import com.keao.edu.im.api.client.ImFeignService;
  15. import com.keao.edu.im.api.entity.MemberChangedMessage;
  16. import com.keao.edu.im.api.entity.PublishMessageDto;
  17. import com.keao.edu.thirdparty.message.provider.JiguangPushPlugin;
  18. import com.keao.edu.thirdparty.message.provider.YimeiSmsPlugin;
  19. import com.keao.edu.user.api.entity.ExamRoom;
  20. import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
  21. import com.keao.edu.user.api.enums.ExamModeEnum;
  22. import com.keao.edu.user.dao.*;
  23. import com.keao.edu.user.dto.ExamRoomDto;
  24. import com.keao.edu.user.dto.ExamRoomExamTimeDto;
  25. import com.keao.edu.user.dto.ExamRoomListDto;
  26. import com.keao.edu.user.dto.ExamRoomStatisticsDto;
  27. import com.keao.edu.user.entity.*;
  28. import com.keao.edu.user.page.ExamRoomListQueryInfo;
  29. import com.keao.edu.user.page.ExamRoomQueryInfo;
  30. import com.keao.edu.user.service.*;
  31. import com.keao.edu.util.collection.MapUtil;
  32. import com.keao.edu.util.date.DateUtil;
  33. import org.apache.commons.beanutils.BeanUtils;
  34. import org.apache.commons.lang.time.DateUtils;
  35. import org.apache.commons.lang3.StringUtils;
  36. import org.springframework.beans.factory.annotation.Autowired;
  37. import org.springframework.stereotype.Service;
  38. import org.springframework.transaction.annotation.Transactional;
  39. import org.springframework.util.CollectionUtils;
  40. import java.time.LocalDate;
  41. import java.time.format.DateTimeFormatter;
  42. import java.util.*;
  43. import java.util.stream.Collectors;
  44. @Service
  45. public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> implements ExamRoomService {
  46. @Autowired
  47. private ExamRoomDao examRoomDao;
  48. @Autowired
  49. private ExamRoomStudentRelationService examRoomStudentRelationService;
  50. @Autowired
  51. private OrganizationService organizationService;
  52. @Autowired
  53. private ExamRegistrationDao examRegistrationDao;
  54. @Autowired
  55. private ExaminationBasicDao examinationBasicDao;
  56. @Autowired
  57. private SysUserDao sysUserDao;
  58. @Autowired
  59. private ExamTeacherSalaryService examTeacherSalaryService;
  60. @Autowired
  61. private ExamCertificationService examCertificationService;
  62. @Autowired
  63. private StudentExamResultDao studentExamResultDao;
  64. @Autowired
  65. private ExamOrganizationRelationDao examOrganizationRelationDao;
  66. @Autowired
  67. private ExamLifecycleLogDao examLifecycleLogDao;
  68. @Autowired
  69. private ImFeignService imFeignService;
  70. @Autowired
  71. private SysUserFeignService sysUserFeignService;
  72. @Autowired
  73. private SysMessageService sysMessageService;
  74. @Autowired
  75. private ExamRoomStudentRelationDao examRoomStudentRelationDao;
  76. @Autowired
  77. private SysConfigService sysConfigService;
  78. @Autowired
  79. private ExamCertificationDao examCertificationDao;
  80. @Autowired
  81. private ExamLocationDao examLocationDao;
  82. @Autowired
  83. private IdGeneratorService idGeneratorService;
  84. @Override
  85. public BaseDAO<Long, ExamRoom> getDAO() {
  86. return examRoomDao;
  87. }
  88. @Override
  89. public PageInfo<ExamRoomListDto> queryExamRoomPage(ExamRoomListQueryInfo queryInfo) {
  90. PageInfo<ExamRoomListDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
  91. Map<String, Object> params = new HashMap<>();
  92. MapUtil.populateMap(params, queryInfo);
  93. // List<Integer> childOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
  94. // params.put("organIds", childOrganIds);
  95. SysUser sysUser = sysUserFeignService.queryUserInfo();
  96. params.put("teacherId",sysUser.getId());
  97. List<ExamRoomListDto> dataList = null;
  98. int count = examRoomDao.countExamRoomPage(params);
  99. if (count > 0) {
  100. pageInfo.setTotal(count);
  101. params.put("offset", pageInfo.getOffset());
  102. dataList = examRoomDao.queryExamRoomPage(params);
  103. //获取考试学员数
  104. Set<Long> roomIds = dataList.stream().map(e -> e.getExamRoomId()).collect(Collectors.toSet());
  105. Map<Long, Integer> convertMybatisMap = MapUtil.convertMybatisMap(examRoomStudentRelationDao.getStudentNumMap(roomIds), Long.class, Integer.class);
  106. dataList.forEach(e->{
  107. e.setStudentNum(convertMybatisMap.get(e.getExamRoomId()));
  108. });
  109. }
  110. if (count == 0) {
  111. dataList = new ArrayList<>();
  112. }
  113. pageInfo.setRows(dataList);
  114. return pageInfo;
  115. }
  116. @Override
  117. public PageInfo<ExamRoomDto> queryExamRooms(ExamRoomQueryInfo queryInfo) {
  118. PageInfo<ExamRoomDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
  119. Map<String, Object> params = new HashMap<>();
  120. MapUtil.populateMap(params, queryInfo);
  121. List<Integer> childOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
  122. params.put("organIds", childOrganIds);
  123. List<ExamRoomDto> dataList = null;
  124. int count = examRoomDao.countExamRoom(params);
  125. if (count > 0) {
  126. pageInfo.setTotal(count);
  127. params.put("offset", pageInfo.getOffset());
  128. dataList = examRoomDao.queryExamRoom(params);
  129. }
  130. if (count == 0) {
  131. dataList = new ArrayList<>();
  132. }
  133. pageInfo.setRows(dataList);
  134. return pageInfo;
  135. }
  136. @Override
  137. @Transactional(rollbackFor = Exception.class)
  138. public void createExamRoom(ExamRoom examRoom) {
  139. if(Objects.isNull(examRoom.getExaminationBasicId())){
  140. throw new BizException("请指定考级项目");
  141. }
  142. ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
  143. if(Objects.isNull(examinationBasic)){
  144. throw new BizException("考级项目不存在");
  145. }
  146. if(Objects.isNull(examRoom.getExamMode())){
  147. throw new BizException("请指定考试类型");
  148. }
  149. if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())&&Objects.isNull(examRoom.getExamLocationId())){
  150. throw new BizException("线下考试请指定考试地址");
  151. }
  152. if(StringUtils.isBlank(examRoom.getSubjectIdList())){
  153. throw new BizException("请指定考试专业");
  154. }
  155. if(Objects.isNull(examRoom.getMainTeacherUserId())){
  156. throw new BizException("请指定主考老师");
  157. }
  158. if(StringUtils.isBlank(examRoom.getExamTimeJson())){
  159. throw new BizException("请指定考试时间");
  160. }
  161. if(ExamModeEnum.ONLINE.equals(examRoom.getExamMode())){
  162. examRoom.setExamLocationId(null);
  163. }
  164. ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examinationBasic.getId(), examRoom.getOrganId());
  165. if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
  166. throw new BizException("无权操作");
  167. }
  168. examRoom.setTenantId(TenantContextHolder.getTenantId());
  169. examRoom.setExamPlanPushFlag(0);
  170. examRoom.setExamRoomStudentNum(0);
  171. if(StringUtils.isBlank(examRoom.getExamTimeJson())){
  172. examRoomDao.insert(examRoom);
  173. return;
  174. }
  175. List<Integer> teacherIds=new ArrayList<>();
  176. teacherIds.add(examRoom.getMainTeacherUserId());
  177. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  178. teacherIds.addAll(Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList()));
  179. HashSet<Integer> noRepeatTeacherIds = new HashSet<>(teacherIds);
  180. if(teacherIds.size()!=noRepeatTeacherIds.size()){
  181. throw new BizException("主考老师与监考老师不可重复");
  182. }
  183. }
  184. Map<Integer, String> teacherIdNameMap = this.getMap("sys_user", "id_", "real_name_", teacherIds, Integer.class, String.class);
  185. examRoom.setMainTeacherName(teacherIdNameMap.get(examRoom.getMainTeacherUserId()));
  186. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  187. List<Integer> assistantTeacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
  188. List<String> assistantTeacherNames = new ArrayList<>();
  189. for (Integer assistantTeacherId : assistantTeacherIds) {
  190. assistantTeacherNames.add(teacherIdNameMap.get(assistantTeacherId));
  191. }
  192. examRoom.setAssistantTeacherUserNameList(StringUtils.join(assistantTeacherNames, ","));
  193. }
  194. List<Integer> subjectIds = Arrays.stream(examRoom.getSubjectIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
  195. Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
  196. examRoom.setSubjectNameList(StringUtils.join(subjectIdNameMap.values(),","));
  197. List<ExamRoom> examRooms=new ArrayList<>();
  198. List<JSONObject> examTimes = JSON.parseArray(examRoom.getExamTimeJson(), JSONObject.class);
  199. for (JSONObject examTime : examTimes) {
  200. ExamRoom er;
  201. try {
  202. er= (ExamRoom) BeanUtils.cloneBean(examRoom);
  203. } catch (Exception e) {
  204. throw new BizException("教室创建失败");
  205. }
  206. er.setExamStartTime(examTime.getDate("examStartTime"));
  207. er.setExamEndTime(examTime.getDate("examEndTime"));
  208. if(Objects.isNull(er.getExamStartTime())||Objects.isNull(er.getExamEndTime())){
  209. throw new BizException("请指定考试时间");
  210. }
  211. if(er.getExamStartTime().compareTo(er.getExamEndTime())>=0){
  212. throw new BizException("考试时间异常");
  213. }
  214. if(!DateUtils.isSameDay(er.getExamStartTime(), er.getExamEndTime())){
  215. throw new BizException("暂不支持跨天");
  216. }
  217. examRooms.add(er);
  218. }
  219. checkRoomTeachers(examRooms);
  220. examRoomDao.batchInsert(examRooms);
  221. ExamRoomExamTimeDto examRoomExamTime = examRoomDao.getExamRoomExamTime(examRoom.getExaminationBasicId());
  222. if(Objects.isNull(examRoomExamTime)){
  223. examinationBasic.setActualExamStartTime(null);
  224. examinationBasic.setActualExamEndTime(null);
  225. }else{
  226. if(examinationBasic.getEnrollEndTime().compareTo(examRoomExamTime.getExamStartTime())>0){
  227. throw new BizException("考试时间不可在报名结束时间之前");
  228. }
  229. examinationBasic.setActualExamStartTime(DateUtils.truncate(examRoomExamTime.getExamStartTime(), Calendar.DAY_OF_MONTH));
  230. examinationBasic.setActualExamEndTime(DateUtils.ceiling(examRoomExamTime.getExamEndTime(), Calendar.DAY_OF_MONTH));
  231. }
  232. examinationBasicDao.update(examinationBasic);
  233. examTeacherSalaryService.teacherSalarySettlementWithExam(examinationBasic.getId());
  234. }
  235. @Override
  236. public ExamRoom updateExamRoom(ExamRoom examRoom) {
  237. if(Objects.isNull(examRoom.getId())){
  238. throw new BizException("请指定考场");
  239. }
  240. ExamRoom existExamRoom = examRoomDao.get(examRoom.getId());
  241. if(Objects.isNull(existExamRoom)){
  242. throw new BizException("考场不存在");
  243. }
  244. if(existExamRoom.getExamPlanPushFlag()==1){
  245. throw new BizException("无法修改");
  246. }
  247. ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
  248. if(Objects.isNull(examinationBasic)){
  249. throw new BizException("考级项目不存在");
  250. }
  251. ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(existExamRoom.getExaminationBasicId(), examRoom.getOrganId());
  252. if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
  253. throw new BizException("无权操作");
  254. }
  255. if(ExamModeEnum.ONLINE.equals(examRoom.getExamMode())){
  256. examRoom.setExamLocationId(null);
  257. }
  258. List<Integer> teacherIds=new ArrayList<>();
  259. teacherIds.add(examRoom.getMainTeacherUserId());
  260. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  261. teacherIds.addAll(Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList()));
  262. HashSet<Integer> noRepeatTeacherIds = new HashSet<>(teacherIds);
  263. if(teacherIds.size()!=noRepeatTeacherIds.size()){
  264. throw new BizException("主考老师与监考老师不可重复");
  265. }
  266. }
  267. Map<Integer, String> teacherIdNameMap = this.getMap("sys_user", "id_", "real_name_", teacherIds, Integer.class, String.class);
  268. examRoom.setMainTeacherName(teacherIdNameMap.get(examRoom.getMainTeacherUserId()));
  269. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  270. List<Integer> assistantTeacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
  271. List<String> assistantTeacherNames = new ArrayList<>();
  272. for (Integer assistantTeacherId : assistantTeacherIds) {
  273. assistantTeacherNames.add(teacherIdNameMap.get(assistantTeacherId));
  274. }
  275. examRoom.setAssistantTeacherUserNameList(StringUtils.join(assistantTeacherNames, ","));
  276. }
  277. List<Integer> subjectIds = Arrays.stream(examRoom.getSubjectIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
  278. Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
  279. examRoom.setSubjectNameList(StringUtils.join(subjectIdNameMap.values(),","));
  280. if(Objects.isNull(examRoom.getExamStartTime())){
  281. examRoom.setExamStartTime(existExamRoom.getExamStartTime());
  282. }
  283. if(Objects.isNull(examRoom.getExamEndTime())){
  284. examRoom.setExamEndTime(existExamRoom.getExamEndTime());
  285. }
  286. if(examRoom.getExamStartTime().compareTo(examRoom.getExamEndTime())>=0){
  287. throw new BizException("考试时间异常");
  288. }
  289. if(!DateUtils.isSameDay(examRoom.getExamStartTime(), examRoom.getExamEndTime())){
  290. throw new BizException("暂不支持跨天");
  291. }
  292. List<ExamRoom> examRooms=new ArrayList<>(Arrays.asList(examRoom));
  293. checkRoomTeachers(examRooms);
  294. examRoomDao.update(examRoom);
  295. ExamRoomExamTimeDto examRoomExamTime = examRoomDao.getExamRoomExamTime(examRoom.getExaminationBasicId());
  296. if(Objects.isNull(examRoomExamTime)){
  297. examinationBasic.setActualExamStartTime(null);
  298. examinationBasic.setActualExamEndTime(null);
  299. }else{
  300. if(examinationBasic.getEnrollEndTime().compareTo(examRoomExamTime.getExamStartTime())>0){
  301. throw new BizException("考试时间不可在报名结束时间之前");
  302. }
  303. examinationBasic.setActualExamStartTime(DateUtils.truncate(examRoomExamTime.getExamStartTime(), Calendar.DAY_OF_MONTH));
  304. examinationBasic.setActualExamEndTime(DateUtils.ceiling(examRoomExamTime.getExamEndTime(), Calendar.DAY_OF_MONTH));
  305. }
  306. examinationBasicDao.update(examinationBasic);
  307. if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
  308. ExamLocation examLocation = examLocationDao.get(examRoom.getExamLocationId());
  309. if(Objects.isNull(examLocation)){
  310. throw new BizException("考试地址不存在");
  311. }
  312. List<ExamRoomStudentRelation> examRoomStudents = examRoomStudentRelationDao.findStudentsWithExamRoom(examRoom.getId());
  313. List<Long> registIds = examRoomStudents.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toList());
  314. examCertificationDao.updateExamAddress(examLocation.getAddress(), registIds);
  315. }
  316. examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
  317. return examRoom;
  318. }
  319. @Override
  320. @Transactional(rollbackFor = Exception.class)
  321. public void deleteExamRooms(Integer organId,String examRoomIdsStr) {
  322. if(StringUtils.isBlank(examRoomIdsStr)){
  323. return;
  324. }
  325. List<Long> examRoomIds = Arrays.asList(examRoomIdsStr.split(",")).stream().map(e -> Long.valueOf(e)).collect(Collectors.toList());
  326. ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
  327. if(examRoom.getExamPlanPushFlag()==1){
  328. throw new BizException("无法删除");
  329. }
  330. ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
  331. if(Objects.isNull(examinationBasic)){
  332. throw new BizException("考级项目不存在");
  333. }
  334. ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRoom.getExaminationBasicId(), organId);
  335. if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
  336. throw new BizException("无权操作");
  337. }
  338. List<ExamRoomStudentRelation> roomStudents = examRoomStudentRelationService.findStudentsWithExamRooms(examRoomIds);
  339. List<Long> registIds = roomStudents.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toList());
  340. examRoomStudentRelationService.deleteWithExamRooms(examRoomIds);
  341. if(!CollectionUtils.isEmpty(registIds)){
  342. examCertificationService.deleteWithRegist(registIds);
  343. studentExamResultDao.deleteWithRegists(registIds);
  344. }
  345. examRoomDao.batchDeleteExamRooms(examRoomIds);
  346. ExamRoomExamTimeDto examRoomExamTime = examRoomDao.getExamRoomExamTime(examRoom.getExaminationBasicId());
  347. if(Objects.isNull(examRoomExamTime)){
  348. examinationBasic.setActualExamStartTime(null);
  349. examinationBasic.setActualExamEndTime(null);
  350. }else{
  351. examinationBasic.setActualExamStartTime(DateUtils.truncate(examRoomExamTime.getExamStartTime(), Calendar.DAY_OF_MONTH));
  352. examinationBasic.setActualExamEndTime(DateUtils.ceiling(examRoomExamTime.getExamEndTime(), Calendar.DAY_OF_MONTH));
  353. }
  354. examinationBasicDao.update(examinationBasic);
  355. examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
  356. }
  357. @Override
  358. @Transactional(rollbackFor = Exception.class)
  359. public void sendExamPlan(Integer organId, Integer examId, Integer operatorId) {
  360. if(Objects.isNull(examId)){
  361. throw new BizException("请指定考级项目");
  362. }
  363. ExaminationBasic exam = examinationBasicDao.get(examId.longValue());
  364. if(Objects.isNull(exam)){
  365. throw new BizException("考级项目不存在");
  366. }
  367. ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(exam.getId(), organId);
  368. if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
  369. throw new BizException("无权操作");
  370. }
  371. int withoutExamRoomStudentNum = examRegistrationDao.countWithoutExamRoomStudentNum(null, examId);
  372. if(withoutExamRoomStudentNum>0){
  373. throw new BizException("存在未安排教室的学员");
  374. }
  375. examLifecycleLogDao.insert(new ExamLifecycleLog(examId, "确认考试安排", operatorId));
  376. List<ExamRoomStudentRelation> examRoomStudentWithOrgans = examRoomStudentRelationDao.getNoSendExamPlanRooms(examId.longValue(), null);
  377. if(CollectionUtils.isEmpty(examRoomStudentWithOrgans)){
  378. return;
  379. }
  380. Set<Integer> locationIds = examRoomStudentWithOrgans.stream().filter(e -> Objects.nonNull(e.getExamLocationId())).map(ExamRoomStudentRelation::getExamLocationId).collect(Collectors.toSet());
  381. Map<Integer, String> idLocationMap = this.getMap("exam_location", "id_", "name_", new ArrayList(locationIds), Integer.class, String.class);
  382. Set<Integer> allStudentIds = examRoomStudentWithOrgans.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
  383. Map<Integer, String> idPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(allStudentIds), Integer.class, String.class);
  384. Set<Long> registIds = examRoomStudentWithOrgans.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toSet());
  385. List<ExamRegistration> examRegistrations = examRegistrationDao.getRegists(new ArrayList<>(registIds));
  386. Map<Integer, ExamRegistration> studentRegistMap = examRegistrations.stream().collect(Collectors.toMap(ExamRegistration::getId, e -> e));
  387. Map<Long, List<ExamRoomStudentRelation>> examRoomStudentMap = examRoomStudentWithOrgans.stream().collect(Collectors.groupingBy(ExamRoomStudentRelation::getExamRoomId));
  388. Map<Integer, List<ExamRoom>> teacherExamRoomsMap = new HashMap<>();
  389. List<ExamRoom> needUpdateExamRooms = new ArrayList<>();
  390. List<ExamRegistration> updateRegistrations = new ArrayList<>();
  391. List<ExamCertification> examCertifications=new ArrayList<>();
  392. List<StudentExamResult> studentExamResults=new ArrayList<>();
  393. String baseUrl = "2?examRegistrationId=";
  394. for (Map.Entry<Long, List<ExamRoomStudentRelation>> examRoomStudentEntry : examRoomStudentMap.entrySet()) {
  395. List<ExamRoomStudentRelation> students = examRoomStudentEntry.getValue();
  396. Set<Integer> studentIds = students.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
  397. if(CollectionUtils.isEmpty(studentIds)){
  398. continue;
  399. }
  400. ExamRoom examRoom=students.get(0);
  401. examRoom.setId(students.get(0).getExamRoomId());
  402. for (ExamRoomStudentRelation student : students) {
  403. ExamRegistration examRegistration = studentRegistMap.get(Integer.valueOf(student.getExamRegistrationId().toString()));
  404. if(Objects.isNull(examRegistration)){
  405. throw new BizException("学员信息错误");
  406. }
  407. ExamCertification ec=new ExamCertification();
  408. ec.setExamRegistrationId(student.getExamRegistrationId());
  409. ec.setExaminationBasicId(student.getExaminationBasicId());
  410. ec.setStudentId(student.getStudentId());
  411. ec.setCardNo(String.valueOf(idGeneratorService.generatorId()));
  412. ec.setSubjectId(examRegistration.getSubjectId());
  413. ec.setLevel(examRegistration.getLevel());
  414. ec.setExamStartTime(examRoom.getExamStartTime());
  415. ec.setExamEndTime(examRoom.getExamEndTime());
  416. if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
  417. ec.setExamAddress(idLocationMap.get(student.getExamLocationId()));
  418. }
  419. ec.setTenantId(TenantContextHolder.getTenantId());
  420. examCertifications.add(ec);
  421. StudentExamResult ser = new StudentExamResult();
  422. ser.setExamRegistrationId(examRegistration.getId().longValue());
  423. ser.setExaminationBasicId(examRegistration.getExaminationBasicId());
  424. ser.setStudentId(examRegistration.getStudentId());
  425. ser.setIsFinishedExam(3);
  426. ser.setConfirmStatus(0);
  427. ser.setTenantId(TenantContextHolder.getTenantId());
  428. ser.setExamRoomId(student.getExamRoomId());
  429. studentExamResults.add(ser);
  430. examRegistration.setCardNo(ec.getCardNo());
  431. updateRegistrations.add(examRegistration);
  432. }
  433. needUpdateExamRooms.add(new ExamRoom(examRoom.getId(), 1));
  434. if(!teacherExamRoomsMap.containsKey(examRoom.getMainTeacherUserId())){
  435. teacherExamRoomsMap.put(examRoom.getMainTeacherUserId(), new ArrayList<>());
  436. }
  437. teacherExamRoomsMap.get(examRoom.getMainTeacherUserId()).add(examRoom);
  438. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  439. Set<Integer> ateacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toSet());
  440. for (Integer ateacherId : ateacherIds) {
  441. if(!teacherExamRoomsMap.containsKey(ateacherId)){
  442. teacherExamRoomsMap.put(ateacherId, new ArrayList<>());
  443. }
  444. teacherExamRoomsMap.get(ateacherId).add(examRoom);
  445. }
  446. }
  447. Map<Integer, String> receiverMap = studentIds.stream().collect(Collectors.toMap(e->e, e->e.toString()));
  448. Map<Integer, String> phoneMap = idPhoneMap.entrySet().stream().filter(e->studentIds.contains(e.getKey())).collect(Collectors.toMap(e->e.getKey(), e->e.getValue()));
  449. MessageTypeEnum pushMessageType = MessageTypeEnum.EXAM_ROOM_CONFIRM_ONLINE_STUDENT_PUSH;
  450. MessageTypeEnum smsMessageType = MessageTypeEnum.EXAM_ROOM_CONFIRM_ONLINE_STUDENT_SMS;
  451. String examName = exam.getName();
  452. String examDayStr = DateUtil.dateToString(examRoom.getExamStartTime(), "MM月dd日");
  453. StringBuffer examTimeStr = new StringBuffer();
  454. examTimeStr.append(DateUtil.dateToString(examRoom.getExamStartTime(), "HH时mm分"));
  455. examTimeStr.append("-");
  456. examTimeStr.append(DateUtil.dateToString(examRoom.getExamEndTime(), "HH时mm分"));
  457. String locationName = "网络考场";
  458. if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
  459. pushMessageType = MessageTypeEnum.EXAM_ROOM_CONFIRM_OFFLINE_STUDENT_PUSH;
  460. smsMessageType = MessageTypeEnum.EXAM_ROOM_CONFIRM_OFFLINE_STUDENT_SMS;
  461. locationName=idLocationMap.get(examRoom.getExamLocationId());
  462. }
  463. sysMessageService.batchSendMessage(pushMessageType,
  464. receiverMap, null, 0, baseUrl+students.get(0).getExamRegistrationId(), JiguangPushPlugin.PLUGIN_NAME,
  465. examName, examDayStr, examTimeStr, locationName);
  466. sysMessageService.batchSendMessage(smsMessageType,
  467. phoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
  468. examName, examDayStr, examTimeStr, locationName);
  469. }
  470. Map<Integer, String> idTeacherPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(teacherExamRoomsMap.keySet()), Integer.class, String.class);
  471. for (Map.Entry<Integer, List<ExamRoom>> teacherRoomEntry : teacherExamRoomsMap.entrySet()) {
  472. String teacherPhone = idTeacherPhoneMap.get(teacherRoomEntry.getKey());
  473. Date examStartTime = teacherRoomEntry.getValue().stream().min(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime();
  474. String examStartTimeStr = DateUtil.dateToString(examStartTime, "MM月dd日 HH时mm分");
  475. int examRoomNum = teacherRoomEntry.getValue().size();
  476. Map<Integer, String> phoneMap = new HashMap<>();
  477. phoneMap.put(teacherRoomEntry.getKey(), teacherPhone);
  478. sysMessageService.batchSendMessage(MessageTypeEnum.EXAM_ROOM_CONFIRM_TEACHER_SMS,
  479. phoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
  480. exam.getName(), examStartTimeStr, examRoomNum);
  481. }
  482. if(!CollectionUtils.isEmpty(needUpdateExamRooms)){
  483. examRoomDao.batchUpdate(needUpdateExamRooms);
  484. }
  485. if(!CollectionUtils.isEmpty(examCertifications)){
  486. examCertificationService.batchInsert(examCertifications);
  487. }
  488. if(!CollectionUtils.isEmpty(updateRegistrations)){
  489. examRegistrationDao.batchUpdate(updateRegistrations);
  490. }
  491. if(!CollectionUtils.isEmpty(studentExamResults)){
  492. studentExamResultDao.batchInsert(studentExamResults);
  493. }
  494. }
  495. @Override
  496. public void tomorrowExamPlanRemind(String day) {
  497. LocalDate tomorrowDate = LocalDate.now().plusDays(1);
  498. String tomorrowDateStr = tomorrowDate.toString();
  499. if(StringUtils.isNotBlank(day)){
  500. tomorrowDateStr = day;
  501. }
  502. List<ExamRoomStudentRelation> tomorrowExamStudents = examRoomStudentRelationDao.getTomorrowExamStudents(tomorrowDateStr);
  503. if(CollectionUtils.isEmpty(tomorrowExamStudents)){
  504. return;
  505. }
  506. Set<Integer> allStudentIds = tomorrowExamStudents.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
  507. Map<Integer, String> idPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(allStudentIds), Integer.class, String.class);
  508. Map<Long, List<ExamRoomStudentRelation>> examRoomStudentMap = tomorrowExamStudents.stream().collect(Collectors.groupingBy(ExamRoomStudentRelation::getExamRoomId));
  509. Map<Integer, List<ExamRoom>> teacherExamRoomsMap = new HashMap<>();
  510. for (Map.Entry<Long, List<ExamRoomStudentRelation>> examRoomStudentEntry : examRoomStudentMap.entrySet()) {
  511. List<ExamRoomStudentRelation> students = examRoomStudentEntry.getValue();
  512. Set<Integer> studentIds = students.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
  513. if(CollectionUtils.isEmpty(studentIds)){
  514. continue;
  515. }
  516. ExamRoom examRoom=students.get(0);
  517. examRoom.setId(students.get(0).getExamRoomId());
  518. if(!teacherExamRoomsMap.containsKey(examRoom.getMainTeacherUserId())){
  519. teacherExamRoomsMap.put(examRoom.getMainTeacherUserId(), new ArrayList<>());
  520. }
  521. teacherExamRoomsMap.get(examRoom.getMainTeacherUserId()).add(examRoom);
  522. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  523. Set<Integer> assistantTeacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toSet());
  524. for (Integer assistantTeacherId : assistantTeacherIds) {
  525. if(!teacherExamRoomsMap.containsKey(assistantTeacherId)){
  526. teacherExamRoomsMap.put(assistantTeacherId, new ArrayList<>());
  527. }
  528. teacherExamRoomsMap.get(assistantTeacherId).add(examRoom);
  529. }
  530. }
  531. Map<Integer, String> receiverMap = studentIds.stream().collect(Collectors.toMap(e->e, e->e.toString()));
  532. Map<Integer, String> phoneMap = idPhoneMap.entrySet().stream().filter(e->studentIds.contains(e.getKey())).collect(Collectors.toMap(e->e.getKey(), e->e.getValue()));
  533. String examDayStr = DateUtil.dateToString(examRoom.getExamStartTime(), "MM月dd日");
  534. StringBuffer examTimeStr = new StringBuffer();
  535. examTimeStr.append(DateUtil.dateToString(examRoom.getExamStartTime(), "HH时mm分"));
  536. sysMessageService.batchSendMessage(MessageTypeEnum.BEFORE_EXAM_STUDENT_REMIND_PUSH,
  537. receiverMap, null, 0, null, JiguangPushPlugin.PLUGIN_NAME,
  538. examDayStr, examTimeStr.toString());
  539. sysMessageService.batchSendMessage(MessageTypeEnum.BEFORE_EXAM_STUDENT_REMIND_SMS,
  540. phoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
  541. examDayStr, examTimeStr.toString());
  542. }
  543. String tomorrowDayStr=tomorrowDate.format(DateTimeFormatter.ofPattern("MM月dd日"));
  544. Map<Integer, String> idTeacherPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(teacherExamRoomsMap.keySet()), Integer.class, String.class);
  545. for (Map.Entry<Integer, List<ExamRoom>> teacherRoomEntry : teacherExamRoomsMap.entrySet()) {
  546. String teacherPhone = idTeacherPhoneMap.get(teacherRoomEntry.getKey());
  547. Date examStartTime = teacherRoomEntry.getValue().stream().min(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime();
  548. String examStartTimeStr = DateUtil.dateToString(examStartTime, "HH时mm分");
  549. Date examEndTime = teacherRoomEntry.getValue().stream().max(Comparator.comparing(ExamRoom::getExamEndTime)).get().getExamEndTime();
  550. String examEndTimeStr = DateUtil.dateToString(examEndTime, "HH时mm分");
  551. int examRoomNum = teacherRoomEntry.getValue().size();
  552. Map<Integer, String> phoneMap = new HashMap<>();
  553. phoneMap.put(teacherRoomEntry.getKey(), teacherPhone);
  554. sysMessageService.batchSendMessage(MessageTypeEnum.BEFORE_EXAM_TEACHER_REMIND_SMS,
  555. phoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
  556. tomorrowDayStr, examStartTimeStr, examEndTimeStr, examRoomNum);
  557. }
  558. }
  559. @Override
  560. public ExamRoomStatisticsDto getExamRoomStatisticsInfo(Integer organId, Long examId) {
  561. ExamRoomStatisticsDto examRoomStatisticsInfo=new ExamRoomStatisticsDto();
  562. List<Integer> childOrganIds = organizationService.getChildOrganIds(organId, true);
  563. examRoomStatisticsInfo.setTotalRegistrationStudentNum(examRegistrationDao.countTotalRegistrationStudentNumWithExam(childOrganIds, examId));
  564. examRoomStatisticsInfo.setInRoomStudentNum(examRegistrationDao.countInExamRoomStudentNum(childOrganIds, examId));
  565. List<ExamRoom> examRooms = examRoomDao.getWithExam(childOrganIds, examId);
  566. if(!CollectionUtils.isEmpty(examRooms)){
  567. examRoomStatisticsInfo.setExamRoomNum(examRooms.size());
  568. examRoomStatisticsInfo.setFirstExamTime(examRooms.stream().min(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime());
  569. examRoomStatisticsInfo.setLastExamTime(examRooms.stream().max(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime());
  570. Set<Integer> teacherIds=new HashSet<>();
  571. for (ExamRoom examRoom : examRooms) {
  572. if(Objects.nonNull(examRoom.getMainTeacherUserId())){
  573. teacherIds.add(examRoom.getMainTeacherUserId());
  574. }
  575. if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
  576. Set<Integer> assistantTeacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toSet());
  577. teacherIds.addAll(assistantTeacherIds);
  578. }
  579. }
  580. examRoomStatisticsInfo.setExamRoomTeacherNum(teacherIds.size());
  581. }
  582. return examRoomStatisticsInfo;
  583. }
  584. @Override
  585. @Transactional(rollbackFor = Exception.class)
  586. public void checkRoomTeachers(List<ExamRoom> examRooms) {
  587. if(CollectionUtils.isEmpty(examRooms)){
  588. throw new BizException("考场信息异常");
  589. }
  590. Set<String> days=new HashSet<>();
  591. Map<Integer, List<ExamRoom>> teacherRoomMap = new HashMap<>();
  592. for (ExamRoom examRoom : examRooms) {
  593. if(Objects.nonNull(examRoom.getExamStartTime())){
  594. days.add(DateUtil.dateToString(examRoom.getExamStartTime(), "yyyy-MM-dd"));
  595. }
  596. if(Objects.nonNull(examRoom.getExamEndTime())){
  597. days.add(DateUtil.dateToString(examRoom.getExamEndTime(), "yyyy-MM-dd"));
  598. }
  599. if(Objects.nonNull(examRoom.getMainTeacherUserId())&&!teacherRoomMap.containsKey(examRoom.getMainTeacherUserId())){
  600. List<ExamRoom> teacherExamRooms=new ArrayList<>();
  601. teacherExamRooms.add(examRoom);
  602. teacherRoomMap.put(examRoom.getMainTeacherUserId(), teacherExamRooms);
  603. }else if(teacherRoomMap.containsKey(examRoom.getMainTeacherUserId())){
  604. teacherRoomMap.get(examRoom.getMainTeacherUserId()).add(examRoom);
  605. }
  606. if(StringUtils.isBlank(examRoom.getAssistantTeacherUserIdList())){
  607. continue;
  608. }
  609. String[] teacherStrIds = examRoom.getAssistantTeacherUserIdList().split(",");
  610. for (String teacherStrId : teacherStrIds) {
  611. if(!teacherRoomMap.containsKey(Integer.valueOf(teacherStrId))){
  612. List<ExamRoom> teacherExamRooms=new ArrayList<>();
  613. teacherExamRooms.add(examRoom);
  614. teacherRoomMap.put(Integer.valueOf(teacherStrId), teacherExamRooms);
  615. }else if(teacherRoomMap.containsKey(Integer.valueOf(teacherStrId))){
  616. teacherRoomMap.get(Integer.valueOf(teacherStrId)).add(examRoom);
  617. }
  618. }
  619. }
  620. if(CollectionUtils.isEmpty(days)){
  621. throw new BizException("考场信息异常");
  622. }
  623. List<ExamRoom> withDays = examRoomDao.getWithDays(new ArrayList<>(days));
  624. for (ExamRoom examRoom : withDays) {
  625. if(teacherRoomMap.containsKey(examRoom.getMainTeacherUserId())){
  626. teacherRoomMap.get(examRoom.getMainTeacherUserId()).add(examRoom);
  627. }
  628. if(StringUtils.isBlank(examRoom.getAssistantTeacherUserIdList())){
  629. continue;
  630. }
  631. String[] teacherStrIds = examRoom.getAssistantTeacherUserIdList().split(",");
  632. for (String teacherStrId : teacherStrIds) {
  633. if(teacherRoomMap.containsKey(Integer.valueOf(teacherStrId))){
  634. teacherRoomMap.get(Integer.valueOf(teacherStrId)).add(examRoom);
  635. }
  636. }
  637. }
  638. for (Map.Entry<Integer, List<ExamRoom>> teacherRoomEntry : teacherRoomMap.entrySet()) {
  639. List<ExamRoom> teacherRooms = teacherRoomEntry.getValue();
  640. teacherRooms.sort(Comparator.comparing(ExamRoom::getExamStartTime));
  641. for (int i = 0; i < teacherRooms.size(); i++) {
  642. if(i==0){
  643. continue;
  644. }
  645. ExamRoom preExamRoom=teacherRooms.get(i-1);
  646. ExamRoom currentExamRoom = teacherRooms.get(i);
  647. if(Objects.nonNull(preExamRoom.getId())&&preExamRoom.getId().equals(currentExamRoom.getId())){
  648. continue;
  649. }
  650. if(preExamRoom.getExamEndTime().compareTo(currentExamRoom.getExamStartTime())>0){
  651. SysUser sysUser = sysUserDao.get(teacherRoomEntry.getKey());
  652. throw new BizException("{}教师时间存在冲突", sysUser.getRealName());
  653. }
  654. }
  655. }
  656. }
  657. @Override
  658. public List<ExamRoom> getStudentEnableJoinRoom(Long registId) {
  659. if(Objects.isNull(registId)){
  660. throw new BizException("请指定报名信息");
  661. }
  662. ExamRegistration examRegistration = examRegistrationDao.get(registId);
  663. if(Objects.isNull(examRegistration)){
  664. throw new BizException("报名信息不存在");
  665. }
  666. return examRoomDao.getWithExamAndSubject(examRegistration.getExaminationBasicId(), examRegistration.getSubjectId());
  667. }
  668. @Override
  669. @Transactional(rollbackFor = Exception.class)
  670. public void changeExamRoom(Long examRoomId, Integer openFlag) {
  671. ExamRoom examRoom = examRoomDao.get(examRoomId);
  672. examRoom.setId(examRoomId);
  673. examRoom.setOpenFlag(openFlag);
  674. if(StringUtils.isEmpty(examRoom.getAssistantTeacherUserIdList())){
  675. examRoom.setShieldUserId(examRoom.getMainTeacherUserId().toString());
  676. }else {
  677. examRoom.setShieldUserId(examRoom.getMainTeacherUserId() + "," + examRoom.getAssistantTeacherUserIdList());
  678. }
  679. if(openFlag == 0){
  680. examRoom.setExamFlag(openFlag);
  681. Integer num = examRoomStudentRelationService.countSignInNum(examRoomId);
  682. if(num != null && num > 0){
  683. throw new BizException("操作失败,当前还有学员未考试");
  684. }
  685. }
  686. examRoomDao.update(examRoom);
  687. SysUser sysUser = sysUserFeignService.queryUserInfo();
  688. //加群退群
  689. if(openFlag == 1){
  690. String studentIds = examRoomStudentRelationService.getStudentIds(examRoomId);
  691. StringBuffer stringBuffer = new StringBuffer();
  692. stringBuffer.append(examRoom.getMainTeacherUserId());
  693. if(StringUtils.isNotEmpty(studentIds)){
  694. stringBuffer.append(",").append(studentIds);
  695. //推送消息
  696. /*String[] split = studentIds.split(",");
  697. Map<Integer, String> userPhoneMap = new HashMap<>(split.length);
  698. // Map<Integer, String> map = MapUtil.convertMybatisMap(examRoomStudentRelationService.getStuRegistrationMap(examRoomId), Integer.class, String.class);
  699. for (String s : split) {
  700. userPhoneMap.put(Integer.parseInt(s),s);
  701. }
  702. // String notifyUrl = "?examRegistrationId=" + studentExtraExercise.getId() + "&studentCourseHomeworkId=" + studentExtraExercise.getId() + "&extra=1";
  703. // String extra = "dayaedu" + notifyUrl + "&userId=" + studentId;
  704. sysMessageService.batchSendMessage(MessageTypeEnum.ACTION_EXAM_SIGN_PUSH,
  705. userPhoneMap, null, 0, null, JiguangPushPlugin.PLUGIN_NAME);*/
  706. }
  707. if(StringUtils.isNotEmpty(examRoom.getAssistantTeacherUserIdList())){
  708. stringBuffer.append(",").append(examRoom.getAssistantTeacherUserIdList());
  709. }
  710. imFeignService.joinGroup(stringBuffer.toString(),examRoomId.toString(),examRoomId.toString());
  711. PublishMessageDto publishMessageDto = new PublishMessageDto();
  712. publishMessageDto.setUserId(sysUser.getId().toString());
  713. publishMessageDto.setRoomId(examRoomId.toString());
  714. MemberChangedMessage msg = new MemberChangedMessage(5, sysUser.getId().toString(),3);
  715. msg.setWaitNum(0);
  716. msg.setClassroomSwitch(0);
  717. msg.setOpenFlag(openFlag);
  718. Map<String,Object> paramMap = new HashMap<>(1);
  719. paramMap.put("studentQueue",examRoomStudentRelationService.queryNeedCheckingList(examRoomId));
  720. msg.setWebParamJson(JSONObject.toJSONString(paramMap));
  721. publishMessageDto.setMemberChangedMessage(msg);
  722. imFeignService.publishMessage(publishMessageDto);
  723. }else {
  724. imFeignService.dismissGroup(sysUser.getId().toString(),examRoomId.toString());
  725. imFeignService.destroyRoom(examRoomId);
  726. }
  727. }
  728. }