|
@ -1,13 +1,37 @@ |
|
|
package com.lzbi.bi.service; |
|
|
package com.lzbi.bi.service; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import cn.hutool.core.util.ObjUtil; |
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.extension.service.IService; |
|
|
import com.baomidou.mybatisplus.extension.service.IService; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
import com.lzbi.asset.service.DcBaseAssetInfoService; |
|
|
import com.lzbi.bi.domain.DcBusiDataScreenDto; |
|
|
import com.lzbi.bi.domain.DcBusiDataScreenDto; |
|
|
import com.lzbi.bi.domain.DcBusiDataScreenVo; |
|
|
import com.lzbi.bi.domain.DcBusiDataScreenVo; |
|
|
|
|
|
import com.lzbi.bi.domain.SysDeptLocation; |
|
|
import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; |
|
|
import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; |
|
|
|
|
|
import com.lzbi.common.constant.BizConstants; |
|
|
|
|
|
import com.lzbi.common.core.domain.entity.SysDept; |
|
|
|
|
|
import com.lzbi.common.enums.ReportNameEnum; |
|
|
|
|
|
import com.lzbi.common.utils.StringUtils; |
|
|
|
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; |
|
|
|
|
|
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; |
|
|
|
|
|
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; |
|
|
|
|
|
import com.lzbi.system.service.ISysDeptService; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.util.Comparator; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import static java.util.stream.Collectors.groupingBy; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 资产指标调整单;(dc_busi_target_adjust)表服务接口 |
|
|
* 资产指标调整单;(dc_busi_target_adjust)表服务接口 |
|
@ -17,6 +41,13 @@ import java.util.List; |
|
|
@Service |
|
|
@Service |
|
|
public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMainMapper, DcBusiDataScreenDto> implements IService<DcBusiDataScreenDto> { |
|
|
public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMainMapper, DcBusiDataScreenDto> implements IService<DcBusiDataScreenDto> { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private SysDeptLocationService sysDeptLocationService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ISysDeptService iSysDeptService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService; |
|
|
|
|
|
|
|
|
public List<DcBusiDataScreenVo> selectCoalLostByDate(String qdate){ |
|
|
public List<DcBusiDataScreenVo> selectCoalLostByDate(String qdate){ |
|
|
return baseMapper.selectCoalLostByDate(qdate); |
|
|
return baseMapper.selectCoalLostByDate(qdate); |
|
|
} |
|
|
} |
|
@ -35,9 +66,242 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai |
|
|
public List<DcBusiDataScreenVo> selectDataWaterLostStationAll(String qdate){ |
|
|
public List<DcBusiDataScreenVo> selectDataWaterLostStationAll(String qdate){ |
|
|
return baseMapper.selectDataWaterLostStationAll(qdate); |
|
|
return baseMapper.selectDataWaterLostStationAll(qdate); |
|
|
} |
|
|
} |
|
|
public List<DcBusiDataScreenVo> selectPowerAll(String qdate){ |
|
|
public JSONObject selectPowerAll(TargetDraftDaynewReqVo vo){ |
|
|
return baseMapper.selectPowerAll(qdate); |
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.TOTAL_GENERATING_CAPACITY.getName(), ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()).collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("0").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList())); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray list=new JSONArray(); |
|
|
|
|
|
targetDraftDaynewResVos.forEach(item->{ |
|
|
|
|
|
JSONObject jsb=new JSONObject(); |
|
|
|
|
|
jsb.put("name",item.getReportName()); |
|
|
|
|
|
jsb.put("value", item.getValueResult().toString()); |
|
|
|
|
|
jsb.put("unit",item.getTargetUnit()); |
|
|
|
|
|
list.add(jsb); |
|
|
|
|
|
}); |
|
|
|
|
|
ret.put("source",list); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
public JSONObject getSquareInfoCompany(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.NET_AREA.getName(), ReportNameEnum.NETWORK_AREA.getName()).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray product=new JSONArray(); |
|
|
|
|
|
JSONArray realcost=new JSONArray(); |
|
|
|
|
|
JSONArray realcost_2=new JSONArray(); |
|
|
|
|
|
product.add("real_name"); |
|
|
|
|
|
realcost.add(ReportNameEnum.NET_AREA.getName()); |
|
|
|
|
|
realcost_2.add(ReportNameEnum.NETWORK_AREA.getName()); |
|
|
|
|
|
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName)); |
|
|
|
|
|
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList())); |
|
|
|
|
|
for (int i = 1; i < product.size(); i++) { |
|
|
|
|
|
int finalI = i; |
|
|
|
|
|
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.NET_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.NETWORK_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray list=new JSONArray(); |
|
|
|
|
|
list.add(product); |
|
|
|
|
|
list.add(realcost); |
|
|
|
|
|
list.add(realcost_2); |
|
|
|
|
|
ret.put("source",list); |
|
|
|
|
|
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit()); |
|
|
|
|
|
ret.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NET_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add)); |
|
|
|
|
|
ret.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NETWORK_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add)); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getSquareInfoGroup(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.NET_AREA.getName(), ReportNameEnum.NETWORK_AREA.getName()).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray inCircle=new JSONArray(); |
|
|
|
|
|
JSONArray outCircle=new JSONArray(); |
|
|
|
|
|
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NET_AREA.getName().equals(x.getReportName())).forEach(x->{ |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("name", x.getOrganizeName()); |
|
|
|
|
|
jo.put("unit", x.getTargetUnit()); |
|
|
|
|
|
jo.put("value", x.getValueResult()); |
|
|
|
|
|
inCircle.add(jo); |
|
|
|
|
|
}); |
|
|
|
|
|
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NETWORK_AREA.getName().equals(x.getReportName())).forEach(x->{ |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("name", x.getOrganizeName()); |
|
|
|
|
|
jo.put("unit", x.getTargetUnit()); |
|
|
|
|
|
jo.put("value", x.getValueResult()); |
|
|
|
|
|
outCircle.add(jo); |
|
|
|
|
|
});; |
|
|
|
|
|
ret.put("inCircle",inCircle); |
|
|
|
|
|
ret.put("outCircle",outCircle); |
|
|
|
|
|
JSONObject allJo=new JSONObject(); |
|
|
|
|
|
allJo.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit()); |
|
|
|
|
|
allJo.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NET_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add)); |
|
|
|
|
|
allJo.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NETWORK_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add)); |
|
|
|
|
|
ret.put("all", allJo); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getCoalLostRate(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.COAL_CONSUMPTION.getName(), ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray product=new JSONArray(); |
|
|
|
|
|
JSONArray realcost=new JSONArray(); |
|
|
|
|
|
JSONArray realcost_2=new JSONArray(); |
|
|
|
|
|
product.add("name"); |
|
|
|
|
|
realcost.add(ReportNameEnum.COAL_CONSUMPTION.getName()); |
|
|
|
|
|
realcost_2.add(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()); |
|
|
|
|
|
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName)); |
|
|
|
|
|
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList())); |
|
|
|
|
|
for (int i = 1; i < product.size(); i++) { |
|
|
|
|
|
int finalI = i; |
|
|
|
|
|
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.COAL_CONSUMPTION.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray list=new JSONArray(); |
|
|
|
|
|
list.add(product); |
|
|
|
|
|
list.add(realcost); |
|
|
|
|
|
list.add(realcost_2); |
|
|
|
|
|
ret.put("source",list); |
|
|
|
|
|
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit()); |
|
|
|
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getWaterInfo(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName(), ReportNameEnum.SECOND_NETWORK_WATER_CONSUMPTION_RATE.getName(), |
|
|
|
|
|
ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName(), ReportNameEnum.DATANG_PRIMARY_NET_RECHARGE_WATER.getName()).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray list=new JSONArray(); |
|
|
|
|
|
targetDraftDaynewResVos.stream().collect(groupingBy(TargetDraftDaynewResVo::getOrganizeName)).entrySet().forEach(entry->{ |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("name", entry.getKey()); |
|
|
|
|
|
jo.put("field1", entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
jo.put("field2", entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.SECOND_NETWORK_WATER_CONSUMPTION_RATE.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
BigDecimal primary_net_recharge_water_value = entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult(); |
|
|
|
|
|
BigDecimal datang_primary_net_recharge_water_value = entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult(); |
|
|
|
|
|
primary_net_recharge_water_value = ObjUtil.isNotEmpty(primary_net_recharge_water_value)?primary_net_recharge_water_value:BigDecimal.ZERO; |
|
|
|
|
|
datang_primary_net_recharge_water_value = ObjUtil.isNotEmpty(datang_primary_net_recharge_water_value)?datang_primary_net_recharge_water_value:BigDecimal.ZERO; |
|
|
|
|
|
jo.put("field3", primary_net_recharge_water_value.add(datang_primary_net_recharge_water_value)); |
|
|
|
|
|
list.add(jo); |
|
|
|
|
|
}); |
|
|
|
|
|
ret.put("source",list); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getPowerLostRate(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName(), ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray product=new JSONArray(); |
|
|
|
|
|
JSONArray realcost=new JSONArray(); |
|
|
|
|
|
JSONArray realcost_2=new JSONArray(); |
|
|
|
|
|
product.add("name"); |
|
|
|
|
|
realcost.add(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName()); |
|
|
|
|
|
realcost_2.add(ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()); |
|
|
|
|
|
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName)); |
|
|
|
|
|
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList())); |
|
|
|
|
|
for (int i = 1; i < product.size(); i++) { |
|
|
|
|
|
int finalI = i; |
|
|
|
|
|
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
} |
|
|
|
|
|
JSONArray list=new JSONArray(); |
|
|
|
|
|
list.add(product); |
|
|
|
|
|
list.add(realcost); |
|
|
|
|
|
list.add(realcost_2); |
|
|
|
|
|
ret.put("source",list); |
|
|
|
|
|
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit()); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getMapInfo(TargetDraftDaynewReqVo vo){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
QueryWrapper<SysDeptLocation> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
queryWrapper.in("org_id", orgIds); |
|
|
|
|
|
List<SysDeptLocation> sysDeptLocations = sysDeptLocationService.list(queryWrapper); |
|
|
|
|
|
if (CollUtil.isEmpty(sysDeptLocations)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
orgIds = sysDeptLocations.stream().map(SysDeptLocation::getOrgId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
List<String> reportNames = Stream.of(ReportNameEnum.NET_AREA.getName(), ReportNameEnum.HEAT_RATE.getName(), ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName()).collect(Collectors.toList()); |
|
|
|
|
|
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); |
|
|
|
|
|
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); |
|
|
|
|
|
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
Map<String, List<TargetDraftDaynewResVo>> map = targetDraftDaynewResVos.stream().collect(groupingBy(TargetDraftDaynewResVo::getOrganizeId)); |
|
|
|
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
|
|
|
map.entrySet().forEach(entry->{ |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
JSONArray ja = new JSONArray(); |
|
|
|
|
|
List<TargetDraftDaynewResVo> list = entry.getValue(); |
|
|
|
|
|
SysDeptLocation sysDeptLocation = sysDeptLocations.stream().filter(x -> x.getOrgId().toString().equals(entry.getKey())).findFirst().orElse(new SysDeptLocation()); |
|
|
|
|
|
ja.add(sysDeptLocation.getLonValue()); |
|
|
|
|
|
ja.add(sysDeptLocation.getLatValue()); |
|
|
|
|
|
jo.put("value",ja); |
|
|
|
|
|
jo.put("name", list.get(0).getOrganizeName()); |
|
|
|
|
|
jo.put("value1", list.stream().filter(x->x.getReportName().equals(ReportNameEnum.NET_AREA.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
jo.put("value2", list.stream().filter(x->x.getReportName().equals(ReportNameEnum.HEAT_RATE.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
jo.put("value3", list.stream().filter(x->x.getReportName().equals(ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); |
|
|
|
|
|
jsonArray.add(jo); |
|
|
|
|
|
}); |
|
|
|
|
|
ret.put("source", jsonArray); |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public List<DcBusiDataScreenVo> selectSquareRealDetail(String qdate) { |
|
|
public List<DcBusiDataScreenVo> selectSquareRealDetail(String qdate) { |
|
|
return baseMapper.selectSquareRealDetail(qdate); |
|
|
return baseMapper.selectSquareRealDetail(qdate); |
|
|
} |
|
|
} |
|
|