Quellcode durchsuchen

事项数据 变更

master
PoffyZhang vor 8 Monaten
Ursprung
Commit
209a6eea44
2 geänderte Dateien mit 105 neuen und 1 gelöschten Zeilen
  1. +25
    -0
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java
  2. +80
    -1
      kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java

+ 25
- 0
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/controller/NdKqZzsfwMenuController.java Datei anzeigen

@@ -5,6 +5,7 @@ import com.ningdatech.kqapi.common.exception.BizException;
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO;
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.manage.MatterManage;
import lombok.RequiredArgsConstructor;
@@ -38,6 +39,30 @@ public class NdKqZzsfwMenuController {
return matterManage.getMatters();
}

@GetMapping("/zones")
public List<TreeVO> getZones() {
return matterManage.getZones();
}

@GetMapping("/windows")
public List<TreeVO> getWindows(@RequestParam(required = false) String zoneName) {
return matterManage.getWindows(zoneName);
}

@GetMapping("/departments")
public List<TreeVO> getDepartments(@RequestParam(required = false) String windowName,
@RequestParam(required = false) String zoneName) {
return matterManage.getDepartments(zoneName,windowName);
}

@GetMapping("/matter-list")
public List<MattersVO> matterList(@RequestParam(required = false) String windowName,
@RequestParam(required = false) String zoneName,
@RequestParam(required = false) String department,
@RequestParam(required = false) Integer type) {
return matterManage.matterList(zoneName,windowName,department,type);
}

@GetMapping("/top10")
public List<MatterTopVO> topTen() {
return matterManage.topTen();


+ 80
- 1
kqapi/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java Datei anzeigen

@@ -13,6 +13,7 @@ import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO;
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMattersDeduplicate;
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu;
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.enumeration.ItemTypeEnum;
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMatterDeduplicateService;
@@ -75,7 +76,7 @@ public class MatterManage {
(!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
.collect(Collectors.toList());
Set<String> zoneSet = new HashSet<>();
List<TreeVO> res = matters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
List<TreeVO> res = finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
TreeVO zone = new TreeVO();
zone.setName(m.getZoneName());
zone.setChilren(generateWindows(m, finalMatters));
@@ -85,6 +86,84 @@ public class MatterManage {
return res;
}

/**
* 查询社区
* @return
*/
public List<TreeVO> getZones() {
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.orderByAsc(NdKqZzsfwMenu::getSort));
if(CollUtil.isEmpty(matters)){
return Collections.emptyList();
}

//如果是政府类型的 就隐藏 没有链接的
List<NdKqZzsfwMenu> finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) &&
(!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
.collect(Collectors.toList());
Set<String> zoneSet = new HashSet<>();
List<TreeVO> res = finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
TreeVO zone = new TreeVO();
zone.setName(m.getZoneName());
zone.setType(ZzsfwMenuConstant.MENU_TYPE_ZONE);
return zone;
}).collect(Collectors.toList());
return res;
}

public List<TreeVO> getWindows(String zoneName) {
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.eq(StringUtils.isNotBlank(zoneName),NdKqZzsfwMenu::getZoneName,zoneName)
.orderByAsc(NdKqZzsfwMenu::getSort));
if(CollUtil.isEmpty(matters)){
return Collections.emptyList();
}

Set<String> windowSet = new HashSet<>();
return matters.stream().filter(m -> windowSet.add(m.getWindow()))
.map(m -> {
TreeVO window = new TreeVO();
window.setName(m.getWindow());
window.setType(ZzsfwMenuConstant.MENU_TYPE_WINDOW);
return window;
}).collect(Collectors.toList());
}

public List<TreeVO> getDepartments(String zoneName,String windowName) {
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.eq(StringUtils.isNotBlank(windowName),NdKqZzsfwMenu::getWindow,windowName)
.eq(StringUtils.isNotBlank(zoneName),NdKqZzsfwMenu::getZoneName,zoneName)
.orderByAsc(NdKqZzsfwMenu::getSort));
if(CollUtil.isEmpty(matters)){
return Collections.emptyList();
}

Set<String> departMentSet = new HashSet<>();
return matters.stream().filter(m -> departMentSet.add(m.getDepartment()))
.map(m -> {
TreeVO department = new TreeVO();
department.setName(m.getDepartment());
department.setType(ZzsfwMenuConstant.MENU_TYPE_DEPARTMENT);
return department;
}).collect(Collectors.toList());
}

public List<MattersVO> matterList(String zoneName, String windowName, String department, Integer type) {
List<NdKqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)
.eq(StringUtils.isNotBlank(windowName),NdKqZzsfwMenu::getWindow,windowName)
.eq(StringUtils.isNotBlank(zoneName),NdKqZzsfwMenu::getZoneName,zoneName)
.eq(StringUtils.isNotBlank(department),NdKqZzsfwMenu::getDepartment,department)
.eq(Objects.nonNull(type),NdKqZzsfwMenu::getType,type)
.orderByAsc(NdKqZzsfwMenu::getSort));
if(CollUtil.isEmpty(matters)){
return Collections.emptyList();
}

return matters.stream()
.map(m -> BeanUtil.copyProperties(m,MattersVO.class))
.collect(Collectors.toList());
}

private List<TreeVO> generateWindows(NdKqZzsfwMenu menu, List<NdKqZzsfwMenu> matters) {
Set<String> windowSet = new HashSet<>();
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getZoneName()) && m.getZoneName().equals(menu.getZoneName())


Laden…
Abbrechen
Speichern