|
|
@ -7,7 +7,9 @@ import com.blockchain.common.base.dto.YyyfUserDto; |
|
|
|
import com.blockchain.common.base.util.RSACoderUtils; |
|
|
|
import com.blockchain.common.base.util.RSACoderUtils; |
|
|
|
import com.blockchain.server.yyyf.controller.api.LoginApi; |
|
|
|
import com.blockchain.server.yyyf.controller.api.LoginApi; |
|
|
|
import com.blockchain.server.yyyf.dto.*; |
|
|
|
import com.blockchain.server.yyyf.dto.*; |
|
|
|
|
|
|
|
import com.blockchain.server.yyyf.entity.AssessUser; |
|
|
|
import com.blockchain.server.yyyf.service.AssessUserService; |
|
|
|
import com.blockchain.server.yyyf.service.AssessUserService; |
|
|
|
|
|
|
|
import com.blockchain.server.yyyf.utils.IdGenerator; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
@ -69,10 +71,13 @@ public class LoginController { |
|
|
|
Integer schoolId = yyyfLoginRequestVo.getSchoolId(); |
|
|
|
Integer schoolId = yyyfLoginRequestVo.getSchoolId(); |
|
|
|
|
|
|
|
|
|
|
|
yyyfUserDto.setClassId(classId); |
|
|
|
yyyfUserDto.setClassId(classId); |
|
|
|
yyyfUserDto.setId(userId); |
|
|
|
yyyfUserDto.setUserId(userId); |
|
|
|
yyyfUserDto.setName(userName); |
|
|
|
yyyfUserDto.setUserName(userName); |
|
|
|
yyyfUserDto.setSchoolId(schoolId); |
|
|
|
yyyfUserDto.setSchoolId(schoolId); |
|
|
|
yyyfUserDto.setType(userType); |
|
|
|
yyyfUserDto.setUserType(userType); |
|
|
|
|
|
|
|
yyyfUserDto.setClassId(classId); |
|
|
|
|
|
|
|
yyyfUserDto.setCourseId(yyyfLoginRequestVo.getCourserId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//以渔有方考核id
|
|
|
|
//以渔有方考核id
|
|
|
|
String examId = yyyfLoginRequestVo.getReqId(); |
|
|
|
String examId = yyyfLoginRequestVo.getReqId(); |
|
|
@ -80,6 +85,23 @@ public class LoginController { |
|
|
|
String examPaperId = yyyfLoginRequestVo.getCaseId(); |
|
|
|
String examPaperId = yyyfLoginRequestVo.getCaseId(); |
|
|
|
//做考试和练习
|
|
|
|
//做考试和练习
|
|
|
|
if (0 == reqType || 1 == reqType) { |
|
|
|
if (0 == reqType || 1 == reqType) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId); |
|
|
|
|
|
|
|
if(assessUser==null){ |
|
|
|
|
|
|
|
assessUser=new AssessUser(); |
|
|
|
|
|
|
|
assessUser.setId(IdGenerator.uuid()); |
|
|
|
|
|
|
|
assessUser.setAchieveMentType(reqType==0?1:0); |
|
|
|
|
|
|
|
assessUser.setCaseId(yyyfLoginRequestVo.getCaseId()); |
|
|
|
|
|
|
|
assessUser.setClassId(String.valueOf(classId)); |
|
|
|
|
|
|
|
assessUser.setCourseId(yyyfLoginRequestVo.getCourserId()); |
|
|
|
|
|
|
|
assessUser.setIssueId(examId); |
|
|
|
|
|
|
|
assessUser.setSsPractiseId(yyyfLoginRequestVo.getCaseId()); |
|
|
|
|
|
|
|
assessUser.setStartTime(new Date()); |
|
|
|
|
|
|
|
assessUser.setUserId(userId); |
|
|
|
|
|
|
|
this.assessUserService.insert(assessUser); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash(); |
|
|
|
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash(); |
|
|
|
|
|
|
|
|
|
|
|
//将参加考试的人员缓存
|
|
|
|
//将参加考试的人员缓存
|
|
|
@ -168,7 +190,7 @@ public class LoginController { |
|
|
|
//删除强制提醒的缓存
|
|
|
|
//删除强制提醒的缓存
|
|
|
|
redisTemplate.delete(YyyfConstant.ANSER_KEY + userId); |
|
|
|
redisTemplate.delete(YyyfConstant.ANSER_KEY + userId); |
|
|
|
|
|
|
|
|
|
|
|
ValueOperations<String, Object> studentAnsweValueOperations = redisTemplate.opsForValue(); |
|
|
|
/* ValueOperations<String, Object> studentAnsweValueOperations = redisTemplate.opsForValue(); |
|
|
|
String studentAnswerDtoKey = YyyfConstant.ANSER_KEY + userId + examPaperId; |
|
|
|
String studentAnswerDtoKey = YyyfConstant.ANSER_KEY + userId + examPaperId; |
|
|
|
StudentAnswerDto studentAnswerDto = new StudentAnswerDto(); |
|
|
|
StudentAnswerDto studentAnswerDto = new StudentAnswerDto(); |
|
|
|
studentAnswerDto.setUserId(userId); |
|
|
|
studentAnswerDto.setUserId(userId); |
|
|
@ -181,7 +203,7 @@ public class LoginController { |
|
|
|
studentAnswerDto.setClassId(classId); |
|
|
|
studentAnswerDto.setClassId(classId); |
|
|
|
studentAnswerDto.setCourseId(yyyfLoginRequestVo.getCourserId()); |
|
|
|
studentAnswerDto.setCourseId(yyyfLoginRequestVo.getCourserId()); |
|
|
|
|
|
|
|
|
|
|
|
studentAnsweValueOperations.set(studentAnswerDtoKey, studentAnswerDto); |
|
|
|
studentAnsweValueOperations.set(studentAnswerDtoKey, studentAnswerDto);*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>(); |
|
|
|
Map<String, String> map = new HashMap<String, String>(); |
|
|
@ -189,7 +211,7 @@ public class LoginController { |
|
|
|
map.put("examId", examId); |
|
|
|
map.put("examId", examId); |
|
|
|
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(caseKey, map); |
|
|
|
redisTemplate.opsForValue().set(caseKey, map); |
|
|
|
redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS); |
|
|
|
// redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS);
|
|
|
|
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); |
|
|
|
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
@ -204,7 +226,7 @@ public class LoginController { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private ResultDTO handleAfterLogin(YyyfLoginDto yyyfLoginDto, YyyfUserDto yyyfUserDto) { |
|
|
|
private ResultDTO handleAfterLogin(YyyfLoginDto yyyfLoginDto, YyyfUserDto yyyfUserDto) { |
|
|
|
int status = yyyfLoginDto.getStatus(); |
|
|
|
int status = yyyfLoginDto.getStatus(); |
|
|
|
String token = generateToken(String.valueOf(yyyfUserDto.getId()), System.currentTimeMillis(), |
|
|
|
String token = generateToken(String.valueOf(yyyfUserDto.getUserId()), System.currentTimeMillis(), |
|
|
|
YyyfConstant.YYYF_ZHIXINLIAN_USER_KEY); |
|
|
|
YyyfConstant.YYYF_ZHIXINLIAN_USER_KEY); |
|
|
|
yyyfLoginDto.setYyyfUserToken(token); |
|
|
|
yyyfLoginDto.setYyyfUserToken(token); |
|
|
|
if (status != 2) { |
|
|
|
if (status != 2) { |
|
|
|