diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java index b010c59..3e607eb 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java @@ -115,9 +115,8 @@ public class ExamController { throw new YyyfException(YyyfEnums.FODBID_EXAM_RESTART); } 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)); redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES); diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java index 9373a41..a54c6c3 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java @@ -99,7 +99,7 @@ public class LoginController { AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId); if (assessUser == null) { 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)); @@ -168,6 +168,14 @@ public class LoginController { if (joinStuIds == null) { joinStuIds = new ArrayList(); } + + Map map = new HashMap(); + map.put("examPaperId", examDto.getExamPaperId()); + map.put("examId", examDto.getExamId()); + + redisTemplate.opsForValue().set(caseKey, map); + redisTemplate.expire(caseKey, 30, TimeUnit.DAYS); + //如果等于0 if (joinStuIds.stream() .filter(stuIds -> (stuIds.equals(userId))).count() == 0) { @@ -192,6 +200,14 @@ public class LoginController { yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId); yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); + + Map map = new HashMap(); + 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); } @@ -199,14 +215,6 @@ public class LoginController { } //删除强制提醒的缓存 // redisTemplate.delete(YyyfConstant.ANSER_KEY + userId); - - - Map map = new HashMap(); - map.put("examPaperId", examPaperId); - map.put("examId", examId); - - redisTemplate.opsForValue().set(caseKey, map); - redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); yyyfLoginDto.setStatus(1); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java index b428e05..8f57522 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java @@ -141,7 +141,6 @@ public class AssessUserServiceImpl implements AssessUserService { @Override public AssessUserDto submit(String assessUserId) { AssessUser assessUser = this.selectAssessUserById(assessUserId); - if (assessUser.getEndTime() != null) { throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION); }