wangliang 4 年 前
コミット
199678a5e6

+ 24 - 4
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -211,7 +211,12 @@
         <include refid="invigilatePageHead"/>
         ,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and
         tiiwi.approve_status = 0) as warningNew
-		,date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s') as remainTime
+		,case
+		when tee.mode = 'ANYTIME' then
+		date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s')
+		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then
+		date_format(date_sub(from_unixtime(IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000),INTERVAL 8 HOUR), '%H:%i:%s')
+		END	as remainTime
         <include refid="invigilatePageMiddle"/>
 		<include refid="invigilatePageFoot"/>
         <if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
@@ -234,7 +239,12 @@
 		<include refid="invigilatePageHead" />
 		,t.monitor_live_url as monitorLiveUrl
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.approve_status = 0) as warningNew
-		,date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s') as remainTime
+		,case
+		when tee.mode = 'ANYTIME' then
+		date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s')
+		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then
+		date_format(date_sub(from_unixtime(IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000),INTERVAL 8 HOUR), '%H:%i:%s')
+		END	as remainTime
 		<include refid="invigilatePageMiddle" />
 		<include refid="invigilatePageFoot" />
 		<if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
@@ -252,7 +262,12 @@
 		<include refid="invigilatePageHead" />
 		,t.monitor_live_url as monitorLiveUrl
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.approve_status = 0) as warningNew
-		,date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s') as remainTime
+		,case
+		when tee.mode = 'ANYTIME' then
+		date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s')
+		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then
+		date_format(date_sub(from_unixtime(IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000),INTERVAL 8 HOUR), '%H:%i:%s')
+		END	as remainTime
 		<include refid="invigilatePageMiddle" />
 		<where> 1 = 1
 		<if test="examId != null and examId != ''">
@@ -268,7 +283,12 @@
 		,(select count(1) from t_ie_invigilate_exception_info tiiei where tiiei.exam_record_id = t.id) as exceptionCount
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.`type` =
 		'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
-		,date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s') as remainTime
+		,case
+		when tee.mode = 'ANYTIME' then
+		date_format(date_sub(from_unixtime(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds),INTERVAL 8 HOUR), '%H:%i:%s')
+		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then
+		date_format(date_sub(from_unixtime(IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000),INTERVAL 8 HOUR), '%H:%i:%s')
+		END	as remainTime
 		<include refid="invigilatePageMiddle" />
 		<include refid="invigilatePageFoot" />
 			<if test="status == null or status == ''">

+ 4 - 5
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -736,8 +736,9 @@ public class MqLogicServiceImpl implements MqLogicService {
 
         Long clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
         Integer diff = 0;
+        Long startTime = System.currentTimeMillis();
         if (Objects.nonNull(clientLastSyncTime)) {//大于等于当前时间,说明未重连或重登录
-            Long l = (System.currentTimeMillis() - clientLastSyncTime) / 1000;
+            Long l = (startTime - clientLastSyncTime) / 1000;
             diff = l.intValue();
         }
         Long examId = ExamRecordCacheUtil.getExamId(recordId);
@@ -747,10 +748,8 @@ public class MqLogicServiceImpl implements MqLogicService {
         //增加异常日志
         TIeInvigilateExceptionInfo tIeInvigilateExceptionInfo = new TIeInvigilateExceptionInfo(examId, examActivityId, recordId, examStudentId, ExceptionEnum.NET_TIME_OUT.getCode(), ExceptionEnum.NET_TIME_OUT, diff, ExamRecordCacheUtil.getLastBreakId(recordId));
         if (Objects.nonNull(diff)) {
-            Calendar calendar = Calendar.getInstance();
-            calendar.setTimeInMillis(tIeInvigilateExceptionInfo.getCreateTime());
-            calendar.add(Calendar.SECOND, diff);
-            tIeInvigilateExceptionInfo.setUpdateTime(calendar.getTime().getTime());
+            tIeInvigilateExceptionInfo.setCreateTime(clientLastSyncTime);
+            tIeInvigilateExceptionInfo.setUpdateTime(startTime);
         }
         tIeInvigilateExceptionInfoService.saveOrUpdate(tIeInvigilateExceptionInfo);
         TEExamStudentLog teExamStudentLog = new TEExamStudentLog(SystemOperationEnum.BREAK_OFF.name(), SystemOperationEnum.BREAK_OFF.getCode(), SystemOperationEnum.BREAK_OFF.getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId, ExamRecordCacheUtil.getLastBreakId(recordId));