|
@@ -6,6 +6,7 @@ import com.book.dao.cpsshard.entity.UserRecentlyRead;
|
|
|
import com.book.server.common.entity.Result;
|
|
|
import com.book.server.common.entity.ResultCode;
|
|
|
import com.book.dao.VO.*;
|
|
|
+import com.book.server.service.BlockCacheGuava;
|
|
|
import com.book.server.service.BookService;
|
|
|
import com.book.server.service.CacheService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -91,17 +92,6 @@ public class BookController extends BaseController {
|
|
|
return Result.byObject(list);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 更新block缓存
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@GetMapping("/resetBlockCache")
|
|
|
- //@CacheEvict(value = "block", allEntries = true)
|
|
|
- //public Result resetBlockCache() {
|
|
|
- // return Result.byObject("OK");
|
|
|
- //}
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 导入书库
|
|
@@ -193,6 +183,7 @@ public class BookController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CacheService cacheService;
|
|
|
+
|
|
|
/**
|
|
|
* 自定义书籍上传
|
|
|
*
|
|
@@ -201,7 +192,7 @@ public class BookController extends BaseController {
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- @PostMapping("/upload")
|
|
|
+ @PostMapping("/upload-8F80F0A4-E084-44C6-8659-61612C9D9D44")
|
|
|
public Result uploadFile(@RequestParam("file") MultipartFile file, Long bookId) throws IOException {
|
|
|
if (file.isEmpty() || bookId == null || bookId < 100_0000) {
|
|
|
return Result.failure(ResultCode.PARAMERROR);
|
|
@@ -215,6 +206,16 @@ public class BookController extends BaseController {
|
|
|
return Result.success("添加成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 后台-删除上传的书籍
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("deleteUpload-8F80F0A4-E084-44C6-8659-61612C9D9D44")
|
|
|
+ public Result deleteUploadFile(Long id) {
|
|
|
+ return Result.success(bookService.deleteUploadFile(id));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 后台-获取章节书籍内容
|
|
|
*
|
|
@@ -236,4 +237,28 @@ public class BookController extends BaseController {
|
|
|
public Result updateBookContent(@RequestBody BookContentVO bookContentVO) {
|
|
|
return Result.byObject(bookService.updateBookContent(bookContentVO));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 后台-获取建议的 ID
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getRecommendId-584CBBC1-DBD9-47A9-AAF1-EBC684B82B55")
|
|
|
+ public Result getRecommendId() {
|
|
|
+ return Result.byObject(bookService.getRecommendId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BlockCacheGuava blockCacheGuava;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新 block 缓存
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/updateBlockCache-8AA34230-157C-4EF6-98CE-0D928B3DE9EF")
|
|
|
+ public Result updateBlockCache() {
|
|
|
+ blockCacheGuava.clearCache();
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
}
|