|
|
@@ -1,19 +1,16 @@ |
|
|
|
package com.ningdatech.kqapi.zzsfw.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.StopWatch; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.kqapi.common.enumeration.CommonEnum; |
|
|
|
import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant; |
|
|
|
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; |
|
|
|
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.entity.vo.WindowVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.entity.vo.ZoneVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
@@ -33,7 +30,7 @@ public class MatterManage { |
|
|
|
|
|
|
|
private final INdKqZzsfwMenuService menuService; |
|
|
|
|
|
|
|
public List<ZoneVO> getMatters() { |
|
|
|
public List<TreeVO> getMatters() { |
|
|
|
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class) |
|
|
|
.eq(NdKqZzsfwMenu::getHasUrl, CommonEnum.YES.getCode()) |
|
|
|
.orderByAsc(NdKqZzsfwMenu::getSort)); |
|
|
@@ -42,34 +39,49 @@ public class MatterManage { |
|
|
|
} |
|
|
|
|
|
|
|
Set<String> zoneSet = new HashSet<>(); |
|
|
|
List<ZoneVO> res = matters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> { |
|
|
|
ZoneVO zone = new ZoneVO(); |
|
|
|
zone.setZoneName(m.getZoneName()); |
|
|
|
zone.setWindows(generateWindows(m, matters)); |
|
|
|
List<TreeVO> res = matters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> { |
|
|
|
TreeVO zone = new TreeVO(); |
|
|
|
zone.setName(m.getZoneName()); |
|
|
|
zone.setChilren(generateWindows(m, matters)); |
|
|
|
zone.setType(ZzsfwMenuConstant.MENU_TYPE_ZONE); |
|
|
|
return zone; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
private List<WindowVO> generateWindows(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { |
|
|
|
private List<TreeVO> generateWindows(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { |
|
|
|
Set<String> windowSet = new HashSet<>(); |
|
|
|
return matters.stream().filter(m -> windowSet.add(m.getWindow()) && StringUtils.isNotBlank(m.getZoneName()) && m.getZoneName().equals(menu.getZoneName())) |
|
|
|
.map(m -> { |
|
|
|
WindowVO window = new WindowVO(); |
|
|
|
window.setWindowName(m.getWindow()); |
|
|
|
window.setMatters(generateMatters(m,matters)); |
|
|
|
TreeVO window = new TreeVO(); |
|
|
|
window.setName(m.getWindow()); |
|
|
|
window.setChilren(generateDepartment(m,matters)); |
|
|
|
window.setType(ZzsfwMenuConstant.MENU_TYPE_WINDOW); |
|
|
|
return window; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
private List<MattersVO> generateMatters(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { |
|
|
|
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow())) |
|
|
|
private List<TreeVO> generateDepartment(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { |
|
|
|
Set<String> departmentSet = new HashSet<>(); |
|
|
|
return matters.stream().filter(m -> departmentSet.add(m.getDepartment()) && StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow())) |
|
|
|
.map(m -> { |
|
|
|
TreeVO department = new TreeVO(); |
|
|
|
department.setName(m.getDepartment()); |
|
|
|
department.setChilren(generateMatters(m,matters)); |
|
|
|
department.setType(ZzsfwMenuConstant.MENU_TYPE_DEPARTMENT); |
|
|
|
return department; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
private List<TreeVO> generateMatters(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { |
|
|
|
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getDepartment()) && m.getDepartment().equals(menu.getDepartment())) |
|
|
|
.map(m -> { |
|
|
|
MattersVO matter = new MattersVO(); |
|
|
|
matter.setMatterName(m.getItemName()); |
|
|
|
matter.setWebapplyurl(m.getWebapplyurl()); |
|
|
|
matter.setRowguid(m.getItemRowid()); |
|
|
|
TreeVO matter = new TreeVO(); |
|
|
|
matter.setName(m.getItemName()); |
|
|
|
matter.setUrl(m.getWebapplyurl()); |
|
|
|
matter.setId(m.getItemRowid()); |
|
|
|
matter.setSort(m.getSort()); |
|
|
|
matter.setType(ZzsfwMenuConstant.MENU_TYPE_MATTER); |
|
|
|
return matter; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|