Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang 1 year ago
parent
commit
f6092a05b1
5 changed files with 25 additions and 22 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  3. +20
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java
  5. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java View File

@@ -46,7 +46,7 @@ public enum ExportOptionEnum {


buildOrgZheJiangGovDingId(14, "建设单位浙政钉ID"), buildOrgZheJiangGovDingId(14, "建设单位浙政钉ID"),


buildOrgCode(15, "建设单位统一信用代码"),
orgCreditCode(15, "建设单位统一信用代码"),


projectType(16, "项目类型"), projectType(16, "项目类型"),




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -201,7 +201,7 @@ public class ExcelDownUtil {
for (ExportOptionEnum column : columnList) { for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList(); List<String> columnValues = Lists.newArrayList();
columnValues.add(column.getDesc()); columnValues.add(column.getDesc());
projects.stream().forEach(project -> {
projects.forEach(project -> {
String s = JSON.toJSONString(project); String s = JSON.toJSONString(project);
JSONObject jsonObject = JSON.parseObject(s); JSONObject jsonObject = JSON.parseObject(s);
String columnValue = String.valueOf(jsonObject.get(column.toString())); String columnValue = String.valueOf(jsonObject.get(column.toString()));


+ 20
- 18
pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java View File

@@ -10,10 +10,7 @@ import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO;


import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;


/** /**
@@ -125,32 +122,37 @@ public final class TreeUtil {
} }
Map<Long, List<MenuRoleVO>> menuGroup = CollUtils.group(treeList, MenuTreeEntity::getPid); Map<Long, List<MenuRoleVO>> menuGroup = CollUtils.group(treeList, MenuTreeEntity::getPid);
Map<Long, MenuRoleVO> menuMap = CollUtils.listToMap(treeList, MenuTreeEntity::getId); Map<Long, MenuRoleVO> menuMap = CollUtils.listToMap(treeList, MenuTreeEntity::getId);
return buildUserMenuTree(menuGroup, menuMap, StrPool.DEF_PARENT_ID);
return buildUserMenuTree(menuGroup, menuMap, StrPool.DEF_PARENT_ID, null);
} }


private static List<MenuRoleVO> buildUserMenuTree(Map<Long, List<MenuRoleVO>> menuGroup, Map<Long, MenuRoleVO> menuMap, Long parentId) {
private static List<MenuRoleVO> buildUserMenuTree(Map<Long, List<MenuRoleVO>> menuGroup,
Map<Long, MenuRoleVO> menuMap,
Long parentId,
ListIterator<MenuRoleVO> parentIter) {
List<MenuRoleVO> currMenus = menuGroup.get(parentId); List<MenuRoleVO> currMenus = menuGroup.get(parentId);
if (currMenus == null) { if (currMenus == null) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<MenuRoleVO> menus = new ArrayList<>(currMenus);
for (MenuRoleVO curr : currMenus) {
List<MenuRoleVO> menus;
if (!parentId.equals(StrPool.DEF_PARENT_ID)) {
Map<MenuTypeEnum, List<MenuRoleVO>> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType);
for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) {
parentIter.add(vo);
}
menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList());
} else {
menus = new ArrayList<>(currMenus);
}
ListIterator<MenuRoleVO> currIter = menus.listIterator();
while (currIter.hasNext()) {
MenuRoleVO curr = currIter.next();
if (curr.getPid().equals(StrPool.DEF_PARENT_ID)) { if (curr.getPid().equals(StrPool.DEF_PARENT_ID)) {
curr.setPid(null); curr.setPid(null);
curr.setTopMenu(curr.getName()); curr.setTopMenu(curr.getName());
} else { } else {
curr.setTopMenu(menuMap.get(curr.getPid()).getTopMenu()); curr.setTopMenu(menuMap.get(curr.getPid()).getTopMenu());
} }
List<MenuRoleVO> childMenus = menuGroup.get(curr.getId());
if (childMenus != null) {
Map<MenuTypeEnum, List<MenuRoleVO>> groupByType = CollUtils.group(childMenus, MenuRoleVO::getMenuType);
menus.addAll(groupByType.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList()));
curr.setChildren(groupByType.get(MenuTypeEnum.MENU));
for (MenuRoleVO child : curr.getChildren()) {
child.setTopMenu(curr.getTopMenu());
child.setChildren(buildUserMenuTree(menuGroup, menuMap, child.getId()));
}
}
curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter));
} }
return menus; return menus;
} }


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.sys.model.dto; package com.ningdatech.pmapi.sys.model.dto;


import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
@@ -48,7 +49,7 @@ public class MenuUpdateDTO implements Serializable {
* 类型 * 类型
*/ */
@ApiModelProperty(value = "类型") @ApiModelProperty(value = "类型")
private Integer type;
private MenuTypeEnum menuType;


/** /**
* 页面路径 * 页面路径


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java View File

@@ -79,7 +79,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean update(MenuUpdateDTO data, Long userId) { public boolean update(MenuUpdateDTO data, Long userId) {
if (MenuTypeEnum.MENU.getCode().equals(data.getType())) {
if (MenuTypeEnum.MENU.equals(data.getMenuType())) {
if (StrUtil.isBlank(data.getPath())) { if (StrUtil.isBlank(data.getPath())) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空"); throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空");
} }


Loading…
Cancel
Save