|
@@ -153,11 +153,18 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
* @version V1.0 2021/5/24 6:01 下午
|
|
|
*/
|
|
|
private List<SimpleProjectVO> getProjectsByAreaAndBuildingType(String areaCode, String buildingType) {
|
|
|
+ if (StringUtils.isBlank(areaCode) || StringUtils.isBlank(areaCode)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
List<PoemsProjectVO> projectsByArea = getProjectsByArea(areaCode);
|
|
|
if (CollectionUtils.isEmpty(projectsByArea)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
List<String> buildingTypes = getRelatedBuildingTypes(buildingType);
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(buildingTypes)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
return projectsByArea.stream().filter(
|
|
|
poemsProjectVO -> StringUtils.isNotBlank(poemsProjectVO.getFunctionType()) &&
|
|
|
buildingTypes.contains(poemsProjectVO.getFunctionType())).map(
|
|
@@ -199,6 +206,9 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
* @version V1.0 2021/5/24 6:04 下午
|
|
|
*/
|
|
|
private List<String> getRelatedBuildingTypes(String buildingType) {
|
|
|
+ if (StringUtils.isBlank(buildingType)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
List<FunctionTypeVO> sonBuildingTypes = findSonBuildingTypes(buildingType);
|
|
|
List<String> buildingTypes = Lists.newArrayList(buildingType);
|
|
|
functionTypeTree2List(sonBuildingTypes, buildingTypes);
|
|
@@ -235,6 +245,9 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
* @version V1.0 2021/5/21 2:40 下午
|
|
|
*/
|
|
|
private List<FunctionTypeVO> findSonBuildingTypes(String buildingType) {
|
|
|
+ if (StringUtils.isBlank(buildingType)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
// 获取业态下所有的子业态
|
|
|
PoemsFeignBaseDTO poemsFeignBaseDTO = new PoemsFeignBaseDTO();
|
|
|
poemsFeignBaseDTO.setDefaultValue();
|
|
@@ -306,11 +319,34 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
result.add(partitionVO);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 给根节点添加子节点
|
|
|
+ cascadeSetPartitionChildren(result, parentIdMap);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 级联给区域的子节点赋值
|
|
|
+ *
|
|
|
+ * @param result 需要赋值的节点
|
|
|
+ * @param parentIdMap 区域父节点id -> 区域列表
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/5/28 5:51 下午
|
|
|
+ */
|
|
|
+ private void cascadeSetPartitionChildren(List<PartitionVO> result, Map<String, List<FilterPartitionVO>> parentIdMap) {
|
|
|
+ if (CollectionUtils.isEmpty(result)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (PartitionVO partitionVO : result) {
|
|
|
+ List<FilterPartitionVO> filterPartitionVOList = parentIdMap.get(partitionVO.getAreaId());
|
|
|
+ List<PartitionVO> partitionVOList = ConvertSaasWebTool.INSTANCE.convert2PartitionVOList(filterPartitionVOList);
|
|
|
+ partitionVO.setChildren(partitionVOList);
|
|
|
+ cascadeSetPartitionChildren(partitionVOList, parentIdMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void setChildren(Map<String, List<FilterPartitionVO>> parentIdMap, List<PartitionVO> rootNodes) {
|
|
|
if (!CollectionUtils.isEmpty(rootNodes)) {
|
|
|
for (PartitionVO rootNode : rootNodes) {
|
|
@@ -388,7 +424,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
List<PartitionProjectVO> contents = partitionProject.getContents();
|
|
|
for (PartitionProjectVO content : contents) {
|
|
|
if (!projectFlag.equals(content.getType())) {
|
|
|
- content.setParentId(partitionProject.getParentId());
|
|
|
+ content.setParentId(partitionProject.getId());
|
|
|
result.add(content);
|
|
|
}
|
|
|
getPartitionsInPartitionProjects(content, result);
|