|
|
@ -25,6 +25,7 @@ import com.lzbi.common.utils.bean.BeanUtils; |
|
|
|
import com.lzbi.draft.domain.vo.*; |
|
|
|
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; |
|
|
|
import com.lzbi.system.service.ISysDeptService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
@ -45,6 +46,7 @@ import static java.util.stream.Collectors.groupingBy; |
|
|
|
* @author : zhousq |
|
|
|
* @date : 2023-11-16 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMainMapper, DcBusiDataScreenDto> implements IService<DcBusiDataScreenDto> { |
|
|
|
|
|
|
@ -56,6 +58,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService; |
|
|
|
// @Resource
|
|
|
|
// private ScreenMockDataMapper baseMapper;
|
|
|
|
|
|
|
|
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|
|
|
/** |
|
|
|
* 供暖起始日期--月日 |
|
|
@ -310,21 +313,22 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
|
List<SomeReportDataRankingVO> result = new ArrayList<>(); |
|
|
|
this.buildChildrenOrgReportDataReq(reportDataReq); |
|
|
|
this.buildHeatingDate(reportDataReq); |
|
|
|
List<MultiOrgSomeReportEverydayData> multiOrgSomeReportEverydayDataList = baseMapper.selectChildOrgSomeReportEverydayDataList(reportDataReq); |
|
|
|
if (!CollectionUtils.isEmpty(multiOrgSomeReportEverydayDataList)) { |
|
|
|
List<MultiOrgSomeReportEverydayData> data = baseMapper.selectChildOrgSomeReportEverydayDataList(reportDataReq); |
|
|
|
log.info("排名数据:{}", JSONArray.toJSONString(data)); |
|
|
|
if (!CollectionUtils.isEmpty(data)) { |
|
|
|
// 排序后的日期列表
|
|
|
|
List<String> dateSoredList = multiOrgSomeReportEverydayDataList.stream().map(MultiOrgSomeReportEverydayData::getDate).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList()); |
|
|
|
List<String> dateSoredList = data.stream().map(MultiOrgSomeReportEverydayData::getDate).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList()); |
|
|
|
// 排序后的组织id列表
|
|
|
|
List<Long> orgIdSoredList = multiOrgSomeReportEverydayDataList.stream().map(MultiOrgSomeReportEverydayData::getOrgId).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList()); |
|
|
|
List<Long> orgIdSoredList = data.stream().map(MultiOrgSomeReportEverydayData::getOrgId).collect(Collectors.toSet()).stream().sorted().collect(Collectors.toList()); |
|
|
|
// 组织map
|
|
|
|
Map<Long, String> orgMap = multiOrgSomeReportEverydayDataList.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, MultiOrgSomeReportEverydayData::getOrgName, (v1, v2) -> v2)); |
|
|
|
Map<Long, String> orgMap = data.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, MultiOrgSomeReportEverydayData::getOrgName, (v1, v2) -> v2)); |
|
|
|
// 按日期分组的map
|
|
|
|
Map<String, List<MultiOrgSomeReportEverydayData>> groupDateMap = multiOrgSomeReportEverydayDataList.stream().collect(groupingBy(MultiOrgSomeReportEverydayData::getDate)); |
|
|
|
Map<String, List<MultiOrgSomeReportEverydayData>> groupDateMap = data.stream().collect(groupingBy(MultiOrgSomeReportEverydayData::getDate)); |
|
|
|
dateSoredList.forEach(date -> { |
|
|
|
SomeReportDataRankingVO someReportDataRankingVO = new SomeReportDataRankingVO(); |
|
|
|
someReportDataRankingVO.setCdate(date); |
|
|
|
List<MultiOrgSomeReportEverydayData> data = groupDateMap.get(date); |
|
|
|
Map<Long, MultiOrgSomeReportEverydayData> orgIdMap = data.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, item -> item, (v1, v2) -> v1)); |
|
|
|
List<MultiOrgSomeReportEverydayData> dateData = groupDateMap.get(date); |
|
|
|
Map<Long, MultiOrgSomeReportEverydayData> orgIdMap = dateData.stream().collect(Collectors.toMap(MultiOrgSomeReportEverydayData::getOrgId, item -> item, (v1, v2) -> v1)); |
|
|
|
List<String> orgNameList = new ArrayList<>(); |
|
|
|
List<BigDecimal> valueList = new ArrayList<>(); |
|
|
|
orgIdSoredList.forEach(orgId -> { |
|
|
|