🐛 修复切换缓存时, 出现的异常 BUG

This commit is contained in:
zhaojun1998
2020-01-03 16:24:53 +08:00
parent 316566d479
commit 7b288b795c
2 changed files with 9 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import im.zhaojun.common.model.dto.ResultBean;
import im.zhaojun.common.model.dto.SystemConfigDTO;
import im.zhaojun.common.model.enums.StorageTypeEnum;
import im.zhaojun.common.service.AbstractFileService;
import im.zhaojun.common.service.FileAsyncCacheService;
import im.zhaojun.common.service.StorageConfigService;
import im.zhaojun.common.service.SystemConfigService;
import org.springframework.stereotype.Controller;
@@ -36,6 +37,9 @@ public class InstallController {
@Resource
private AdminController adminController;
@Resource
private FileAsyncCacheService fileAsyncCacheService;
@GetMapping("/is-installed")
@ResponseBody
public ResultBean isInstall() {
@@ -92,6 +96,10 @@ public class InstallController {
if (Objects.equals(storageStrategy, currentStorageStrategy)) {
AbstractFileService fileService = systemConfigService.getCurrentFileService();
fileService.clearCache();
if (systemConfigService.getEnableCache()) {
fileAsyncCacheService.cacheGlobalFile();
}
fileService.init();
}

View File

@@ -164,6 +164,7 @@ public abstract class AbstractFileService implements FileService {
return null;
}).collect(Collectors.toSet());
collect.remove(null);
collect.add("/");
return collect;
} else {
return Collections.emptySet();