bug修改
This commit is contained in:
parent
4eb0efd056
commit
f70c020d52
@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -161,4 +158,11 @@ public class BaseMenuController {
|
||||
public Result<Map<String,Object>> getDefaultProjectMenu() {
|
||||
return Result.success(baseMenuService.getDefaultProjectMenu());
|
||||
}*/
|
||||
|
||||
@ApiOperation(value = "解决项目子账号的菜单按钮无法分配", notes = "解决项目子账号的菜单按钮无法分配", httpMethod="GET")
|
||||
@GetMapping(value = "/fixAuthDistribute")
|
||||
public Result fixAuthDistribute() {
|
||||
baseMenuService.fixAuthDistribute();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,4 +50,7 @@ public interface IBaseMenuService extends IService<BaseMenu> {
|
||||
List<EntityMap> getSupplierMenuList(Map<String, Object> param);
|
||||
|
||||
List<EntityMap> getSupplierActionList(Map<String, Object> param);
|
||||
|
||||
void fixAuthDistribute();
|
||||
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseAction;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
|
||||
@ -19,21 +21,24 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 系统菜单
|
||||
* @author: pds
|
||||
* @date: 2020-10-12
|
||||
* @date: 2020-10-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> implements IBaseMenuService {
|
||||
@Autowired
|
||||
BaseActionServiceImpl baseActionService;
|
||||
@Autowired
|
||||
private BaseMenuMapper baseMenuMapper;
|
||||
@Autowired
|
||||
@ -67,6 +72,19 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
return baseMenuMapper.getSupplierActionList(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixAuthDistribute() {
|
||||
List<BaseMenu> baseMenus = baseMenuMapper.selectList(null);
|
||||
for (BaseMenu baseMenu : baseMenus) {
|
||||
editBaseMenu(baseMenu);
|
||||
}
|
||||
|
||||
List<BaseAction> baseActions = baseActionMapper.selectList(null);
|
||||
for (BaseAction baseAction : baseActions) {
|
||||
baseActionService.editBaseAction(baseAction);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProjectModuleAndMenu(Map<String, Object> map) {
|
||||
map.put("styleType", getStyleType(MapUtils.getString(map, "projectSn")));
|
||||
@ -125,18 +143,18 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityMap> groupMenu(List<EntityMap> list,List<EntityMap> actionList){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
List<EntityMap> childList=new ArrayList<>();
|
||||
if(list!=null&&list.size()>0){
|
||||
for (EntityMap menu:list){
|
||||
if("0".equals(MapUtils.getString(menu,"parentId"))){
|
||||
public List<EntityMap> groupMenu(List<EntityMap> list, List<EntityMap> actionList) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
List<EntityMap> childList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (EntityMap menu : list) {
|
||||
if ("0".equals(MapUtils.getString(menu, "parentId"))) {
|
||||
tempList.add(menu);
|
||||
}else{
|
||||
} else {
|
||||
childList.add(menu);
|
||||
}
|
||||
}
|
||||
tempList=groupList(tempList,childList,actionList);
|
||||
tempList = groupList(tempList, childList, actionList);
|
||||
}
|
||||
return tempList;
|
||||
}
|
||||
@ -184,12 +202,12 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
|
||||
}
|
||||
|
||||
private List<BaseModule> groupModuleMenu(List<BaseModule> moduleList,List<EntityMap> menuList){
|
||||
if(menuList!=null&&menuList.size()>0){
|
||||
for (BaseModule module:moduleList){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
for (EntityMap menu:menuList){
|
||||
if(MapUtils.getString(menu,"moduleId").equals(String.valueOf(module.getModuleId()))){
|
||||
private List<BaseModule> groupModuleMenu(List<BaseModule> moduleList, List<EntityMap> menuList) {
|
||||
if (menuList != null && menuList.size() > 0) {
|
||||
for (BaseModule module : moduleList) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
for (EntityMap menu : menuList) {
|
||||
if (MapUtils.getString(menu, "moduleId").equals(String.valueOf(module.getModuleId()))) {
|
||||
tempList.add(menu);
|
||||
}
|
||||
}
|
||||
@ -199,40 +217,40 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
return moduleList;
|
||||
}
|
||||
|
||||
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList,List<EntityMap> actionList){
|
||||
for(EntityMap menu:list){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
List<EntityMap> List2=new ArrayList<>();
|
||||
for(EntityMap childMenu:childList){
|
||||
if(MapUtils.getString(menu,"menuId").equals(MapUtils.getString(childMenu,"parentId"))){
|
||||
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList, List<EntityMap> actionList) {
|
||||
for (EntityMap menu : list) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
List<EntityMap> List2 = new ArrayList<>();
|
||||
for (EntityMap childMenu : childList) {
|
||||
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(childMenu, "parentId"))) {
|
||||
tempList.add(childMenu);
|
||||
}else{
|
||||
} else {
|
||||
List2.add(childMenu);
|
||||
}
|
||||
}
|
||||
if(List2.size()>0) {
|
||||
tempList = groupList(tempList, List2,actionList);
|
||||
if (List2.size() > 0) {
|
||||
tempList = groupList(tempList, List2, actionList);
|
||||
}
|
||||
if(tempList.size()>0){
|
||||
menu.put("menu_list",tempList);
|
||||
}else{
|
||||
List<EntityMap> tempActionList=new ArrayList<>();
|
||||
for(EntityMap actionMenu:actionList){
|
||||
if(MapUtils.getString(menu,"menuId").equals(MapUtils.getString(actionMenu,"menuId"))){
|
||||
if (tempList.size() > 0) {
|
||||
menu.put("menu_list", tempList);
|
||||
} else {
|
||||
List<EntityMap> tempActionList = new ArrayList<>();
|
||||
for (EntityMap actionMenu : actionList) {
|
||||
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(actionMenu, "menuId"))) {
|
||||
tempActionList.add(actionMenu);
|
||||
}
|
||||
}
|
||||
menu.put("menu_list",tempActionList);
|
||||
menu.put("menu_list", tempActionList);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private Integer getStyleType(String projectSn){
|
||||
CompanyConfig companyConfig=companyConfigMapper.selectConfigByProject(projectSn);
|
||||
if(companyConfig!=null&&companyConfig.getStyleType()!=null){
|
||||
private Integer getStyleType(String projectSn) {
|
||||
CompanyConfig companyConfig = companyConfigMapper.selectConfigByProject(projectSn);
|
||||
if (companyConfig != null && companyConfig.getStyleType() != null) {
|
||||
return companyConfig.getStyleType();
|
||||
}else{
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user