|
|
|
@ -2,12 +2,16 @@ package cn.estsh.i3plus.core.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.model.license.ImppLicense;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefRoleMenu;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
@ -23,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 后台服务
|
|
|
|
@ -47,6 +52,11 @@ public class BackstageController extends CoreBaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreMemTreeService memTreeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysRoleService sysRoleService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPersonnelService penfindSysRefUserRole;
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/redis-put-all")
|
|
|
|
|
@ApiOperation(value = "重新加载所有缓存数据",notes = "重新加载所有缓存数据")
|
|
|
|
@ -190,4 +200,33 @@ public class BackstageController extends CoreBaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/update-clean-ref-role-menu")
|
|
|
|
|
@ApiOperation(value = "更新并清理角色功能数据", notes = "更新并清理角色功能数据")
|
|
|
|
|
public ResultBean updateRefRoleMenu(){
|
|
|
|
|
try {
|
|
|
|
|
List<Long> roleIdList = sysRoleService.findAll().stream().map(SysRole::getId).collect(Collectors.toList());
|
|
|
|
|
Map<Long,Set<Long>> roleMenuMap = new HashMap<>();
|
|
|
|
|
for (SysRefRoleMenu refRoleMenu : penfindSysRefUserRole.findSysRefRoleMenuByRoleIds(roleIdList)) {
|
|
|
|
|
if (!roleMenuMap.containsKey(refRoleMenu.getRoleId())) {
|
|
|
|
|
roleMenuMap.put(refRoleMenu.getRoleId(), new HashSet<>());
|
|
|
|
|
}
|
|
|
|
|
roleMenuMap.get(refRoleMenu.getRoleId()).add(refRoleMenu.getMenuId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<Long, Set<Long>> longSetEntry : roleMenuMap.entrySet()) {
|
|
|
|
|
sysRoleService.refreshSysRoleRef(
|
|
|
|
|
longSetEntry.getKey(),
|
|
|
|
|
longSetEntry.getValue().toArray(new Long[longSetEntry.getValue().size()]),
|
|
|
|
|
"清理垃圾数据"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功");
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ResultBean.fail(e).setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|