mirror of https://gitee.com/stylefeng/roses
【8.3.0】【resource】完善错误的提示
parent
1adb01dfc0
commit
5bee81ad23
|
@ -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.entity.SysResource;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.resource.factory.ResourceFactory;
|
import cn.stylefeng.roses.kernel.sys.modular.resource.factory.ResourceFactory;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -26,6 +27,7 @@ import java.util.concurrent.CompletableFuture;
|
||||||
* @since 2023/6/18 10:34
|
* @since 2023/6/18 10:34
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class DefaultResourceReporter implements ResourceReportApi {
|
public class DefaultResourceReporter implements ResourceReportApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -64,8 +66,12 @@ public class DefaultResourceReporter implements ResourceReportApi {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
// 根据project删除该项目下的所有资源
|
// 根据project删除该项目下的所有资源
|
||||||
this.sysResourceService.deleteResourceByProjectCode(projectCode);
|
this.sysResourceService.deleteResourceByProjectCode(projectCode);
|
||||||
|
|
||||||
// 将资源存入库中
|
// 将资源存入库中
|
||||||
sysResourceService.batchSaveResourceList(allResources);
|
sysResourceService.batchSaveResourceList(allResources);
|
||||||
|
}).exceptionally(ex -> {
|
||||||
|
log.error("资源扫描保存到库中出现错误,请检查问题,以免影响后续运行!", ex);
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将资源存入缓存一份
|
// 将资源存入缓存一份
|
||||||
|
|
|
@ -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 cn.stylefeng.roses.kernel.sys.modular.role.service.SysRoleService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ import java.util.concurrent.CompletableFuture;
|
||||||
* @since 2020/12/17 21:56
|
* @since 2020/12/17 21:56
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class InitAdminService {
|
public class InitAdminService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -89,11 +91,17 @@ public class InitAdminService {
|
||||||
// 获取所有的菜单和绑定所有的菜单
|
// 获取所有的菜单和绑定所有的菜单
|
||||||
CompletableFuture.supplyAsync(() -> sysMenuService.getTotalMenuList()).thenAccept((totalMenuList) -> {
|
CompletableFuture.supplyAsync(() -> sysMenuService.getTotalMenuList()).thenAccept((totalMenuList) -> {
|
||||||
sysRoleMenuService.bindRoleMenus(superAdminRole.getRoleId(), totalMenuList);
|
sysRoleMenuService.bindRoleMenus(superAdminRole.getRoleId(), totalMenuList);
|
||||||
|
}).exceptionally(ex -> {
|
||||||
|
log.error("超级管理员绑定菜单出现错误!请及时检查错误,以免影响程序后续运行!", ex);
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取所有的菜单功能和绑定所有的菜单功能
|
// 获取所有的菜单功能和绑定所有的菜单功能
|
||||||
CompletableFuture.supplyAsync(() -> sysMenuOptionsService.getTotalMenuOptionsList()).thenAccept((totalMenuOptionsList) -> {
|
CompletableFuture.supplyAsync(() -> sysMenuOptionsService.getTotalMenuOptionsList()).thenAccept((totalMenuOptionsList) -> {
|
||||||
sysRoleMenuOptionsService.bindRoleMenuOptions(superAdminRole.getRoleId(), totalMenuOptionsList);
|
sysRoleMenuOptionsService.bindRoleMenuOptions(superAdminRole.getRoleId(), totalMenuOptionsList);
|
||||||
|
}).exceptionally(ex -> {
|
||||||
|
log.error("超级管理员绑定菜单功能出现错误!请及时检查错误,以免影响程序后续运行!", ex);
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue