Преглед на файлове

Merge remote-tracking branch 'origin/master'

master
PoffyZhang преди 1 година
родител
ревизия
f6092a05b1
променени са 5 файла, в които са добавени 25 реда и са изтрити 22 реда
  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 Целия файл

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

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

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

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



+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java Целия файл

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


+ 20
- 18
pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java Целия файл

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

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;

/**
@@ -125,32 +122,37 @@ public final class TreeUtil {
}
Map<Long, List<MenuRoleVO>> menuGroup = CollUtils.group(treeList, MenuTreeEntity::getPid);
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);
if (currMenus == null) {
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)) {
curr.setPid(null);
curr.setTopMenu(curr.getName());
} else {
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;
}


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuUpdateDTO.java Целия файл

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

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

/**
* 页面路径


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java Целия файл

@@ -79,7 +79,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
@Transactional(rollbackFor = Exception.class)
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())) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空");
}


Loading…
Отказ
Запис