|
|
@@ -5,14 +5,14 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant; |
|
|
|
import com.ningdatech.kqapi.zzsfw.enumeration.ItemTypeEnum; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.dto.KqZzsfwMattersDeduplicateDTO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.dto.KqZzsfwMenuDTO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMenu; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMattersDeduplicate; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMenu; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.vo.MatterTopVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.vo.MattersVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.model.vo.TreeVO; |
|
|
|
import com.ningdatech.kqapi.zzsfw.enumeration.ItemTypeEnum; |
|
|
|
import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMatterDeduplicateService; |
|
|
|
import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMenuService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@@ -64,13 +64,13 @@ public class MatterManage { |
|
|
|
public List<TreeVO> getMatters() { |
|
|
|
List<KqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) |
|
|
|
.orderByAsc(KqZzsfwMenu::getSort)); |
|
|
|
if(CollUtil.isEmpty(matters)){ |
|
|
|
if (CollUtil.isEmpty(matters)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
//如果是政府类型的 就隐藏 没有链接的 |
|
|
|
List<KqZzsfwMenu> finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) && |
|
|
|
(!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl()))) |
|
|
|
(!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 -> { |
|
|
@@ -85,12 +85,13 @@ public class MatterManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询社区 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public List<TreeVO> getZones() { |
|
|
|
List<KqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) |
|
|
|
.orderByAsc(KqZzsfwMenu::getSort)); |
|
|
|
if(CollUtil.isEmpty(matters)){ |
|
|
|
if (CollUtil.isEmpty(matters)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
@@ -109,9 +110,9 @@ public class MatterManage { |
|
|
|
|
|
|
|
public List<TreeVO> getWindows(String zoneName) { |
|
|
|
List<KqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName,zoneName) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName, zoneName) |
|
|
|
.orderByAsc(KqZzsfwMenu::getSort)); |
|
|
|
if(CollUtil.isEmpty(matters)){ |
|
|
|
if (CollUtil.isEmpty(matters)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
@@ -130,22 +131,20 @@ public class MatterManage { |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
public List<TreeVO> getDepartments(String zoneName,String windowName) { |
|
|
|
public List<TreeVO> getDepartments(String zoneName, String windowName) { |
|
|
|
List<KqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) |
|
|
|
.select(KqZzsfwMenu::getDepartment,KqZzsfwMenu::getType,KqZzsfwMenu::getWebapplyurl) |
|
|
|
.eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow,windowName) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName,zoneName) |
|
|
|
.select(KqZzsfwMenu::getDepartment, KqZzsfwMenu::getType, KqZzsfwMenu::getWebapplyurl) |
|
|
|
.eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow, windowName) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName, zoneName) |
|
|
|
.isNotNull(KqZzsfwMenu::getDepartment) |
|
|
|
.orderByAsc(KqZzsfwMenu::getSort)); |
|
|
|
if(CollUtil.isEmpty(matters)){ |
|
|
|
if (CollUtil.isEmpty(matters)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
List<KqZzsfwMenu> finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) && |
|
|
|
(!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
Set<String> departMentSet = new HashSet<>(); |
|
|
|
return finalMatters.stream().filter(m -> departMentSet.add(m.getDepartment())) |
|
|
|
return matters.stream() |
|
|
|
.filter(m -> m.getType() != null && (!ItemTypeEnum.GOV.eq(m.getType()) || m.getWebapplyurl() != null)) |
|
|
|
.filter(m -> departMentSet.add(m.getDepartment())) |
|
|
|
.map(m -> { |
|
|
|
TreeVO department = new TreeVO(); |
|
|
|
department.setName(m.getDepartment()); |
|
|
@@ -156,33 +155,29 @@ public class MatterManage { |
|
|
|
|
|
|
|
public List<MattersVO> matterList(String zoneName, String windowName, String department, Integer type) { |
|
|
|
List<KqZzsfwMenu> matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class) |
|
|
|
.eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow,windowName) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName,zoneName) |
|
|
|
.eq(StringUtils.isNotBlank(department), KqZzsfwMenu::getDepartment,department) |
|
|
|
.eq(Objects.nonNull(type), KqZzsfwMenu::getType,type) |
|
|
|
.eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow, windowName) |
|
|
|
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName, zoneName) |
|
|
|
.eq(StringUtils.isNotBlank(department), KqZzsfwMenu::getDepartment, department) |
|
|
|
.eq(Objects.nonNull(type), KqZzsfwMenu::getType, type) |
|
|
|
.orderByAsc(KqZzsfwMenu::getSort)); |
|
|
|
if(CollUtil.isEmpty(matters)){ |
|
|
|
if (CollUtil.isEmpty(matters)) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
//如果是政府类型的 就隐藏 没有链接的 |
|
|
|
List<KqZzsfwMenu> finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) && |
|
|
|
(!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return finalMatters.stream() |
|
|
|
return matters.stream().filter(m -> Objects.nonNull(m.getType()) |
|
|
|
&& (!ItemTypeEnum.GOV.eq(m.getType()) || Objects.nonNull(m.getWebapplyurl()))) |
|
|
|
.map(m -> { |
|
|
|
MattersVO mattersVO = BeanUtil.copyProperties(m, MattersVO.class); |
|
|
|
mattersVO.setMatterName(m.getItemName()); |
|
|
|
mattersVO.setId(m.getId()); |
|
|
|
return mattersVO; |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
public MattersVO matter(Long id) { |
|
|
|
KqZzsfwMenu matter = menuService.getById(id); |
|
|
|
if(Objects.isNull(matter)){ |
|
|
|
if (Objects.isNull(matter)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
MattersVO mattersVO = BeanUtil.copyProperties(matter, MattersVO.class); |
|
|
@@ -194,11 +189,11 @@ public class MatterManage { |
|
|
|
private List<TreeVO> generateWindows(KqZzsfwMenu menu, List<KqZzsfwMenu> matters) { |
|
|
|
Set<String> windowSet = new HashSet<>(); |
|
|
|
return matters.stream().filter(m -> StringUtils.isNotBlank(m.getZoneName()) && m.getZoneName().equals(menu.getZoneName()) |
|
|
|
&& windowSet.add(m.getWindow())) |
|
|
|
&& windowSet.add(m.getWindow())) |
|
|
|
.map(m -> { |
|
|
|
TreeVO window = new TreeVO(); |
|
|
|
window.setName(m.getWindow()); |
|
|
|
window.setChilren(generateDepartment(m,matters)); |
|
|
|
window.setChilren(generateDepartment(m, matters)); |
|
|
|
window.setType(ZzsfwMenuConstant.MENU_TYPE_WINDOW); |
|
|
|
return window; |
|
|
|
}).collect(Collectors.toList()); |
|
|
@@ -206,12 +201,12 @@ public class MatterManage { |
|
|
|
|
|
|
|
private List<TreeVO> generateDepartment(KqZzsfwMenu menu, List<KqZzsfwMenu> matters) { |
|
|
|
Set<String> departmentSet = new HashSet<>(); |
|
|
|
return matters.stream().filter( m -> 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 -> { |
|
|
|
TreeVO department = new TreeVO(); |
|
|
|
department.setName(m.getDepartment()); |
|
|
|
department.setChilren(generateItemType(m,matters)); |
|
|
|
department.setChilren(generateItemType(m, matters)); |
|
|
|
department.setType(ZzsfwMenuConstant.MENU_TYPE_DEPARTMENT); |
|
|
|
return department; |
|
|
|
}).collect(Collectors.toList()); |
|
|
@@ -224,9 +219,9 @@ public class MatterManage { |
|
|
|
.map(m -> { |
|
|
|
TreeVO menuType = new TreeVO(); |
|
|
|
ItemTypeEnum itemTypeEnum = ItemTypeEnum.match(m.getType()); |
|
|
|
if(Objects.nonNull(itemTypeEnum)){ |
|
|
|
if (Objects.nonNull(itemTypeEnum)) { |
|
|
|
menuType.setName(itemTypeEnum.getDesc()); |
|
|
|
menuType.setChilren(generateMatters(m,matters)); |
|
|
|
menuType.setChilren(generateMatters(m, matters)); |
|
|
|
menuType.setType(ZzsfwMenuConstant.MENU_ITEM_TYPE); |
|
|
|
return menuType; |
|
|
|
} |
|
|
@@ -270,27 +265,27 @@ public class MatterManage { |
|
|
|
} |
|
|
|
|
|
|
|
public String save(KqZzsfwMenuDTO dto) { |
|
|
|
if(Objects.isNull(dto)){ |
|
|
|
if (Objects.isNull(dto)) { |
|
|
|
return "保存失败 传入为空"; |
|
|
|
} |
|
|
|
|
|
|
|
KqZzsfwMenu entity = BeanUtil.copyProperties(dto, KqZzsfwMenu.class); |
|
|
|
if(menuService.save(entity)){ |
|
|
|
if (menuService.save(entity)) { |
|
|
|
return "保存成功 :" + entity; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return "保存失败"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public String saveDup(KqZzsfwMattersDeduplicateDTO dto) { |
|
|
|
if(Objects.isNull(dto)){ |
|
|
|
if (Objects.isNull(dto)) { |
|
|
|
return "保存失败 传入为空"; |
|
|
|
} |
|
|
|
|
|
|
|
KqZzsfwMattersDeduplicate entity = BeanUtil.copyProperties(dto, KqZzsfwMattersDeduplicate.class); |
|
|
|
if(matterDeduplicateService.save(entity)){ |
|
|
|
if (matterDeduplicateService.save(entity)) { |
|
|
|
return "保存成功 :" + entity; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return "保存失败"; |
|
|
|
} |
|
|
|
} |
|
|
@@ -390,13 +385,14 @@ public class MatterManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* 4-10 数据问题 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String update4_10() { |
|
|
|
//1.窗口后缀不是服务的 都加个服务 |
|
|
|
List<KqZzsfwMenu> list = menuService.list(); |
|
|
|
for (KqZzsfwMenu menu : list) { |
|
|
|
if(StringUtils.isNotBlank(menu.getWindow()) && !menu.getWindow().endsWith("服务")){ |
|
|
|
if (StringUtils.isNotBlank(menu.getWindow()) && !menu.getWindow().endsWith("服务")) { |
|
|
|
menu.setWindow(menu.getWindow() + "服务"); |
|
|
|
menuService.updateById(menu); |
|
|
|
} |
|
|
|