删除无用代码,修改考试进入逻辑。

pull/1/head
unclekh 5 years ago
parent db02445950
commit 94cb9630a0
  1. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java
  2. 26
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  3. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java

@ -115,9 +115,8 @@ public class ExamController {
throw new YyyfException(YyyfEnums.FODBID_EXAM_RESTART); throw new YyyfException(YyyfEnums.FODBID_EXAM_RESTART);
} }
Date now=new Date(); Date now=new Date();
System.out.println(now.getTime());
//系统账户初始化 //系统账户初始化
String tel=new SimpleDateFormat("yyMMddHHmm").format(now).concat(String.valueOf(yyyfUserDto.getUserId())); String tel=new SimpleDateFormat("yyMMddHHmmss").format(now).concat(String.valueOf(yyyfUserDto.getUserId()));
//第一次进入进行注册 //第一次进入进行注册
String code=String.format("%06d",new Random().nextInt(1000000)); String code=String.format("%06d",new Random().nextInt(1000000));
redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES); redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES);

@ -99,7 +99,7 @@ public class LoginController {
AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId); AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId);
if (assessUser == null) { if (assessUser == null) {
Date now = new Date(); Date now = new Date();
String tel=new SimpleDateFormat("yyMMddHHmm").format(now).concat(String.valueOf(userId)); String tel=new SimpleDateFormat("yyMMddHHmmss").format(now).concat(String.valueOf(userId));
//第一次进入进行注册 //第一次进入进行注册
String code=String.format("%06d",new Random().nextInt(1000000)); String code=String.format("%06d",new Random().nextInt(1000000));
@ -168,6 +168,14 @@ public class LoginController {
if (joinStuIds == null) { if (joinStuIds == null) {
joinStuIds = new ArrayList<Integer>(); joinStuIds = new ArrayList<Integer>();
} }
Map<String, String> map = new HashMap<String, String>();
map.put("examPaperId", examDto.getExamPaperId());
map.put("examId", examDto.getExamId());
redisTemplate.opsForValue().set(caseKey, map);
redisTemplate.expire(caseKey, 30, TimeUnit.DAYS);
//如果等于0 //如果等于0
if (joinStuIds.stream() if (joinStuIds.stream()
.filter(stuIds -> (stuIds.equals(userId))).count() == 0) { .filter(stuIds -> (stuIds.equals(userId))).count() == 0) {
@ -192,6 +200,14 @@ public class LoginController {
yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE);
ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId); ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId);
yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000);
Map<String, String> map = new HashMap<String, String>();
map.put("examPaperId", examDto.getExamPaperId());
map.put("examId", examDto.getExamId());
redisTemplate.opsForValue().set(caseKey, map);
redisTemplate.expire(caseKey, 30, TimeUnit.DAYS);
return handleAfterLogin(yyyfLoginDto, yyyfUserDto); return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
} }
@ -199,14 +215,6 @@ public class LoginController {
} }
//删除强制提醒的缓存 //删除强制提醒的缓存
// redisTemplate.delete(YyyfConstant.ANSER_KEY + userId); // redisTemplate.delete(YyyfConstant.ANSER_KEY + userId);
Map<String, String> map = new HashMap<String, String>();
map.put("examPaperId", examPaperId);
map.put("examId", examId);
redisTemplate.opsForValue().set(caseKey, map);
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS);
yyyfLoginDto.setStatus(1); yyyfLoginDto.setStatus(1);
} }

@ -141,7 +141,6 @@ public class AssessUserServiceImpl implements AssessUserService {
@Override @Override
public AssessUserDto submit(String assessUserId) { public AssessUserDto submit(String assessUserId) {
AssessUser assessUser = this.selectAssessUserById(assessUserId); AssessUser assessUser = this.selectAssessUserById(assessUserId);
if (assessUser.getEndTime() != null) { if (assessUser.getEndTime() != null) {
throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION); throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION);
} }

Loading…
Cancel
Save