Ver código fonte

Merge branch 'dev-v1.0.0-jd' of http://39.106.8.246:3003/apm/energy-report into dev-v1.0.0-jd

wangchenghong 3 anos atrás
pai
commit
3e5c6a1647

+ 3 - 5
src/main/java/com/persagy/apm/energy/report/monthly/config/type/service/impl/ReportTypeServiceImpl.java

@@ -238,16 +238,14 @@ public class ReportTypeServiceImpl extends ServiceImpl<ReportTypeMapper, ReportT
                         reportTypes, availableBelongIds);
                 listItemVOList.addAll(voList);
             }
-            List<PartitionVO> availableAreas = saasWebService.getAvailableAreas(buildingType.getKey());
-            if (!CollectionUtils.isEmpty(availableAreas)) {
-                List<String> availableBelongIds = availableAreas.stream().map(
-                        PartitionVO::getAreaId).collect(Collectors.toList());
+            List<String> availableAreaIds = saasWebService.getAvailableAreaIds(buildingType.getKey());
+            if (!CollectionUtils.isEmpty(availableAreaIds)) {
                 QueryReportTypeDTO queryReportTypeDTO = new QueryReportTypeDTO();
                 queryReportTypeDTO.setBelongType(BelongTypeEnum.AREA.getType());
                 queryReportTypeDTO.setBusinessType(buildingType.getKey());
                 List<ReportType> reportTypes = queryReportTypeList(queryReportTypeDTO);
                 List<ResponseReportTypeListItemVO> voList = packageReportTypeListItemVOList(
-                        reportTypes, availableBelongIds);
+                        reportTypes, availableAreaIds);
                 listItemVOList.addAll(voList);
             }
         }

+ 1 - 0
src/main/java/com/persagy/apm/energy/report/monthly/outline/service/impl/ReportOutlineServiceImpl.java

@@ -334,6 +334,7 @@ public class ReportOutlineServiceImpl extends ServiceImpl<ReportOutlineMapper, R
             }
         }
 
+        // 查询当前用户可用的报告类型
         IPage<ResponseReportTypeListItemVO> availableReportTypes = reportTypeService.queryAvailableReportTypes();
         if (availableReportTypes != null) {
             List<ResponseReportTypeListItemVO> records = availableReportTypes.getRecords();

+ 10 - 0
src/main/java/com/persagy/apm/energy/report/saasweb/service/ISaasWebService.java

@@ -198,6 +198,16 @@ public interface ISaasWebService {
     List<PartitionVO> getAvailableAreas(String buildingType);
 
     /**
+     * 根据业态获取用户可选的分区id
+     *
+     * @param buildingType 项目业态
+     * @return 用户可选的分区树
+     * @author lixing
+     * @version V1.0 2021/5/21 10:53 上午
+     */
+    List<String> getAvailableAreaIds(String buildingType);
+
+    /**
      * 获取可同比项目(开业时间在指定月份的上一年1月1日之前)
      *
      * @param projectIds 要筛选的项目集

+ 13 - 0
src/main/java/com/persagy/apm/energy/report/saasweb/service/impl/SaasWebServiceImpl.java

@@ -383,6 +383,19 @@ public class SaasWebServiceImpl implements ISaasWebService {
         return filterPartitionMap2Tree(filterPartitionMap);
     }
 
+    @Override
+    public List<String> getAvailableAreaIds(String buildingType) {
+        // 遍历用户所有可选分区树,标记分区父节点及分区拥有的项目
+        List<FilterPartitionVO> partitions = partitionProjectTree2FilterPartitionList();
+        // 筛选分区
+        Map<String, FilterPartitionVO> filterPartitionMap = filterPartitions(partitions, buildingType);
+        if (CollectionUtils.isEmpty(filterPartitionMap)) {
+            return Lists.newArrayList();
+        } else {
+            return Lists.newArrayList(filterPartitionMap.keySet());
+        }
+    }
+
 
     @Override
     public List<PartitionProjectVO> getAvailableProjectTree(String buildingType) {