|
|
@@ -6,6 +6,7 @@ import com.izouma.nineth.dto.*;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.CollectionRepo;
|
|
|
import com.izouma.nineth.repo.NewsRepo;
|
|
|
+import com.izouma.nineth.service.CacheService;
|
|
|
import com.izouma.nineth.service.CollectionService;
|
|
|
import com.izouma.nineth.service.LikeService;
|
|
|
import com.izouma.nineth.utils.SecurityUtils;
|
|
|
@@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
|
@RestController
|
|
|
@@ -32,6 +34,7 @@ public class CollectionController extends BaseController {
|
|
|
private CollectionRepo collectionRepo;
|
|
|
private LikeService likeService;
|
|
|
private NewsRepo newsRepo;
|
|
|
+ private CacheService cacheService;
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
@@ -139,5 +142,11 @@ public class CollectionController extends BaseController {
|
|
|
recommedDTOS.sort((a, b) -> b.getSort().compareTo(a.getSort()));
|
|
|
return recommedDTOS;
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/clearRecommend")
|
|
|
+ public String clearRecommend() {
|
|
|
+ cacheService.clearRecommend();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
}
|
|
|
|