|
|
@ -20,6 +20,7 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
@ -44,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -144,9 +142,27 @@ public class IcStatsResiWarnServiceImpl extends BaseServiceImpl<IcStatsResiWarnD |
|
|
|
p.setConfigId(c.getWarnConfigId()); |
|
|
|
list.add(p); |
|
|
|
}); |
|
|
|
List<PersonWarnLeftPieDTO> dtos = baseDao.selectCategoryCount(configList.stream().map(m -> m.getWarnConfigId()).collect(Collectors.toList()), staffInfo.getAgencyId()); |
|
|
|
if (CollectionUtils.isNotEmpty(dtos)){ |
|
|
|
list.forEach(l -> dtos.stream().filter(d -> d.getConfigId().equals(l.getConfigId())).forEach(d -> l.setTypeCount(d.getCount()))); |
|
|
|
// List<PersonWarnLeftPieDTO> dtos = baseDao.selectCategoryCount(configList.stream().map(m -> m.getWarnConfigId()).collect(Collectors.toList()), staffInfo.getAgencyId());
|
|
|
|
List<String> columns = configList.stream().map(m -> m.getColumnName()).collect(Collectors.toList()); |
|
|
|
List<Map<String, String>> maps = baseDao.selectCategoryCountByColumn(columns, staffInfo.getAgencyId()); |
|
|
|
// if (CollectionUtils.isNotEmpty(dtos)){
|
|
|
|
// list.forEach(l -> dtos.stream().filter(d -> d.getConfigId().equals(l.getConfigId())).forEach(d -> l.setTypeCount(d.getCount())));
|
|
|
|
// }
|
|
|
|
Map<String,Integer> columnCount = new HashMap<>(16); |
|
|
|
if (CollectionUtils.isNotEmpty(maps)){ |
|
|
|
columns.forEach(c -> { |
|
|
|
Map<String, List<Map<String, String>>> groupByColumn = maps.stream().collect(Collectors.groupingBy((Map<String, String> m) -> m.get(c))); |
|
|
|
columnCount.put(c,CollectionUtils.isNotEmpty(groupByColumn.get(NumConstant.ONE_STR)) ? groupByColumn.get(NumConstant.ONE_STR).size() : NumConstant.ZERO); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(columnCount)){ |
|
|
|
list.forEach(l -> { |
|
|
|
columnCount.forEach((k,v) -> { |
|
|
|
if (l.getTypeCode().equals(k)){ |
|
|
|
l.setTypeCount(v); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
result.setTotal(list.stream().collect(Collectors.summingInt(PersonWarnLeftPieResultDTO.PersonWarnLeftPie::getTypeCount))); |
|
|
|
result.setList(list); |
|
|
|