|
@@ -1,12 +1,9 @@
|
|
|
package com.keao.edu.user.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.keao.edu.auth.api.client.SysMessageFeignService;
|
|
|
import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
|
-import com.keao.edu.auth.api.entity.SysMessageParams;
|
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
-import com.keao.edu.common.enums.MessageTypeEnum;
|
|
|
import com.keao.edu.common.enums.YesOrNoEnum;
|
|
|
import com.keao.edu.common.exception.BizException;
|
|
|
import com.keao.edu.common.page.PageInfo;
|
|
@@ -20,7 +17,6 @@ import com.keao.edu.im.api.entity.ReqUserData;
|
|
|
import com.keao.edu.user.api.entity.ExamRoom;
|
|
|
import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
|
|
|
import com.keao.edu.user.api.enums.ExamModeEnum;
|
|
|
-import com.keao.edu.user.controller.WebSocketServer;
|
|
|
import com.keao.edu.user.dao.*;
|
|
|
import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
|
|
|
import com.keao.edu.user.dto.NeedCheckingDetailDto;
|
|
@@ -39,7 +35,6 @@ import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -68,8 +63,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
private ImFeignService imFeignService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
- @Autowired
|
|
|
- private SysMessageFeignService sysMessageFeignService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, ExamRoomStudentRelation> getDAO() {
|
|
@@ -285,13 +278,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
//关闭学员房间入口
|
|
|
examRoomStudentRelation.setClassroomSwitch(YesOrNoEnum.NO);
|
|
|
examRoomStudentRelationDao.update(examRoomStudentRelation);
|
|
|
- PublishMessageDto publishMessageDto = new PublishMessageDto();
|
|
|
- String userId = examRoomStudentRelation.getStudentId().toString();
|
|
|
- publishMessageDto.setUserId(userId);
|
|
|
- publishMessageDto.setRoomId(examRoomStudentRelation.getExamRoomId().toString());
|
|
|
- MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Recorded, userId,3);
|
|
|
- publishMessageDto.setMemberChangedMessage(msg);
|
|
|
- imFeignService.publishMessage(publishMessageDto);
|
|
|
+ publishMessage(examRoomStudentRelation);
|
|
|
}
|
|
|
nextStudent(nextExamRoomStudentRelationId);
|
|
|
}
|
|
@@ -317,6 +304,21 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<ExamRoomStudentRelation> findStudentsWithExamRooms(List<Long> examRoomIds) {
|
|
|
+ return examRoomStudentRelationDao.findStudentsWithExamRooms(examRoomIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteWithExamRooms(List<Long> examRoomIds) {
|
|
|
+ examRoomStudentRelationDao.deleteWithExamRooms(examRoomIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getStudentIds(Long examRoomId) {
|
|
|
+ return examRoomStudentRelationDao.getStudentIds(examRoomId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void nextBit(Long nextExamRoomStudentRelationId, Long currentExamRoomStudentRelationId, Integer examStatus,Long examRoomId) {
|
|
|
if(currentExamRoomStudentRelationId != null){
|
|
|
ExamRoomStudentRelation examRoomStudentRelation = examRoomStudentRelationDao.get(currentExamRoomStudentRelationId);
|
|
@@ -332,16 +334,17 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
//关闭学员房间入口
|
|
|
examRoomStudentRelation.setClassroomSwitch(YesOrNoEnum.NO);
|
|
|
examRoomStudentRelationDao.update(examRoomStudentRelation);
|
|
|
+ publishMessage(examRoomStudentRelation);
|
|
|
}
|
|
|
nextStudent(nextExamRoomStudentRelationId);
|
|
|
|
|
|
- try {
|
|
|
+ /*try {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
String message = JSONObject.toJSONString(this.queryNeedCheckingList(examRoomId));
|
|
|
WebSocketServer.sendInfo(message,sysUser.getId().toString());
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
private void nextStudent(Long nextExamRoomStudentRelationId){
|
|
@@ -350,17 +353,47 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
//开启学员房间入口
|
|
|
examRoomStudentRelation.setClassroomSwitch(YesOrNoEnum.YES);
|
|
|
examRoomStudentRelationDao.update(examRoomStudentRelation);
|
|
|
- Integer studentId = examRoomStudentRelation.getStudentId();
|
|
|
- //推送消息
|
|
|
- Map<Integer, String> userPhoneMap = new HashMap<>();
|
|
|
- userPhoneMap.put(studentId, studentId.toString());
|
|
|
- SysMessageParams sysMessageParams=new SysMessageParams(MessageTypeEnum.EXAM_REGISTRATION_URL_SMS,
|
|
|
- userPhoneMap, null, 0, null, null);
|
|
|
- sysMessageFeignService.batchSendMessage(sysMessageParams);
|
|
|
+ publishMessage(examRoomStudentRelation);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void publishMessage(ExamRoomStudentRelation examRoomStudentRelation){
|
|
|
+ PublishMessageDto publishMessageDto = new PublishMessageDto();
|
|
|
+ String userId = examRoomStudentRelation.getStudentId().toString();
|
|
|
+ publishMessageDto.setUserId(userId);
|
|
|
+ publishMessageDto.setRoomId(examRoomStudentRelation.getExamRoomId().toString());
|
|
|
+ MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Student_Queue, userId,3);
|
|
|
+ String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId()));
|
|
|
+ msg.setAppParamJson(jsonString);
|
|
|
+ Map<String,Object> paramMap = new HashMap<>(2);
|
|
|
+ this.queryNeedCheckingList(examRoomStudentRelation.getExamRoomId());
|
|
|
+ paramMap.put("studentQueue",this.queryNeedCheckingList(examRoomStudentRelation.getExamRoomId()));
|
|
|
+ paramMap.put("examCertification",examCertificationService.findDetailByStudentId(examRoomStudentRelation.getExamRegistrationId()));
|
|
|
+ msg.setWebParamJson(JSONObject.toJSONString(paramMap));
|
|
|
+ publishMessageDto.setMemberChangedMessage(msg);
|
|
|
+ imFeignService.publishMessage(publishMessageDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PublishMessageDto getPublishMessage(Long examRegistrationId){
|
|
|
+ ExamRoomStudentRelation examRoomStudentRelation = examRoomStudentRelationDao.getStudentExamRoom(examRegistrationId);
|
|
|
+ PublishMessageDto publishMessageDto = new PublishMessageDto();
|
|
|
+ String userId = examRoomStudentRelation.getStudentId().toString();
|
|
|
+ publishMessageDto.setUserId(userId);
|
|
|
+ publishMessageDto.setRoomId(examRoomStudentRelation.getExamRoomId().toString());
|
|
|
+ MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Student_Queue, userId,3);
|
|
|
+ String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId()));
|
|
|
+ msg.setAppParamJson(jsonString);
|
|
|
+ Map<String,Object> paramMap = new HashMap<>(2);
|
|
|
+ this.queryNeedCheckingList(examRoomStudentRelation.getExamRoomId());
|
|
|
+ paramMap.put("studentQueue",this.queryNeedCheckingList(examRoomStudentRelation.getExamRoomId()));
|
|
|
+ paramMap.put("examCertification",examCertificationService.findDetailByStudentId(examRoomStudentRelation.getExamRegistrationId()));
|
|
|
+ msg.setWebParamJson(JSONObject.toJSONString(paramMap));
|
|
|
+ publishMessageDto.setMemberChangedMessage(msg);
|
|
|
+ return publishMessageDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<RoomStudentListDto> queryStudentList(Long roomId) {
|
|
|
return examRoomStudentRelationDao.queryStudentList(roomId);
|
|
|
}
|
|
@@ -392,7 +425,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
publishMessageDto.setRoomId(studentExamRoom.getExamRoomId().toString());
|
|
|
MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Student_Queue, userId,3);
|
|
|
String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRegistrationId));
|
|
|
- msg.setParamJson(jsonString);
|
|
|
+ msg.setAppParamJson(jsonString);
|
|
|
publishMessageDto.setMemberChangedMessage(msg);
|
|
|
imFeignService.publishMessage(publishMessageDto);
|
|
|
}
|