Compare commits
3 Commits
2026-01
...
23de6313a6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23de6313a6 | ||
|
|
7a5ef040bb | ||
| 140ed85108 |
@@ -0,0 +1,52 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/2/2 15:16
|
||||
*/
|
||||
@Data
|
||||
public class LineInfoMonitorIdVO {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "gdName",value = "供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "对象名称")
|
||||
private String objName;
|
||||
|
||||
@ApiModelProperty(name = "subName",value = "变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty(name = "powerSubstationName", value = "电网侧变电站")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ApiModelProperty(name = "deviceId",value = "装置Id")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(name = "deviceName",value = "装置名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(name = "ip",value = "装置ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "供应商名称")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "monitorId",value = "国网ID")
|
||||
private String monitorId;
|
||||
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志(0-电网侧;1-非电网侧)")
|
||||
private Integer powerFlag;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/07/18 11:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class CityDataExcel implements Serializable {
|
||||
|
||||
|
||||
@ExcelProperty(value = "单位")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty(value = "监测终端数量")
|
||||
private BigDecimal deviceNum;
|
||||
|
||||
@ExcelProperty(value = "监测点个数")
|
||||
private BigDecimal lineNum;
|
||||
|
||||
@ExcelProperty(value = "在线率(%)")
|
||||
private BigDecimal onlineRate;
|
||||
|
||||
@ExcelProperty(value = "完整率(%)")
|
||||
private BigDecimal integrity;
|
||||
|
||||
@ExcelProperty(value = "问题监测点")
|
||||
private BigDecimal abnormalNum;
|
||||
|
||||
@ExcelProperty(value = "问题监测点")
|
||||
private List<String> abnormalList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/07/18 11:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class LineDataExcel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
private BigDecimal lineNum;
|
||||
|
||||
@ExcelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ExcelProperty(value = "所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty(value = "接入电网侧变电站名")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ExcelProperty(value = "监测点对象名称")
|
||||
private String objName;
|
||||
|
||||
@ExcelProperty(value = "装置编号")
|
||||
private String deviceName;
|
||||
|
||||
@ExcelProperty(value = "IP地址")
|
||||
private String ip;
|
||||
|
||||
@ExcelProperty(value = "终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ExcelProperty(value = "在线率")
|
||||
private BigDecimal onlineRate;
|
||||
|
||||
@ExcelProperty(value = "数据完整性")
|
||||
private BigDecimal integrity;
|
||||
|
||||
@ExcelProperty(value = "国网ID")
|
||||
private BigDecimal monitorId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.njcn.device.pq.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.CityDataExcel;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/2/2 10:13
|
||||
*/
|
||||
public class DataLineExcelUtil {
|
||||
|
||||
/**
|
||||
* 创建监测点信息表头
|
||||
* @param FlyMonitorId
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> lineHeader(Boolean FlyMonitorId) {
|
||||
List<List<String>> header = new ArrayList<>();
|
||||
header.add(Collections.singletonList("序号"));
|
||||
header.add(Collections.singletonList("监测点名称"));
|
||||
header.add(Collections.singletonList("所属部门"));
|
||||
header.add(Collections.singletonList("接入电网侧变电站名"));
|
||||
header.add(Collections.singletonList("监测点对象名称"));
|
||||
header.add(Collections.singletonList("装置编号"));
|
||||
header.add(Collections.singletonList("IP地址"));
|
||||
header.add(Collections.singletonList("终端厂家"));
|
||||
header.add(Collections.singletonList("在线率"));
|
||||
header.add(Collections.singletonList("数据完整性"));
|
||||
if(FlyMonitorId){
|
||||
header.add(Collections.singletonList("国网ID"));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* 监测点信息表头数据写入
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static List<List<Object>> lineBody(List<LineDataExcel> data) {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (LineDataExcel datum : data) {
|
||||
ArrayList<Object> row = Lists.newArrayList(datum.getLineNum(),
|
||||
datum.getLineName(),
|
||||
datum.getDeptName(),
|
||||
datum.getPowerSubstationName(),
|
||||
datum.getObjName(),
|
||||
datum.getDeviceName(),
|
||||
datum.getIp(),
|
||||
datum.getManufacturer(),
|
||||
datum.getOnlineRate(),
|
||||
datum.getIntegrity());
|
||||
if(ObjUtil.isNotNull(datum.getMonitorId())){
|
||||
row.add(datum.getMonitorId());
|
||||
}
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
// 插入一个空行
|
||||
result.add(Collections.emptyList());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建地市信息表头
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> cityHeader() {
|
||||
List<List<String>> header = new ArrayList<>();
|
||||
header.add(Collections.singletonList("单位"));
|
||||
header.add(Collections.singletonList("监测终端数量"));
|
||||
header.add(Collections.singletonList("监测点个数"));
|
||||
header.add(Collections.singletonList("在线率(%)"));
|
||||
header.add(Collections.singletonList("完整率(%)"));
|
||||
header.add(Collections.singletonList("问题监测点"));
|
||||
return header;
|
||||
}
|
||||
|
||||
public static List<List<Object>> cityBody(List<CityDataExcel> data) {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (CityDataExcel datum : data) {
|
||||
ArrayList<Object> row = Lists.newArrayList(datum.getDeptName(),
|
||||
datum.getDeviceNum(),
|
||||
datum.getLineNum(),
|
||||
datum.getOnlineRate(),
|
||||
datum.getIntegrity(),
|
||||
datum.getAbnormalNum());
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
// 插入一个空行
|
||||
result.add(Collections.emptyList());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,12 +4,17 @@ import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.DataVerifyExcel;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
@@ -57,23 +62,13 @@ public class FixedDynamicExcelExport {
|
||||
}
|
||||
}
|
||||
|
||||
public static void exportExcelByDataSize(List<DataVerifyExcel> dataList, OutputStream outputStream) {
|
||||
// 步骤1:统计每个字段的有效数据量
|
||||
public static Map<String, List> exportExcelByDataSize(List<DataVerifyExcel> dataList) {
|
||||
Map<String, List> map = new HashMap<>(2);
|
||||
Map<String, Integer> fieldCount = countValidData(dataList);
|
||||
// 步骤2:按数据量降序排序字段名
|
||||
List<String> sortedFields = sortFields(fieldCount);
|
||||
// 步骤3:构建正确的动态表头
|
||||
List<List<String>> head = buildCorrectHead(sortedFields);
|
||||
// 步骤4:构建对应顺序的行数据
|
||||
List<List<Object>> data = buildRowData(dataList, sortedFields);
|
||||
|
||||
// 步骤5:导出Excel(含列宽设置)
|
||||
EasyExcel.write(outputStream)
|
||||
.head(head)
|
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(20))
|
||||
.registerWriteHandler(new FreezeHeaderHandler()) // 用修复后的表头
|
||||
.sheet("数据统计")
|
||||
.doWrite(data);
|
||||
map.put("head", buildCorrectHead(sortedFields));
|
||||
map.put("data", buildRowData(dataList, sortedFields));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static class FreezeHeaderHandler implements SheetWriteHandler {
|
||||
@@ -91,6 +86,40 @@ public class FixedDynamicExcelExport {
|
||||
}
|
||||
}
|
||||
|
||||
public static HorizontalCellStyleStrategy writeCenterStyle() {
|
||||
// 内容的策略
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
//设置 自动换行
|
||||
contentWriteCellStyle.setWrapped(true);
|
||||
//设置 垂直居中
|
||||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
//设置 水平居中
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
//设置边框样式
|
||||
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
|
||||
|
||||
WriteFont bodyWriteFont = new WriteFont();
|
||||
bodyWriteFont.setFontHeightInPoints((short) 11);
|
||||
bodyWriteFont.setBold(false);
|
||||
bodyWriteFont.setFontName("宋体");
|
||||
contentWriteCellStyle.setWriteFont(bodyWriteFont);
|
||||
|
||||
// 头部
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
// 设置字体居中
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
WriteFont headWriteFont = new WriteFont();
|
||||
// 设置字体大小为20
|
||||
headWriteFont.setFontHeightInPoints((short) 11);
|
||||
headWriteFont.setBold(false);
|
||||
headWriteFont.setFontName("宋体");
|
||||
headWriteCellStyle.setWriteFont(headWriteFont);
|
||||
|
||||
return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||
}
|
||||
// ★ 修复点1:构建正确的表头(每个列名独立成List)
|
||||
private static List<List<String>> buildCorrectHead(List<String> allFields) {
|
||||
List<List<String>> head = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -155,6 +156,8 @@ public class DataVerifyController extends BaseController {
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
||||
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
||||
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -11,29 +12,39 @@ import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONTokener;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.WriteTable;
|
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.device.pq.utils.DataLineExcelUtil;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -43,6 +54,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -52,6 +64,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.njcn.device.pq.utils.FixedDynamicExcelExport.exportExcelByDataSize;
|
||||
import static com.njcn.device.pq.utils.FixedDynamicExcelExport.writeCenterStyle;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -75,6 +88,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final DeptLineService deptLineService;
|
||||
private final GeneralDeviceService deviceService;
|
||||
private final RStatIntegrityDMapper integrityDMapper;
|
||||
private final OnLineRateMapper onLineRateMapper;
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
@@ -373,37 +389,225 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
@Override
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getDeptId())) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
monitorBaseParam.setMonitorIds(monitorIds);
|
||||
}
|
||||
List<DataVerifyExcel> dataVerifyExcels = this.baseMapper.selectDataVerifySum(monitorBaseParam);
|
||||
List<String> ids = dataVerifyExcels.stream().map(DataVerifyExcel::getLineId).collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> map = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
for (DataVerifyExcel dataVerifyExcel : dataVerifyExcels) {
|
||||
if (map.containsKey(dataVerifyExcel.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(dataVerifyExcel.getLineId());
|
||||
dataVerifyExcel.setCity(areaLineInfoVO.getGdName());
|
||||
dataVerifyExcel.setLineName(areaLineInfoVO.getLineName());
|
||||
dataVerifyExcel.setLoadType(areaLineInfoVO.getLoadType());
|
||||
dataVerifyExcel.setObjName(areaLineInfoVO.getObjName());
|
||||
dataVerifyExcel.setStationName(areaLineInfoVO.getSubName());
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
DeviceInfoParam param = new DeviceInfoParam();
|
||||
param.setDeptIndex(monitorBaseParam.getDeptId());
|
||||
param.setStatisticalType(new SimpleDTO());
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, Arrays.asList(0), Arrays.asList(1));
|
||||
List<String> lineIds = deviceInfo.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<String> devIds = deviceInfo.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> areaLineInfoVOList = lineMapper.getBaseLineInfoMonitorIdInfo(lineIds);
|
||||
List<LineInfoMonitorIdVO> monitorLine = areaLineInfoVOList.stream().filter(x -> StrUtil.isNotBlank(x.getMonitorId())).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> gridSide = areaLineInfoVOList.stream().filter(x -> x.getPowerFlag() == 0).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> nonGridSide = areaLineInfoVOList.stream().filter(x -> x.getPowerFlag() == 1).collect(Collectors.toList());
|
||||
|
||||
OnlineRateParam onlineRateParam = new OnlineRateParam();
|
||||
onlineRateParam.setIds(devIds);
|
||||
onlineRateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
onlineRateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
//完整率
|
||||
List<RStatIntegrityVO> integrityList = integrityDMapper.getLineIntegrityRateInfo(lineIds,
|
||||
monitorBaseParam.getSearchBeginTime(),
|
||||
monitorBaseParam.getSearchEndTime());
|
||||
//获取所有终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
|
||||
List<CityDataExcel> cityData1 = new ArrayList<>();
|
||||
List<CityDataExcel> cityData2 = new ArrayList<>();
|
||||
List<CityDataExcel> cityData3 = new ArrayList<>();
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
cityData1.add(addCityDataExcel(dto, monitorLine, onlineRateByDev, integrityList));
|
||||
cityData2.add(addCityDataExcel(dto, gridSide, onlineRateByDev, integrityList));
|
||||
cityData3.add(addCityDataExcel(dto, nonGridSide, onlineRateByDev, integrityList));
|
||||
}
|
||||
monitorBaseParam.setMonitorIds(lineIds);
|
||||
List<DataVerifyExcel> dataVerifyExcels = this.baseMapper.selectDataVerifySum(monitorBaseParam);
|
||||
Map<String, LineInfoMonitorIdVO> lineInfomap = areaLineInfoVOList.stream().collect(Collectors.toMap(LineInfoMonitorIdVO::getLineId, Function.identity()));
|
||||
for (DataVerifyExcel dataVerifyExcel : dataVerifyExcels) {
|
||||
if (lineInfomap.containsKey(dataVerifyExcel.getLineId())) {
|
||||
LineInfoMonitorIdVO areaLineInfoVO = lineInfomap.get(dataVerifyExcel.getLineId());
|
||||
dataVerifyExcel.setCity(areaLineInfoVO.getGdName());
|
||||
dataVerifyExcel.setLineName(areaLineInfoVO.getLineName());
|
||||
dataVerifyExcel.setLoadType(areaLineInfoVO.getLoadType());
|
||||
dataVerifyExcel.setObjName(areaLineInfoVO.getObjName());
|
||||
dataVerifyExcel.setStationName(areaLineInfoVO.getSubName());
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
}
|
||||
}
|
||||
dataVerifyExcels.sort(Comparator
|
||||
.comparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
.thenComparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName() + "_" + item.getDevName())
|
||||
);
|
||||
Map<String, List> map = exportExcelByDataSize(dataVerifyExcels);
|
||||
// 步骤5:导出Excel(含列宽设置)
|
||||
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
|
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(20))
|
||||
.registerWriteHandler(writeCenterStyle()).build();
|
||||
WriteSheet writeSheet0 = EasyExcel.writerSheet("监测点异常指标统计").build();
|
||||
WriteTable writeTable0 = EasyExcel.writerTable(0).needHead(Boolean.TRUE).head(map.get("head")).build();
|
||||
excelWriter.write(map.get("data"), writeSheet0, writeTable0);
|
||||
|
||||
Map<Integer, List<CityDataExcel>> cityData = new HashMap<>();
|
||||
cityData.put(1, cityData1);
|
||||
cityData.put(2, cityData2);
|
||||
cityData.put(3, cityData3);
|
||||
|
||||
Map<Integer, List<LineDataExcel>> lineData = new HashMap<>();
|
||||
addLineDataExcel(cityData1, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 1);
|
||||
addLineDataExcel(cityData2, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 2);
|
||||
addLineDataExcel(cityData3, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 3);
|
||||
|
||||
excelExtracted(excelWriter, "数据质量", new HashMap<>(), cityData, true);
|
||||
excelExtracted(excelWriter, "数据质量表格", lineData, new HashMap<>(), false);
|
||||
excelWriter.finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void addLineDataExcel(List<CityDataExcel> cityData1, List<LineInfoMonitorIdVO> areaLineInfoVOList, List<RStatOnlineRateVO> onlineRateByDev, List<RStatIntegrityVO> integrityList, Map<Integer, List<LineDataExcel>> lineData, Integer num) {
|
||||
List<LineDataExcel> lineDataExcels1 = new ArrayList<>();
|
||||
List<String> lineData1 = cityData1.stream().flatMap(x -> x.getAbnormalList().stream()).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> lineInfoData1 = areaLineInfoVOList.stream().filter(x -> lineData1.contains(x.getLineId())).collect(Collectors.toList());
|
||||
LineDataExcel lineDataExcel;
|
||||
for (int i = 0; i < lineInfoData1.size(); i++) {
|
||||
LineInfoMonitorIdVO dto = lineInfoData1.get(i);
|
||||
lineDataExcel = new LineDataExcel();
|
||||
lineDataExcel.setLineNum(BigDecimal.valueOf((i + 1)));
|
||||
lineDataExcel.setLineName(dto.getLineName());
|
||||
lineDataExcel.setDeptName(dto.getDeviceName());
|
||||
lineDataExcel.setPowerSubstationName(dto.getPowerSubstationName());
|
||||
lineDataExcel.setObjName(dto.getObjName());
|
||||
lineDataExcel.setDeviceName(dto.getDeviceName());
|
||||
lineDataExcel.setIp(dto.getIp());
|
||||
lineDataExcel.setManufacturer(dto.getManufacturer());
|
||||
lineDataExcel.setOnlineRate(onLineRate(onlineRateByDev, Arrays.asList(dto.getDeviceId())));
|
||||
lineDataExcel.setIntegrity(integrity(integrityList, Arrays.asList(dto.getLineId())));
|
||||
if (num == 1) {
|
||||
lineDataExcel.setMonitorId(new BigDecimal(dto.getMonitorId()));
|
||||
}
|
||||
lineDataExcels1.add(lineDataExcel);
|
||||
}
|
||||
lineData.put(num, lineDataExcels1);
|
||||
}
|
||||
|
||||
|
||||
private CityDataExcel addCityDataExcel(GeneralDeviceDTO dto, List<LineInfoMonitorIdVO> monitorLine, List<RStatOnlineRateVO> onlineRateByDev, List<RStatIntegrityVO> integrityList) {
|
||||
CityDataExcel data = new CityDataExcel();
|
||||
List<String> monitorLineList = monitorLine.stream()
|
||||
.filter(x -> dto.getLineIndexes().contains(x.getLineId()))
|
||||
.map(LineInfoMonitorIdVO::getLineId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<String> devList = monitorLine.stream()
|
||||
.filter(x -> dto.getDeviceIndexes().contains(x.getDeviceId()))
|
||||
.map(LineInfoMonitorIdVO::getDeviceId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
data.setDeptName(dto.getName());
|
||||
data.setDeviceNum(BigDecimal.valueOf(devList.size()));
|
||||
data.setLineNum(BigDecimal.valueOf(monitorLineList.size()));
|
||||
data.setOnlineRate(onLineRate(onlineRateByDev, devList));
|
||||
data.setIntegrity(integrity(integrityList, monitorLineList));
|
||||
List<String> abnormalList = integrityList.stream()
|
||||
.filter(x -> ObjUtil.isNotNull(x.getIntegrityRate()))
|
||||
.filter(x -> x.getIntegrityRate().compareTo(BigDecimal.ZERO) == 0)
|
||||
.filter(x -> monitorLineList.contains(x.getLineIndex()))
|
||||
.map(RStatIntegrityVO::getLineIndex)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
data.setAbnormalNum(BigDecimal.valueOf(abnormalList.size()));
|
||||
data.setAbnormalList(abnormalList);
|
||||
return data;
|
||||
}
|
||||
|
||||
private BigDecimal integrity(List<RStatIntegrityVO> integrityList, List<String> lineIds) {
|
||||
//监测完整率
|
||||
List<RStatIntegrityVO> integrityDS = integrityList.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getDueTime).sum();
|
||||
if (dueTime == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(realTime * 100.0 / dueTime, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal onLineRate(List<RStatOnlineRateVO> onlineRateByDev, List<String> devIds) {
|
||||
//终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateDS = onlineRateByDev.stream().filter(x -> devIds.contains(x.getDevIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
|
||||
if ((onlineTime + offlineTime) == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void excelExtracted(ExcelWriter excelWriter, String sheetName, Map<Integer, List<LineDataExcel>> lineData, Map<Integer, List<CityDataExcel>> cityData, Boolean fly) {
|
||||
// 构建sheet页--表示不加表头
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).needHead(Boolean.FALSE).build();
|
||||
// 表头的数量
|
||||
int num = 0;
|
||||
Boolean first = false;
|
||||
// 模拟写5张表
|
||||
for (int i = 1; i < 4; i++) {
|
||||
String name = "";
|
||||
if (i == 1) {
|
||||
if (fly) {
|
||||
name = "一类监测点";
|
||||
} else {
|
||||
name = "冀北公司一类监测点数据质量问题";
|
||||
}
|
||||
first = true;
|
||||
}
|
||||
if (i == 2) {
|
||||
if (fly) {
|
||||
name = "电网侧";
|
||||
} else {
|
||||
name = "冀北公司电网侧监测点数据质量问题(不包含一类监测点)";
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
if (i == 3) {
|
||||
if (fly) {
|
||||
name = "非电网侧";
|
||||
} else {
|
||||
name = "冀北公司非电网侧问题监测点(不包含一类监测点)";
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
String finalName = name;
|
||||
List<List<String>> contentHeader;
|
||||
if (fly) {
|
||||
contentHeader = DataLineExcelUtil.cityHeader();
|
||||
} else {
|
||||
contentHeader = DataLineExcelUtil.lineHeader(first);
|
||||
}
|
||||
List<List<String>> nameHeader = contentHeader.stream().map(item -> Collections.singletonList(finalName)).collect(Collectors.toList());
|
||||
// 这里必须指定需要头,table 会继承sheet的配置,sheet配置了不需要,table 默认也是不需要
|
||||
// 创建一个表头
|
||||
WriteTable writeTable1 = EasyExcel.writerTable(num).needHead(Boolean.TRUE).head(nameHeader).build();
|
||||
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
|
||||
//创建数据
|
||||
WriteTable writeTable2 = EasyExcel.writerTable(num + 1).needHead(Boolean.TRUE).head(contentHeader).build();
|
||||
List<List<Object>> body;
|
||||
if (fly) {
|
||||
body = DataLineExcelUtil.cityBody(cityData.get(i));
|
||||
} else {
|
||||
body = DataLineExcelUtil.lineBody(lineData.get(i));
|
||||
}
|
||||
excelWriter.write(body, writeSheet, writeTable2);
|
||||
// 插入两次表头加2
|
||||
num = num + 2;
|
||||
}
|
||||
dataVerifyExcels.sort(Comparator
|
||||
.comparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
.thenComparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName()+"_"+item.getDevName())
|
||||
);
|
||||
exportExcelByDataSize(dataVerifyExcels,response.getOutputStream());
|
||||
// Set<String> excludeColumnFiledNames = new HashSet<>(1);
|
||||
// excludeColumnFiledNames.add("lineId");
|
||||
// EasyExcel.write(response.getOutputStream(), DataVerifyExcel.class)
|
||||
// .excludeColumnFiledNames(excludeColumnFiledNames).sheet("sheet")
|
||||
// .doWrite(dataVerifyExcels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -216,6 +216,8 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
*/
|
||||
List<AreaLineInfoVO> getBaseLineAreaInfo(@Param("list") List<String> lineIndex, @Param("searchValue") String searchValue, @Param("comFlag") Integer comFlag);
|
||||
|
||||
List<LineInfoMonitorIdVO> getBaseLineInfoMonitorIdInfo(@Param("list") List<String> lineIndex);
|
||||
|
||||
/**
|
||||
* 返回监测点信息及通讯状态
|
||||
*
|
||||
|
||||
@@ -1949,5 +1949,83 @@
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
<select id="getBaseLineInfoMonitorIdInfo" resultType="com.njcn.device.pq.pojo.vo.LineInfoMonitorIdVO">
|
||||
SELECT
|
||||
line.Id lineId,
|
||||
line.Name lineName,
|
||||
gd.Name gdName,
|
||||
substation.id subId,
|
||||
substation.Name subName,
|
||||
subscale.name subScale,
|
||||
device.id deviceId,
|
||||
device.name deviceName,
|
||||
pqdevice.IP ip,
|
||||
factory.Name manufacturer,
|
||||
voltage.id voltageId,
|
||||
voltage.Name voltageName,
|
||||
scale.Name voltageScale,
|
||||
pqdevice.run_flag,
|
||||
pqdevice.com_flag,
|
||||
pqsubstation.Lng,
|
||||
pqsubstation.lat,
|
||||
detail.num,
|
||||
detail.ct1,
|
||||
detail.ct2,
|
||||
detail.pt1,
|
||||
detail.pt2,
|
||||
detail.obj_name,
|
||||
detail.Dev_Capacity deviceCapacity,
|
||||
detail.Short_Capacity,
|
||||
detail.Standard_Capacity,
|
||||
detail.Deal_Capacity,
|
||||
detail.Business_Type businessType,
|
||||
detail.Calssification_Grade,
|
||||
detail.Superiors_Substation,
|
||||
detail.Hang_Line,
|
||||
loadtype.name loadType,
|
||||
detail.New_Station_Id as newStationId,
|
||||
detail.obj_id,
|
||||
detail.big_obj_type,
|
||||
detail.small_obj_type,
|
||||
detail.Power_Flag powerFlag,
|
||||
detail.Power_Substation_Name powerSubstationName,
|
||||
detail.Monitor_Id monitorId
|
||||
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
pq_line voltage,
|
||||
pq_voltage pqvoltage,
|
||||
pq_line device,
|
||||
pq_device pqdevice,
|
||||
pq_line substation,
|
||||
pq_substation pqsubstation,
|
||||
pq_line gd,
|
||||
sys_dict_data scale,
|
||||
sys_dict_data factory,
|
||||
sys_dict_data loadtype,
|
||||
sys_dict_data subscale
|
||||
WHERE
|
||||
line.id = detail.id
|
||||
AND line.pid = voltage.id
|
||||
AND voltage.id = pqvoltage.id
|
||||
AND pqvoltage.Scale = scale.id
|
||||
AND voltage.pid = device.id
|
||||
AND voltage.pid = pqdevice.id
|
||||
AND pqdevice.Manufacturer = factory.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.id = pqsubstation.id
|
||||
AND pqsubstation.scale = subscale.id
|
||||
AND substation.pid = gd.id
|
||||
AND detail.load_type = loadtype.id
|
||||
<if test="list !=null and list.size() >0">
|
||||
AND line.Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -12,9 +12,9 @@ import com.njcn.echarts.pojo.constant.PicCommonData;
|
||||
import com.njcn.echarts.util.DrawPicUtil;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.event.common.service.EventReportService;
|
||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||
import com.njcn.event.common.utils.WordUtils;
|
||||
import com.njcn.event.pojo.param.ExportParam;
|
||||
import com.njcn.event.pojo.param.StatisticsParam;
|
||||
@@ -218,7 +218,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
||||
EventDetail eventDetail = plot.get(j);
|
||||
String s = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
|
||||
insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + "");
|
||||
insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", Objects.isNull(eventDetail.getAdvanceType())?"/":eventDetail.getAdvanceType(), Objects.isNull(eventDetail.getAdvanceReason())?"/":eventDetail.getAdvanceReason(), Objects.isNull(eventDetail.getSeverity())?"/":eventDetail.getSeverity() + "");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -585,6 +585,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
||||
// .in(RmpEventDetailPO::getEventType, typeIds)
|
||||
.ge(StrUtil.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
|
||||
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||
);
|
||||
|
||||
return BeanUtil.copyToList(info, EventDetail.class);
|
||||
|
||||
@@ -125,6 +125,6 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
|
||||
|
||||
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO);
|
||||
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO,null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ public interface MonitorHarmonicReportService {
|
||||
String crmName,
|
||||
Boolean isUrl,
|
||||
MultipartFile file,
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit);
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit, String dataLevel);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONTokener;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -157,7 +158,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
} else {
|
||||
phase = PHASE_MAPPING.get(item.getPhase());
|
||||
}
|
||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) {
|
||||
for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) {
|
||||
tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
} else {
|
||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
});
|
||||
|
||||
eleEpdPqdList = eleEpdPqdList.stream().filter(it->"T".equals(it.getPhase())||"M".equals(it.getPhase())).collect(Collectors.toList());
|
||||
|
||||
@@ -14,15 +14,15 @@ 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.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import com.njcn.harmonic.common.service.MonitorCommReportService;
|
||||
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
|
||||
import com.njcn.harmonic.pojo.param.ReportQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||
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.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import com.njcn.harmonic.common.service.MonitorCommReportService;
|
||||
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
|
||||
import com.njcn.harmonic.utils.WordUtil2;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.ThemeFeignClient;
|
||||
@@ -114,7 +114,7 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
String crmName,
|
||||
Boolean isUrl,
|
||||
MultipartFile file,
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit) {
|
||||
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit, String dataLevel) {
|
||||
//获取监测点信息
|
||||
String bdname;
|
||||
Integer pttype;
|
||||
@@ -122,6 +122,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
String atype = "";
|
||||
String btype = "";
|
||||
String ctype = "";
|
||||
//pt
|
||||
Double pt = getData(lineDto.getPt());
|
||||
//ct
|
||||
Double ct = getData(lineDto.getCt());
|
||||
|
||||
|
||||
if (type == 0) {
|
||||
if (ObjectUtil.isNull(lineDto)) {
|
||||
throw new BusinessException(CommonResponseEnum.NO_DATA);
|
||||
@@ -263,14 +269,13 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
// 基波电压最大值
|
||||
|
||||
reportmap.put("$B" + "V0" + "X" + "_A$", judgeNull(voltage1.getFmaxValue()));
|
||||
|
||||
reportmap.put("$B" + "V0" + "X" + "_B$", judgeNull(voltage2.getFmaxValue()));
|
||||
reportmap.put("$B" + "V0" + "X" + "_C$", judgeNull(voltage3.getFmaxValue()));
|
||||
|
||||
// 基波电流最大值
|
||||
reportmap.put("$B" + "I0" + "X" + "_A$", judgeNull(current1.getFmaxValue()));
|
||||
reportmap.put("$B" + "I0" + "X" + "_B$", judgeNull(current2.getFmaxValue()));
|
||||
reportmap.put("$B" + "I0" + "X" + "_C$", judgeNull(current3.getFmaxValue()));
|
||||
reportmap.put("$B" + "I0" + "X" + "_A$", dataConversion(current1.getFmaxValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "X" + "_B$", dataConversion(current2.getFmaxValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "X" + "_C$", dataConversion(current3.getFmaxValue(),dataLevel,ct,true));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -291,9 +296,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
reportmap.put("$B" + "V0" + "N" + "_C$", judgeNull(voltage3.getMinValue()));
|
||||
|
||||
// 基波电流最小值
|
||||
reportmap.put("$B" + "I0" + "N" + "_A$", judgeNull(current1.getMinValue()));
|
||||
reportmap.put("$B" + "I0" + "N" + "_B$", judgeNull(current2.getMinValue()));
|
||||
reportmap.put("$B" + "I0" + "N" + "_C$", judgeNull(current3.getMinValue()));
|
||||
reportmap.put("$B" + "I0" + "N" + "_A$", dataConversion(current1.getMinValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "N" + "_B$", dataConversion(current2.getMinValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "N" + "_C$", dataConversion(current3.getMinValue(),dataLevel,ct,true));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -314,9 +319,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
reportmap.put("$B" + "V0" + "E" + "_C$", judgeNull(voltage3.getMeanValue()));
|
||||
|
||||
// 基波电流平均值
|
||||
reportmap.put("$B" + "I0" + "E" + "_A$", judgeNull(current1.getMeanValue()));
|
||||
reportmap.put("$B" + "I0" + "E" + "_B$", judgeNull(current2.getMeanValue()));
|
||||
reportmap.put("$B" + "I0" + "E" + "_C$", judgeNull(current3.getMeanValue()));
|
||||
reportmap.put("$B" + "I0" + "E" + "_A$", dataConversion(current1.getMeanValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "E" + "_B$", dataConversion(current2.getMeanValue(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "E" + "_C$", dataConversion(current3.getMeanValue(),dataLevel,ct,true));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -337,9 +342,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
reportmap.put("$B" + "V0" + "%" + "_C$", judgeNull(voltage3.getCp95Value()));
|
||||
|
||||
// 基波电流cp95值
|
||||
reportmap.put("$B" + "I0" + "%" + "_A$", judgeNull(current1.getCp95Value()));
|
||||
reportmap.put("$B" + "I0" + "%" + "_B$", judgeNull(current2.getCp95Value()));
|
||||
reportmap.put("$B" + "I0" + "%" + "_C$", judgeNull(current3.getCp95Value()));
|
||||
reportmap.put("$B" + "I0" + "%" + "_A$", dataConversion(current1.getCp95Value(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "%" + "_B$", dataConversion(current2.getCp95Value(),dataLevel,ct,true));
|
||||
reportmap.put("$B" + "I0" + "%" + "_C$", dataConversion(current3.getCp95Value(),dataLevel,ct,true));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -387,10 +392,10 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
Double vaveValue = Double.parseDouble(reportmap.get("$BV0E_" + tmpstrMap + "$").toString());
|
||||
Double vcp95Value = Double.parseDouble(reportmap.get("$BV0%_" + tmpstrMap + "$").toString());
|
||||
// 基波电流
|
||||
Double imaxValue = Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString());
|
||||
Double iminValue = Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString());
|
||||
Double iaveValue = Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString());
|
||||
Double icp95Value = Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString());
|
||||
Double imaxValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString())*ct;
|
||||
Double iminValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString())*ct;
|
||||
Double iaveValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString())*ct;
|
||||
Double icp95Value = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString())*ct;
|
||||
|
||||
if (!(vmaxValue >= vminValue && vmaxValue >= vaveValue && vmaxValue >= vcp95Value)) {
|
||||
strBaseVIResult += "注意:从上表中可以看出" + strLineBaseName
|
||||
@@ -1222,9 +1227,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
String strCurrent = strMap + (i + 1) + "%";
|
||||
|
||||
// 谐波电流幅值
|
||||
strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
|
||||
strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
|
||||
strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
|
||||
// strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
|
||||
// strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
|
||||
// strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
|
||||
strCurrentA = dataConversion(this.listICurrent.get(i).getList().get(0).getCp95Value(),dataLevel,ct,true);
|
||||
strCurrentB = dataConversion(this.listICurrent.get(i).getList().get(1).getCp95Value(),dataLevel,ct,true);
|
||||
strCurrentC = dataConversion(this.listICurrent.get(i).getList().get(2).getCp95Value(),dataLevel,ct,true);
|
||||
strLimit = judgeNull(this.listICurrent.get(i).getOverLimit());
|
||||
|
||||
reportmap.put(strCurrent + "_A$", strCurrentA);
|
||||
@@ -1253,9 +1261,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
reportmap.put("$CI" + (i + 1) + "L$", strLimit);
|
||||
|
||||
try {
|
||||
maxValue = Double.parseDouble(strCurrentA);
|
||||
minValue = Double.parseDouble(strCurrentB);
|
||||
aveValue = Double.parseDouble(strCurrentC);
|
||||
maxValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentA)*ct : Double.parseDouble(strCurrentA);
|
||||
minValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentB)*ct : Double.parseDouble(strCurrentB);
|
||||
aveValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentC)*ct : Double.parseDouble(strCurrentC);;
|
||||
limit = Double.parseDouble(strLimit);
|
||||
} catch (Exception e) {
|
||||
strResultCurrentValue += "注意:从上表中可以看出" + strLineBaseName +(i + 1)+ "次谐波电流幅值95%概率值数据存在异常(不是数值类型)。\r\n";
|
||||
@@ -1380,6 +1388,26 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
}
|
||||
}
|
||||
|
||||
public Double getData(String data) {
|
||||
double ratio = 1.0;
|
||||
if (Objects.isNull(data) || data.isEmpty()) {
|
||||
return ratio;
|
||||
}
|
||||
String[] parts = data.split("/");
|
||||
if (parts.length == 2) {
|
||||
try {
|
||||
Double num1 = Double.parseDouble(parts[0]);
|
||||
Double num2 = Double.parseDouble(parts[1]);
|
||||
ratio = num1 / num2;
|
||||
} catch (NumberFormatException var7) {
|
||||
System.out.println("字符串格式错误");
|
||||
}
|
||||
} else {
|
||||
ratio = Double.parseDouble(parts[0]);
|
||||
}
|
||||
return ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据单位信息 重组
|
||||
*
|
||||
@@ -1722,6 +1750,22 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
|
||||
return (result == null) ? "/" : result.toString();
|
||||
}
|
||||
|
||||
public String dataConversion(Float result, String dataLevel, Double ratio, Boolean isI) {
|
||||
if (result == null) {
|
||||
return "/";
|
||||
}
|
||||
if (!"Secondary".equals(dataLevel)) {
|
||||
return String.valueOf(result);
|
||||
}
|
||||
double conversionRatio = (ratio != null) ? ratio : 1.0;
|
||||
double convertedValue = result * conversionRatio;
|
||||
if (isI != null && Boolean.TRUE.equals(isI)) {
|
||||
return String.format("%.2f", convertedValue);
|
||||
} else {
|
||||
return String.format("%.2f", convertedValue / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 谐波电流限值
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user