WANG 5 anos atrás
pai
commit
53ff910a2c

+ 15 - 2
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamCloudServiceProvider.java

@@ -82,6 +82,7 @@ import cn.com.qmth.examcloud.examwork.api.response.SaveExamResp;
 import cn.com.qmth.examcloud.examwork.api.response.SetExamPropertyResp;
 import cn.com.qmth.examcloud.examwork.api.response.UnlockExamStudentsResp;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
@@ -100,6 +101,9 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 
 	private static final long serialVersionUID = 6850508158980856785L;
 
+	@Autowired
+	RedisClient redisClient;
+
 	@Autowired
 	private ExamService examService;
 
@@ -303,11 +307,17 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 	@PostMapping("getOngoingExamList")
 	@Override
 	public GetOngoingExamListResp getOngoingExamList(@RequestBody GetOngoingExamListReq req) {
-
 		Long rootOrgId = req.getRootOrgId();
 		String examType = req.getExamType();
 		Long orgId = req.getOrgId();
 
+		String key = "B_ON_GOING_EXAM:" + rootOrgId + "_" + examType + "_" + orgId;
+		GetOngoingExamListResp resp = redisClient.get(key, GetOngoingExamListResp.class);
+
+		if (null != resp) {
+			return resp;
+		}
+
 		ExamType et = null;
 		if (StringUtils.isNotBlank(examType)) {
 			try {
@@ -384,8 +394,11 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 			bean.setExamType(cur.getExamType().name());
 		}
 
-		GetOngoingExamListResp resp = new GetOngoingExamListResp();
+		resp = new GetOngoingExamListResp();
 		resp.setExamSpecialSettingsList(list);
+
+		redisClient.set(key, resp, 120);
+
 		return resp;
 	}