Browse Source

改成 树结构

master
PoffyZhang 1 year ago
parent
commit
1141aff932
3 changed files with 10 additions and 6 deletions
  1. +1
    -1
      kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java
  2. +2
    -2
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java
  3. +7
    -3
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java

+ 1
- 1
kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalResponseHandler.java View File

@@ -16,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
* @Version 1.0 * @Version 1.0
**/ **/
@RestControllerAdvice(basePackages = { @RestControllerAdvice(basePackages = {
"com.ningdatech.kqapi.zzsfw.controller"
}) })
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {




+ 2
- 2
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java View File

@@ -34,7 +34,7 @@ public class NdKqZzsfwMenuController {


@ApiOperation(value = "获取政务事项数据列表", notes = "获取政务事项数据列表") @ApiOperation(value = "获取政务事项数据列表", notes = "获取政务事项数据列表")
@GetMapping("/matters") @GetMapping("/matters")
public ApiResponse<List<TreeVO>> getMatters() {
return ApiResponse.ofSuccess(matterManage.getMatters());
public List<TreeVO> getMatters() {
return matterManage.getMatters();
} }
} }

+ 7
- 3
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java View File

@@ -51,7 +51,8 @@ public class MatterManage {


private List<TreeVO> generateWindows(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { private List<TreeVO> generateWindows(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) {
Set<String> windowSet = new HashSet<>(); Set<String> windowSet = new HashSet<>();
return matters.stream().filter(m -> windowSet.add(m.getWindow()) && StringUtils.isNotBlank(m.getZoneName()) && m.getZoneName().equals(menu.getZoneName()))
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getZoneName()) && m.getZoneName().equals(menu.getZoneName())
&& windowSet.add(m.getWindow()))
.map(m -> { .map(m -> {
TreeVO window = new TreeVO(); TreeVO window = new TreeVO();
window.setName(m.getWindow()); window.setName(m.getWindow());
@@ -63,7 +64,8 @@ public class MatterManage {


private List<TreeVO> generateDepartment(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { private List<TreeVO> generateDepartment(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) {
Set<String> departmentSet = new HashSet<>(); Set<String> departmentSet = new HashSet<>();
return matters.stream().filter(m -> departmentSet.add(m.getDepartment()) && StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow()))
return matters.stream().filter( m -> StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow()) &&
m.getZoneName().equals(menu.getZoneName()) && departmentSet.add(m.getDepartment()))
.map(m -> { .map(m -> {
TreeVO department = new TreeVO(); TreeVO department = new TreeVO();
department.setName(m.getDepartment()); department.setName(m.getDepartment());
@@ -74,7 +76,9 @@ public class MatterManage {
} }


private List<TreeVO> generateMatters(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) { private List<TreeVO> generateMatters(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) {
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getDepartment()) && m.getDepartment().equals(menu.getDepartment()))
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getDepartment()) &&
m.getDepartment().equals(menu.getDepartment()) && m.getWindow().equals(menu.getWindow()) &&
m.getZoneName().equals(menu.getZoneName()))
.map(m -> { .map(m -> {
TreeVO matter = new TreeVO(); TreeVO matter = new TreeVO();
matter.setName(m.getItemName()); matter.setName(m.getItemName());


Loading…
Cancel
Save