//信访听证 资源前缀
public static final String RESPREFIX_MODULE_XINFTZ_="module_xinftz_";
//听证专家库
public static final ConstantItem RES_MODULE_XINFTZ_TINGZZJK = new ConstantItem(RESPREFIX_MODULE_XINFTZ_ + "tingzzjk","听证专家库");
//听证模板库
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK = new ConstantItem(RESPREFIX_MODULE_XINFTZ_ + "tingzmbk","听证模板库");
//听证模板库
public static final String RESPREFIX_MODULE_XINFTZMBK_="module_xinftzmbk_";//听证模板库
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK_PILDRMB = new ConstantItem(RESPREFIX_MODULE_XINFTZMBK_+"pildrmb","批量导入模板");
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK_DAORMB = new ConstantItem(RESPREFIX_MODULE_XINFTZMBK_+"daormb","导入模板");
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK_BIANJ = new ConstantItem(RESPREFIX_MODULE_XINFTZMBK_+"bianj","编辑");
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK_SHANC = new ConstantItem(RESPREFIX_MODULE_XINFTZMBK_+"shanc","删除");
public static final ConstantItem RES_MODULE_XINFTZ_TINGZMBK_TUODBS = new ConstantItem(RESPREFIX_MODULE_XINFTZMBK_+"tuodbs","拖动标识");
private static final String RESCATEGORY_MODULE_XINFTZ=XysdSysConstants.RESPREFIX_MODULE_XINFTZ_;//信访听证
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZZJK=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZZJK.getId();//听证专家库
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBK=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK.getId();//听证模板库
private static final String RESPREFIX_MODULE_XINFTZMBK=(String)XysdSysConstants.RESPREFIX_MODULE_XINFTZMBK_;//听证模板库
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZDJ=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZDJ.getId();//听证登记
private static final String RESCATEGORY_MODULE_XINFTZ_BENDWTZCX=(String)XysdSysConstants.RES_MODULE_XINFTZ_BENDWTZCX.getId();//本单位听证查询
private static final String RESCATEGORY_MODULE_XINFTZ_ZERDWTZCX=(String)XysdSysConstants.RES_MODULE_XINFTZ_ZERDWTZCX.getId();//责任单位听证查询
private static final String RESCATEGORY_MODULE_XINFTZ_BENDWCYTZCX=(String)XysdSysConstants.RES_MODULE_XINFTZ_BENDWCYTZCX.getId();//本单位参与听证查询
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZTJ=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZTJ.getId();//听证统计
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK_PILDRMB.getId();//批量导入模板
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK_DAORMB.getId();//导入模板
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK_BIANJ.getId();//编辑
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK_SHANC.getId();//删除
private static final String RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS=(String)XysdSysConstants.RES_MODULE_XINFTZ_TINGZMBK_TUODBS.getId();//拖动标识
private List<TreeNode> buildTreeNodes(List<SysDataSimpleDTO> resList) {
List<TreeNode> nodes=new ArrayList<>();
List<TreeNode> xinftzResList=new ArrayList<>();//信访听证
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ,"信访听证",null,"root",false,"Category",false));
List<TreeNode> xinftmbkzResList=new ArrayList<>();//信访听证
xinftmbkzResList.add(new TreeNode(RESPREFIX_MODULE_XINFTZMBK,"听证模板库",null,"root",false,"Category",false));
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZZJK)){//信访听证-听证专家库
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZZJK)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZZJK,"听证专家库",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZZJK, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZDJ)){//信访听证-听证登记
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZDJ)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZDJ,"听证登记",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZDJ, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_BENDWTZCX)){//信访听证-本单位听证查询
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_BENDWTZCX)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_BENDWTZCX,"本单位听证查询",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_BENDWTZCX, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_ZERDWTZCX)){//信访听证-责任单位听证查询
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_ZERDWTZCX)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_ZERDWTZCX,"责任单位听证查询",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_ZERDWTZCX, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_BENDWCYTZCX)){//信访听证-本单位参与听证查询
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_BENDWCYTZCX)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_BENDWCYTZCX,"本单位参与听证查询",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_BENDWCYTZCX, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZTJ)){//信访听证-听证统计
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZTJ)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZTJ,"听证统计",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZTJ, new SysDataSimpleDTO());
}
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBK)){//信访听证-听证模板库
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBK)) {
xinftzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBK,"听证模板库",null,RESCATEGORY_MODULE_XINFTZ,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBK, new SysDataSimpleDTO());
}
xinftzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBK,false,"Res",false));
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB)){//信访听证-听证模板库批量导入
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB)) {
xinftmbkzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB,"批量导入模板",null,RESPREFIX_MODULE_XINFTZMBK,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB, new SysDataSimpleDTO());
}
xinftmbkzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_PILDRMB,false,"Res",false));
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB)){//信访听证-听证模板库导入模板
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB)) {
xinftmbkzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB,"导入模板",null,RESPREFIX_MODULE_XINFTZMBK,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB, new SysDataSimpleDTO());
}
xinftmbkzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_DAORMB,false,"Res",false));
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ)){//信访听证-听证模板库编辑
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ)) {
xinftmbkzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ,"编辑",null,RESPREFIX_MODULE_XINFTZMBK,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ, new SysDataSimpleDTO());
}
xinftmbkzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_BIANJ,false,"Res",false));
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC)){//信访听证-听证模板库删除
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC)) {
xinftmbkzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC,"删除",null,RESPREFIX_MODULE_XINFTZMBK,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC, new SysDataSimpleDTO());
}
xinftmbkzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_SHANC,false,"Res",false));
continue;
}
if(res.getId().startsWith(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS)){//信访听证-听证模板库拖动标识
if(!handledRes.containsKey(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS)) {
xinftmbkzResList.add(new TreeNode(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS,"拖动标识",null,RESPREFIX_MODULE_XINFTZMBK,false,"Category",false));
handledRes.put(RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS, new SysDataSimpleDTO());
}
xinftmbkzResList.add(new TreeNode(res.getId(),res.getName(),null,RESCATEGORY_MODULE_XINFTZ_TINGZMBKT_TUODBS,false,"Res",false));
continue;
}
//信访听证资源
nodes.addAll(xinftzResList);
//信访听证模板库资源
nodes.addAll(xinftmbkzResList);
return nodes;
@ApiOperation(value="树-获取所有节点", httpMethod="POST")
@ApiImplicitParam(name="params", value="参数集合", dataType="Map" )
@RequestMapping(value="/allnodes/get",method=RequestMethod.POST)
public ApiResultDTO<List<TreeNode>> getAllTreeNodes(@RequestBody Map<String,String> params,HttpServletRequest hreq){
return RestAPITemplate.restapi(new IMyLogic<List<TreeNode>>() {
@Override
public List<TreeNode> logic() {
AccessTokenUser user=new AccessTokenUserAssembler().getAccessTokenUserFromReq(hreq);
String treeType=params.get("treeType");
ITreeService treeService=getTreeServiceByTreeType(treeType);
return treeService.getAllTreeNodes(user, params);
}
});
}
public List<TreeNode> getAllTreeNodes(AccessTokenUser user,Map<String, String> params) {
List<SysDataSimpleDTO> resList=systemGatewayService.findAllResList();
List<TreeNode> nodes=this.buildTreeNodes(resList);
return nodes;
}
ApiModel(value="MenuDTO ",description="菜单模型")
@JsonIgnoreProperties(ignoreUnknown=true)
public class MenuDTO {
@ApiModelProperty(value="菜单标识")
private String id;
@ApiModelProperty(value="菜单名称")
private String name;
@ApiModelProperty(value="菜单名称简称")
private String simpleName;
@ApiModelProperty(value="菜单打开的链接地址")
private String url;
@ApiModelProperty(value="菜单描述")
private String description;
@ApiModelProperty(value="是否显示")
private Boolean isShow = false;
@ApiModelProperty(value="子菜单")
private List<MenuDTO> submenus = new ArrayList<MenuDTO>();
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getSimpleName() {
return simpleName;
}
public String getUrl() {
return url;
}
public String getDescription() {
return description;
}
public void setSubmenus(List<MenuDTO> submenus) {
this.submenus = submenus;
}
public List<MenuDTO> getSubmenus() {
return submenus;
}
public Boolean getShow() {
return isShow;
}
public void setShow(Boolean show) {
isShow = show;
}
public MenuDTO() {
super();
}
public MenuDTO(String id, String name, String simpleName) {
super();
this.id = id;
this.name = name;
this.simpleName=simpleName;
if(StringUtils.isNotBlank(name) && StringUtils.isBlank(simpleName)){
this.simpleName=name.substring(0,2);
}
}
public MenuDTO(String id, String name, String simpleName, String url, String description) {
super();
this.id = id;
this.name = name;
this.simpleName=simpleName;
if(StringUtils.isNotBlank(name) && StringUtils.isBlank(simpleName)){
this.simpleName=name.substring(0,2);
}
this.url = url;
this.description = description;
}
/**************************************************************开始格式化数据方法**************************************************************/
/**
* 是否有子菜单
* @return
*/
public boolean isHasSubMenus() {
return this.submenus.size()>0;
}
}
请求参数
{
"treeType": "resourceTree"
}
@AuditLogEnregistor(module="角色管理",action="保存")
@ApiOperation(value="保存角色", httpMethod="POST")
@ApiImplicitParam(name="roleDTO", value="角色详情", required=true)
@RequestMapping(value="/save", method=RequestMethod.POST)
public ApiResultDTO<RoleDTO> saveRole(@RequestBody RoleDTO roleDTO,HttpServletRequest hreq) {
return RestAPITemplate.restapi(new IMyLogic<RoleDTO>() {
@Override
public RoleDTO logic() {
AccessTokenUser user=new AccessTokenUserAssembler().getAccessTokenUserFromReq(hreq);
roleService.saveRole(user,null,roleDTO);
return roleDTO;
}
});
}
public void saveRole(AccessTokenUser user, Date operateTime, RoleDTO roleDTO) {
if(roleDTO.getParent()==null||StringUtils.isBlank(roleDTO.getParent().getId())){
throw new RuntimeException("请选择上级节点!");
}
//this.checkRoleCanEditByRoleName(roleDTO.getName());//检查可编辑权限
RoleDTOAssembler roleDTOAssembler=new RoleDTOAssembler(this.beansFactoryService);
String roleId=roleDTO.getId();
String parentId=roleDTO.getParent().getId();
Role role=null;
Role parent=this.roleRepository.getRoleById(parentId);
if(parent==null){
throw new RuntimeException("未找到上级节点!");
}
String oldParentId=null;
Integer oldOrderNo=null;
if(StringUtils.isBlank(roleId)){
role = roleDTOAssembler.fromRoleDTO(roleDTO);
role.updateCreateInfo(user, operateTime, parent);
}else{
role=this.roleRepository.getRoleById(roleId);
if(role==null){
throw new RuntimeException("根据角色id未找到相应的角色!");
}
//this.checkRoleCanEditByRoleName(role.getName());//检查可编辑权限
oldParentId=role.getParent().getId();
oldOrderNo=role.getOrderNo();
String name=roleDTO.getName();
String visibleLevel=roleDTO.getVisibleLevel();
String resourceCodes = roleDTO.obtainResourceCodes();
String comments=roleDTO.getComments();
int orderNo=roleDTO.getOrderNo();
role.updateRole(user, operateTime, parent, name, visibleLevel, resourceCodes,comments, orderNo);
}
roleRepository.createOrUpdateRole(role);
if (oldParentId==null || oldOrderNo==null || oldOrderNo!=role.getOrderNo() ||!oldParentId.equals(role.getParent().getId())){
//更新fullId和fullOrder
roleDomainService.updateRoleFullIdAndFullOrder(user, operateTime,role);
roleRepository.createOrUpdateRole(role);
}
//更新角色 用户关系
roleDomainService.updateRoleUsers(user, operateTime,roleDTO.getUsers(),role);
if (StringUtils.isBlank(roleDTO.getId())){
roleDTO.setId(role.getId());
}
}
@Entity
@Table(name = "T_ROLE")
public class Role extends ExBizEntity {
public static final String NODETYPE_ROOT = "Root";
public static final String NODETYPE_CATEGORY = "Category";
public static final String NODETYPE_ROLE = "Role";
@Column(length=200)
private String name;//角色名称
@Column(length=20)
private String nodeType;//节点类型
@Column(length=100)
private String visibleLevel;//可见级别
@Column(columnDefinition="text")
private String resourceCodes;//拥有的资源的资源编码
@OneToMany(mappedBy="roleId")
@OrderBy("createTime,id")
private Set<RoleUser> roleUsers = new LinkedHashSet<RoleUser>();//拥有此角色的用户
@Column(length = 500)
private String fullId;//增强树,全路径
@Column(length = 500)
private String fullOrder;//增强树排序
@Column(length = 1000)
private String comments;//说明
private int orderNo = 0;//归口顺序号
@ManyToOne(fetch = FetchType.LAZY)
private Role parent;//父节点
@OneToMany(mappedBy = "parent")
@OrderBy("orderNo")
private Set<Role> children = new HashSet<Role>();//子节点
//todo 省略get方法
public Role() {
super();
}
public Role(String nodeType,String visibleLevel, String name,
String resourceCodes,String comments, int orderNo) {
super();
this.nodeType = nodeType;
this.visibleLevel = visibleLevel;
this.name = name;
this.resourceCodes = resourceCodes;
this.comments = comments;
this.orderNo = orderNo;
}
//为跟节点构造
private Role(AccessTokenUser user, Date operateTime, String name){
this.setCreateInfo(new OperateInfo(user));
this.id = getRoleRootId();
this.nodeType = NODETYPE_ROOT;
this.name = name;
this.orderNo = 1;
this.fullId = this.id+"-";
this.fullOrder = 1+"-";
}
//获取角色跟节点id
@Transient
public static String getRoleRootId(){
return "rootRole";
}
//创建角色跟节点
public static Role createRoleRoot( AccessTokenUser user,Date operateTime){
Role root=new Role(user, operateTime, "角色管理");
return root;
}
public void updateCreateInfo(AccessTokenUser user,Date operateTime, Role parent) {
this.setCreateInfo(new OperateInfo(user));
this.parent = parent;
}
public void updateRole(AccessTokenUser user, Date operateTime,
Role parent,String name, String visibleLevel,
String resourceCodes,String comments, int orderNo) {
if(operateTime==null){
operateTime = new Date();
}
this.lastUpdateDate = operateTime;
this.name = name;
this.visibleLevel = visibleLevel;
this.parent = parent;
this.orderNo = orderNo;
this.resourceCodes = resourceCodes;
this.comments = comments;
}
//更新角色fullId和fullOrder
public void updateRoleFullIdAndFullOrder(AccessTokenUser user, Date operateTime,String oldFullId,String oldFullOrder) {
if(this.parent!=null){
this.fullId = this.parent.getFullId()+this.id+"-";
this.fullOrder = this.parent.getFullOrder()+Utils.lpadStr(this.orderNo+"",10,'0')+"-";
}else{
this.fullId = this.id+"-";
this.fullOrder = Utils.lpadStr(this.orderNo+"",10,'0')+"-";
}
//如果fullId或者fullOrder发生改变
if(!fullId.equals(oldFullId)||!fullOrder.equals(oldFullOrder)){
if(operateTime==null){
operateTime = new Date();
}
this.lastUpdateDate = operateTime;
}
}
}
@Entity
@Table(name = "T_USER_ROLE")
public class RoleUser extends ValueObjectEntity {
@Column(length=100)
private String roleId;//角色id
@Column(length=200)
private String roleName;//角色名称
@Column(length=100)
private String userId;//用户id
@Column(length=200)
private String userName;//用户名称
//todo 省略get方法
public RoleUser() {
super();
}
public RoleUser(String roleId, String roleName,
String userId,String userName) {
super();
this.roleId = roleId;
this.roleName = roleName;
this.userId = userId;
this.userName = userName;
}
//创建角色用户关系
public void createRoleUser(AccessTokenUser user,Date operateTime) {
this.setCreateInfo(new OperateInfo(user));
this.id = this.userId+"_"+this.roleId;
}
}
@ApiOperation(value="获取框架菜单", httpMethod="GET")
@RequestMapping(value="/menus/get", method=RequestMethod.GET)
public ApiResultDTO<Map<String,List<MenuDTO>>> getHomePageMenus(@RequestParam(value = "fromType",required = false) String fromType, HttpServletRequest hreq,
HttpServletResponse hrep){
return RestAPITemplate.restapi(new IMyLogic<Map<String,List<MenuDTO>>>() {
@Override
public Map<String,List<MenuDTO>> logic() {
AccessTokenUser user = new AccessTokenUserAssembler().getAccessTokenUserFromReq(hreq);
return layoutService.getLayoutMenus(user,fromType);
}
});
}
@Override
public Map<String,List<MenuDTO>> getLayoutMenus(AccessTokenUser user,String fromType) {
Map<String,List<MenuDTO>> result=new HashMap<String, List<MenuDTO>>();
PrivilegesUser puser = ThreadLocalCache.fetchAPIData(
"PrivilegesUser."+user.getUserId(),
new IDataFetch<ApiResultDTO<PrivilegesUser>>() {
@Override
public ApiResultDTO<PrivilegesUser> fetchData() {
return systGatewayService.getPrivilegesUserById(user.getUserId());
}
}
);
puser.getOtherData().put("accessToken", user.getAccessToken());
UserLayoutSetDTO layoutSet=this.getNotNullUserLayoutSet(user,fromType);
Map<String,List<MenuDTO>> allMenus=this.getMyAllMenus(user,fromType);
List<MenuDTO> leftTop = new ArrayList<MenuDTO>();//左菜单 上半部分
result.put("leftTop", leftTop);
List<WorkReminderDTO> gongztxq = layoutSet.getGongztxq();
for (int i = 0; i < gongztxq.size(); i++) {
for (MenuDTO menuDto : allMenus.get("gongztxq")) {
if(menuDto==null) continue;
if(menuDto.getId().equals(gongztxq.get(i).getMenuId()) && gongztxq.get(i).getShow()){
leftTop.add(menuDto);
break;
}
}
}
List<MenuDTO> leftBottom = new ArrayList<MenuDTO>();//左菜单 下半部分
result.put("leftBottom", leftBottom);
// Map changygnqMap=allMenus.get("changygnq").stream().collect(
// Collectors.toMap(d->d.getId(), d->d)
// );
if(layoutSet.getChangygnq() != null){
for (int i = 0; i < layoutSet.getChangygnq().size(); i++) {
for (MenuDTO menuDto : allMenus.get("changygnq")) {
if(menuDto==null) continue;
if(menuDto.getSubmenus().size() > 0){
for (MenuDTO submenu : menuDto.getSubmenus()) {
if(submenu.getId().equals(layoutSet.getChangygnq().get(i))){
leftBottom.add(submenu);
break;
}
}
}else{
if(menuDto.getId().equals(layoutSet.getChangygnq().get(i))){
leftBottom.add(menuDto);
}
}
}
}
}
if (leftTop.size()==0){
List<MenuDTO> leftBottom1 = result.get("leftBottom");
result.put("leftTop",leftBottom1);
result.put("leftBottom",new ArrayList<MenuDTO>());
}
return result;
}
public Map<String,List<MenuDTO>> getMyAllMenus(AccessTokenUser user,String fromType) {
List<MenuDTO> gongztxq = new ArrayList<>();//工作提醒区
String quyName="gongztxq";
result.put(quyName, gongztxq);
//待办
if(puser.hasAppointPrefixResource((String)XysdSysConstants.RES_MODULE_SHOUY_DAIB_.getId())) {
gongztxq.add(new MenuDTO(quyName+"_daib", "待办", "待办", "/xf/waitTodo", "待处理工作,需及时处理"));
}
//提醒
if(puser.hasResource((String)XysdSysConstants.RES_MODULE_SHOUY_TIX.getId())) {
gongztxq.add(new MenuDTO(quyName+"_tix", "提醒", "提醒", "/xf/remind", "新件、催办、退办等提醒"));
}
//预警 海淀 HDXF-21069 增加 预警飘窗,去掉这个 工作人员app,公交集团 还是需要
if (ValueObjectEntity.SYSCODE_GJJTXF.equals(BaseConstants.getProperty("syscode", null))
|| XysdConstants.TOKEN_FORMTYPE_APP.equals(user.obtainFromType())
||"gzapp".equals(fromType)){//处理PC登陆APP
if(puser.hasAppointPrefixResource((String)XysdSysConstants.RES_MODULE_SHOUY_YUJ_.getId())) {
gongztxq.add(new MenuDTO(quyName+"_yuj", "预警", "预警", "/xf/earlyWarn", "信访三率预警"));
}
}
//监控
if(puser.hasAppointPrefixResource((String)XysdSysConstants.RES_MODULE_SHOUY_JIANK_.getId())) {
gongztxq.add(new MenuDTO(quyName+"_jiank", "监控", "监控", "/xf/monitor", "未结件跟进办理"));
}
//看板
if(puser.hasResource((String)XysdSysConstants.RES_MODULE_SHOUY_KANB.getId())) {
gongztxq.add(new MenuDTO(quyName+"_kanb", "看板", "看板", "/xf/bulletinBoard", "全区信访统计分析"));
}
//数据分析
if(puser.hasResource((String)XysdSysConstants.RES_MODULE_SHOUY_SHUJFX.getId())) {
gongztxq.add(new MenuDTO(quyName+"_shujfx", "数据分析", "数据分析", "/xf/dataAnalysis", "数据分析"));
}
List<MenuDTO> defaultChangygnq = new ArrayList<MenuDTO>();//默认常用功能区
List<MenuDTO> changygnq = new ArrayList<MenuDTO>();//常用功能区
quyName="changygnq";
result.put(quyName, changygnq);
result.put("defaultChangygnq", defaultChangygnq);
//查询统计
menuDTO = new MenuDTO(quyName+"_chaxtj", "查询统计", "查询统计");
//查询统计-查询
if(puser.hasAppointPrefixResource(XysdSysConstants.RESPREFIX_MODULE_XINF_CHAX_)) {
MenuDTO cxMuDTO = new MenuDTO(quyName+"_chaxtj_xinfcx", "查询", "查询", "/xf/query", "办理查询");
menuDTO.getSubmenus().add(cxMuDTO);
defaultChangygnq.add(cxMuDTO);
}
//查询统计-统计
if(puser.hasAppointPrefixResource(XysdSysConstants.RESPREFIX_MODULE_TONGJBB_)) {
MenuDTO tjMuDTO = new MenuDTO(quyName+"_chaxtj_tongj", "统计", "统计", "/xf/statistics", "统计中心,进行各类统计");
menuDTO.getSubmenus().add(tjMuDTO);
defaultChangygnq.add(tjMuDTO);
}
//信访库
menuDTO = new MenuDTO(quyName+"_xinfk", "信访库", "信访库");
//信访库-查询
if(puser.hasAppointPrefixResource(XysdSysConstants.RESPREFIX_MODULE_XINFK_CHAX_)) {
menuDTO.getSubmenus().add(new MenuDTO(quyName+"_xinfk_chax", "信访库", "信访库", "/xf/infoLibrary", "信访人、信访件等集中查询"));
}
//信访库-整理
if(puser.hasAppointPrefixResource(XysdSysConstants.RESPREFIX_MODULE_XINFK_ZHENGL_)) {
menuDTO.getSubmenus().add(new MenuDTO(quyName+"_xinfk_zhengl", "信访库整理", "信访库整理", "/xf/infoArrange", "信访库整理"));
}
if(menuDTO.isHasSubMenus()) {
changygnq.add(menuDTO);
}
return result;
}
请看最上面