deason 1 سال پیش
والد
کامیت
93fc6db562

+ 40 - 0
src/main/java/com/qmth/exam/reserve/controller/IndexController.java

@@ -0,0 +1,40 @@
+package com.qmth.exam.reserve.controller;
+
+import com.qmth.exam.reserve.cache.RedisClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Set;
+
+@RestController
+public class IndexController extends BaseController {
+
+    private static final Logger log = LoggerFactory.getLogger(IndexController.class);
+
+    @Autowired
+    private RedisClient redisClient;
+
+    @GetMapping(value = "/")
+    public String index() {
+        return String.valueOf(System.currentTimeMillis());
+    }
+
+    @GetMapping(value = "/api/cache/clear")
+    public String clearCache() {
+        // 清理缓存接口(临时)
+        RedisTemplate<String, Object> redisTemplate = redisClient.getRedisTemplate();
+        Set<String> keys = redisTemplate.keys("$cache:*");
+        if (keys != null && !keys.isEmpty()) {
+            keys.forEach(cacheKey -> {
+                log.warn("DELETE cacheKey:{}", cacheKey);
+                redisClient.delete(cacheKey);
+            });
+        }
+        return "ok";
+    }
+
+}

+ 9 - 22
src/main/java/com/qmth/exam/reserve/controller/student/ExamSiteController.java

@@ -1,25 +1,22 @@
 package com.qmth.exam.reserve.controller.student;
 
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.exam.reserve.bean.examsite.ExamSiteInfo;
-import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.controller.BaseController;
 import com.qmth.exam.reserve.service.ExamSiteService;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
 
 @RestController
 @Api(tags = "【考生端】考点相关接口")
@@ -32,9 +29,6 @@ public class ExamSiteController extends BaseController {
     @Autowired
     private ExamSiteService examSiteService;
 
-    @Autowired
-    private ApplyTaskCacheService cacheService;
-
     @ApiOperation(value = "获取“数据分类”关联的考点列表")
     @PostMapping(value = "/list")
     public List<ExamSiteInfo> list(@ApiParam("数据分类ID") @RequestParam(required = false) Long categoryId) {
@@ -45,11 +39,4 @@ public class ExamSiteController extends BaseController {
         return examSiteService.getExamSiteListForStudent(categoryId);
     }
 
-    @Aac(strict = false, auth = false)
-    @ApiOperation(value = "清空某个考点中的缓存")
-    @PostMapping(value = "/clear/cache")
-    public void clearReidsCache(@ApiParam("考点ID") @RequestParam Long id) {
-        cacheService.clearApplyTotalCountCache(id);
-    }
-
 }