Browse Source

jiahan.wu[CR] bi大屏集团

develop
eric777 10 months ago
parent
commit
5cde0481db
  1. 4
      lzbi-module/src/main/java/com/lzbi/bi/domain/UserIOverViewVO.java
  2. 31
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java

4
lzbi-module/src/main/java/com/lzbi/bi/domain/UserIOverViewVO.java

@ -1,8 +1,10 @@
package com.lzbi.bi.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
@ -10,8 +12,10 @@ import java.math.BigDecimal;
* 用户总览结果
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class UserIOverViewVO {
/**

31
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java

@ -7,7 +7,6 @@ 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.impl.ServiceImpl;
import com.lzbi.asset.service.DcBaseAssetInfoService;
import com.lzbi.bi.domain.DcBusiDataScreenDto;
import com.lzbi.bi.domain.DcBusiDataScreenVo;
import com.lzbi.bi.domain.SysDeptLocation;
@ -15,7 +14,6 @@ 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;
@ -27,7 +25,6 @@ import java.math.BigDecimal;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -91,7 +88,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
if (CollUtil.isEmpty(sysDepts)) {
return ret;
}
List<String> reportNames = Stream.of(ReportNameEnum.NET_AREA.getName(), ReportNameEnum.NETWORK_AREA.getName()).collect(Collectors.toList());
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_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);
@ -102,14 +99,14 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
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());
realcost.add(ReportNameEnum.OPENING_AREA.getName());
realcost_2.add(ReportNameEnum.HEATING_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());
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.OPENING_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.HEATING_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
}
JSONArray list=new JSONArray();
list.add(product);
@ -117,8 +114,8 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
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));
ret.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
ret.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
return ret;
}
@ -128,7 +125,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
if (CollUtil.isEmpty(sysDepts)) {
return ret;
}
List<String> reportNames = Stream.of(ReportNameEnum.NET_AREA.getName(), ReportNameEnum.NETWORK_AREA.getName()).collect(Collectors.toList());
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_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);
@ -137,14 +134,14 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
}
JSONArray inCircle=new JSONArray();
JSONArray outCircle=new JSONArray();
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.NET_AREA.getName().equals(x.getReportName())).forEach(x->{
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_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->{
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).forEach(x->{
JSONObject jo = new JSONObject();
jo.put("name", x.getOrganizeName());
jo.put("unit", x.getTargetUnit());
@ -155,8 +152,8 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
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));
allJo.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
allJo.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
ret.put("all", allJo);
return ret;
}
@ -276,7 +273,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
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());
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_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)) {
@ -293,7 +290,7 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
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("value1", list.stream().filter(x->x.getReportName().equals(ReportNameEnum.OPENING_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);

Loading…
Cancel
Save