Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79cec4e21b | |||
|
|
615fe78d61 | ||
|
|
5fff0890e8 | ||
|
|
f5e134b194 | ||
|
|
291a20649e | ||
|
|
7eef16599f | ||
| 11750a4f3a | |||
|
|
e6332f1c51 | ||
| 23d87aecc8 | |||
| eff784e94e |
@@ -77,6 +77,12 @@ public interface BusinessTopic {
|
|||||||
*/
|
*/
|
||||||
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
|
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理心跳过期处理主题
|
||||||
|
*/
|
||||||
|
String HEARTBEAT_TIMEOUT_TOPIC = "heartbeat_timeout_topic";
|
||||||
|
|
||||||
|
|
||||||
/********************************数据中心*********************************/
|
/********************************数据中心*********************************/
|
||||||
|
|
||||||
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";
|
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";
|
||||||
@@ -147,4 +153,17 @@ public interface BusinessTopic {
|
|||||||
String STREAM_TAG = "streamInfo";
|
String STREAM_TAG = "streamInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface HeartTag {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apf 心跳
|
||||||
|
*/
|
||||||
|
String APF_TAG = "apf";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cld 心跳
|
||||||
|
*/
|
||||||
|
String CLD_TAG = "cld";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.mq.message;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class HeartbeatTimeoutMessage extends BaseMessage implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
private Long timestamp;
|
||||||
|
|
||||||
|
private Integer delayLevel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
import com.njcn.mq.constant.BusinessTopic;
|
||||||
|
import com.njcn.mq.message.HeartbeatTimeoutMessage;
|
||||||
|
import org.apache.rocketmq.client.producer.SendResult;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/11 15:28
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class HeartbeatTimeoutMessageTemplate extends RocketMQEnhanceTemplate {
|
||||||
|
|
||||||
|
public HeartbeatTimeoutMessageTemplate(RocketMQTemplate template) {
|
||||||
|
super(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SendResult sendMember(HeartbeatTimeoutMessage heartbeatTimeoutMessage) {
|
||||||
|
heartbeatTimeoutMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||||
|
return send(BusinessTopic.HEARTBEAT_TIMEOUT_TOPIC, BusinessTopic.HeartTag.APF_TAG, heartbeatTimeoutMessage, heartbeatTimeoutMessage.getDelayLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -239,18 +239,47 @@ public class ExcelUtil {
|
|||||||
* @param strings 下拉内容
|
* @param strings 下拉内容
|
||||||
*/
|
*/
|
||||||
public static void selectList(Workbook workbook, int firstCol, int lastCol, String[] strings) {
|
public static void selectList(Workbook workbook, int firstCol, int lastCol, String[] strings) {
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
// Sheet sheet = workbook.getSheetAt(0);
|
||||||
// 生成下拉列表
|
// // 生成下拉列表
|
||||||
// 只对(x,x)单元格有效
|
// // 只对(x,x)单元格有效
|
||||||
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
// CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
||||||
// 生成下拉框内容
|
// // 生成下拉框内容
|
||||||
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
// DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
||||||
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)
|
// XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)
|
||||||
dvHelper.createExplicitListConstraint(strings);
|
// dvHelper.createExplicitListConstraint(strings);
|
||||||
XSSFDataValidation validation = (XSSFDataValidation) dvHelper.createValidation(
|
// XSSFDataValidation validation = (XSSFDataValidation) dvHelper.createValidation(
|
||||||
dvConstraint, cellRangeAddressList);
|
// dvConstraint, cellRangeAddressList);
|
||||||
// 对sheet页生效
|
// // 对sheet页生效
|
||||||
sheet.addValidationData(validation);
|
// sheet.addValidationData(validation);
|
||||||
|
|
||||||
|
Sheet targetSheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// ===================== 关键:每个下拉用唯一名称的隐藏Sheet =====================
|
||||||
|
String uniqueHiddenName = "dropdown_" + firstCol + "_" + lastCol + "_" + System.currentTimeMillis();
|
||||||
|
Sheet hiddenSheet = workbook.createSheet(uniqueHiddenName);
|
||||||
|
// 隐藏数据源Sheet
|
||||||
|
workbook.setSheetHidden(workbook.getSheetIndex(hiddenSheet), true);
|
||||||
|
|
||||||
|
// 写入选项到隐藏Sheet
|
||||||
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
Row row = hiddenSheet.createRow(i);
|
||||||
|
Cell cell = row.createCell(0);
|
||||||
|
cell.setCellValue(strings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造引用公式(无长度限制)
|
||||||
|
String formula = uniqueHiddenName + "!$A$1:$A$" + strings.length;
|
||||||
|
|
||||||
|
// 下拉作用范围:第3行 ~ 65536行
|
||||||
|
CellRangeAddressList range = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
||||||
|
DataValidationHelper helper = targetSheet.getDataValidationHelper();
|
||||||
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(formula);
|
||||||
|
DataValidation validation = helper.createValidation(constraint, range);
|
||||||
|
|
||||||
|
// 必加:防止下拉冲突、不显示
|
||||||
|
validation.setShowErrorBox(true);
|
||||||
|
validation.setShowPromptBox(true);
|
||||||
|
targetSheet.addValidationData(validation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ import cn.hutool.core.io.FileUtil;
|
|||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -76,6 +78,59 @@ public class PoiUtil {
|
|||||||
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||||
response.setContentType("application/octet-stream;charset=" + CharsetUtil.UTF_8);
|
response.setContentType("application/octet-stream;charset=" + CharsetUtil.UTF_8);
|
||||||
|
//将带*号的列变成红色
|
||||||
|
Sheet sheetAt = workbook.getSheetAt(0);
|
||||||
|
//获取列数
|
||||||
|
int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells();
|
||||||
|
//没有表格标题,只有表格头
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
//获取行
|
||||||
|
Row row = sheetAt.getRow(i);
|
||||||
|
if (Objects.isNull(row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int j = 0; j < physicalNumberOfCells; j++) {
|
||||||
|
//获取单元格对象
|
||||||
|
Cell cell = row.getCell(j);
|
||||||
|
//获取单元格样式对象
|
||||||
|
CellStyle cellStyle = workbook.createCellStyle();
|
||||||
|
//获取单元格内容对象
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontHeightInPoints((short) 12);
|
||||||
|
//一定要装入 样式中才会生效
|
||||||
|
cellStyle.setFont(font);
|
||||||
|
//设置居中对齐
|
||||||
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
//设置单元格字体颜色
|
||||||
|
cell.setCellStyle(cellStyle);
|
||||||
|
//获取当前值
|
||||||
|
String stringCellValue = cell.getStringCellValue();
|
||||||
|
if (stringCellValue.contains("*")) {
|
||||||
|
// 创建一个富文本
|
||||||
|
XSSFRichTextString xssfRichTextString = new XSSFRichTextString(stringCellValue);
|
||||||
|
int startIndex = stringCellValue.indexOf("*");
|
||||||
|
int entIndex = stringCellValue.lastIndexOf("*");
|
||||||
|
if (entIndex != 0) {
|
||||||
|
Font font3 = workbook.createFont();
|
||||||
|
font3.setFontHeightInPoints((short) 12);
|
||||||
|
font3.setColor(Font.COLOR_NORMAL);
|
||||||
|
xssfRichTextString.applyFont(0, entIndex, font3);
|
||||||
|
}
|
||||||
|
//设置带*样式
|
||||||
|
Font font1 = workbook.createFont();
|
||||||
|
font1.setFontHeightInPoints((short) 12);
|
||||||
|
font1.setColor(Font.COLOR_RED);
|
||||||
|
xssfRichTextString.applyFont(startIndex, entIndex + 1, font1);
|
||||||
|
//其他样式
|
||||||
|
Font font2 = workbook.createFont();
|
||||||
|
font2.setFontHeightInPoints((short) 12);
|
||||||
|
font2.setColor(Font.COLOR_NORMAL);
|
||||||
|
xssfRichTextString.applyFont(entIndex + 1, stringCellValue.length(), font2);
|
||||||
|
cell.setCellValue(xssfRichTextString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -347,6 +347,30 @@ public class RedisUtil {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据key模糊查询,并取出所有符合条件的key集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Set<String> scanKeysByPattern(String pattern, int count) {
|
||||||
|
Set<String> keys = new HashSet<>();
|
||||||
|
ScanOptions options = ScanOptions.scanOptions()
|
||||||
|
.match(pattern)
|
||||||
|
.count(count)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Cursor<byte[]> cursor = redisTemplate.getConnectionFactory()
|
||||||
|
.getConnection()
|
||||||
|
.scan(options)) {
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
keys.add(new String(cursor.next()));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("扫描Redis keys失败", e);
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据切库
|
* 数据切库
|
||||||
* @param dbIndex
|
* @param dbIndex
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ public class LineALLInfoDTO {
|
|||||||
private Integer num;
|
private Integer num;
|
||||||
@ApiModelProperty(name = "objName",value = "监测点对象名称")
|
@ApiModelProperty(name = "objName",value = "监测点对象名称")
|
||||||
private String objName;
|
private String objName;
|
||||||
|
@ApiModelProperty(name = "objName",value = "电网侧监测点对象名称Id")
|
||||||
|
private String objId;
|
||||||
|
@ApiModelProperty(name = "objName",value = "电网侧监测点对象名称")
|
||||||
|
private String objName2;
|
||||||
|
|
||||||
@ApiModelProperty(name = "loadType",value = "监测对象类型")
|
@ApiModelProperty(name = "loadType",value = "监测对象类型")
|
||||||
private String loadType;
|
private String loadType;
|
||||||
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
||||||
|
|||||||
@@ -22,65 +22,65 @@ import java.math.BigDecimal;
|
|||||||
public class TerminalBaseExcel implements Serializable {
|
public class TerminalBaseExcel implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "项目", width = 15)
|
@Excel(name = "*项目", width = 15)
|
||||||
@NotBlank(message = DeviceValidMessage.PROJECT_NAME_NOT)
|
@NotBlank(message = DeviceValidMessage.PROJECT_NAME_NOT)
|
||||||
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = DeviceValidMessage.PROJECT_NAME_RULE)
|
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = DeviceValidMessage.PROJECT_NAME_RULE)
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
@Excel(name = "工程", width = 15)
|
@Excel(name = "*省份", width = 15)
|
||||||
@NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
|
@NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
|
||||||
private String provinceName;
|
private String provinceName;
|
||||||
|
|
||||||
@Excel(name = "单位", width = 15)
|
@Excel(name = "*供电公司", width = 15)
|
||||||
@NotBlank(message = "供电公司名称")
|
@NotBlank(message = "供电公司名称")
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "供电公司名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "供电公司名称违规")
|
||||||
private String gdName;
|
private String gdName;
|
||||||
|
|
||||||
@Excel(name = "部门", width = 15)
|
@Excel(name = "*变电站", width = 15)
|
||||||
@NotBlank(message = "变电站名称不可为空")
|
@NotBlank(message = "变电站名称不可为空")
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "变电站名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "变电站名称违规")
|
||||||
private String substationName;
|
private String substationName;
|
||||||
|
|
||||||
@Excel(name = "部门电压等级", width = 15)
|
@Excel(name = "*变电站电压等级", width = 15)
|
||||||
@NotBlank(message = "电压等级不可为空")
|
@NotBlank(message = "变电站电压等级不可为空")
|
||||||
private String subStationScale;
|
private String subStationScale;
|
||||||
|
|
||||||
@Excel(name = "经度", width = 15)
|
@Excel(name = "*经度", width = 15)
|
||||||
private BigDecimal lng;
|
private BigDecimal lng;
|
||||||
|
|
||||||
@Excel(name = "纬度", width = 15)
|
@Excel(name = "*纬度", width = 15)
|
||||||
private BigDecimal lat;
|
private BigDecimal lat;
|
||||||
|
|
||||||
@Excel(name = "终端", width = 15)
|
@Excel(name = "*装置名称", width = 15)
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "设备名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "装置名称违规")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
@Excel(name = "终端模型", replace = {"虚拟设备_0", "实际设备_1", "离线设备_2"}, width = 15)
|
@Excel(name = "*终端模型", replace = {"虚拟设备_0", "实际设备_1", "离线设备_2"}, width = 15)
|
||||||
@NotNull(message = "设备模型不能为空")
|
@NotNull(message = "设备模型不能为空")
|
||||||
private Integer devModel;
|
private Integer devModel;
|
||||||
|
|
||||||
@Excel(name = "数据类型", replace = {"暂态系统_0", "稳态系统_1", "双系统_2"}, width = 15)
|
@Excel(name = "*数据类型", replace = {"暂态系统_0", "稳态系统_1", "双系统_2"}, width = 15)
|
||||||
@NotNull(message = "数据类型不能为空")
|
@NotNull(message = "数据类型不能为空")
|
||||||
private Integer devDataType;
|
private Integer devDataType;
|
||||||
|
|
||||||
@Excel(name = "运行状态", replace = {"投运_0", "热备用_1", "停运_2"}, width = 15)
|
@Excel(name = "*运行状态", replace = {"投运_0", "热备用_1", "停运_2"}, width = 15)
|
||||||
@NotNull(message = "运行状态不能为空")
|
@NotNull(message = "运行状态不能为空")
|
||||||
private Integer runFlag;
|
private Integer runFlag;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "终端厂家", width = 15)
|
@Excel(name = "*终端厂家", width = 15)
|
||||||
@NotBlank(message = "终端厂家不能为空")
|
@NotBlank(message = "终端厂家不能为空")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
@Excel(name = "设备型号", width = 15)
|
@Excel(name = "*设备型号", width = 15)
|
||||||
@NotBlank(message = "设备型号不能为空")
|
@NotBlank(message = "设备型号不能为空")
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
@Excel(name = "网络参数", width = 15)
|
@Excel(name = "*网络参数", width = 15)
|
||||||
@NotBlank(message = "设备网络参数不能为空")
|
@NotBlank(message = "设备网络参数不能为空")
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
@Excel(name = "端口", width = 15)
|
@Excel(name = "*端口", width = 15)
|
||||||
@Range(min = 1, max = 100000, message = "端口号违规")
|
@Range(min = 1, max = 100000, message = "端口号违规")
|
||||||
@NotNull(message = "设备端口号不能为空")
|
@NotNull(message = "设备端口号不能为空")
|
||||||
private Integer port;
|
private Integer port;
|
||||||
@@ -91,15 +91,15 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "终端秘钥", width = 15)
|
@Excel(name = "终端秘钥", width = 15)
|
||||||
private String devKey;
|
private String devKey;
|
||||||
|
|
||||||
@Excel(name = "召唤标志",replace = {"周期触发_0", "变为触发_1"}, width = 15)
|
@Excel(name = "*召唤标志",replace = {"周期触发_0", "变为触发_1"}, width = 15)
|
||||||
@NotNull(message = "召唤标志不为空")
|
@NotNull(message = "召唤标志不为空")
|
||||||
private Integer callFlag;
|
private Integer callFlag;
|
||||||
|
|
||||||
@Excel(name = "前置名称", width = 15)
|
@Excel(name = "*前置名称", width = 15)
|
||||||
@NotBlank(message = "前置名称不能为空")
|
@NotBlank(message = "前置名称不能为空")
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
|
|
||||||
@Excel(name = "前置类型", width = 15)
|
@Excel(name = "*前置类型", width = 15)
|
||||||
@NotBlank(message = "前置类型不能为空")
|
@NotBlank(message = "前置类型不能为空")
|
||||||
private String frontType;
|
private String frontType;
|
||||||
|
|
||||||
@@ -109,71 +109,71 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "SIM卡号", width = 15)
|
@Excel(name = "SIM卡号", width = 15)
|
||||||
private String sim;
|
private String sim;
|
||||||
|
|
||||||
@Excel(name = "母线", width = 15)
|
@Excel(name = "*母线", width = 15)
|
||||||
@NotBlank(message = "母线名称不能为空")
|
@NotBlank(message = "母线名称不能为空")
|
||||||
private String subvName;
|
private String subvName;
|
||||||
|
|
||||||
@Excel(name = "母线号", width = 15)
|
@Excel(name = "*母线号", width = 15)
|
||||||
@NotNull(message = "母线号不为空")
|
@NotNull(message = "母线号不为空")
|
||||||
private Integer subvNum;
|
private Integer subvNum;
|
||||||
|
|
||||||
@Excel(name = "母线电压等级", width = 15)
|
@Excel(name = "*母线电压等级", width = 15)
|
||||||
@NotBlank(message = "母线电压等级不能为空")
|
@NotBlank(message = "母线电压等级不能为空")
|
||||||
private String subvScale;
|
private String subvScale;
|
||||||
|
|
||||||
@Excel(name = "母线模型", replace = {"虚拟母线_0", "实际母线_1"}, width = 15)
|
@Excel(name = "*母线模型", replace = {"虚拟母线_0", "实际母线_1"}, width = 15)
|
||||||
@NotNull(message = "母线模型不为空")
|
@NotNull(message = "母线模型不为空")
|
||||||
private Integer subvModel;
|
private Integer subvModel;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "监测点名称", width = 15)
|
@Excel(name = "*监测点名称", width = 15)
|
||||||
@NotBlank(message = "监测点名称不能为空")
|
@NotBlank(message = "监测点名称不能为空")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
@Excel(name = "监测点线路号", width = 15)
|
@Excel(name = "*监测点线路号", width = 15)
|
||||||
@NotNull(message = "监测点线路号不为空")
|
@NotNull(message = "监测点线路号不为空")
|
||||||
private Integer lineNum;
|
private Integer lineNum;
|
||||||
|
|
||||||
@Excel(name = "监测点等级", width = 15)
|
@Excel(name = "*监测点等级", width = 15)
|
||||||
private String lineGrade;
|
private String lineGrade;
|
||||||
|
|
||||||
@Excel(name = "pt", width = 20)
|
@Excel(name = "*pt(格式pt1/pt2)", width = 20)
|
||||||
@NotBlank(message = "pt不能为空")
|
@NotBlank(message = "pt不能为空")
|
||||||
private String pt;
|
private String pt;
|
||||||
|
|
||||||
@Excel(name = "ct", width = 20)
|
@Excel(name = "*ct(格式ct1/ct2)", width = 20)
|
||||||
@NotBlank(message = "ct不能为空")
|
@NotBlank(message = "ct不能为空")
|
||||||
private String ct;
|
private String ct;
|
||||||
|
|
||||||
@Excel(name = "设备容量", width = 15)
|
@Excel(name = "*设备容量", width = 15)
|
||||||
@NotNull(message = "设备容量不为空")
|
@NotNull(message = "设备容量不为空")
|
||||||
private Float devCapacity;
|
private Float devCapacity;
|
||||||
|
|
||||||
@Excel(name = "短路容量", width = 15)
|
@Excel(name = "*短路容量", width = 15)
|
||||||
@NotNull(message = "短路容量不为空")
|
@NotNull(message = "短路容量不为空")
|
||||||
private Float shortCapacity;
|
private Float shortCapacity;
|
||||||
|
|
||||||
@Excel(name = "基准容量", width = 15)
|
@Excel(name = "*基准容量", width = 15)
|
||||||
@NotNull(message = "基准容量不为空")
|
@NotNull(message = "基准容量不为空")
|
||||||
private Float standardCapacity;
|
private Float standardCapacity;
|
||||||
|
|
||||||
@Excel(name = "协议容量", width = 15)
|
@Excel(name = "*协议容量", width = 15)
|
||||||
@NotNull(message = "协议容量不为空")
|
@NotNull(message = "协议容量不为空")
|
||||||
private Float dealCapacity;
|
private Float dealCapacity;
|
||||||
|
|
||||||
@Excel(name = "接线方式", replace = {"星型接法_0", "三角型接法_1", "开口三角型接法_2"}, width = 15)
|
@Excel(name = "*接线方式", replace = {"星型接法_0", "三角型接法_1", "开口三角型接法_2"}, width = 15)
|
||||||
@NotNull(message = "接线方式不为空")
|
@NotNull(message = "接线方式不为空")
|
||||||
private Integer ptType;
|
private Integer ptType;
|
||||||
|
|
||||||
@Excel(name = "测量间隔", width = 15)
|
@Excel(name = "*测量间隔", width = 15)
|
||||||
@NotNull(message = "测量间隔不为空")
|
@NotNull(message = "测量间隔不为空")
|
||||||
private Integer timeInterval;
|
private Integer timeInterval;
|
||||||
|
|
||||||
@Excel(name = "干扰源类型", width = 15)
|
@Excel(name = "*干扰源类型", width = 15)
|
||||||
@NotBlank(message = "干扰源类型不为空")
|
@NotBlank(message = "干扰源类型不为空")
|
||||||
private String loadType;
|
private String loadType;
|
||||||
|
|
||||||
@Excel(name = "行业类型", width = 15)
|
@Excel(name = "*行业类型", width = 15)
|
||||||
@NotBlank(message = "行业类型不为空")
|
@NotBlank(message = "行业类型不为空")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
@@ -183,11 +183,11 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "监测点对象名称", width = 15)
|
@Excel(name = "监测点对象名称", width = 15)
|
||||||
private String objName;
|
private String objName;
|
||||||
|
|
||||||
@Excel(name = "电网侧标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
|
@Excel(name = "*电网侧标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
|
||||||
@NotNull(message = "电网侧标志不为空")
|
@NotNull(message = "电网侧标志不为空")
|
||||||
private Integer powerFlag;
|
private Integer powerFlag;
|
||||||
|
|
||||||
@Excel(name = "人为干预统计", replace = {"不参与统计_0", "参与统计_1"}, width = 15)
|
@Excel(name = "*人为干预统计", replace = {"不参与统计_0", "参与统计_1"}, width = 15)
|
||||||
@NotNull(message = "统计标志不为空")
|
@NotNull(message = "统计标志不为空")
|
||||||
private Integer statFlag;
|
private Integer statFlag;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.device.pq.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:请求装置文件系统参数
|
||||||
|
* Date: 2026/04/30 上午 10:51【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AskFileSysParam {
|
||||||
|
|
||||||
|
private String devId;
|
||||||
|
private String path;
|
||||||
|
private String remotePath;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,14 +6,14 @@ package com.njcn.device.pq.controller;
|
|||||||
* @Description: 异常告警数据指标范围
|
* @Description: 异常告警数据指标范围
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
|
||||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.device.device.service.DeviceProcessService;
|
||||||
|
import com.njcn.device.device.service.IDeviceService;
|
||||||
|
import com.njcn.device.pq.pojo.param.AskFileSysParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.Device;
|
||||||
|
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||||
|
import com.njcn.message.api.ProduceFeignClient;
|
||||||
|
import com.njcn.message.message.AskFileSysMessage;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2026/04/29 上午 11:41【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dir")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "装置文件系统")
|
||||||
|
public class DirectoryController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
private final ProduceFeignClient produceFeignClient;
|
||||||
|
|
||||||
|
|
||||||
|
private final PendingRequestManager pendingRequestManager;
|
||||||
|
|
||||||
|
private final IDeviceService iDeviceService;
|
||||||
|
private final DeviceProcessService deviceProcessService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("获取装置文件目录")
|
||||||
|
public DeferredResult<Object> listDirectory(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("listDirectory");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(0);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/downLoadFile")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("获取装置文件文件")
|
||||||
|
public DeferredResult<Object> downLoadFile(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("downLoadFile");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(1);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/upLoadFile")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("上传装置文件文件")
|
||||||
|
public DeferredResult<Object> upLoadFile(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("upLoadFile");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(2);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
askFileSysMessage.setRemotePath(askFileSysParam.getRemotePath());
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("装置目录,文件删除")
|
||||||
|
public DeferredResult<Object> delete(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(3);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
askFileSysMessage.setRemotePath(askFileSysParam.getRemotePath());
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/restart")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("装置重启")
|
||||||
|
public DeferredResult<Object> restart(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("restart");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setPath("reboot");
|
||||||
|
askFileSysMessage.setType(4);
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class PendingRequestManager {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
// 本地映射:msgId -> DeferredResult,主要用于超时清理和主动完成
|
||||||
|
private final ConcurrentHashMap<String, DeferredResult<Object>> deferredResultMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 创建挂起请求
|
||||||
|
public DeferredResult<Object> createPendingRequest(String msgId, long timeoutMs) {
|
||||||
|
DeferredResult<Object> deferredResult = new DeferredResult<>(timeoutMs);
|
||||||
|
// 超时回调
|
||||||
|
deferredResult.onTimeout(() -> {
|
||||||
|
// 清理 Redis 中的等待记录
|
||||||
|
redisTemplate.delete("pending:" + msgId);
|
||||||
|
deferredResultMap.remove(msgId);
|
||||||
|
deferredResult.setErrorResult(new BusinessException("前置超时...."));
|
||||||
|
});
|
||||||
|
// 完成回调(正常或异常后移出本地映射)
|
||||||
|
deferredResult.onCompletion(() -> deferredResultMap.remove(msgId));
|
||||||
|
|
||||||
|
deferredResultMap.put(msgId, deferredResult);
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收到 Redis 通知后,根据 msgId 完成请求
|
||||||
|
public void completeRequest(String msgId) {
|
||||||
|
if (deferredResultMap.containsKey(msgId)) {
|
||||||
|
DeferredResult<Object> deferredResult = deferredResultMap.get(msgId);
|
||||||
|
|
||||||
|
// 从 Redis 中获取结果内容
|
||||||
|
String key = "pending:" + msgId;
|
||||||
|
Object result = redisTemplate.opsForValue().get(key);
|
||||||
|
if (result != null) {
|
||||||
|
deferredResult.setResult( HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result,""));
|
||||||
|
} else {
|
||||||
|
log.info("Receive notification for unknown msgId: " + msgId);
|
||||||
|
deferredResult.setErrorResult(new BusinessException("前置未返回结果"));
|
||||||
|
}
|
||||||
|
// 清理 Redis 中的记录(可选,利用过期时间自动删除也可)
|
||||||
|
redisTemplate.delete(key);
|
||||||
|
} else {
|
||||||
|
// 可能请求已超时被移除了,仅记录日志即可
|
||||||
|
log.info("Receive notification for unknown msgId: " + msgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RedisMessageSubscriber implements MessageListener {
|
||||||
|
@Autowired
|
||||||
|
private PendingRequestManager pendingRequestManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Message message, byte[] pattern) {
|
||||||
|
String msgId = new String(message.getBody(), StandardCharsets.UTF_8);
|
||||||
|
pendingRequestManager.completeRequest(msgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import com.njcn.redis.config.RedisConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.listener.ChannelTopic;
|
||||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2026/04/29 下午 3:37【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Import(RedisConfig.class) // 引入公共配置
|
||||||
|
public class RedisSubscriptionConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisMessageListenerContainer redisContainer(
|
||||||
|
RedisConnectionFactory connectionFactory,
|
||||||
|
MessageListenerAdapter resultListenerAdapter) {
|
||||||
|
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||||
|
container.setConnectionFactory(connectionFactory);
|
||||||
|
container.addMessageListener(resultListenerAdapter, new ChannelTopic("result_ready_channel"));
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MessageListenerAdapter resultListenerAdapter(RedisMessageSubscriber subscriber) {
|
||||||
|
return new MessageListenerAdapter(subscriber, "onMessage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ import com.njcn.message.constant.RedisKeyPrefix;
|
|||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -35,6 +36,7 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@ConditionalOnProperty(name = "business.task-enabled", havingValue = "true", matchIfMissing = true)
|
||||||
public class DeviceComflagTasks {
|
public class DeviceComflagTasks {
|
||||||
private final NodeMapper nodeMapper;
|
private final NodeMapper nodeMapper;
|
||||||
private final IDeviceService iDeviceService;
|
private final IDeviceService iDeviceService;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.device.pq.mapper;
|
package com.njcn.device.pq.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.njcn.device.pq.service;
|
package com.njcn.device.pq.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -9,20 +9,17 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.algorithm.pojo.api.PqReasonableRangeFeignClient;
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient;
|
import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataLimitRateFeignClient;
|
import com.njcn.dataProcess.api.DataLimitRateFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataLimitTargetFeignClient;
|
import com.njcn.dataProcess.api.DataLimitTargetFeignClient;
|
||||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
|
||||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
|
||||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
import com.njcn.device.line.service.DeptLineService;
|
import com.njcn.device.line.service.DeptLineService;
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.algorithm.pojo.api.PqReasonableRangeFeignClient;
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
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.mapper.onlinerate.OnLineRateMapper;
|
||||||
import com.njcn.device.common.service.GeneralDeviceService;
|
import com.njcn.device.common.service.GeneralDeviceService;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package com.njcn.device.pq.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.device.biz.commApi.CommLineClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
|
||||||
import com.njcn.device.common.service.GeneralDeviceService;
|
import com.njcn.device.common.service.GeneralDeviceService;
|
||||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
@@ -66,6 +69,7 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
private final GeneralDeviceService deviceService;
|
private final GeneralDeviceService deviceService;
|
||||||
private final LineService lineService;
|
private final LineService lineService;
|
||||||
private final UserLedgerService userLedgerService;
|
private final UserLedgerService userLedgerService;
|
||||||
|
private final CommLineClient commLineClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Float getTotalIntegrityByLineIds(LineBaseQueryParam param) {
|
public Float getTotalIntegrityByLineIds(LineBaseQueryParam param) {
|
||||||
@@ -146,6 +150,9 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
@Override
|
@Override
|
||||||
public DeviceOnlineRate getData(DeviceInfoParam.BusinessParam param) {
|
public DeviceOnlineRate getData(DeviceInfoParam.BusinessParam param) {
|
||||||
DeviceOnlineRate rate = new DeviceOnlineRate();
|
DeviceOnlineRate rate = new DeviceOnlineRate();
|
||||||
|
//BusinessParam的searchvalue只匹配监测点名称现在要匹配电站,监测点,监测点对象名称,所以穿空再添加过滤逻辑
|
||||||
|
String tempSearchValue=param.getSearchValue();
|
||||||
|
param.setSearchValue("");
|
||||||
//获取终端台账类信息
|
//获取终端台账类信息
|
||||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, null, Collections.singletonList(1));
|
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, null, Collections.singletonList(1));
|
||||||
if (CollUtil.isNotEmpty(deviceInfo)) {
|
if (CollUtil.isNotEmpty(deviceInfo)) {
|
||||||
@@ -154,14 +161,55 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
.stream()
|
.stream()
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
rate.setTotalNum(lineIds.size());
|
List<String> filterLineList = new ArrayList<>();
|
||||||
//获取所有监测点的数据完整性
|
|
||||||
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
|
|
||||||
//获取所有监测点信息信息
|
|
||||||
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
|
|
||||||
|
|
||||||
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, lineIds.size()) : lineIds.size());
|
if(CollectionUtil.isNotEmpty(lineIds)){
|
||||||
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, lineIds).doubleValue()>100.0?BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
//根据searchvalue过滤
|
||||||
|
List<LineALLInfoDTO> data = commLineClient.getLineAllDetailList(lineIds).getData();
|
||||||
|
filterLineList= data.stream()
|
||||||
|
.filter(dto -> {
|
||||||
|
LineALLInfoDTO.LineLineDTO lineDTO = dto.getLineLineDTO();
|
||||||
|
String linename = lineDTO != null ? lineDTO.getLinename() : null;
|
||||||
|
String objName2 = lineDTO != null ? lineDTO.getObjName2() : null;
|
||||||
|
|
||||||
|
LineALLInfoDTO.LineSubStationDTO subStationDTO = dto.getLineSubStationDTO();
|
||||||
|
String subStationName = subStationDTO != null ? subStationDTO.getSubStationName() : null;
|
||||||
|
|
||||||
|
// 大小写敏感的模糊匹配(相当于 MySQL 的 LIKE '%keyword%')
|
||||||
|
return (linename != null && linename.contains(tempSearchValue))
|
||||||
|
|| (objName2 != null && objName2.contains(tempSearchValue))
|
||||||
|
|| (subStationName != null && subStationName.contains(tempSearchValue));
|
||||||
|
}).map(dto -> dto.getLineLineDTO() != null ? dto.getLineLineDTO().getLineId() : null)
|
||||||
|
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
rate.setTotalNum(filterLineList.size());
|
||||||
|
List<String> finalFilterLineList = filterLineList;
|
||||||
|
//根据过滤后监测点过滤
|
||||||
|
deviceInfo= deviceInfo.stream()
|
||||||
|
.filter(dto -> {
|
||||||
|
List<String> original = dto.getLineIndexes();
|
||||||
|
if (original == null || original.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 计算交集
|
||||||
|
List<String> intersection = original.stream()
|
||||||
|
.filter(finalFilterLineList::contains)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (intersection.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 更新当前 DTO 的 lineIndexes 为交集
|
||||||
|
dto.setLineIndexes(intersection);
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()); //获取所有监测点的数据完整性
|
||||||
|
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(filterLineList, param.getSearchBeginTime(), param.getSearchEndTime());
|
||||||
|
//获取所有监测点信息信息
|
||||||
|
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(filterLineList);
|
||||||
|
|
||||||
|
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, filterLineList.size()) : lineIds.size());
|
||||||
|
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, filterLineList).doubleValue()>100.0?BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
||||||
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
|
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
|
||||||
DeviceOnlineRate.CitDetail citDetail;
|
DeviceOnlineRate.CitDetail citDetail;
|
||||||
DeviceOnlineRate.LineDetail detail;
|
DeviceOnlineRate.LineDetail detail;
|
||||||
@@ -174,12 +222,13 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
|
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
|
||||||
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
|
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
|
||||||
citDetail = new DeviceOnlineRate.CitDetail();
|
citDetail = new DeviceOnlineRate.CitDetail();
|
||||||
|
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||||
|
|
||||||
citDetail.setCitName(dto.getName());
|
citDetail.setCitName(dto.getName());
|
||||||
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
||||||
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
|
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
|
||||||
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()).doubleValue()>100.0?BigDecimal.valueOf(100.0):calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()).doubleValue()>100.0?BigDecimal.valueOf(100.0):calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
||||||
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
||||||
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
|
||||||
for (LineDetailVO.Detail line : lineDetail) {
|
for (LineDetailVO.Detail line : lineDetail) {
|
||||||
detail = new DeviceOnlineRate.LineDetail();
|
detail = new DeviceOnlineRate.LineDetail();
|
||||||
detail.setCit(line.getDeptName());
|
detail.setCit(line.getDeptName());
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package com.njcn.device.pq.service.impl;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
import com.njcn.device.pq.mapper.ReasonableRangeMapper;
|
import com.njcn.device.pq.mapper.ReasonableRangeMapper;
|
||||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.njcn.device.device.mapper.DeviceMapper;
|
|||||||
import com.njcn.device.device.service.DeviceBakService;
|
import com.njcn.device.device.service.DeviceBakService;
|
||||||
import com.njcn.device.device.service.DeviceProcessService;
|
import com.njcn.device.device.service.DeviceProcessService;
|
||||||
import com.njcn.device.device.service.NodeDeviceService;
|
import com.njcn.device.device.service.NodeDeviceService;
|
||||||
|
import com.njcn.device.device.service.PqDevTypeService;
|
||||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
@@ -74,6 +75,8 @@ import com.njcn.oss.utils.FileStorageUtil;
|
|||||||
import com.njcn.poi.excel.ExcelUtil;
|
import com.njcn.poi.excel.ExcelUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
|
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
@@ -140,6 +143,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
private final DeviceProcessService deviceProcessService;
|
private final DeviceProcessService deviceProcessService;
|
||||||
private final ProduceFeignClient produceFeignClient;
|
private final ProduceFeignClient produceFeignClient;
|
||||||
private final UserLedgerService userLedgerService;
|
private final UserLedgerService userLedgerService;
|
||||||
|
private final PqDevTypeService pqDevTypeService;
|
||||||
|
|
||||||
@Value("${oracle.isSync}")
|
@Value("${oracle.isSync}")
|
||||||
private Boolean isSync;
|
private Boolean isSync;
|
||||||
@@ -1731,18 +1735,24 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
|
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
|
||||||
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
||||||
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
||||||
List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
|
// List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
|
||||||
|
List<PqDevType> devTypeList = pqDevTypeService.list(new LambdaQueryWrapper<PqDevType>()
|
||||||
|
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.orderByDesc(PqDevType::getCreateTime));
|
||||||
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
|
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
|
||||||
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
List<UserLedgerVO> userLedgerVOS = userLedgerService.selectUserList(new UserReportParam());
|
||||||
List<Node> nodeList = nodeService.nodeAllList();
|
List<Node> nodeList = nodeService.nodeAllList();
|
||||||
|
|
||||||
|
ExcelUtil.selectList(workbook, 4, 4, scaleList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
|
ExcelUtil.selectList(workbook, 40, 40, userLedgerVOS.stream().map(UserLedgerVO::getProjectName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
|
|
||||||
//这里是自己加的 带下拉框的代码
|
//这里是自己加的 带下拉框的代码
|
||||||
ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"});
|
ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"});
|
||||||
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
|
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
|
||||||
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
|
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
|
||||||
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(PqDevType::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
|
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
|
||||||
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
@@ -1760,6 +1770,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
|
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
|
||||||
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
|
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
|
||||||
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2729,6 +2741,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/5/18
|
* @date 2022/5/18
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
private void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
private void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
||||||
List<TerminalBaseExcel.TerminalBaseExcelMsg> terminalBaseExcelMsgs = new ArrayList<>();
|
List<TerminalBaseExcel.TerminalBaseExcelMsg> terminalBaseExcelMsgs = new ArrayList<>();
|
||||||
//任意集合数据为空,不处理
|
//任意集合数据为空,不处理
|
||||||
@@ -2844,10 +2857,16 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//处理终端类型
|
//处理终端类型
|
||||||
DictData devTypeDicData = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getDevType()).getData();
|
DictData devTypeDicData = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getDevType()).getData();
|
||||||
|
PqDevType one = new PqDevType();
|
||||||
if (Objects.isNull(devTypeDicData)) {
|
if (Objects.isNull(devTypeDicData)) {
|
||||||
|
//上边逻辑不删兼容旧版本,新版本查询pq_dev_type
|
||||||
|
one = pqDevTypeService.lambdaQuery().eq(PqDevType::getName, terminalBaseExcel.getDevType()).eq(PqDevType::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
|
if(Objects.isNull(one)){
|
||||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典装置型号不存在"));
|
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典装置型号不存在"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
this.baseMapper.insert(temp);
|
this.baseMapper.insert(temp);
|
||||||
Device device = new Device();
|
Device device = new Device();
|
||||||
BeanUtils.copyProperties(terminalBaseExcel, device);
|
BeanUtils.copyProperties(terminalBaseExcel, device);
|
||||||
@@ -2856,7 +2875,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
device.setIp(terminalBaseExcel.getIp());
|
device.setIp(terminalBaseExcel.getIp());
|
||||||
device.setNodeId(node.getId());
|
device.setNodeId(node.getId());
|
||||||
device.setFrontType(frontTypeDicData.getId());
|
device.setFrontType(frontTypeDicData.getId());
|
||||||
device.setDevType(devTypeDicData.getId());
|
device.setDevType(Objects.isNull(devTypeDicData)?one.getId():devTypeDicData.getId());
|
||||||
device.setComFlag(0);
|
device.setComFlag(0);
|
||||||
device.setCheckFlag(1);
|
device.setCheckFlag(1);
|
||||||
device.setLoginTime(LocalDate.now());
|
device.setLoginTime(LocalDate.now());
|
||||||
@@ -2865,7 +2884,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
device.setUpdateTime(LocalDateTime.now());
|
device.setUpdateTime(LocalDateTime.now());
|
||||||
device.setElectroplate(0);
|
device.setElectroplate(0);
|
||||||
device.setOnTime(1);
|
device.setOnTime(1);
|
||||||
|
//处理装置识别码秘钥
|
||||||
|
coderM3d(device, false);
|
||||||
deviceMapper.insert(device);
|
deviceMapper.insert(device);
|
||||||
|
//分配前置进程
|
||||||
|
nodeDeviceService.oneKeyDistribution(node.getId());
|
||||||
}
|
}
|
||||||
//添加终端索引
|
//添加终端索引
|
||||||
pids.add(temp.getId());
|
pids.add(temp.getId());
|
||||||
@@ -2892,6 +2915,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//处理电压等级字典表
|
//处理电压等级字典表
|
||||||
DictData subvScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
DictData subvScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
|
||||||
if (Objects.isNull(subvScale)) {
|
if (Objects.isNull(subvScale)) {
|
||||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级:" + terminalBaseExcel.getSubStationScale() + "不存在"));
|
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级:" + terminalBaseExcel.getSubStationScale() + "不存在"));
|
||||||
continue;
|
continue;
|
||||||
@@ -2969,8 +2993,17 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
lineDetail.setPt2(Float.valueOf(pt[1]));
|
lineDetail.setPt2(Float.valueOf(pt[1]));
|
||||||
lineDetail.setCt1(Float.valueOf(ct[0]));
|
lineDetail.setCt1(Float.valueOf(ct[0]));
|
||||||
lineDetail.setCt2(Float.valueOf(ct[1]));
|
lineDetail.setCt2(Float.valueOf(ct[1]));
|
||||||
|
if(StringUtils.isNoneBlank(terminalBaseExcel.getObjName())){
|
||||||
|
UserReportPO one = userLedgerService.lambdaQuery().eq(UserReportPO::getProjectName, terminalBaseExcel.getObjName())
|
||||||
|
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
|
if(Objects.nonNull(one)){
|
||||||
|
lineDetail.setObjId(one.getId());
|
||||||
|
|
||||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
|
||||||
lineDetailMapper.insert(lineDetail);
|
lineDetailMapper.insert(lineDetail);
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), null, null);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), null, null);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.njcn.influx.imapper.PqsCommunicateMapper;
|
|||||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
|
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
@@ -616,6 +617,11 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
lineLineDTO.setLinename(lineName);
|
lineLineDTO.setLinename(lineName);
|
||||||
lineLineDTO.setNum(lineDetail.getNum());
|
lineLineDTO.setNum(lineDetail.getNum());
|
||||||
lineLineDTO.setObjName(lineDetail.getObjName());
|
lineLineDTO.setObjName(lineDetail.getObjName());
|
||||||
|
lineLineDTO.setObjId(lineDetail.getObjId());
|
||||||
|
if(StringUtils.isNotEmpty(lineDetail.getObjId())){
|
||||||
|
UserReportVO userReportVO = userLedgerService.getUserReportById(lineDetail.getObjId());
|
||||||
|
lineLineDTO.setObjName2(userReportVO.getProjectName());
|
||||||
|
}
|
||||||
lineLineDTO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
lineLineDTO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
||||||
//电压使用母线电压
|
//电压使用母线电压
|
||||||
lineLineDTO.setVoltageLevel(dicDataFeignClient.getDicDataById(voltage.getScale()).getData().getName());
|
lineLineDTO.setVoltageLevel(dicDataFeignClient.getDicDataById(voltage.getScale()).getData().getName());
|
||||||
|
|||||||
@@ -187,14 +187,14 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
if (device.getRunFlag() == 0) {
|
if (device.getRunFlag() == 0) {
|
||||||
newFlag = "投运";
|
newFlag = "投运";
|
||||||
} else if (device.getRunFlag() == 1) {
|
} else if (device.getRunFlag() == 1) {
|
||||||
newFlag = "热备用";
|
newFlag = "检修";
|
||||||
} else if (device.getRunFlag() == 2) {
|
} else if (device.getRunFlag() == 2) {
|
||||||
newFlag = "停运";
|
newFlag = "停运";
|
||||||
}
|
}
|
||||||
if (device1.getRunFlag() == 0) {
|
if (device1.getRunFlag() == 0) {
|
||||||
oldFlag = "投运";
|
oldFlag = "投运";
|
||||||
} else if (device1.getRunFlag() == 1) {
|
} else if (device1.getRunFlag() == 1) {
|
||||||
oldFlag = "热备用";
|
oldFlag = "检修";
|
||||||
} else if (device1.getRunFlag() == 2) {
|
} else if (device1.getRunFlag() == 2) {
|
||||||
oldFlag = "停运";
|
oldFlag = "停运";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.njcn.event.common.service;
|
package com.njcn.event.common.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.EventBaseParam;
|
||||||
|
import com.njcn.event.pojo.param.StatisticsParam;
|
||||||
import com.njcn.event.pojo.vo.*;
|
import com.njcn.event.pojo.vo.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,8 +79,6 @@ public interface EventAnalysisService {
|
|||||||
*/
|
*/
|
||||||
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*监测点事件波形下载
|
*监测点事件波形下载
|
||||||
* @author zbj
|
* @author zbj
|
||||||
@@ -88,6 +86,20 @@ public interface EventAnalysisService {
|
|||||||
*/
|
*/
|
||||||
//HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception;
|
//HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判定压降落点区域
|
||||||
|
* <p>
|
||||||
|
* 入参:
|
||||||
|
* eventValue 特征幅值(百分比形式,如 "80.5" 表示 80.5%),内部 /100 得到 VVm(0~1)
|
||||||
|
* persistTime 持续时间(秒)
|
||||||
|
* <p>
|
||||||
|
* 优先规则:
|
||||||
|
* 1) 持续时间 < 0.001 秒 或 VVm = 0 → A区
|
||||||
|
* 2) 按区间表逐行匹配(左闭右开 [下限, 上限))
|
||||||
|
* 3) 都不匹配返回 null,由调用方走兜底
|
||||||
|
*
|
||||||
|
* @return 区域名(A区/B区/C区/D区);解析失败或未匹配返回 null
|
||||||
|
*/
|
||||||
|
String determineDropZone(String eventValue, String persistTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
@@ -13,6 +12,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
|
import com.njcn.event.common.service.EventAnalysisService;
|
||||||
import com.njcn.event.common.service.EventDetailService;
|
import com.njcn.event.common.service.EventDetailService;
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||||
@@ -21,19 +21,20 @@ import com.njcn.event.pojo.param.StatisticsParam;
|
|||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.event.pojo.vo.*;
|
import com.njcn.event.pojo.vo.*;
|
||||||
import com.njcn.event.common.service.EventAnalysisService;
|
|
||||||
import com.njcn.influx.utils.InfluxDbUtils;
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.influxdb.dto.QueryResult;
|
import org.influxdb.dto.QueryResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.text.ParseException;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@@ -51,6 +52,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class EventAnalysisServiceImpl implements EventAnalysisService {
|
public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||||
|
|
||||||
// 定义阈值常量(单位:百分比)
|
// 定义阈值常量(单位:百分比)
|
||||||
@@ -1727,6 +1729,75 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String determineDropZone(String eventValue, String persistTime) {
|
||||||
|
if (eventValue == null || eventValue.trim().isEmpty()
|
||||||
|
|| persistTime == null || persistTime.trim().isEmpty()) {
|
||||||
|
log.warn("判定压降落点区域入参为空,eventValue={}, persistTime={}", eventValue, persistTime);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BigDecimal vvm;
|
||||||
|
BigDecimal vvtm;
|
||||||
|
try {
|
||||||
|
// params[3] 是百分比(如 "80.5"),/100 得到 0~1 的 VVm
|
||||||
|
vvm = new BigDecimal(eventValue.trim()).divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP);
|
||||||
|
vvtm = new BigDecimal(persistTime.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("判定压降落点区域入参解析失败,eventValue={}, persistTime={}", eventValue, persistTime, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1) 超短脉冲 或 完全失压 默认 A 区
|
||||||
|
if (vvtm.compareTo(new BigDecimal("0.001")) < 0
|
||||||
|
|| vvm.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
return "A区";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) 区间表(左闭右开)
|
||||||
|
// A区
|
||||||
|
if (inRange(vvm, "0.9", "1") && inRange(vvtm, "0.001", "60")) {
|
||||||
|
return "A区";
|
||||||
|
}
|
||||||
|
if (inRange(vvm, "0", "0.9") && inRange(vvtm, "0.001", "0.05")) {
|
||||||
|
return "A区";
|
||||||
|
}
|
||||||
|
// B区
|
||||||
|
if (inRange(vvm, "0.5", "0.7") && inRange(vvtm, "0.05", "0.2")) {
|
||||||
|
return "B区";
|
||||||
|
}
|
||||||
|
if (inRange(vvm, "0.7", "0.8") && inRange(vvtm, "0.05", "0.5")) {
|
||||||
|
return "B区";
|
||||||
|
}
|
||||||
|
if (inRange(vvm, "0.8", "0.9") && inRange(vvtm, "0.05", "60")) {
|
||||||
|
return "B区";
|
||||||
|
}
|
||||||
|
// C区
|
||||||
|
if (inRange(vvm, "0", "0.5") && inRange(vvtm, "0.05", "1")) {
|
||||||
|
return "C区";
|
||||||
|
}
|
||||||
|
if (inRange(vvm, "0.5", "0.7") && inRange(vvtm, "0.2", "1")) {
|
||||||
|
return "C区";
|
||||||
|
}
|
||||||
|
if (inRange(vvm, "0.7", "0.8") && inRange(vvtm, "0.5", "1")) {
|
||||||
|
return "C区";
|
||||||
|
}
|
||||||
|
// D区
|
||||||
|
if (inRange(vvm, "0", "0.8") && inRange(vvtm, "1", "60")) {
|
||||||
|
return "D区";
|
||||||
|
}
|
||||||
|
|
||||||
|
log.warn("压降落点区域未匹配任何规则,eventValue={}, persistTime={}", eventValue, persistTime);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 左闭右开区间判断:lowerInclusive ≤ value < upperExclusive
|
||||||
|
*/
|
||||||
|
private boolean inRange(BigDecimal value, String lowerInclusive, String upperExclusive) {
|
||||||
|
return value.compareTo(new BigDecimal(lowerInclusive)) >= 0
|
||||||
|
&& value.compareTo(new BigDecimal(upperExclusive)) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点事件波形下载
|
* 监测点事件波形下载
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public class ReportSearchParam {
|
|||||||
//目前用于区分不同系统资源,null默认 1.无线系统,配合cs-device
|
//目前用于区分不同系统资源,null默认 1.无线系统,配合cs-device
|
||||||
private Integer resourceType;
|
private Integer resourceType;
|
||||||
|
|
||||||
|
//区分统计数据还是分钟数据,null默认统计数据 0.统计数据 1.分钟数据
|
||||||
|
private Integer isStatisticData;
|
||||||
|
|
||||||
//浙江无线报表特殊标识 null为通用报表 1.浙江无线报表
|
//浙江无线报表特殊标识 null为通用报表 1.浙江无线报表
|
||||||
private Integer customType;
|
private Integer customType;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
|
import com.njcn.device.biz.commApi.CommLineClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||||
@@ -48,6 +50,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -83,7 +86,7 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
|||||||
private final EventDetailFeignClient eventDetailFeignClient;
|
private final EventDetailFeignClient eventDetailFeignClient;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||||
|
private final CommLineClient commLineClient;
|
||||||
@Override
|
@Override
|
||||||
public Page<OverAreaLimitVO> getAreaData(OverAreaVO param) {
|
public Page<OverAreaLimitVO> getAreaData(OverAreaVO param) {
|
||||||
Page<OverAreaLimitVO> page = new Page<>();
|
Page<OverAreaLimitVO> page = new Page<>();
|
||||||
@@ -301,8 +304,31 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
|||||||
lineList.addAll(item.getLineIndexes());
|
lineList.addAll(item.getLineIndexes());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
List<String> filterLineList = new ArrayList<>();
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(lineList)){
|
if(CollectionUtil.isNotEmpty(lineList)){
|
||||||
page = targetMapper.getSumLimitTargetPage(page, lineList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
//根据searchvalue过滤
|
||||||
|
String searchvalue=param.getSearchValue();
|
||||||
|
List<LineALLInfoDTO> data = commLineClient.getLineAllDetailList(lineList).getData();
|
||||||
|
filterLineList= data.stream()
|
||||||
|
.filter(dto -> {
|
||||||
|
LineALLInfoDTO.LineLineDTO lineDTO = dto.getLineLineDTO();
|
||||||
|
String linename = lineDTO != null ? lineDTO.getLinename() : null;
|
||||||
|
String objName2 = lineDTO != null ? lineDTO.getObjName2() : null;
|
||||||
|
|
||||||
|
LineALLInfoDTO.LineSubStationDTO subStationDTO = dto.getLineSubStationDTO();
|
||||||
|
String subStationName = subStationDTO != null ? subStationDTO.getSubStationName() : null;
|
||||||
|
|
||||||
|
// 大小写敏感的模糊匹配(相当于 MySQL 的 LIKE '%keyword%')
|
||||||
|
return (linename != null && linename.contains(searchvalue))
|
||||||
|
|| (objName2 != null && objName2.contains(searchvalue))
|
||||||
|
|| (subStationName != null && subStationName.contains(searchvalue));
|
||||||
|
}).map(dto -> dto.getLineLineDTO() != null ? dto.getLineLineDTO().getLineId() : null)
|
||||||
|
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(filterLineList)) {
|
||||||
|
page = targetMapper.getSumLimitTargetPage(page, filterLineList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
||||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||||
List<MonitorOverLimitVO> pageRecords = page.getRecords();
|
List<MonitorOverLimitVO> pageRecords = page.getRecords();
|
||||||
if (CollectionUtils.isEmpty(pageRecords)) {
|
if (CollectionUtils.isEmpty(pageRecords)) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
*
|
* 装置数据单位配置类
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2026/1/17
|
* @date 2026/1/17
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
|||||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.enums.OssResponseEnum;
|
import com.njcn.oss.enums.OssResponseEnum;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
@@ -44,7 +45,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
|||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -72,6 +73,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final InfluxDbUtils influxDbUtils;
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
||||||
|
|
||||||
private final String CELL_DATA = "celldata";
|
private final String CELL_DATA = "celldata";
|
||||||
@@ -310,7 +312,6 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String saveReport(JSONArray jsonArray, Map<String, Object> dataMap) {
|
private String saveReport(JSONArray jsonArray, Map<String, Object> dataMap) {
|
||||||
String filePath = "";
|
String filePath = "";
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
@@ -589,9 +590,9 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
if (Objects.isNull(dictData)) {
|
if (Objects.isNull(dictData)) {
|
||||||
throw new BusinessException(CommonResponseEnum.FAIL, "字典类型模板缺少!");
|
throw new BusinessException(CommonResponseEnum.FAIL, "字典类型模板缺少!");
|
||||||
}
|
}
|
||||||
|
List<EleEpdPqd> eleEpdPqdList = epdFeignClient.dictMarkByDataType(dictData.getId()).getData();
|
||||||
|
Map<String, String> tableMap = eleEpdPqdList.stream().collect(Collectors.toMap(EleEpdPqd::getResourcesId, EleEpdPqd::getClassId, (oldValue, newValue) -> oldValue));
|
||||||
|
|
||||||
DictData epdDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.EPD.getCode(),DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
|
||||||
List<EleEpdPqd> eleEpdPqdList= epdFeignClient.dictMarkByDataType(epdDic.getId()).getData();
|
|
||||||
|
|
||||||
Map<String, String> tMap = new HashMap<>();
|
Map<String, String> tMap = new HashMap<>();
|
||||||
eleEpdPqdList.forEach(item -> {
|
eleEpdPqdList.forEach(item -> {
|
||||||
@@ -610,7 +611,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eleEpdPqdList = eleEpdPqdList.stream().filter(it->"T".equals(it.getPhase())||"M".equals(it.getPhase())).collect(Collectors.toList());
|
eleEpdPqdList = eleEpdPqdList.stream().filter(it -> "M".equals(it.getPhase())).collect(Collectors.toList());
|
||||||
List<String> noPhaseList = eleEpdPqdList.stream().filter(it -> StrUtil.isNotBlank(it.getOtherName())).map(it -> it.getOtherName().toUpperCase()).collect(Collectors.toList());
|
List<String> noPhaseList = eleEpdPqdList.stream().filter(it -> StrUtil.isNotBlank(it.getOtherName())).map(it -> it.getOtherName().toUpperCase()).collect(Collectors.toList());
|
||||||
|
|
||||||
//处理指标是否合格
|
//处理指标是否合格
|
||||||
@@ -639,13 +640,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -675,9 +676,9 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析模板
|
* 解析模板
|
||||||
|
*
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2023/10/20
|
* @date 2023/10/20
|
||||||
*/
|
*/
|
||||||
@@ -815,6 +816,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 对多测点数据进行计算求出一组数据
|
* 对多测点数据进行计算求出一组数据
|
||||||
|
*
|
||||||
* @param method
|
* @param method
|
||||||
* @param allList
|
* @param allList
|
||||||
* @return
|
* @return
|
||||||
@@ -884,7 +886,6 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理指标超标结论
|
* 处理指标超标结论
|
||||||
*/
|
*/
|
||||||
@@ -1035,9 +1036,6 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
|
|
||||||
//频率和频率偏差仅统计T相
|
//频率和频率偏差仅统计T相
|
||||||
if (noPhaseList.contains(data.get(0).getTemplateName())) {
|
if (noPhaseList.contains(data.get(0).getTemplateName())) {
|
||||||
if(data.get(0).getTemplateName().equalsIgnoreCase("v_unbalance")){
|
|
||||||
System.out.println(44);
|
|
||||||
}
|
|
||||||
sql.append(InfluxDbSqlConstant.AND)
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
.append(InfluxDBTableConstant.PHASIC_TYPE)
|
.append(InfluxDBTableConstant.PHASIC_TYPE)
|
||||||
.append(InfluxDbSqlConstant.EQ)
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
@@ -1050,9 +1048,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getStartTime()).append(InfluxDbSqlConstant.START_TIME).append(InfluxDbSqlConstant.QM)
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getStartTime()).append(InfluxDbSqlConstant.START_TIME).append(InfluxDbSqlConstant.QM)
|
||||||
.append(InfluxDbSqlConstant.AND)
|
.append(InfluxDbSqlConstant.AND)
|
||||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getEndTime()).append(InfluxDbSqlConstant.END_TIME).append(InfluxDbSqlConstant.QM);
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getEndTime()).append(InfluxDbSqlConstant.END_TIME).append(InfluxDbSqlConstant.QM);
|
||||||
|
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
|
|
||||||
List<Map<String, Object>> mapList = SqlRunner.DEFAULT.selectList(sql.toString());
|
List<Map<String, Object>> mapList = SqlRunner.DEFAULT.selectList(sql.toString());
|
||||||
if (CollUtil.isEmpty(mapList) || Objects.isNull(mapList.get(0))) {
|
if (CollUtil.isEmpty(mapList) || Objects.isNull(mapList.get(0))) {
|
||||||
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
||||||
@@ -1123,6 +1119,251 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void assembleSqlAndQuery(Map<String, String> tMap, String dataLevel, String pt, String ct,
|
||||||
|
List<ReportTemplateDTO> data, StringBuilder sql,
|
||||||
|
List<ReportTemplateDTO> endList, String method,
|
||||||
|
ReportSearchParam reportSearchParam,
|
||||||
|
Map<String, ReportTemplateDTO> limitMap,
|
||||||
|
Map<String, Float> overLimitMap,
|
||||||
|
Map<String, ReportTemplateDTO> assNoPassMap,
|
||||||
|
List<String> noPhaseList,
|
||||||
|
Map<String, String> tableMap) {
|
||||||
|
// sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
||||||
|
|
||||||
|
// 处理CP95或PERCENTILE特殊情况
|
||||||
|
boolean isCp95 = InfluxDbSqlConstant.CP95.equals(method);
|
||||||
|
boolean isAvg = InfluxDbSqlConstant.AVG_WEB.equals(method);
|
||||||
|
String aggregateFunc;
|
||||||
|
// 执行查询
|
||||||
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||||
|
if (Objects.isNull(reportSearchParam.getIsStatisticData()) || reportSearchParam.getIsStatisticData() == 0) {
|
||||||
|
aggregateFunc = isCp95 ? InfluxDbSqlConstant.MAX : method;
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
sql.append(aggregateFunc)
|
||||||
|
.append(InfluxDbSqlConstant.LBK)
|
||||||
|
.append(data.get(i).getTemplateName())
|
||||||
|
.append(InfluxDbSqlConstant.RBK)
|
||||||
|
.append(Objects.equals(dataLevel, "Secondary") ? " " + appendData(tMap, data.get(i).getTemplateName() + data.get(i).getPhase() + data.get(0).getResourceId(), getData(pt), getData(ct)) : "");
|
||||||
|
if (i == data.size() - 1) {
|
||||||
|
sql.append(InfluxDbSqlConstant.AS).append("\"").append(data.get(i).getItemName()).append("\"");
|
||||||
|
} else {
|
||||||
|
sql.append(InfluxDbSqlConstant.AS).append("\"").append(data.get(i).getItemName()).append("\"").append(StrUtil.COMMA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//拼接表名
|
||||||
|
sql.append(StrPool.C_SPACE).append(InfluxDbSqlConstant.FROM).append(data.get(0).getResourceId());
|
||||||
|
|
||||||
|
sql.append(InfluxDbSqlConstant.WHERE)
|
||||||
|
.append(InfluxDBTableConstant.LINE_ID)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(reportSearchParam.getLineId())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
|
||||||
|
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDBTableConstant.VALUE_TYPE)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(data.get(0).getStatMethod())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
|
||||||
|
|
||||||
|
//相别特殊处理
|
||||||
|
if (noPhaseList.contains(data.get(0).getTemplateName())) {
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDBTableConstant.PHASIC_TYPE)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(InfluxDBTableConstant.PHASE_TYPE_T)
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
}else {
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDBTableConstant.PHASIC_TYPE)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(data.get(0).getPhase())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
}
|
||||||
|
//时间范围处理
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getStartTime()).append(InfluxDbSqlConstant.START_TIME).append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(reportSearchParam.getEndTime()).append(InfluxDbSqlConstant.END_TIME).append(InfluxDbSqlConstant.QM);
|
||||||
|
System.out.println(sql);
|
||||||
|
mapList = SqlRunner.DEFAULT.selectList(sql.toString());
|
||||||
|
} else if (reportSearchParam.getIsStatisticData() == 1) {
|
||||||
|
//查分钟数据
|
||||||
|
if (isCp95) {
|
||||||
|
// InfluxDB的PERCENTILE特殊处理
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
sql.append(method)
|
||||||
|
.append(InfluxDbSqlConstant.LBK)
|
||||||
|
.append(data.get(i).getTemplateName().toLowerCase())
|
||||||
|
.append(InfluxDbSqlConstant.NUM_95)
|
||||||
|
.append(InfluxDbSqlConstant.RBK)
|
||||||
|
.append(InfluxDbSqlConstant.AS).append(InfluxDbSqlConstant.DQM)
|
||||||
|
.append(data.get(i).getItemName()).append(InfluxDbSqlConstant.DQM);
|
||||||
|
if (i != data.size() - 1) {
|
||||||
|
sql.append(StrUtil.COMMA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
aggregateFunc = isAvg ? InfluxDbSqlConstant.AVG:method;
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
sql.append(aggregateFunc)
|
||||||
|
.append(InfluxDbSqlConstant.LBK)
|
||||||
|
.append(data.get(i).getTemplateName().toLowerCase())
|
||||||
|
.append(InfluxDbSqlConstant.RBK)
|
||||||
|
.append(Objects.equals(dataLevel, "Secondary") ? " " + appendData(tMap, data.get(i).getTemplateName() + data.get(i).getPhase() + data.get(0).getResourceId(), getData(pt), getData(ct)) : "")
|
||||||
|
.append(InfluxDbSqlConstant.AS).append("\"").append(data.get(i).getItemName()).append("\"");
|
||||||
|
if (i != data.size() - 1) {
|
||||||
|
sql.append(StrUtil.COMMA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 拼接表名
|
||||||
|
sql.append(StrPool.C_SPACE).append(InfluxDbSqlConstant.FROM).append(StrPool.C_SPACE);
|
||||||
|
if (Objects.nonNull(reportSearchParam.getResourceType()) && reportSearchParam.getResourceType() == 1) {
|
||||||
|
sql.append(data.get(0).getClassId().replace("data", "day"));
|
||||||
|
} else {
|
||||||
|
sql.append(tableMap.get(data.get(0).getResourceId().toLowerCase()).toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接WHERE条件
|
||||||
|
sql.append(InfluxDbSqlConstant.WHERE)
|
||||||
|
.append(InfluxDBTableConstant.LINE_ID)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(reportSearchParam.getLineId())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
|
||||||
|
// InfluxDB特殊处理:data_flicker、data_fluc、data_plt 无 value_type
|
||||||
|
String classTable = tableMap.get(data.get(0).getResourceId().toLowerCase());
|
||||||
|
if (!InfluxDBTableConstant.DATA_FLICKER.equals(classTable)
|
||||||
|
&& !InfluxDBTableConstant.DATA_FLUC.equals(classTable)
|
||||||
|
&& !InfluxDBTableConstant.DATA_PLT.equals(classTable)) {
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDBTableConstant.VALUE_TYPE)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(data.get(0).getStatMethod())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 相别特殊处理
|
||||||
|
if (!noPhaseList.contains(data.get(0).getPhase())) {
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDBTableConstant.PHASIC_TYPE)
|
||||||
|
.append(InfluxDbSqlConstant.EQ)
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(data.get(0).getPhase())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 时间范围处理
|
||||||
|
sql.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE)
|
||||||
|
.append(InfluxDbSqlConstant.QM).append(reportSearchParam.getStartTime())
|
||||||
|
.append(InfluxDbSqlConstant.QM)
|
||||||
|
.append(InfluxDbSqlConstant.AND)
|
||||||
|
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT)
|
||||||
|
.append(InfluxDbSqlConstant.QM).append(reportSearchParam.getEndTime())
|
||||||
|
.append(InfluxDbSqlConstant.QM);
|
||||||
|
|
||||||
|
// InfluxDB需要添加时区
|
||||||
|
sql.append(InfluxDbSqlConstant.TZ);
|
||||||
|
System.out.println(sql);
|
||||||
|
mapList = influxDbUtils.getMapResult(sql.toString());
|
||||||
|
}
|
||||||
|
// 处理查询结果
|
||||||
|
fetchData(mapList, data, limitMap, overLimitMap, assNoPassMap, endList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void fetchData(List<Map<String, Object>> mapList,
|
||||||
|
List<ReportTemplateDTO> data, Map<String,
|
||||||
|
ReportTemplateDTO> limitMap,
|
||||||
|
Map<String, Float> overLimitMap,
|
||||||
|
Map<String, ReportTemplateDTO> assNoPassMap,
|
||||||
|
List<ReportTemplateDTO> endList) {
|
||||||
|
// 处理查询结果
|
||||||
|
if (CollUtil.isEmpty(mapList)) {
|
||||||
|
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
// 兼容达梦数据库方法
|
||||||
|
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
|
||||||
|
for (ReportTemplateDTO item : data) {
|
||||||
|
if (map.containsKey(item.getItemName())) {
|
||||||
|
double v = Double.parseDouble(map.get(item.getItemName()).toString());
|
||||||
|
item.setValue(String.format("%.3f", v));
|
||||||
|
|
||||||
|
// 处理overLimitMap越限判断
|
||||||
|
if (overLimitMap != null && overLimitMap.containsKey(item.getLimitName())) {
|
||||||
|
Float tagVal = overLimitMap.get(item.getLimitName());
|
||||||
|
|
||||||
|
if (item.getLimitName() != null && item.getLimitName().equalsIgnoreCase(UVOLTAGE_DEV)) {
|
||||||
|
// 对电压偏差特殊处理
|
||||||
|
Float tagVal_U = overLimitMap.get(UVOLTAGE_DEV);
|
||||||
|
if (v > tagVal || v < tagVal_U) {
|
||||||
|
item.setOverLimitFlag(1);
|
||||||
|
} else {
|
||||||
|
item.setOverLimitFlag(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (v > tagVal) {
|
||||||
|
item.setOverLimitFlag(1);
|
||||||
|
} else {
|
||||||
|
item.setOverLimitFlag(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否越限(limitMap处理)
|
||||||
|
if (limitMap != null && !limitMap.isEmpty()) {
|
||||||
|
String key = item.getLimitName() + STR_ONE + item.getStatMethod() + "#PQ_OVERLIMIT";
|
||||||
|
if (limitMap.containsKey(key)) {
|
||||||
|
ReportTemplateDTO tem = limitMap.get(key);
|
||||||
|
double limitVal = Double.parseDouble(tem.getValue());
|
||||||
|
|
||||||
|
if (VOLTAGE_DEV.equalsIgnoreCase(tem.getLimitName())) {
|
||||||
|
// 针对电压偏差特殊处理
|
||||||
|
double limitLowVal = Double.parseDouble(tem.getLowValue());
|
||||||
|
if (v > limitVal || v < limitLowVal) {
|
||||||
|
tem.setOverLimitFlag(1);
|
||||||
|
if (assNoPassMap != null) {
|
||||||
|
assNoPassMap.put(key, tem);
|
||||||
|
}
|
||||||
|
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||||
|
tem.setOverLimitFlag(0);
|
||||||
|
assNoPassMap.put(key, tem);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他指标
|
||||||
|
if (v > limitVal) {
|
||||||
|
tem.setOverLimitFlag(1);
|
||||||
|
if (assNoPassMap != null) {
|
||||||
|
assNoPassMap.put(key, tem);
|
||||||
|
}
|
||||||
|
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||||
|
tem.setOverLimitFlag(0);
|
||||||
|
assNoPassMap.put(key, tem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.setValue("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (endList != null) {
|
||||||
|
endList.addAll(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据单位信息
|
* 数据单位信息
|
||||||
*/
|
*/
|
||||||
@@ -1179,6 +1420,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理最终结果
|
* 处理最终结果
|
||||||
|
*
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2026/1/16
|
* @date 2026/1/16
|
||||||
*/
|
*/
|
||||||
@@ -1275,4 +1517,9 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
|||||||
return newMap;
|
return newMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 5. 添加线程池销毁方法
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy() {
|
||||||
|
executorService.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
|||||||
eleEpdPqd.setStatMethod(String.join(",", eleEpdPqdParam.getStatMethod()));
|
eleEpdPqd.setStatMethod(String.join(",", eleEpdPqdParam.getStatMethod()));
|
||||||
}
|
}
|
||||||
if (Objects.isNull(eleEpdPqdParam.getPhase())){
|
if (Objects.isNull(eleEpdPqdParam.getPhase())){
|
||||||
eleEpdPqd.setPhase("M");
|
eleEpdPqd.setPhase("T");
|
||||||
}
|
}
|
||||||
eleEpdPqd.setStatus(1);
|
eleEpdPqd.setStatus(1);
|
||||||
boolean result = this.save(eleEpdPqd);
|
boolean result = this.save(eleEpdPqd);
|
||||||
@@ -118,7 +118,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
|||||||
eleEpdPqd.setStatMethod(String.join(",", updateParam.getStatMethod()));
|
eleEpdPqd.setStatMethod(String.join(",", updateParam.getStatMethod()));
|
||||||
}
|
}
|
||||||
if (Objects.isNull(updateParam.getPhase())){
|
if (Objects.isNull(updateParam.getPhase())){
|
||||||
eleEpdPqd.setPhase("M");
|
eleEpdPqd.setPhase("T");
|
||||||
}
|
}
|
||||||
boolean result = this.updateById(eleEpdPqd);
|
boolean result = this.updateById(eleEpdPqd);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|||||||
Reference in New Issue
Block a user