|
|
@ -2,6 +2,7 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -194,6 +196,18 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
List<IcResiCategoryStatsConfigDTO> icResiCategoryStatsConfigDTOList = statsResult.getData(); |
|
|
|
//获取tableName 和columnName
|
|
|
|
List<IcStatsResiResultDTO> result = new ArrayList<>(); |
|
|
|
//tableName List<columnName>
|
|
|
|
Map<String,List<String>> paramMap = new HashMap<>(); |
|
|
|
icResiCategoryStatsConfigDTOList.forEach(config->{ |
|
|
|
List<String> list = paramMap.getOrDefault(config.getTableName(), new ArrayList<>()); |
|
|
|
list.add(config.getColumnName()); |
|
|
|
paramMap.put(config.getTableName(),list); |
|
|
|
}); |
|
|
|
Map<String,Map<String, BigDecimal>> tableColumnCountMap = new HashMap<>(); |
|
|
|
paramMap.forEach((tableName,columnList) ->{ |
|
|
|
Map<String, BigDecimal> countMap = icResiUserDao.getDataAnalyseCount(customerId,tableName,columnList, id,level); |
|
|
|
tableColumnCountMap.put(tableName,countMap); |
|
|
|
}); |
|
|
|
icResiCategoryStatsConfigDTOList.forEach(item->{ |
|
|
|
IcStatsResiResultDTO resultDTO = new IcStatsResiResultDTO(); |
|
|
|
resultDTO.setId(item.getId()); |
|
|
@ -202,8 +216,9 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
resultDTO.setHouseShowIcon(item.getHouseShowIcon()); |
|
|
|
resultDTO.setManagementIcon(item.getManagementIcon()); |
|
|
|
//根据id ,level 获取count
|
|
|
|
Integer count = icStatsResiWarnDao.countListByLevelAndCol(customerId,item.getTableName(),item.getColumnName(),id,level); |
|
|
|
resultDTO.setCount(count); |
|
|
|
//Integer count = icStatsResiWarnDao.countListByLevelAndCol(customerId,item.getTableName(),item.getColumnName(),id,level);
|
|
|
|
Map<String, BigDecimal> orDefault = tableColumnCountMap.getOrDefault(item.getTableName(), new HashMap<>()); |
|
|
|
resultDTO.setCount(orDefault.getOrDefault(item.getColumnName(), NumConstant.ZERO_DECIMAL).intValue()); |
|
|
|
result.add(resultDTO); |
|
|
|
}); |
|
|
|
return result; |
|
|
|