稳态报告接口迁移(后续需要合并代码)

This commit is contained in:
cdf
2025-12-05 09:51:23 +08:00
parent 3753544e5f
commit 3526926034
44 changed files with 5481 additions and 103 deletions

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
@@ -13,19 +14,16 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.PubUtils;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
import com.njcn.csharmonic.pojo.dto.report.EnumPass;
import com.njcn.csharmonic.pojo.dto.report.OverLimitInfo;
import com.njcn.csharmonic.pojo.dto.report.Pass;
import com.njcn.csharmonic.pojo.dto.report.ReportTarget;
import com.njcn.csharmonic.pojo.param.report.ReportQueryParam;
import com.njcn.csharmonic.pojo.vo.report.ReportValue;
import com.njcn.csharmonic.service.ReportService;
import com.njcn.csharmonic.utils.report.WordUtil2;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.DeviceUnitClient;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.report.EnumPass;
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
import com.njcn.harmonic.pojo.po.report.Pass;
import com.njcn.harmonic.pojo.po.report.ReportTarget;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.harmonic.utils.WordUtil2;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.ThemeFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -83,11 +81,11 @@ public class WordExportModelController extends BaseController {
private final CsLineFeignClient csLineFeignClient;
private final MonitorClient monitorClient;
//private final MonitorClient monitorClient;
private final DicDataFeignClient dicDataFeignClient;
private final ThemeFeignClient themeFeignClient;
private final ReportService reportService;
private final DeviceUnitClient deviceUnitClient;
//private final DeviceUnitClient deviceUnitClient;
private final WordUtil2 wordUtil2;
/**
@@ -118,9 +116,9 @@ public class WordExportModelController extends BaseController {
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException {
String methodDescribe = getMethodDescribe("exportWorld");
//获取监测点信息
String bdname;
Integer pttype;
String areaName;
String bdname = "";
Integer pttype = 0;
String areaName = "";
String atype = "";
String btype = "";
String ctype = "";
@@ -137,7 +135,7 @@ public class WordExportModelController extends BaseController {
}
pttype = PubUtils.ptTypeName(lineDto.getPtType());
} else {
List<Monitor> monitorList = monitorClient.getMonitorList(Collections.singletonList(lineIndex)).getData();
/* List<Monitor> monitorList = monitorClient.getMonitorList(Collections.singletonList(lineIndex)).getData();
if (ObjectUtil.isNull(monitorList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA);
}
@@ -157,7 +155,7 @@ public class WordExportModelController extends BaseController {
//设备容量
lineDto.setDevCapacity(monitor.getPowerSupplyEqCapacity());
//电压等级
lineDto.setScale(dicDataFeignClient.getDicDataById(monitor.getVoltageLevel()).getData().getName());
lineDto.setScale(dicDataFeignClient.getDicDataById(monitor.getVoltageLevel()).getData().getName());*/
}
if (pttype == 0) {
@@ -198,7 +196,8 @@ public class WordExportModelController extends BaseController {
if (type == 0) {
overLimit = csLineFeignClient.getOverLimitData(Stream.of(param.getLineId()).collect(Collectors.toList())).getData().get(0);
} else {
overLimit = monitorClient.getOverLimitData(param.getLineId()).getData();
overLimit = csLineFeignClient.getOverLimitData(Stream.of(param.getLineId()).collect(Collectors.toList())).getData().get(0);
}
param.setCount(overLimitData.getCount());
overLimitData.setOverLimitRate(Arrays.asList(overLimit));

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.csharmonic.mapper.report.ReportMapper">
<select id="getVirtualDataI" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getVirtualDataI" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -55,7 +55,7 @@
GROUP BY
phasic_type;
</select>
<select id="getVirtualDataV" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getVirtualDataV" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -169,7 +169,7 @@
</if>
</where>
</select>
<select id="getVVirtualData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getVVirtualData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -223,7 +223,7 @@
GROUP BY
phasic_type
</select>
<select id="getPowerP" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getPowerP" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -282,7 +282,7 @@
GROUP BY
phasic_type
</select>
<select id="getPF" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getPF" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -341,7 +341,7 @@
GROUP BY
phasic_type
</select>
<select id="getPowerQ" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getPowerQ" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -400,7 +400,7 @@
GROUP BY
phasic_type
</select>
<select id="getPowerS" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getPowerS" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -459,7 +459,7 @@
GROUP BY
phasic_type
</select>
<select id="getFlickerData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getFlickerData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -518,7 +518,7 @@
GROUP BY
phasic_type
</select>
<select id="getLFlickerData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getLFlickerData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -577,7 +577,7 @@
GROUP BY
phasic_type
</select>
<select id="getUVdeviationData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getUVdeviationData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -631,7 +631,7 @@
GROUP BY
phasic_type;
</select>
<select id="getLVdeviationData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getLVdeviationData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -685,7 +685,7 @@
GROUP BY
phasic_type;
</select>
<select id="getDistortionDataV" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getDistortionDataV" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -739,7 +739,7 @@
GROUP BY
phasic_type;
</select>
<select id="getDistortionDataI" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getDistortionDataI" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -793,7 +793,7 @@
GROUP BY
phasic_type;
</select>
<select id="getFrequencyData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getFrequencyData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -847,7 +847,7 @@
GROUP BY
phasic_type;
</select>
<select id="getDEVFrequencyData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getDEVFrequencyData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
@@ -901,7 +901,7 @@
GROUP BY
phasic_type;
</select>
<select id="getINegData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
<select id="getINegData" resultType="com.njcn.csharmonic.pojo.vo.report.ReportValue">
SELECT
phasic_type AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,

View File

@@ -1,7 +1,7 @@
package com.njcn.csharmonic.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.csharmonic.pojo.po.day.RStatDataIDPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@@ -1,7 +1,7 @@
package com.njcn.csharmonic.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
import com.njcn.csharmonic.pojo.po.day.RStatDataInharmVDPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -13,5 +13,5 @@ import java.util.List;
*/
public interface RStatDataInharmVDMapper extends BaseMapper<RStatDataInharmVDPO> {
List<RStatDataInharmVDPO> getV(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
//List<RStatDataInharmVDPO> getV(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@@ -1,43 +0,0 @@
package com.njcn.csharmonic.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RStatDataVD;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2023-03-31
*/
public interface RStatDataVDMapper extends BaseMapper<RStatDataVD> {
/**
* 获取频率偏差、三相电压不平衡度
*/
List<RStatDataVD> getFreqDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取电压偏差
*/
List<RStatDataVD> getVuDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取电压总谐波畸变率
*/
List<RStatDataVD> getVthd(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取三相电压不平衡度
*/
List<RStatDataVD> getUnbalance(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取谐波电压
*/
List<RStatDataVD> getV(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@@ -0,0 +1,43 @@
package com.njcn.csharmonic.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.csharmonic.pojo.po.day.RStatDataVDPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2023-03-31
*/
public interface RStatDataVDPOMapper extends BaseMapper<RStatDataVDPO> {
/**
* 获取频率偏差、三相电压不平衡度
*/
List<RStatDataVDPO> getFreqDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取电压偏差
*/
List<RStatDataVDPO> getVuDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取电压总谐波畸变率
*/
List<RStatDataVDPO> getVthd(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取三相电压不平衡度
*/
List<RStatDataVDPO> getUnbalance(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取谐波电压
*/
List<RStatDataVDPO> getV(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@@ -1,7 +1,8 @@
package com.njcn.csharmonic.mapper.report;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.csharmonic.pojo.param.report.ReportQueryParam;
import com.njcn.csharmonic.pojo.vo.report.ReportValue;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@@ -1,8 +1,10 @@
package com.njcn.csharmonic.service;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.csharmonic.pojo.dto.report.OverLimitInfo;
import com.njcn.csharmonic.pojo.param.report.ReportQueryParam;
import com.njcn.csharmonic.pojo.vo.report.ReportValue;
import java.util.List;

View File

@@ -7,16 +7,17 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.csharmonic.mapper.report.RStatDataIDMapper;
import com.njcn.csharmonic.mapper.report.RStatDataInharmVDMapper;
import com.njcn.csharmonic.mapper.report.RStatDataVDMapper;
import com.njcn.csharmonic.mapper.report.RStatDataVDPOMapper;
import com.njcn.csharmonic.mapper.report.ReportMapper;
import com.njcn.csharmonic.pojo.dto.report.OverLimitInfo;
import com.njcn.csharmonic.pojo.param.report.ReportQueryParam;
import com.njcn.csharmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.csharmonic.pojo.po.day.RStatDataInharmVDPO;
import com.njcn.csharmonic.pojo.po.day.RStatDataVDPO;
import com.njcn.csharmonic.pojo.vo.report.ReportValue;
import com.njcn.csharmonic.service.ReportService;
import com.njcn.csharmonic.util.RegroupData;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.RStatDataVD;
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
import com.njcn.harmonic.pojo.vo.ReportValue;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -35,7 +36,7 @@ import java.util.stream.Collectors;
public class ReportServiceImpl implements ReportService {
private final ReportMapper reportMapper;
private final RStatDataVDMapper rStatDataVDMapper;
private final RStatDataVDPOMapper rStatDataVDMapper;
private final RStatDataIDMapper rStatDataIDMapper;
private final RStatDataInharmVDMapper rStatDataInharmVDMapper;
@@ -328,20 +329,20 @@ public class ReportServiceImpl implements ReportService {
* @return
*/
private List<ReportValue> dataV(ReportQueryParam param, List<String> valueTypes, Integer num, Integer size, Boolean fly, Integer index) {
List<RStatDataVD> rStatDataVDS = rStatDataVDMapper.selectList(new LambdaQueryWrapper<RStatDataVD>()
.eq(RStatDataVD::getLineId, param.getLineId())
.in(CollUtil.isNotEmpty(valueTypes), RStatDataVD::getPhasicType, valueTypes)
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataVD::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataVD::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
List<RStatDataVDPO> rStatDataVDS = rStatDataVDMapper.selectList(new LambdaQueryWrapper<RStatDataVDPO>()
.eq(RStatDataVDPO::getLineId, param.getLineId())
.in(CollUtil.isNotEmpty(valueTypes), RStatDataVDPO::getPhaseType, valueTypes)
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataVDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataVDPO::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
String max = "MAX";
String avg = "AVG";
String min = "MIN";
String cp95 = "CP95";
List<ReportValue> a = new ArrayList<>();
Map<String, List<RStatDataVD>> collect = rStatDataVDS.stream().collect(Collectors.groupingBy(RStatDataVD::getPhasicType));
Map<String, List<RStatDataVDPO>> collect = rStatDataVDS.stream().collect(Collectors.groupingBy(RStatDataVDPO::getPhaseType));
collect.forEach((key, value) -> {
Map<String, List<RStatDataVD>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataVD::getValueType));
Map<String, List<RStatDataVDPO>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataVDPO::getValueType));
for (int i = num; i < size; i++) {
ReportValue reportValue = new ReportValue();
@@ -393,10 +394,10 @@ public class ReportServiceImpl implements ReportService {
* @param name
* @return
*/
private List<Float> reflectDataV(List<RStatDataVD> value, String name, String attribute) {
private List<Float> reflectDataV(List<RStatDataVDPO> value, String name, String attribute) {
Field field = null;
try {
field = RStatDataVD.class.getDeclaredField(attribute);
field = RStatDataVDPO.class.getDeclaredField(attribute);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}

View File

@@ -1,6 +1,7 @@
package com.njcn.csharmonic.util;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.csharmonic.pojo.vo.report.ReportValue;
import java.util.List;