|
@ -1,9 +1,11 @@ |
|
|
package com.lzbi.bi.service; |
|
|
package com.lzbi.bi.service; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.date.DatePattern; |
|
|
import cn.hutool.core.date.DatePattern; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjUtil; |
|
|
import cn.hutool.core.util.ObjUtil; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
@ -18,6 +20,7 @@ import com.lzbi.common.core.domain.entity.SysDept; |
|
|
import com.lzbi.common.enums.HeatingPeriodEnum; |
|
|
import com.lzbi.common.enums.HeatingPeriodEnum; |
|
|
import com.lzbi.common.enums.ReportNameEnum; |
|
|
import com.lzbi.common.enums.ReportNameEnum; |
|
|
import com.lzbi.common.utils.StringUtils; |
|
|
import com.lzbi.common.utils.StringUtils; |
|
|
|
|
|
import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo; |
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; |
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; |
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; |
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; |
|
|
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; |
|
|
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; |
|
@ -27,10 +30,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.Calendar; |
|
|
import java.util.*; |
|
|
import java.util.Comparator; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Stream; |
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
@ -315,8 +315,8 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
return baseMapper.selectSquareGroup(qdate); |
|
|
return baseMapper.selectSquareGroup(qdate); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<Map> getHeatingPeriodData(TargetDraftDaynewReqVo vo){ |
|
|
public List<TargetDraftDayRangeResVo> getHeatingPeriodData(TargetDraftDaynewReqVo vo){ |
|
|
List<Map> res = Lists.newArrayList(); |
|
|
List<TargetDraftDayRangeResVo> res = Lists.newArrayList(); |
|
|
if (!HeatingPeriodEnum.HEATING_ALL_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) { |
|
|
if (!HeatingPeriodEnum.HEATING_ALL_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) { |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
@ -332,7 +332,26 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
} |
|
|
} |
|
|
vo.setBeginDate(StringUtils.join(dateYear, "1101")).setAssetType("0").setAssetLevel("10").setOrgIds(orgIds) |
|
|
vo.setBeginDate(StringUtils.join(dateYear, "1101")).setAssetType("0").setAssetLevel("10").setOrgIds(orgIds) |
|
|
.setEndDate(StringUtils.join(vo.getDateYear(),vo.getDateMonth(),vo.getDateDay())); |
|
|
.setEndDate(StringUtils.join(vo.getDateYear(),vo.getDateMonth(),vo.getDateDay())); |
|
|
res = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewRangeList(vo); |
|
|
List<TargetDraftDayRangeResVo> list = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewRangeList(vo); |
|
|
|
|
|
List<SysDept> depts = sysDepts.stream().filter(x -> list.stream().map(TargetDraftDayRangeResVo::getCname).distinct().collect(Collectors.toList()).contains(x.getDeptName())).collect(Collectors.toList()); |
|
|
|
|
|
List<TargetDraftDayRangeResVo> totalList = Lists.newArrayList(); |
|
|
|
|
|
list.stream().collect(groupingBy(TargetDraftDayRangeResVo::getCdate)).entrySet().forEach(entry->{ |
|
|
|
|
|
depts.forEach(dept->{ |
|
|
|
|
|
TargetDraftDayRangeResVo dayVo = entry.getValue().stream().filter(x -> x.getCname().equals(dept.getDeptName())).findFirst().orElse(null); |
|
|
|
|
|
if (ObjectUtil.isNull(dayVo)) { |
|
|
|
|
|
totalList.add(TargetDraftDayRangeResVo.builder().cdate(entry.getKey()).cname(dept.getDeptName()).valueResult(BigDecimal.ZERO).build()); |
|
|
|
|
|
} else { |
|
|
|
|
|
totalList.add(dayVo); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
totalList.stream().collect(groupingBy(TargetDraftDayRangeResVo::getCdate)).entrySet().forEach(entry->{ |
|
|
|
|
|
res.add(TargetDraftDayRangeResVo.builder().cdate(entry.getKey()) |
|
|
|
|
|
.cut(CollectionUtil.join(entry.getValue().stream().map(TargetDraftDayRangeResVo::getValueResult).collect(Collectors.toList()), ",")) |
|
|
|
|
|
.cname(CollectionUtil.join(entry.getValue().stream().map(TargetDraftDayRangeResVo::getCname).collect(Collectors.toList()), ",")) |
|
|
|
|
|
.build()); |
|
|
|
|
|
}); |
|
|
|
|
|
res.sort(Comparator.comparing(TargetDraftDayRangeResVo::getCdate)); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |