【8.3.0】【resource】完善错误的提示

master
stylefeng 2024-10-06 21:57:21 +08:00
parent 1adb01dfc0
commit 5bee81ad23
2 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.SysResourcePersistenc
import cn.stylefeng.roses.kernel.sys.modular.resource.entity.SysResource;
import cn.stylefeng.roses.kernel.sys.modular.resource.factory.ResourceFactory;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
@ -26,6 +27,7 @@ import java.util.concurrent.CompletableFuture;
* @since 2023/6/18 10:34
*/
@Service
@Slf4j
public class DefaultResourceReporter implements ResourceReportApi {
@Resource
@ -64,8 +66,12 @@ public class DefaultResourceReporter implements ResourceReportApi {
CompletableFuture.runAsync(() -> {
// 根据project删除该项目下的所有资源
this.sysResourceService.deleteResourceByProjectCode(projectCode);
// 将资源存入库中
sysResourceService.batchSaveResourceList(allResources);
}).exceptionally(ex -> {
log.error("资源扫描保存到库中出现错误,请检查问题,以免影响后续运行!", ex);
return null;
});
// 将资源存入缓存一份

View File

@ -35,6 +35,7 @@ import cn.stylefeng.roses.kernel.sys.modular.role.service.SysRoleMenuService;
import cn.stylefeng.roses.kernel.sys.modular.role.service.SysRoleService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -47,6 +48,7 @@ import java.util.concurrent.CompletableFuture;
* @since 2020/12/17 21:56
*/
@Service
@Slf4j
public class InitAdminService {
@Resource
@ -89,11 +91,17 @@ public class InitAdminService {
// 获取所有的菜单和绑定所有的菜单
CompletableFuture.supplyAsync(() -> sysMenuService.getTotalMenuList()).thenAccept((totalMenuList) -> {
sysRoleMenuService.bindRoleMenus(superAdminRole.getRoleId(), totalMenuList);
}).exceptionally(ex -> {
log.error("超级管理员绑定菜单出现错误!请及时检查错误,以免影响程序后续运行!", ex);
return null;
});
// 获取所有的菜单功能和绑定所有的菜单功能
CompletableFuture.supplyAsync(() -> sysMenuOptionsService.getTotalMenuOptionsList()).thenAccept((totalMenuOptionsList) -> {
sysRoleMenuOptionsService.bindRoleMenuOptions(superAdminRole.getRoleId(), totalMenuOptionsList);
}).exceptionally(ex -> {
log.error("超级管理员绑定菜单功能出现错误!请及时检查错误,以免影响程序后续运行!", ex);
return null;
});
}