|
@@ -162,7 +162,18 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
teUserLogService.save(teUserLog);
|
|
|
} else if (Objects.equals(MqTagEnum.STUDENT.name(), tag)) {
|
|
|
TEExamStudentLog teExamStudentLog = null;
|
|
|
+ String ip = null, country = null, region = null, province = null, city = null, isp = null;
|
|
|
if (Objects.nonNull(mqDto.getProperties())) {
|
|
|
+ Long recordId = Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_RECORD_ID)));
|
|
|
+ ip = Objects.nonNull(recordId) ? ExamRecordCacheUtil.getClientCurrentIp(recordId) : mqDto.getObjName();
|
|
|
+ String[] strs = SystemConstant.getIpInfo(ip);
|
|
|
+ if (Objects.nonNull(strs) && strs.length > 0) {
|
|
|
+ country = strs[0];
|
|
|
+ region = strs[1];
|
|
|
+ province = strs[2];
|
|
|
+ city = strs[3];
|
|
|
+ isp = strs[4];
|
|
|
+ }
|
|
|
String type = Objects.nonNull(mqDto.getProperties().get(SystemConstant.TYPE)) ?
|
|
|
String.valueOf(mqDto.getProperties().get(SystemConstant.TYPE)) :
|
|
|
SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode();
|
|
@@ -201,17 +212,29 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
teExamStudentLog = new TEExamStudentLog(String.valueOf(mqDto.getBody()), info, remark,
|
|
|
Long.parseLong(String.valueOf(mqDto.getObjId())),
|
|
|
Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_STUDENT_ID))),
|
|
|
- Long.parseLong(String.valueOf(mqDto.getProperties().get(SystemConstant.EXAM_RECORD_ID))),
|
|
|
- title);
|
|
|
+ recordId, title, ip, country, region, province, city, isp);
|
|
|
teExamStudentLog.setObjId(objId);
|
|
|
} else {
|
|
|
+ if (Objects.nonNull(mqDto.getObjName())) {
|
|
|
+ ip = mqDto.getObjName();
|
|
|
+ String[] strs = SystemConstant.getIpInfo(ip);
|
|
|
+ if (Objects.nonNull(strs) && strs.length > 0) {
|
|
|
+ country = strs[0];
|
|
|
+ region = strs[1];
|
|
|
+ province = strs[2];
|
|
|
+ city = strs[3];
|
|
|
+ isp = strs[4];
|
|
|
+ }
|
|
|
+ }
|
|
|
teExamStudentLog = new TEExamStudentLog(String.valueOf(mqDto.getBody()),
|
|
|
SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode(),
|
|
|
SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody())).getCode(),
|
|
|
- Long.parseLong(String.valueOf(mqDto.getObjId())));
|
|
|
+ Long.parseLong(String.valueOf(mqDto.getObjId())), ip, country, region, province, city, isp);
|
|
|
SystemOperationEnum systemOperationEnum = SystemOperationEnum.valueOf(String.valueOf(mqDto.getBody()));
|
|
|
- if (systemOperationEnum == SystemOperationEnum.LOGOUT && Objects.nonNull(mqDto.getObjName())) {
|
|
|
- tbSessionService.removeById(mqDto.getObjName());
|
|
|
+ if (systemOperationEnum == SystemOperationEnum.LOGOUT && Objects.nonNull(mqDto.getObjId())) {
|
|
|
+ QueryWrapper<TBSession> tbSessionQueryWrapper = new QueryWrapper<>();
|
|
|
+ tbSessionQueryWrapper.lambda().eq(TBSession::getIdentity, String.valueOf(mqDto.getObjId()));
|
|
|
+ tbSessionService.remove(tbSessionQueryWrapper);
|
|
|
}
|
|
|
}
|
|
|
teExamStudentLogService.save(teExamStudentLog);
|
|
@@ -436,18 +459,28 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
|
examStudentId = tOeExamRecord.getExamStudentId();
|
|
|
}
|
|
|
+ String ip = null, country = null, region = null, province = null, city = null, isp = null;
|
|
|
+ ip = Objects.nonNull(recordId) ? ExamRecordCacheUtil.getClientCurrentIp(recordId) : mqDto.getObjName();
|
|
|
+ String[] strs = SystemConstant.getIpInfo(ip);
|
|
|
+ if (Objects.nonNull(strs) && strs.length > 0) {
|
|
|
+ country = strs[0];
|
|
|
+ region = strs[1];
|
|
|
+ province = strs[2];
|
|
|
+ city = strs[3];
|
|
|
+ isp = strs[4];
|
|
|
+ }
|
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
if (Objects.nonNull(photoUrl) && (Objects.equals(type.toUpperCase(), ExamTypeEnum.FIRST_START.name()) || Objects.equals(type.toUpperCase(), ExamTypeEnum.RESUME_START.name()))) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(PhotoTypeEnum.FACE_VERIFY_PHOTO.name(), photoUrl);
|
|
|
TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, ExamTypeEnum.valueOf(type).getCode(),
|
|
|
jsonObject.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(),
|
|
|
- recordId, ExamTypeEnum.valueOf(type).getTitle());
|
|
|
+ recordId, ExamTypeEnum.valueOf(type).getTitle(), ip, country, region, province, city, isp);
|
|
|
faceVerifyHistoryService.save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception, null);
|
|
|
teExamStudentLogService.saveOrUpdate(teExamStudentLog);
|
|
|
} else if (Objects.equals(type.toUpperCase(), ExamTypeEnum.IN_PROCESS.name())) {
|
|
|
VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
|
|
|
- WarningDto warningDto = new WarningDto(warningEnum, faceCount, realness, recordId, photoUrl);
|
|
|
+ WarningDto warningDto = new WarningDto(warningEnum, faceCount, realness, recordId, photoUrl, ip, country, region, province, city, isp);
|
|
|
if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
|
|
|
if (Objects.nonNull(realness) && realness.intValue() == 0) {//真实性异常
|
|
|
String realnessErrorRandom = ExamRecordCacheUtil.getRealnessErrorRandom(recordId);
|
|
@@ -556,6 +589,16 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Long startTime = (Long) param.get("startTime");
|
|
|
Long finishTime = (Long) param.get("finishTime");
|
|
|
String exception = (String) param.get("exception");
|
|
|
+ String ip = null, country = null, region = null, province = null, city = null, isp = null;
|
|
|
+ ip = Objects.nonNull(recordId) ? ExamRecordCacheUtil.getClientCurrentIp(recordId) : mqDto.getObjName();
|
|
|
+ String[] strs = SystemConstant.getIpInfo(ip);
|
|
|
+ if (Objects.nonNull(strs) && strs.length > 0) {
|
|
|
+ country = strs[0];
|
|
|
+ region = strs[1];
|
|
|
+ province = strs[2];
|
|
|
+ city = strs[3];
|
|
|
+ isp = strs[4];
|
|
|
+ }
|
|
|
Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
if (Objects.isNull(examStudentId)) {
|
|
|
TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
@@ -574,7 +617,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type,
|
|
|
LivenessTypeEnum.valueOf(type).getCode(), object.toJSONString(),
|
|
|
examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId,
|
|
|
- LivenessTypeEnum.valueOf(type).getTitle());
|
|
|
+ LivenessTypeEnum.valueOf(type).getTitle(), ip, country, region, province, city, isp);
|
|
|
livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
|
|
|
teExamStudentLogService.saveOrUpdate(teExamStudentLog);
|
|
|
break;
|
|
@@ -590,7 +633,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
livenessActionErrorRandom = SystemConstant.getNanoId();
|
|
|
ExamRecordCacheUtil.setLivenessActionErrorRandom(recordId, livenessActionErrorRandom);
|
|
|
}
|
|
|
- WarningDto warningDto = new WarningDto(warningEnum, null, null, recordId, null);
|
|
|
+ WarningDto warningDto = new WarningDto(warningEnum, null, null, recordId, null, ip, country, region, province, city, isp);
|
|
|
warningDto.setRandom(livenessActionErrorRandom);
|
|
|
livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, livenessActionErrorRandom);
|
|
|
ExamRecordCacheUtil.setLivenessActionErrorRandom(recordId, SystemConstant.getNanoId());
|
|
@@ -724,13 +767,14 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
ExceptionEnum exceptionEnum = ExceptionEnum.valueOf(
|
|
|
ExceptionEnum.convertToName(String.valueOf(jsonObject.getJSONObject("reason").get(SystemConstant.TYPE))));
|
|
|
Long recordId = Long.parseLong(mqDto.getObjId());
|
|
|
+ Long lastPrepareTime = ExamRecordCacheUtil.getLastPrepareTime(recordId);
|
|
|
Long breakId = ExamRecordCacheUtil.getLastBreakId(recordId);
|
|
|
if (Objects.nonNull(breakId)) {
|
|
|
//获取断点时间
|
|
|
Long lastBreakTime = ExamRecordCacheUtil.getLastBreakTime(recordId);
|
|
|
Integer diff = 0;
|
|
|
if (Objects.nonNull(lastBreakTime)) {
|
|
|
- Long l = ((System.currentTimeMillis() - lastBreakTime) / 1000);
|
|
|
+ Long l = ((lastPrepareTime - lastBreakTime) / 1000);
|
|
|
diff = l.intValue();
|
|
|
}
|
|
|
|
|
@@ -740,7 +784,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
tIeInvigilateExceptionInfoUpdateWrapper.lambda().set(TIeInvigilateExceptionInfo::getInfo, reason)
|
|
|
.set(TIeInvigilateExceptionInfo::getType, exceptionEnum)
|
|
|
.set(TIeInvigilateExceptionInfo::getDifference, diff)
|
|
|
- .set(TIeInvigilateExceptionInfo::getUpdateTime, System.currentTimeMillis())
|
|
|
+ .set(TIeInvigilateExceptionInfo::getUpdateTime, lastPrepareTime)
|
|
|
.eq(TIeInvigilateExceptionInfo::getObjId, breakId);
|
|
|
tIeInvigilateExceptionInfoService.update(tIeInvigilateExceptionInfoUpdateWrapper);
|
|
|
|
|
@@ -749,7 +793,7 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
teExamStudentLogUpdateWrapper.lambda().set(TEExamStudentLog::getType, exceptionEnum.name())
|
|
|
.set(TEExamStudentLog::getInfo, exceptionEnum.getCode())
|
|
|
.set(TEExamStudentLog::getRemark, reason)
|
|
|
- .set(TEExamStudentLog::getUpdateTime, System.currentTimeMillis())
|
|
|
+ .set(TEExamStudentLog::getUpdateTime, lastPrepareTime)
|
|
|
.eq(TEExamStudentLog::getObjId, breakId);
|
|
|
teExamStudentLogService.update(teExamStudentLogUpdateWrapper);
|
|
|
}
|
|
@@ -844,10 +888,22 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
// tIeInvigilateExceptionInfo.setUpdateTime(startTime);
|
|
|
// }
|
|
|
tIeInvigilateExceptionInfoService.saveOrUpdate(tIeInvigilateExceptionInfo);
|
|
|
+
|
|
|
+ String ip = ExamRecordCacheUtil.getClientCurrentIp(recordId), country = null, region = null, province = null, city = null, isp = null;
|
|
|
+ String[] strs = SystemConstant.getIpInfo(ip);
|
|
|
+ if (Objects.nonNull(strs) && strs.length > 0) {
|
|
|
+ country = strs[0];
|
|
|
+ region = strs[1];
|
|
|
+ province = strs[2];
|
|
|
+ city = strs[3];
|
|
|
+ isp = strs[4];
|
|
|
+ }
|
|
|
+
|
|
|
TEExamStudentLog teExamStudentLog = new TEExamStudentLog(SystemOperationEnum.BREAK_OFF.name(),
|
|
|
SystemOperationEnum.BREAK_OFF.getCode(), SystemOperationEnum.BREAK_OFF.getCode(),
|
|
|
examStudentCacheBean.getStudentId(), examStudentId, recordId,
|
|
|
- ExamRecordCacheUtil.getLastBreakId(recordId), SystemOperationEnum.BREAK_OFF.getTitle());
|
|
|
+ ExamRecordCacheUtil.getLastBreakId(recordId), SystemOperationEnum.BREAK_OFF.getTitle(),
|
|
|
+ ip, country, region, province, city, isp);
|
|
|
teExamStudentLogService.save(teExamStudentLog);
|
|
|
|
|
|
SystemConstant.clientMonitorStatusStop(recordId);
|