Răsfoiți Sursa

考试首页弹框改造
限时考试超出考试时间也不在弹框

xiexh 9 ore în urmă
părinte
comite
734197a674

+ 1 - 1
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/common/provider/DesktopFacadeProvider.java

@@ -270,7 +270,7 @@ public class DesktopFacadeProvider extends GenericProvider implements IDesktopFa
 				if (StringUtil.isNotBlank(bean.getDataSourceId())) {
 					String uniqueKey = bean.getDataSourceId() + "_" + ContextUtil.getCurrentUserId();
 					String flag = examStatusMap.get(uniqueKey);
-					if ("pass".equals(flag)) {
+					if ("pass".equals(flag) || "overTime".equals(flag)) {
 						//logger.warn("已限制时间考试{}, id{},已通过取消弹窗提醒", bean.getTitle(), bean.getDataSourceId());
 						bean.setPopUp(0);
 					}

+ 20 - 1
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/platform/service/DesktopFacadeService.java

@@ -1,5 +1,8 @@
 package com.lc.ibps.platform.service;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -252,6 +255,23 @@ public class DesktopFacadeService {
 		Object limitDateObj =record.get("limitDate");
 		String examState = (String) record.get("examState");
 		String paperState = (String) record.get("paperState");
+		if (limitDateObj != null && !limitDateObj.toString().isEmpty()) {
+			if("不限".equals(limitDateObj.toString().trim())){
+				return "不限";//非限时考试不处理
+			}
+			//获取当前时间
+			LocalDateTime now = LocalDateTime.now();
+			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
+			try {
+				LocalDateTime limitDateTime = LocalDateTime.parse(limitDateObj.toString(), formatter);
+				if (limitDateTime.isBefore(now)) {
+					//System.out.println("限时时间:"+limitDateObj.toString()+" < 当前时间:"+now+",超出考试时间不在弹框");
+					return "overTime";
+				}
+			} catch (DateTimeParseException e) {
+				// 忽略这条数据
+			}
+		}
 		// 检查条件
 		if (limitDateObj != null && !limitDateObj.toString().isEmpty() && "已发布".equals(examState) && "已完成".equals(paperState)) {
 			// 获取字段值
@@ -262,7 +282,6 @@ public class DesktopFacadeService {
 				// 关键字段缺失,返回未完成状态
 				return "NotExaminedStatus";
 			}
-
 			double totalScore = Double.parseDouble(record.get("totalScore").toString());
 			double qualifiedRadio = Double.parseDouble(record.get("qualifiedRadio").toString());
 			String scoringType = (String) record.get("scoringType");