From c58f242c7bc9cb2b293940b49a4815e9176f85f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E6=9C=A8c?= <857448963@qq.com> Date: Fri, 1 Dec 2023 10:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../njcn}/harmonic/pojo/dto/LineDataDto.java | 2 +- .../harmonic/pojo/po/dim/RDimBusGlobalD.java | 2 - .../harmonic/pojo/po/dim/RDimBusGlobalM.java | 5 +- .../harmonic/pojo/po/dim/RDimObjGlobalD.java | 2 +- .../harmonic/pojo/po/dim/RDimObjGlobalM.java | 7 +- .../harmonic/pojo/po/dim/RDimObjGlobalY.java | 8 +- .../harmonic/pojo/vo/DimGlobalDataVO.java | 8 + .../dim/DimGlobalDealController.java | 4 +- .../mapper/dim/RDimVoltageDMapper.java | 23 + .../mapper/dim/RDimVoltageMMapper.java | 16 + .../mapper/dim/RDimVoltageYMapper.java | 16 + .../service/dim/DimGlobalDealService.java | 2 +- .../dim/impl/DimGlobalDealServiceImpl.java | 2807 +++++++++++------ .../mapper/mysql/dim/RDimVoltageDMapper.java | 2 +- .../mysql/dim/mapping/RDimVoltageDMapper.xml | 2 +- .../dim/impl/RDimVoltageDServiceImpl.java | 2 +- .../com/njcn/system/enums/DicDataEnum.java | 3 +- 17 files changed, 1973 insertions(+), 938 deletions(-) rename {pqs-prepare/prepare-api/src/main/java/com/njcn/prepare => pqs-harmonic/harmonic-api/src/main/java/com/njcn}/harmonic/pojo/dto/LineDataDto.java (97%) create mode 100644 pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageDMapper.java create mode 100644 pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageMMapper.java create mode 100644 pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageYMapper.java diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/dto/LineDataDto.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/dto/LineDataDto.java similarity index 97% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/dto/LineDataDto.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/dto/LineDataDto.java index 3a10d1bca..d4b77d227 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/dto/LineDataDto.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/dto/LineDataDto.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.dto; +package com.njcn.harmonic.pojo.dto; import lombok.Data; diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalD.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalD.java index 8cc260d48..e15b02b2a 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalD.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalD.java @@ -57,8 +57,6 @@ public class RDimBusGlobalD { private Float stationLimitAvgRate; - private Integer state; - } diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalM.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalM.java index 5a1dba0d2..f2e44a13a 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalM.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimBusGlobalM.java @@ -20,7 +20,7 @@ import lombok.Setter; @Getter @Setter @TableName("r_dim_bus_global_m") -public class RDimBusGlobalM extends BaseEntity { +public class RDimBusGlobalM{ private static final long serialVersionUID = 1L; @@ -37,9 +37,6 @@ public class RDimBusGlobalM extends BaseEntity { private Float stationLimitAvgRate; - private Integer state; - - } diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalD.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalD.java index 291b1de7d..2831b6099 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalD.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalD.java @@ -19,7 +19,7 @@ import java.time.LocalDate; @Getter @Setter @TableName("r_dim_obj_global_d") -public class RDimObjGlobalD extends BaseEntity { +public class RDimObjGlobalD { private static final long serialVersionUID = 1L; @MppMultiId(value = "Org_Id") diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalM.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalM.java index edce82ca6..a39418344 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalM.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalM.java @@ -20,7 +20,7 @@ import java.time.LocalDate; @Getter @Setter @TableName("r_dim_obj_global_m") -public class RDimObjGlobalM extends BaseEntity { +public class RDimObjGlobalM { private static final long serialVersionUID = 1L; @@ -35,11 +35,6 @@ public class RDimObjGlobalM extends BaseEntity { @MppMultiId(value = "Object_Type") private String objectType; -// -// /** -// * **源荷对象监测率(%) -// */ -// private Double monitorRate; /** * **源荷对象超标占比(%) diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalY.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalY.java index 545917355..9b8e4372c 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalY.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/dim/RDimObjGlobalY.java @@ -20,7 +20,7 @@ import java.time.LocalDate; @Getter @Setter @TableName("r_dim_obj_global_y") -public class RDimObjGlobalY extends BaseEntity { +public class RDimObjGlobalY { private static final long serialVersionUID = 1L; @@ -35,12 +35,6 @@ public class RDimObjGlobalY extends BaseEntity { @MppMultiId(value = "Object_Type") private String objectType; -// -// /** -// * **源荷对象监测率(%) -// */ -// private Double monitorRate; - /** * **源荷对象超标占比(%) */ diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/DimGlobalDataVO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/DimGlobalDataVO.java index 312780f03..342dcd63b 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/DimGlobalDataVO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/DimGlobalDataVO.java @@ -1,5 +1,6 @@ package com.njcn.harmonic.pojo.vo; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @@ -13,11 +14,18 @@ import java.math.BigDecimal; @Data public class DimGlobalDataVO { + @ApiModelProperty(name = "orgId",value = "单位code") private String orgId; + @ApiModelProperty(name = "orgName",value = "单位名称") private String orgName; + @ApiModelProperty(name = "type",value = "一类大类型,电压等级/源荷") private String type; + @ApiModelProperty(name = "secondType",value = "二类类型,稳态指标/暂态指标/") + private String secondType; + + @ApiModelProperty(name = "value",value = "单位code") private BigDecimal value; } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/dim/DimGlobalDealController.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/dim/DimGlobalDealController.java index f63be77d8..9fc40f738 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/dim/DimGlobalDealController.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/dim/DimGlobalDealController.java @@ -47,9 +47,9 @@ public class DimGlobalDealController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("pms电能质量指标综合") @ApiImplicitParam(name = "dimGlobalDataParam", value = "条件参数", required = true) - public HttpResult> dealGlobalData(@RequestBody @Validated DimGlobalDataParam dimGlobalDataParam){ + public HttpResult> dealGlobalData(@RequestBody @Validated DimGlobalDataParam dimGlobalDataParam){ String methodDescribe = getMethodDescribe("dealGlobalData"); - Page result = dimGlobalDealService.dealGlobalData(dimGlobalDataParam); + List result = dimGlobalDealService.dealGlobalData(dimGlobalDataParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageDMapper.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageDMapper.java new file mode 100644 index 000000000..039e9566d --- /dev/null +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageDMapper.java @@ -0,0 +1,23 @@ +package com.njcn.harmonic.mapper.dim; + +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.harmonic.pojo.dto.LineDataDto; +import com.njcn.harmonic.pojo.po.dim.RDimVoltageD; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Set; + +/** + *

+ * 母线不同电压等级指标数据-日表 Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-11-27 + */ +public interface RDimVoltageDMapper extends MppBaseMapper { + + List getLineData(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("collection") Set list); + +} diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageMMapper.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageMMapper.java new file mode 100644 index 000000000..0c10b83e0 --- /dev/null +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageMMapper.java @@ -0,0 +1,16 @@ +package com.njcn.harmonic.mapper.dim; + +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.harmonic.pojo.po.dim.RDimVoltageM; + +/** + *

+ * 区域母线**电压等级**指标标准差、平均值-月表 Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-11-29 + */ +public interface RDimVoltageMMapper extends MppBaseMapper { + +} diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageYMapper.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageYMapper.java new file mode 100644 index 000000000..efab566f4 --- /dev/null +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/dim/RDimVoltageYMapper.java @@ -0,0 +1,16 @@ +package com.njcn.harmonic.mapper.dim; + +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.harmonic.pojo.po.dim.RDimVoltageY; + +/** + *

+ * 区域母线**电压等级**指标标准差、平均值-年表 Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-11-29 + */ +public interface RDimVoltageYMapper extends MppBaseMapper { + +} diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/DimGlobalDealService.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/DimGlobalDealService.java index c1781235d..29e210fa1 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/DimGlobalDealService.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/DimGlobalDealService.java @@ -20,5 +20,5 @@ public interface DimGlobalDealService { * @author cdf * @date 2023/11/27 */ - public Page dealGlobalData(DimGlobalDataParam dimGlobalDataParam); + List dealGlobalData(DimGlobalDataParam dimGlobalDataParam); } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/impl/DimGlobalDealServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/impl/DimGlobalDealServiceImpl.java index 92002b6d3..794ba526f 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/impl/DimGlobalDealServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/dim/impl/DimGlobalDealServiceImpl.java @@ -3,16 +3,19 @@ package com.njcn.harmonic.service.dim.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.harmonic.mapper.dim.*; import com.njcn.harmonic.pojo.param.DimGlobalDataParam; import com.njcn.harmonic.pojo.po.dim.*; import com.njcn.harmonic.pojo.vo.DimGlobalDataVO; import com.njcn.harmonic.service.dim.DimGlobalDealService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataEnum; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.pojo.po.Dic; +import com.njcn.system.pojo.po.DictData; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.po.Dept; -import com.njcn.web.factory.PageFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -35,6 +38,7 @@ import java.util.stream.Collectors; public class DimGlobalDealServiceImpl implements DimGlobalDealService { private final DeptFeignClient deptFeignClient; + private final DicDataFeignClient dicDataFeignClient; private final RDimBusGlobalDMapper rDimBusGlobalDMapper; private final RDimBusGlobalMMapper rDimBusGlobalMMapper; @@ -73,14 +77,24 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { private final RDimObjTargetMMapper rDimObjTargetMMapper; private final RDimObjTargetDMapper rDimObjTargetDMapper; + private final RDimObjEventYMapper rDimObjEventYMapper; + private final RDimObjEventMMapper rDimObjEventMMapper; + private final RDimObjEventDMapper rDimObjEventDMapper; + + + private final RDimVoltageYMapper rDimVoltageYMapper; + private final RDimVoltageMMapper rDimVoltageMMapper; + private final RDimVoltageDMapper rDimVoltageDMapper; + @Override - public Page dealGlobalData(DimGlobalDataParam dimGlobalDataParam) { - Page resultPage = new Page<>(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)); + public List dealGlobalData(DimGlobalDataParam dimGlobalDataParam) { List resultList = new ArrayList<>(); Dept dept = deptFeignClient.getDeptByCode(dimGlobalDataParam.getOrgId()).getData(); - List deptList = deptFeignClient.getDirectSonSelf(dept.getId()).getData(); - List deptCodeIds = deptList.stream().map(Dept::getCode).collect(Collectors.toList()); + List deptList = deptFeignClient.getDepSonDetailByDeptId(dept.getId()).getData(); + List deptCodeIds = deptList.stream().map(DeptDTO::getCode).collect(Collectors.toList()); + List dicList = new ArrayList<>(); + List dicSecondList = new ArrayList<>(); switch (dimGlobalDataParam.getType()) { case 1: @@ -90,12 +104,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimMonitorRateY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateY::getOrgId, deptCodeIds); - Page yPage = rDimMonitorRateYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimMonitorRateYMapper.selectList(lambdaQueryWrapperY); if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimMonitorRateY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -107,7 +119,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgId(d.getCode()); @@ -120,13 +132,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimMonitorRateM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateM::getOrgId, deptCodeIds); - Page mPage = rDimMonitorRateMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); - + List mList = rDimMonitorRateMMapper.selectList(lambdaQueryWrapperM); if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimMonitorRateM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -138,7 +147,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -151,13 +160,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimMonitorRateD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateD::getOrgId, deptCodeIds); - Page dPage = rDimMonitorRateDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); - + List dList = rDimMonitorRateDMapper.selectList(lambdaQueryWrapperD); if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimMonitorRateD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -169,7 +175,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -187,13 +193,12 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimMonitorRateY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateY::getOrgId, deptCodeIds); - Page yPage = rDimMonitorRateYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimMonitorRateYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimMonitorRateY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -205,7 +210,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -218,12 +223,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimMonitorRateM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateM::getOrgId, deptCodeIds); - Page mPage = rDimMonitorRateMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimMonitorRateMMapper.selectList(lambdaQueryWrapperM); if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimMonitorRateM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -235,7 +238,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -248,12 +251,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimMonitorRateD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimMonitorRateD::getOrgId, deptCodeIds); - Page dPage = rDimMonitorRateDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimMonitorRateDMapper.selectList(lambdaQueryWrapperD); if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimMonitorRateD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -265,7 +266,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -283,12 +284,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusGlobalY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalY::getOrgId, deptCodeIds); - Page yPage = rDimBusGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimBusGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimBusGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -300,7 +300,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -313,12 +313,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalM::getOrgId, deptCodeIds); - Page mPage = rDimBusGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimBusGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimBusGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -330,7 +329,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -343,12 +342,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalD::getOrgId, deptCodeIds); - Page dPage = rDimBusGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimBusGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimBusGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -360,7 +358,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -378,12 +376,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusGlobalY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalY::getOrgId, deptCodeIds); - Page yPage = rDimBusGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimBusGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimBusGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -395,7 +392,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -408,12 +405,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalM::getOrgId, deptCodeIds); - Page mPage = rDimBusGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimBusGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimBusGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -425,7 +421,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -438,12 +434,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalD::getOrgId, deptCodeIds); - Page dPage = rDimBusGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimBusGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimBusGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -455,7 +450,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -473,12 +468,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusGlobalY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalY::getOrgId, deptCodeIds); - Page yPage = rDimBusGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimBusGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimBusGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -490,7 +484,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -503,12 +497,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalM::getOrgId, deptCodeIds); - Page mPage = rDimBusGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimBusGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimBusGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -520,7 +513,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -533,12 +526,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalD::getOrgId, deptCodeIds); - Page dPage = rDimBusGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimBusGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimBusGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -550,7 +542,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -568,12 +560,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusGlobalY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalY::getOrgId, deptCodeIds); - Page yPage = rDimBusGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimBusGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimBusGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -585,7 +576,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -598,12 +589,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalM::getOrgId, deptCodeIds); - Page mPage = rDimBusGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimBusGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimBusGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -615,7 +605,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -628,12 +618,11 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusGlobalD::getOrgId, deptCodeIds); - Page dPage = rDimBusGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimBusGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimBusGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); @@ -645,7 +634,7 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -659,96 +648,128 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { case 7: //母线**指标超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusTargetYPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetYPO::getOrgId, deptCodeIds).eq(RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimBusTargetYPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .in(RDimBusTargetYPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimBusTargetYPOMapper.selectList(lambdaQueryWrapperY); if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimBusTargetYPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setSecondType(dictData.getId()); + String mapKey = d.getCode()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); + } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 3: LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusTargetMPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetMPO::getOrgId, deptCodeIds).eq(RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimBusTargetMPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .in(RDimBusTargetMPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimBusTargetMPOMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimBusTargetMPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 5: LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusTargetDPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetDPO::getOrgId, deptCodeIds).eq(RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimBusTargetDPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .in(RDimBusTargetDPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimBusTargetDPOMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimBusTargetDPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -756,96 +777,130 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 8: //母线**指标合格率(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusTargetYPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetYPO::getOrgId, deptCodeIds).eq(RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimBusTargetYPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .in(RDimBusTargetYPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimBusTargetYPOMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimBusTargetYPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 3: LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusTargetMPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetMPO::getOrgId, deptCodeIds).eq(RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimBusTargetMPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .in(RDimBusTargetMPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimBusTargetMPOMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimBusTargetMPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 5: LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusTargetDPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetDPO::getOrgId, deptCodeIds).eq(RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimBusTargetDPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .in(RDimBusTargetDPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimBusTargetDPOMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimBusTargetDPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -853,190 +908,258 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 9: //母线**指标平均超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusTargetYPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetYPO::getOrgId, deptCodeIds).eq(RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimBusTargetYPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .in(RDimBusTargetYPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimBusTargetYPOMapper.selectList(lambdaQueryWrapperY); if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimBusTargetYPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 3: LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusTargetMPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetMPO::getOrgId, deptCodeIds).eq(RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimBusTargetMPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .in(RDimBusTargetMPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimBusTargetMPOMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimBusTargetMPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; case 5: LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusTargetDPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetDPO::getOrgId, deptCodeIds).eq(RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimBusTargetDPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .in(RDimBusTargetDPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimBusTargetDPOMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimBusTargetDPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; } + break; case 10: //母线**指标平均合格率(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusTargetYPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetYPO::getOrgId, deptCodeIds).eq(RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimBusTargetYPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .in(RDimBusTargetYPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetYPO::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimBusTargetYPOMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimBusTargetYPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + dimGlobalDataVO.setSecondType(dictData.getId()); + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setSecondType(dictData.getId()); + resultList.add(dimGlobalDataVO); + } } } break; case 3: LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusTargetMPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetMPO::getOrgId, deptCodeIds).eq(RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimBusTargetMPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .in(RDimBusTargetMPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetMPO::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimBusTargetMPOMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimBusTargetMPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + dimGlobalDataVO.setSecondType(dictData.getId()); + + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setSecondType(dictData.getId()); + + resultList.add(dimGlobalDataVO); + } } } break; case 5: LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusTargetDPO::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimBusTargetDPO::getOrgId, deptCodeIds).eq(RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimBusTargetDPOMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .in(RDimBusTargetDPO::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimBusTargetDPO::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimBusTargetDPOMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimBusTargetDPO::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + dimGlobalDataVO.setSecondType(dictData.getId()); + + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setSecondType(dictData.getId()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -1046,36 +1169,67 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { case 11: //**kV变电站**指标超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.DY_DC_500kV.getCode()) || item.getCode().equals(DicDataEnum.DY_220KV.getCode()) || item.getCode().equals(DicDataEnum.DY_110KV.getCode()) || item.getCode().equals(DicDataEnum.DY_35KV.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + } + switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetY::getOrgId, deptCodeIds) - .eq(RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimStationTargetYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1083,31 +1237,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetM::getOrgId, deptCodeIds) - .eq(RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimStationTargetMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1115,31 +1282,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetD::getOrgId, deptCodeIds) - .eq(RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimStationTargetDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1147,36 +1327,67 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 12: //**kV变电站**指标合格率(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.DY_DC_500kV.getCode()) || item.getCode().equals(DicDataEnum.DY_220KV.getCode()) || item.getCode().equals(DicDataEnum.DY_110KV.getCode()) || item.getCode().equals(DicDataEnum.DY_35KV.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + } + switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetY::getOrgId, deptCodeIds) - .eq(RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimStationTargetYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1184,31 +1395,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetM::getOrgId, deptCodeIds) - .eq(RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) .eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimStationTargetMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1216,31 +1440,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetD::getOrgId, deptCodeIds) - .eq(RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimStationTargetDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getPassRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1248,36 +1485,68 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 13: //**kV变电站**指标平均超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.DY_DC_500kV.getCode()) || item.getCode().equals(DicDataEnum.DY_220KV.getCode()) || item.getCode().equals(DicDataEnum.DY_110KV.getCode()) || item.getCode().equals(DicDataEnum.DY_35KV.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + + } + switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetY::getOrgId, deptCodeIds) - .eq(RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimStationTargetYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1285,31 +1554,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetM::getOrgId, deptCodeIds) - .eq(RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimStationTargetMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1317,31 +1599,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetD::getOrgId, deptCodeIds) - .eq(RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimStationTargetDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1349,36 +1644,67 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 14: //**kV变电站**指标平均合格率(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.DY_DC_500kV.getCode()) || item.getCode().equals(DicDataEnum.DY_220KV.getCode()) || item.getCode().equals(DicDataEnum.DY_110KV.getCode()) || item.getCode().equals(DicDataEnum.DY_35KV.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.VOLTAGE_DEV.getCode()) || item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode())).collect(Collectors.toList()); + } + switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetY::getOrgId, deptCodeIds) - .eq(RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetY::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimStationTargetYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1386,31 +1712,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetM::getOrgId, deptCodeIds) - .eq(RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetM::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); + List mList = rDimStationTargetMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1418,31 +1757,44 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimStationTargetD::getOrgId, deptCodeIds) - .eq(RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) - .eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimStationTargetD::getVoltageLevel, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getTargetType()), RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); + List dList = rDimStationTargetDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getVoltageLevel() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+vlotage.getId()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData vlotage : dicList) { + for (DictData dictData : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(vlotage.getId()); + dimGlobalDataVO.setSecondType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -1456,24 +1808,23 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimBusStationEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusStationEventY::getOrgId, deptCodeIds); - Page yPage = rDimBusStationEventYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimBusStationEventYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { Map mapY = yList.stream().collect(Collectors.toMap(RDimBusStationEventY::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getStationLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1486,24 +1837,23 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); lambdaQueryWrapperM.eq(RDimBusStationEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusStationEventM::getOrgId, deptCodeIds); - Page mPage = rDimBusStationEventMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimBusStationEventMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimBusStationEventM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getStationLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1516,24 +1866,23 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); lambdaQueryWrapperD.eq(RDimBusStationEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimBusStationEventD::getOrgId, deptCodeIds); - Page dPage = rDimBusStationEventDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimBusStationEventDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { Map mapD = dList.stream().collect(Collectors.toMap(RDimBusStationEventD::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getStationLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1548,27 +1897,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { //变电站暂态指标发生频次(次/站) switch (dimGlobalDataParam.getDateType()) { case 1: - LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); - lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetY::getOrgId, deptCodeIds).eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimBusStationEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventY::getOrgId, deptCodeIds); + List yList = rDimBusStationEventYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapY = yList.stream().collect(Collectors.toMap(RDimBusStationEventY::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getStationFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1578,27 +1926,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 3: - LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); - lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetM::getOrgId, deptCodeIds).eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimBusStationEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventM::getOrgId, deptCodeIds); + List mList = rDimBusStationEventMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimBusStationEventM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getStationFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1608,27 +1955,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 5: - LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); - lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetD::getOrgId, deptCodeIds).eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimBusStationEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventD::getOrgId, deptCodeIds); + List dList = rDimBusStationEventDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimBusStationEventD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getStationFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1643,27 +1989,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { //监测到暂态指标的变电站母线占比(%) switch (dimGlobalDataParam.getDateType()) { case 1: - LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); - lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetY::getOrgId, deptCodeIds).eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimBusStationEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventY::getOrgId, deptCodeIds); + List yList = rDimBusStationEventYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapY = yList.stream().collect(Collectors.toMap(RDimBusStationEventY::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1673,27 +2018,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 3: - LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); - lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetM::getOrgId, deptCodeIds).eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimBusStationEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventM::getOrgId, deptCodeIds); + List mList = rDimBusStationEventMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimBusStationEventM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1703,27 +2047,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 5: - LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); - lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetD::getOrgId, deptCodeIds).eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimBusStationEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventD::getOrgId, deptCodeIds); + List dList = rDimBusStationEventDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimBusStationEventD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1738,27 +2081,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { //变电站母线暂态指标发生频次(次/线) switch (dimGlobalDataParam.getDateType()) { case 1: - LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); - lambdaQueryWrapperY.eq(RDimStationTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetY::getOrgId, deptCodeIds).eq(RDimStationTargetY::getTargetType, dimGlobalDataParam.getTargetType()); - Page yPage = rDimStationTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimBusStationEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventY::getOrgId, deptCodeIds); + List yList = rDimBusStationEventYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimStationTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapY = yList.stream().collect(Collectors.toMap(RDimBusStationEventY::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1768,27 +2110,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 3: - LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); - lambdaQueryWrapperM.eq(RDimStationTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetM::getOrgId, deptCodeIds).eq(RDimStationTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimStationTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimBusStationEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventM::getOrgId, deptCodeIds); + List mList = rDimBusStationEventMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimStationTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimBusStationEventM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1798,27 +2139,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 5: - LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); - lambdaQueryWrapperD.eq(RDimStationTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimStationTargetD::getOrgId, deptCodeIds).eq(RDimStationTargetD::getTargetType, dimGlobalDataParam.getTargetType()); - Page dPage = rDimStationTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimBusStationEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimBusStationEventD::getOrgId, deptCodeIds); + List dList = rDimBusStationEventDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimStationTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimBusStationEventD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getPassAvgRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitFreq()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -1832,6 +2172,14 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { case 19: //**源荷对象监测率(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); @@ -1839,29 +2187,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { .in(RDimObjRateY::getOrgId, deptCodeIds) .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjRateY::getObjType, dimGlobalDataParam.getMainType()) ; - Page yPage = rDimObjRateYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimObjRateYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimObjRateY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -1870,29 +2225,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperM.eq(RDimObjRateM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjRateM::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjRateM::getObjType, dimGlobalDataParam.getMainType()); - Page mPage = rDimObjRateMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimObjRateMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimObjRateM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -1901,29 +2263,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperD.eq(RDimObjRateD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjRateD::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjRateD::getObjType, dimGlobalDataParam.getMainType()); - Page dPage = rDimObjRateDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimObjRateDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimObjRateD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getObjMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -1931,6 +2300,14 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 20: //**源荷对象超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); @@ -1938,29 +2315,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { .in(RDimObjGlobalY::getOrgId, deptCodeIds) .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjGlobalY::getObjectType, dimGlobalDataParam.getMainType()) ; - Page yPage = rDimObjGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimObjGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimObjGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -1969,29 +2353,35 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperM.eq(RDimObjGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjGlobalM::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjGlobalM::getObjectType, dimGlobalDataParam.getMainType()); - Page mPage = rDimObjGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimObjGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimObjGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -2000,29 +2390,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperD.eq(RDimObjGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjGlobalD::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjGlobalD::getObjectType, dimGlobalDataParam.getMainType()); - Page dPage = rDimObjGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimObjGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimObjGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -2030,6 +2427,15 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { break; case 21: //**源荷对象平均超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } + switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); @@ -2037,29 +2443,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { .in(RDimObjGlobalY::getOrgId, deptCodeIds) .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjGlobalY::getObjectType, dimGlobalDataParam.getMainType()) ; - Page yPage = rDimObjGlobalYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + List yList = rDimObjGlobalYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimObjGlobalY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapY.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -2068,29 +2481,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperM.eq(RDimObjGlobalM::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjGlobalM::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjGlobalM::getObjectType, dimGlobalDataParam.getMainType()); - Page mPage = rDimObjGlobalMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimObjGlobalMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { - Map mapM = mList.stream().collect(Collectors.toMap(RDimObjGlobalM::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapM = mList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(dictData.getId()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -2099,29 +2519,36 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { lambdaQueryWrapperD.eq(RDimObjGlobalD::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjGlobalD::getOrgId, deptCodeIds) .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjGlobalD::getObjectType, dimGlobalDataParam.getMainType()); - Page dPage = rDimObjGlobalDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + List dList = rDimObjGlobalDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimObjGlobalD::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapD = dList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode() + dictData.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitAvgRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } } } break; @@ -2130,37 +2557,67 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { case 22: //**源荷对象**指标超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.HARMONIC_CURRENT.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode()) || item.getCode().equals(DicDataEnum.NEG_CURRENT.getCode())).collect(Collectors.toList()); + } switch (dimGlobalDataParam.getDateType()) { case 1: LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); lambdaQueryWrapperY.eq(RDimObjTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) .in(RDimObjTargetY::getOrgId, deptCodeIds) .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjTargetY::getObjectType, dimGlobalDataParam.getMainType()) - .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetY::getTargetType, dimGlobalDataParam.getTargetType()) - ; - Page yPage = rDimObjTargetYMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperY); - List yList = yPage.getRecords(); - resultPage.setTotal(yPage.getTotal()); + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimObjTargetYMapper.selectList(lambdaQueryWrapperY); + if (CollectionUtil.isNotEmpty(yList)) { - Map mapY = yList.stream().collect(Collectors.toMap(RDimObjTargetY::getOrgId, Function.identity())); - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - if (mapY.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); - } else { - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapY.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } } - resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { - DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); - dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); - dimGlobalDataVO.setOrgName(d.getName()); - dimGlobalDataVO.setOrgId(d.getCode()); - resultList.add(dimGlobalDataVO); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } } } break; @@ -2171,24 +2628,557 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetM::getObjectType, dimGlobalDataParam.getMainType()) .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetM::getTargetType, dimGlobalDataParam.getTargetType()); - Page mPage = rDimObjTargetMMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperM); - List mList = mPage.getRecords(); - resultPage.setTotal(mPage.getTotal()); + List mList = rDimObjTargetMMapper.selectList(lambdaQueryWrapperM); + if (CollectionUtil.isNotEmpty(mList)) { Map mapM = mList.stream().collect(Collectors.toMap(RDimObjTargetM::getOrgId, Function.identity())); - for (Dept d : deptList) { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + case 5: + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimObjTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetD::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetD::getObjectType, dimGlobalDataParam.getMainType()); + List dList = rDimObjTargetDMapper.selectList(lambdaQueryWrapperD); + + if (CollectionUtil.isNotEmpty(dList)) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimObjTargetD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + } + + break; + + case 23: + //**源荷对象**指标平均超标占比(%) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } + + if (StrUtil.isNotBlank(dimGlobalDataParam.getTargetType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getTargetType()).getData(); + dicSecondList.add(dictData); + } else { + //查询全部指标 + dicSecondList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData(); + dicSecondList = dicSecondList.stream().filter(item -> item.getCode().equals(DicDataEnum.THD_V.getCode()) || item.getCode().equals(DicDataEnum.HARMONIC_CURRENT.getCode()) || item.getCode().equals(DicDataEnum.phase_Voltage.getCode()) || item.getCode().equals(DicDataEnum.FLICKER.getCode()) || item.getCode().equals(DicDataEnum.NEG_CURRENT.getCode())).collect(Collectors.toList()); + } + switch (dimGlobalDataParam.getDateType()) { + case 1: + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimObjTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetY::getOrgId, deptCodeIds) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjTargetY::getObjectType, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimObjTargetYMapper.selectList(lambdaQueryWrapperY); + + if (CollectionUtil.isNotEmpty(yList)) { + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapY.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + case 3: + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimObjTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetM::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetM::getObjectType, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetM::getTargetType, dimGlobalDataParam.getTargetType()); + + List mList = rDimObjTargetMMapper.selectList(lambdaQueryWrapperM); + + if (CollectionUtil.isNotEmpty(mList)) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimObjTargetM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + case 5: + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimObjTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetD::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetD::getObjectType, dimGlobalDataParam.getMainType()); + List dList = rDimObjTargetDMapper.selectList(lambdaQueryWrapperD); + + if (CollectionUtil.isNotEmpty(dList)) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimObjTargetD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + } + + break; + + case 24: + //**源荷对象平均超标天数(天) + if (StrUtil.isNotBlank(dimGlobalDataParam.getMainType())) { + DictData dictData = dicDataFeignClient.getDicDataById(dimGlobalDataParam.getMainType()).getData(); + dicList.add(dictData); + } else { + //查询全部指标 + dicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); + dicList = dicList.stream().filter(item -> item.getCode().equals(DicDataEnum.TRACTION_STATION.getCode()) || item.getCode().equals(DicDataEnum.SENSITIVE_USERS.getCode()) || item.getCode().equals(DicDataEnum.WIND_FARM.getCode()) || item.getCode().equals(DicDataEnum.POWER_STATION.getCode())).collect(Collectors.toList()); + } + + switch (dimGlobalDataParam.getDateType()) { + case 1: + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimObjTargetY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetY::getOrgId, deptCodeIds) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getMainType()), RDimObjTargetY::getObjectType, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetY::getTargetType, dimGlobalDataParam.getTargetType()); + List yList = rDimObjTargetYMapper.selectList(lambdaQueryWrapperY); + + if (CollectionUtil.isNotEmpty(yList)) { + Map mapY = yList.stream().collect(Collectors.toMap(item -> item.getOrgId() + item.getObjectType() + item.getTargetType(), Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapY.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + case 3: + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimObjTargetM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetM::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetM::getObjectType, dimGlobalDataParam.getMainType()) + .eq(StrUtil.isNotBlank(dimGlobalDataParam.getTargetType()), RDimObjTargetM::getTargetType, dimGlobalDataParam.getTargetType()); + + List mList = rDimObjTargetMMapper.selectList(lambdaQueryWrapperM); + + if (CollectionUtil.isNotEmpty(mList)) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimObjTargetM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapM.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + case 5: + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimObjTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjTargetD::getOrgId, deptCodeIds) + .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetD::getObjectType, dimGlobalDataParam.getMainType()); + List dList = rDimObjTargetDMapper.selectList(lambdaQueryWrapperD); + + if (CollectionUtil.isNotEmpty(dList)) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimObjTargetD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + String mapKey = d.getCode()+dictData.getId()+tart.getId(); + if (mapD.containsKey(mapKey)) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(mapKey).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } + } + } else { + for (DeptDTO d : deptList) { + for (DictData dictData : dicList) { + for (DictData tart : dicSecondList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setType(dictData.getId()); + dimGlobalDataVO.setSecondType(tart.getId()); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + } + } + break; + } + + break; + + + case 25: + //监测到暂态指标的用户占比(%) + switch (dimGlobalDataParam.getDateType()) { + case 1: + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimObjEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventY::getOrgId, deptCodeIds); + List yList = rDimObjEventYMapper.selectList(lambdaQueryWrapperY); + + if (CollectionUtil.isNotEmpty(yList)) { + Map mapY = yList.stream().collect(Collectors.toMap(RDimObjEventY::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + if (mapY.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + + } + } else { + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + break; + case 3: + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimObjEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventM::getOrgId, deptCodeIds); + + List mList = rDimObjEventMMapper.selectList(lambdaQueryWrapperM); + + if (CollectionUtil.isNotEmpty(mList)) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimObjEventM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + if (mapM.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } else { + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + break; + case 5: + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimObjEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventD::getOrgId, deptCodeIds); + List dList = rDimObjEventDMapper.selectList(lambdaQueryWrapperD); + + if (CollectionUtil.isNotEmpty(dList)) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimObjEventD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + if (mapD.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getMonitorRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + } + } else { + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + break; + } + break; + case 26: + //监测到暂态指标发生频次(次/户) + switch (dimGlobalDataParam.getDateType()) { + case 1: + LambdaQueryWrapper lambdaQueryWrapperY = new LambdaQueryWrapper<>(); + lambdaQueryWrapperY.eq(RDimObjEventY::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventY::getOrgId, deptCodeIds); + List yList = rDimObjEventYMapper.selectList(lambdaQueryWrapperY); + + if (CollectionUtil.isNotEmpty(yList)) { + Map mapY = yList.stream().collect(Collectors.toMap(RDimObjEventY::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + + if (mapY.containsKey(d.getCode())) { + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapY.get(d.getCode()).getLimitFreqRate()).setScale(2, RoundingMode.HALF_UP)); + } else { + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + } + resultList.add(dimGlobalDataVO); + + } + } else { + for (DeptDTO d : deptList) { + DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); + dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); + dimGlobalDataVO.setOrgName(d.getName()); + dimGlobalDataVO.setOrgId(d.getCode()); + resultList.add(dimGlobalDataVO); + } + } + break; + case 3: + LambdaQueryWrapper lambdaQueryWrapperM = new LambdaQueryWrapper<>(); + lambdaQueryWrapperM.eq(RDimObjEventM::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventM::getOrgId, deptCodeIds); + + List mList = rDimObjEventMMapper.selectList(lambdaQueryWrapperM); + + if (CollectionUtil.isNotEmpty(mList)) { + Map mapM = mList.stream().collect(Collectors.toMap(RDimObjEventM::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapM.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapM.get(d.getCode()).getLimitFreqRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -2198,28 +3188,26 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; case 5: - LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); - lambdaQueryWrapperD.eq(RDimObjTargetD::getStatisDate, dimGlobalDataParam.getQueryDate()) - .in(RDimObjTargetD::getOrgId, deptCodeIds) - .eq(StrUtil.isNotEmpty(dimGlobalDataParam.getMainType()), RDimObjTargetD::getObjectType, dimGlobalDataParam.getMainType()); - Page dPage = rDimObjTargetDMapper.selectPage(new Page(PageFactory.getPageNum(dimGlobalDataParam), PageFactory.getPageSize(dimGlobalDataParam)), lambdaQueryWrapperD); - List dList = dPage.getRecords(); - resultPage.setTotal(dPage.getTotal()); + LambdaQueryWrapper lambdaQueryWrapperD = new LambdaQueryWrapper<>(); + lambdaQueryWrapperD.eq(RDimObjEventD::getStatisDate, dimGlobalDataParam.getQueryDate()) + .in(RDimObjEventD::getOrgId, deptCodeIds); + List dList = rDimObjEventDMapper.selectList(lambdaQueryWrapperD); + if (CollectionUtil.isNotEmpty(dList)) { - Map mapD = dList.stream().collect(Collectors.toMap(RDimObjTargetD::getOrgId, Function.identity())); - for (Dept d : deptList) { + Map mapD = dList.stream().collect(Collectors.toMap(RDimObjEventD::getOrgId, Function.identity())); + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setOrgName(d.getName()); dimGlobalDataVO.setOrgId(d.getCode()); if (mapD.containsKey(d.getCode())) { - dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitRate()).setScale(2, RoundingMode.HALF_UP)); + dimGlobalDataVO.setValue(BigDecimal.valueOf(mapD.get(d.getCode()).getLimitFreqRate()).setScale(2, RoundingMode.HALF_UP)); } else { dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); } resultList.add(dimGlobalDataVO); } } else { - for (Dept d : deptList) { + for (DeptDTO d : deptList) { DimGlobalDataVO dimGlobalDataVO = new DimGlobalDataVO(); dimGlobalDataVO.setValue(BigDecimal.valueOf(3.14159)); dimGlobalDataVO.setOrgName(d.getName()); @@ -2229,11 +3217,10 @@ public class DimGlobalDealServiceImpl implements DimGlobalDealService { } break; } - break; + } - resultPage.setRecords(resultList); - return resultPage; + return resultList; } } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/RDimVoltageDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/RDimVoltageDMapper.java index 2e567b5d0..b9964f338 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/RDimVoltageDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/RDimVoltageDMapper.java @@ -2,7 +2,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.dim; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; import com.njcn.harmonic.pojo.po.dim.RDimVoltageD; -import com.njcn.prepare.harmonic.pojo.dto.LineDataDto; +import com.njcn.harmonic.pojo.dto.LineDataDto; import org.apache.ibatis.annotations.Param; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/mapping/RDimVoltageDMapper.xml b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/mapping/RDimVoltageDMapper.xml index 9e04f0c9c..bebb70d63 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/mapping/RDimVoltageDMapper.xml +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/dim/mapping/RDimVoltageDMapper.xml @@ -2,7 +2,7 @@ - select A.`time`, A.line_id lineId, diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/dim/impl/RDimVoltageDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/dim/impl/RDimVoltageDServiceImpl.java index 53a868e1d..c38f12660 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/dim/impl/RDimVoltageDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/dim/impl/RDimVoltageDServiceImpl.java @@ -14,7 +14,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper; import com.njcn.prepare.harmonic.mapper.mysql.dim.GeneratrixWireMapper; import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimVoltageDMapper; import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam; -import com.njcn.prepare.harmonic.pojo.dto.LineDataDto; +import com.njcn.harmonic.pojo.dto.LineDataDto; import com.njcn.prepare.harmonic.service.mysql.dim.IRDimVoltageDService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java index 94d8ec108..384f460c9 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java @@ -37,6 +37,7 @@ public enum DicDataEnum { FREQUENCY_DEV("频率偏差", "Frequency_Dev"), NEG_CURRENT("负序电流", "Neg_Current"), THD_V("电压总谐波畸变率", "Thd_V"), + phase_Voltage("三相电压不平衡度","phase_Voltage"), TOTAL_INDICATOR("总稳态指标", "Total_Indicator"), /** @@ -220,7 +221,7 @@ public enum DicDataEnum { SMELT_LOAD("冶炼负荷", "Smelt_Load"), DISTRIBUTED_PHOTOVOLTAICS("分布式光伏", "Distributed_Photovoltaics"), WIND_FARM("风电场", "Wind_Farm"), - SENSITIVE_USERS("敏感用户", "Sensitive_Users"), + SENSITIVE_USERS("重要敏感用户", "Sensitive_Users"), IMPORTANT_USERS("重要用户", "Important_Users"), TRACTION_STATION("牵引站", "Traction_Station"),