64 Commits

Author SHA1 Message Date
xy
ed10b12e79 微调 2024-09-03 20:19:22 +08:00
xy
fbd15ca353 APP用户相关接口调整 2024-09-03 19:22:39 +08:00
xy
2c79cc72c9 微调 2024-09-03 18:21:59 +08:00
cdf
69157a138b 1.监督计划功能调整 2024-09-02 16:38:53 +08:00
guofeihu
3377bcf488 有功功率趋势区间excel导出 2024-09-02 14:36:14 +08:00
wr
e93f8b4da8 1.解决技术监督申报人问题
2.技术监督全流程删除
2024-09-02 11:53:27 +08:00
guofeihu
e13b1f156e 有功功率趋势2 2024-08-29 16:30:46 +08:00
guofeihu
ee1f36617d Merge remote-tracking branch 'origin/master' 2024-08-29 16:24:47 +08:00
guofeihu
9534882845 pom回退 2024-08-29 16:23:25 +08:00
cdf
5d28504f20 1.审计日志处理2 2024-08-29 16:01:32 +08:00
cdf
7559b94959 1.审计日志处理2 2024-08-29 15:59:56 +08:00
cdf
14b072b5e7 1.审计日志处理2 2024-08-29 15:54:32 +08:00
cdf
0a121a3cf5 1.审计日志处理 2024-08-29 15:39:16 +08:00
cdf
476993db15 1.接口日志类型调整 2024-08-28 19:55:36 +08:00
guofeihu
cccc7953ed Merge remote-tracking branch 'origin/master' 2024-08-28 11:29:26 +08:00
guofeihu
aa0982fb81 有功功率趋势 2024-08-28 11:28:20 +08:00
cdf
07e481bc11 1.缓慢接口调整 2024-08-28 09:52:44 +08:00
wr
b766e77c42 1.解决地址问题
2.解决技术监督管理填报人错误问题,并解决展示问题
2024-08-27 11:44:52 +08:00
xy
cbf310a5a1 Merge remote-tracking branch 'origin/master' 2024-08-27 09:36:18 +08:00
xy
49dd915e27 微调 2024-08-27 09:35:51 +08:00
cdf
ed145dd7ff 1.系统日志加载缓慢问题
2.其他代码问题
2024-08-26 16:03:58 +08:00
cdf
00fd701122 1.pms微调 2024-08-26 13:47:24 +08:00
cdf
6236243284 1.pms无线趋势图实时数据功能 2024-08-26 10:27:28 +08:00
cdf
6dc1b415dc 1.pms公共连接点功能 2024-08-24 20:47:15 +08:00
hanyong
f4fd509d12 类名重复,删除后重新引用 2024-08-23 16:15:55 +08:00
wr
6e8a188172 1.修改列表模板名称 2024-08-23 11:49:07 +08:00
guofeihu
ceb95be340 Merge remote-tracking branch 'origin/master' 2024-08-23 11:16:25 +08:00
guofeihu
21f4466580 高低电压穿越相关接口走算法模块 2024-08-23 11:15:41 +08:00
e50f587bb8 提交文件校验 2024-08-23 11:12:20 +08:00
7727e9e2bf 提交文件校验 2024-08-23 11:10:29 +08:00
wr
043b8f9a71 1.解决省级用户,可查看市级待提交和审核不通过数据
2.pms增加数据单位管理
2024-08-22 16:52:09 +08:00
guofeihu
af058896dc Merge remote-tracking branch 'origin/master' 2024-08-22 15:26:22 +08:00
guofeihu
957af09daa 高低电压穿越及有功功率趋势算法 2024-08-22 15:25:44 +08:00
cdf
d28a8f8fb1 1.pms趋势图处理
2.device模块调整
2024-08-22 09:27:49 +08:00
guofeihu
f27a107bba 更新监测点时新增新能源站字段 2024-08-22 09:08:09 +08:00
wr
bddd1efef3 1.excel通用导出模板,解决时间格式不是文本问题
2.解决部分部门查询问题
2024-08-20 16:23:00 +08:00
guofeihu
003880619e surverytest新增otherreport字段 2024-08-20 15:15:56 +08:00
guofeihu
053183cdd0 新能源场站高低电压穿越统计 2024-08-20 09:36:35 +08:00
c2af7e708c system针对审计日志的微调 2024-08-19 19:55:12 +08:00
guofeihu
f36b3f9ee9 新能源场站高低电压穿越业务新增根据ID查询基本信息方法 2024-08-19 18:58:34 +08:00
wr
25ee513246 1.技术监督通用文件表调整
2.终端检测导入功能调整
3.技术监督计划增加其他附件上传
2024-08-19 16:19:23 +08:00
xy
9e23373878 1.间谐波显示处理
2.超标数据处理
2024-08-19 14:16:32 +08:00
guofeihu
971ae03dcf 新能源场站高低电压穿越融合台账业务 2024-08-16 14:27:05 +08:00
wr
68c0b72710 1.解决技术监督计划部门过滤bug
2.终端模板导入
3.台账关联干扰源管理,信息修改
2024-08-16 12:30:30 +08:00
guofeihu
8bc94ea9a8 Merge remote-tracking branch 'origin/master' 2024-08-16 10:24:40 +08:00
guofeihu
b30ad02ac1 新能源场站高低电压穿越新增下拉用于测点台账时维护 2024-08-16 10:23:45 +08:00
f22748ef8f 1.河北新增公共连接点预处理算法 2024-08-16 09:30:15 +08:00
guofeihu
813af67b9b Merge remote-tracking branch 'origin/master' 2024-08-14 17:34:56 +08:00
guofeihu
758964d9a8 新能源场站增删改查接口 2024-08-14 17:33:47 +08:00
xy
360a73c04e 微调 2024-08-14 14:03:45 +08:00
wr
dbf43633ff 1.excel公共导出模板调整,解决下拉框最大字符255问题,才用隐藏表单来设置下拉框
2.解决冀北试运行报告bug部分
3.解决数据完整性,小数点问题
4.终端监测导出模板和导入功能编写,
2024-08-14 11:44:34 +08:00
1ed56bbac1 1.修改因redis导致的报错 2024-08-14 09:07:10 +08:00
xy
7c943244b3 微调 2024-08-14 08:50:20 +08:00
a492609b36 1.去除influxdb生成每日日表数据代码 2024-08-13 11:18:41 +08:00
1f18c71eb7 1.pms上送 2024-08-13 10:45:59 +08:00
2319895ff4 1.pms电能质量报表
2.园区功能接口
3.自定义报表(部分)
2024-08-13 10:45:06 +08:00
xy
a6f9e30d54 微调 2024-08-12 20:14:21 +08:00
guofeihu
4cff5e90a2 DictTreeController中补充缺失的delete接口 2024-08-09 15:08:18 +08:00
88f7efbc86 1.用户下拉接口增加属性 2024-08-09 13:20:35 +08:00
1d41b1af12 1.实体类调整 2024-08-09 08:38:22 +08:00
wr
3b5442ecf5 1.解决台账数据缺少变电站个别信息
2.解决技术监督台账管理终端信息
3.增加全景展示稳态9指标数据
2024-08-08 16:26:22 +08:00
xy
3ec984752f 微调 2024-08-07 17:08:24 +08:00
wr
99021d3c9c 1.试运行报告微调
2.全景展示稳态超标9指标扩展
3.技术监督变电站台账调整
4.调整登录名正则表达式增加._
2024-08-07 11:50:04 +08:00
xy
b608aab3bd 添加单位 2024-08-06 18:41:42 +08:00
264 changed files with 9196 additions and 1558 deletions

View File

@@ -41,7 +41,7 @@ public class ResponsibilityController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/responsibilityList")
@ApiOperation("列表分页")
@ApiOperation("查询责任划分列表分页")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<Page<RespDataDTO>> responsibilityList(@RequestBody @Validated BaseParam queryParam) {
String methodDescribe = getMethodDescribe("responsibilityList");

View File

@@ -47,7 +47,7 @@ public class UserDataController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/userDataList")
@ApiOperation("列表分页")
@ApiOperation("查询用户列表分页")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<Page<RespUserData>> userDataList(@RequestBody @Validated BaseParam queryParam) {
String methodDescribe = getMethodDescribe("userDataList");

View File

@@ -41,7 +41,7 @@ public interface PatternRegex {
/**
* 登录名只能输入3-16位的英文字母或数字
*/
String LOGIN_NAME_REGEX = "[a-zA-Z0-9_]{3,16}";
String LOGIN_NAME_REGEX = "^[a-zA-Z_.]{1}[a-zA-Z0-9_.]{2,15}$";
/**
* 手机号必须有11位并且为数字是正常的手机·号码开头

View File

@@ -75,4 +75,6 @@ public class LogInfoDTO implements Serializable {
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@@ -84,6 +84,8 @@ public enum CommonResponseEnum {
FILE_EXIST("A0096", "文件已存在"),
FILE_NAME_ERROR("A0096", "文件格式有误"),
FILE_SIZE_ERROR("A0096", "文件过大"),
FILE_XLSX_ERROR("A0096", "请上传excel文件"),

View File

@@ -1,6 +1,7 @@
package com.njcn.common.utils;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
@@ -56,5 +57,115 @@ public class FileUtil {
}
}
/**
* 判断文件是否为word格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsWord(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"doc", "docx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为pdf格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsPdf(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"pdf"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为excel格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsExcel(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"xls", "xlsx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为excel格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsZip(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"zip", "rar"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 从文件名中提取扩展名
*
* @param fileName 文件名
* @return 扩展名
*/
private static String getFileExtension(String fileName) {
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex == -1) {
return "";
}
return fileName.substring(dotIndex + 1);
}
}

View File

@@ -12,6 +12,11 @@ public interface OssPath {
*/
String WAVE_DIR="comtrade/";
/***
* 下载文件
*/
String DOWNLOAD_DIR="download/";
/***
* 稳态报表
*/
@@ -136,4 +141,9 @@ public interface OssPath {
*/
String ONLINE_REPORT="onlineReport/";
/**
* 系统上传文件至装置内,文件存储路径
*/
String SYSTEM_TO_DEV="systemToDev/";
}

View File

@@ -2,18 +2,15 @@ package com.njcn.poi.excel;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.web.utils.HttpServletUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.DVConstraint;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -21,10 +18,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.*;
/**
* @author hongawen
@@ -116,11 +110,31 @@ public class ExcelUtil {
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/octet-stream;charset=UTF-8");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, dataSet);
setTopLevel(workbook, pullDowns);
if (CollUtil.isNotEmpty(pullDowns)) {
int num = 1;
CellStyle cellStyle = workbook.createCellStyle();
DataFormat format = workbook.createDataFormat();
cellStyle.setDataFormat(format.getFormat("@"));
for (PullDown pullDown : pullDowns) {
if (pullDown.getIsText()) {
ExcelUtil.selectListText(workbook, pullDown.getFirstCol(),cellStyle);
} else {
String colName = numberToExcelColumn(num);
int sum = pullDown.getStrings().stream().mapToInt(String::length).sum();
if (sum == 0) {
continue;
}
if (sum > 255) {
ExcelUtil.selectListMaxLength(workbook, pullDown.getFirstCol(), pullDown.getLastCol(), pullDown.getStrings().size(), colName);
num++;
} else {
ExcelUtil.selectList(workbook, pullDown.getFirstCol(), pullDown.getLastCol(), pullDown.getStrings().toArray(new String[]{}));
}
}
}
}
Sheet sheetAt = workbook.getSheetAt(0);
//获取列数
int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells();
@@ -239,6 +253,45 @@ public class ExcelUtil {
sheet.addValidationData(validation);
}
/**
* @param workbook
* @param firstCol
* @param lastCol
* @param colName 列A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
* @Description: 当下拉框超过最大字符255设置隐藏表单来进行展示
* @Author: wr
* @Date: 2024/8/13 15:07
*/
public static void selectListMaxLength(Workbook workbook, int firstCol, int lastCol, int row, String colName) {
Sheet sheet = workbook.getSheetAt(0);
// 生成下拉列表
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(2, 65535, firstCol, lastCol);
String strFormula = workbook.getSheetName(1) + "!$" + colName + "$1:$" + colName + "$" + row;
XSSFDataValidationConstraint hiddentConstraint = new XSSFDataValidationConstraint(DataValidationConstraint.ValidationType.LIST, strFormula);
// 数据有效性对象
DataValidationHelper help = new XSSFDataValidationHelper((XSSFSheet) sheet);
DataValidation validation = help.createValidation(hiddentConstraint, regions);
sheet.addValidationData(validation);
}
/**
* @Description:
* @param workbook
* @param firstCol
* @Author: wr
* @Date: 2024/8/20 10:44
*/
public static void selectListText(Workbook workbook, int firstCol,CellStyle cellStyle) {
Sheet sheet = workbook.getSheetAt(0);
for (int i = 2; i < 65535; i++) {
Row row = sheet.getRow(i);
if(ObjectUtil.isNull(row)){
row = sheet.createRow(i);
}
Cell cell = row.createCell(firstCol);
cell.setCellStyle(cellStyle);
}
}
/**
* 指定名称、数据下载报表(带指定标题将*显示比必填信息),带有下拉信息
@@ -340,5 +393,66 @@ public class ExcelUtil {
sheet.addValidationData(validation);
}
/**
* 设置隐藏表单来进行下拉框
*
* @param workbook
* @param pullDowns
*/
private static void setTopLevel(Workbook workbook, List<PullDown> pullDowns) {
int num = 0;
for (PullDown pullDown : pullDowns) {
if (!pullDown.getIsText()) {
int sum = pullDown.getStrings().stream().mapToInt(String::length).sum();
if (sum == 0) {
continue;
}
if (sum > 255) {
// 创建隐藏sheet
String hiddenSheetName = "hiddenSheetA";
if (num == 0) {
workbook.createSheet(hiddenSheetName);
}
//false展示隐藏sheet ,true不展示隐藏sheet
workbook.setSheetHidden(workbook.getSheetIndex(workbook.getSheet(hiddenSheetName)), true);
Sheet sheet = workbook.getSheet(hiddenSheetName);
if (num == 0) {
//sheet.getLastRowNum无法区分 有一行和没有 所以这里先建一行
sheet.createRow(0);
}
Row row; //创建数据行
sheet.setColumnWidth(num, 4000); //设置每列的列宽
for (int j = 0; j < pullDown.getStrings().size(); j++) {
if (sheet.getLastRowNum() < j) {
row = sheet.createRow(j); //创建数据行
} else {
row = sheet.getRow(j);
}
//设置对应单元格的值
row.createCell(num).setCellValue(pullDown.getStrings().get(j));
}
num++;
}
}
}
}
/**
* 获取根据数值获取列字母(1=A,2=B,3=C,.......,27=AA)
*
* @param n
* @return
*/
public static String numberToExcelColumn(int n) {
CellReference cellRef = new CellReference(0, n - 1, false, false); // Row and column are 0-based
int colIndex = cellRef.getCol();
StringBuilder columnName = new StringBuilder();
while (colIndex >= 0) {
columnName.insert(0, (char) ('A' + (colIndex % 26)));
colIndex /= 26;
colIndex--;
}
return columnName.toString();
}
}

View File

@@ -14,8 +14,13 @@ public class PullDown {
//起始列
private Integer firstCol;
//结束列
private Integer lastCol;
//是否设置单元格(文本)
private Boolean isText = false;
//属性值
private List<String> strings;
}

View File

@@ -74,4 +74,18 @@ public interface AppRedisKey {
*/
String FILE_WAITING="fileWaitingKey:";
/**
* 工程信息
*/
String PROJECT_INFO="projectInfoKey:";
String FILE_INFO="fileInfoKey:";
String DEVICE_ROOT_PATH="deviceRootPathKey:";
String DEVICE_MID="deviceMidKey:";
String UPLOAD = "uploadKey:";
String DOWNLOAD = "downloadKey:";
}

View File

@@ -34,7 +34,13 @@ public enum RedisKeyEnum {
/***
* MQ消息key缓存时间默认72小时 * 60 * 60
*/
ROCKET_MQ_KEY("ROCKET_MQ", 259200L);
ROCKET_MQ_KEY("ROCKET_MQ", 259200L),
/***
* 存放用户的角色关系
*/
USER_ROLE_TYPE_KEY("USER_ROLE_TYPE_KEY", -1L);
private final String key;

View File

@@ -42,6 +42,11 @@ public enum GWSendEnum {
WORK_ORDER_FEEDBACK("workOrderFeedBack", "/pms-ghq-powerquality-start/powerQuality/workOrder/receiveFeedbackInfo"),
PARK_AND_STATION("parkAndStation", "/pms-ghq-powerquality-start/powerQuality/park/create"),
REPORT_CREATE("reportCreate", "/pms-ghq-powerquality-start/powerQuality/report/create"),
COMM_POINT("commPoint","/pms-ghq-powerquality-start/powerQuality/publicConnection/pqBusMonitorDataStatisticalCreate")
;

View File

@@ -22,6 +22,10 @@ public class SendParam {
@ApiModelProperty(value = "统计日期")
private String statisticalDate;
private String statisticalType;
private String isAppend;
@ApiModelProperty(value = "上报参数")
private List stats;
}

View File

@@ -49,6 +49,7 @@ public class LogServiceImpl implements ILogService {
private final MqttPublisher publisher;
/**
* 异步记录controller中返回的信息内容
*

View File

@@ -343,6 +343,20 @@ public class RequestUtil {
return StrUtil.isBlank(loginName) ? LogInfo.UNKNOWN_USER : loginName;
}
/**
* ServerHttpRequest获取在网关中存储的用户昵称
*/
public static String getLoginNameByPayload(HttpServletRequest request) {
String loginName = LogInfo.UNKNOWN_USER;
JSONObject jwtPayload = getJwtPayload(request);
if (Objects.nonNull(jwtPayload)) {
String loginNameTemp = jwtPayload.getString(SecurityConstants.USER_NAME_KEY);
loginName = StrUtil.isBlank(loginNameTemp) ? LogInfo.UNKNOWN_USER : loginNameTemp;
}
return loginName;
}
/**
* ServerHttpRequest获取在网关中存储的用户昵称
*/

View File

@@ -96,8 +96,8 @@ public enum DeviceResponseEnum {
SAME_ALARM_STRATEGY("A0361","当前等级策略已存在"),
LINE_GRADE_INDEX_ERR("A0362","异常等级索引"),
LINE_GRADE_LESS("A0363","监测点等级策略缺失"),
FLOW_UPDATE("A0364","默认类型必须存在一个")
FLOW_UPDATE("A0364","默认类型必须存在一个"),
NEWSTATION_IS_BIND_LINE("A0365","已绑定监测点")
;

View File

@@ -34,4 +34,7 @@ public class LineDTO {
@ApiModelProperty(name = "objType",value = "对象类型")
private String objType;
@ApiModelProperty(name = "新能源场站信息ID")
private String newStationId;
}

View File

@@ -6,10 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pms.api.fallback.MonitorClientFallbackFactory;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.*;
import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO;
@@ -92,4 +89,7 @@ public interface MonitorClient {
*/
@PostMapping("/monitorTypicalList")
HttpResult<Page<TypicalSourceOnLine>> monitorTypicalList(@RequestBody TypicalSourceParam param);
@PostMapping("/getMonitorListByParam")
HttpResult<List<Monitor>> getMonitorListByParam(@RequestBody MonitorParam monitorParam);
}

View File

@@ -7,10 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.*;
import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO;
@@ -83,6 +80,12 @@ public class MonitorClientFallbackFactory implements FallbackFactory<MonitorClie
log.error("{}异常,降级处理,异常为:{}", "典型源荷下穿监测点信息接口 ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<Monitor>> getMonitorListByParam(MonitorParam monitorParam) {
log.error("{}异常,降级处理,异常为:{}", "根据条件查询监测点 ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,58 @@
package com.njcn.device.pms.pojo.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class RunMonitorStatisticalDTO {
private String objId;
private String provinceOrg;
private String provinceOrgName;
private String cityOrg;
private String cityOrgName;
private String maintOrg;
private String maintOrgName;
private String monitorName;
private String monitorVoltageLevel;
private String monitorId;
private String monitorStatus;
private Date monitorOperateDate;
private Date monitorStopDate;
private String substationId;
private String substationName;
private String busId;
private String busName;
private String outLineIntervalId;
private String outLineIntervalName;
private String monitorObjTypeBig;
private String monitorObjTypeSmall;
private String monitorTag;
private String monitorObjName;
private String monitorObjId;
private String isLine;
private BigDecimal minShortCapacity;
private BigDecimal supplyEquipCapacity;
private BigDecimal userProtocolCapacity;
private String terminalCode;
private String terminalManufacturer;
private String terminalModel;
private String terminalManufactureNum;
private String terminalConnect;
private String neutralGround;
private String evtType;
private String statisticalType;
private String statisticalDate;
private String isMonitorOnline;
private String isTerminalOnline;
private Integer onlineMonitorNum;
private Integer runMonitorNum;
private BigDecimal onlineMonitorRate;
private Long expectCollectNum;
private Long actualCollectNum;
private BigDecimal dataFullRate;
}

View File

@@ -65,7 +65,6 @@ public class PowerDistributionareaParam {
private String regionalism;
@ApiModelProperty(name = "regionalism", value = "设备地区特征")
@NotBlank(message = "设备地区特征不可为空")
private String devRegionalism;
@ApiModelProperty(name = "ifRuralPowerGrid", value = "是否农网0-否1")

View File

@@ -0,0 +1,120 @@
package com.njcn.device.pms.pojo.vo;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2023/8/21 10:16
*/
@Data
public class DeviceUnitVo {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "编号")
private String id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "频率")
private String unitFrequency;
@ApiModelProperty(value = "频率偏差")
private String unitFrequencyDev;
@ApiModelProperty(value = "相电压有效值")
private String phaseVoltage;
@ApiModelProperty(value = "线电压有效值")
private String lineVoltage;
@ApiModelProperty(value = "电压上偏差")
private String voltageDev;
@ApiModelProperty(value = "电压下偏差")
private String uvoltageDev;
@ApiModelProperty(value = "电流有效值")
private String ieffective;
@ApiModelProperty(value = "单相有功功率")
private String singleP;
@ApiModelProperty(value = "单相视在功率")
private String singleViewP;
@ApiModelProperty(value = "单相无功功率")
private String singleNoP;
@ApiModelProperty(value = "总有功功率")
private String totalActiveP;
@ApiModelProperty(value = "总视在功率")
private String totalViewP;
@ApiModelProperty(value = "总无功功率")
private String totalNoP;
@ApiModelProperty(value = "相(线)电压基波有效值")
private String vfundEffective;
@ApiModelProperty(value = "基波电流")
private String ifund;
@ApiModelProperty(value = "基波有功功率")
private String fundActiveP;
@ApiModelProperty(value = "基波无功功率")
private String fundNoP;
@ApiModelProperty(value = "电压总谐波畸变率")
private String vdistortion;
@ApiModelProperty(value = "250次谐波电压含有率")
private String vharmonicRate;
@ApiModelProperty(value = "250次谐波电流有效值")
private String iharmonic;
@ApiModelProperty(value = "250次谐波有功功率")
private String pharmonic;
@ApiModelProperty(value = "0.549.5次间谐波电流有效值")
private String iiharmonic;
@ApiModelProperty(value = "正序电压")
private String positiveV;
@ApiModelProperty(value = "运行状态")
private String devFlag;
@ApiModelProperty(value = "零序负序电压")
private String noPositiveV;
@ApiModelProperty(value = "子集数据")
List<?> children;
@Data
public static class DeviceUnit extends PqsDeviceUnit {
@ApiModelProperty(value = "编号")
private String id;
@ApiModelProperty(value = "父节点")
private String pid;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "运行状态")
private String devFlag;
@ApiModelProperty(value = "子集数据")
List<?> children;
}
}

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.controller.ledgerManger;
import cn.hutool.core.date.TimeInterval;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -14,12 +15,15 @@ import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.mapper.majornetwork.PqsDeviceUnitMapper;
import com.njcn.device.pms.pojo.po.DistributionMonitor;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService;
import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.pms.service.majornetwork.ITerminalService;
import com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -56,6 +60,8 @@ public class CommTerminalController extends BaseController {
private final ITerminalService terminalService;
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
/**
* 通过部门获取所有子集部门所拥有的监测点
@@ -269,6 +275,9 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe);
}
/**
* 获取实际,投运,谐波系统 的监测点
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getRunMonitorIds")
@ApiOperation("获取投运谐波系统所有监测点")
@@ -279,20 +288,6 @@ public class CommTerminalController extends BaseController {
}
/**
* 获取实际,投运,谐波系统 的监测点
* @author cdf
* @date 2023/9/18
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getRunMonitorList")
@ApiOperation("获取实际,投运,谐波系统 的监测点")
public HttpResult<List<String>> getRunMonitorList() {
String methodDescribe = getMethodDescribe("getRunMonitorList");
List<String> result = commTerminalService.getOneMonitorIds();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据监测点集合获取监测点详情
* @author cdf
@@ -334,7 +329,25 @@ public class CommTerminalController extends BaseController {
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("lineUnitDetail");
PqsDeviceUnit pqsDeviceUnit = new PqsDeviceUnit();
String devId;
if(lineId.contains("pmswifi_")){
DistributionMonitor distributionMonitor = iDistributionMonitorService.getOne(new LambdaQueryWrapper<DistributionMonitor>().eq(DistributionMonitor::getMonitorId,lineId));
if(Objects.isNull(distributionMonitor)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new PqsDeviceUnit(), methodDescribe);
}
devId = distributionMonitor.getTerminalId();
}else {
Monitor monitor = monitorService.getById(lineId);
if(Objects.isNull(monitor)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new PqsDeviceUnit(), methodDescribe);
}
devId = monitor.getTerminalId();
}
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(devId);
if(Objects.isNull(pqsDeviceUnit)){
pqsDeviceUnit = new PqsDeviceUnit();
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
}

View File

@@ -0,0 +1,84 @@
package com.njcn.device.pms.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 数据单位管理
* </p>
*
* @author wr
* @since 2023-08-21
*/
@RestController
@Api(tags = "数据单位管理")
@RequestMapping("/pq/pqsDeviceUnit")
@RequiredArgsConstructor
public class PqsDeviceUnitController extends BaseController {
private final IPqsDeviceUnitService iPqsDeviceUnitService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/nodeTree")
@ApiOperation("数据单位查询树")
@ApiImplicitParam(name = "devFlag", value = "实体", required = true)
public HttpResult<List<DeviceUnitVo>> nodeTree(String devFlag) {
String methodDescribe = getMethodDescribe("nodeTree");
List<DeviceUnitVo> pqsDeviceUnitVos = iPqsDeviceUnitService.nodeList(devFlag);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnitVos, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/saveDeviceUnit")
@ApiOperation("数据单位修改")
@ApiImplicitParam(name = "unit", value = "实体", required = true)
public HttpResult<Boolean> saveDeviceUnit(@RequestBody PqsDeviceUnit unit) {
String methodDescribe = getMethodDescribe("saveDeviceUnit");
Boolean aBoolean = iPqsDeviceUnitService.saveDeviceUnit(unit);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, aBoolean, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/lineUnitDetail")
@ApiOperation("根据监测点id获取数据单位")
@ApiImplicitParam(name = "lineID", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineID") String lineID) {
String methodDescribe = getMethodDescribe("lineUnitDetail");
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.lineUnitDetail(lineID);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/devUnitDetail")
@ApiOperation("根据终端id获取数据单位")
@ApiImplicitParam(name = "devID", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> devUnitDetail(@RequestParam("devID") String devID) {
String methodDescribe = getMethodDescribe("devUnitDetail");
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.devUnitDetail(devID);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
}
}

View File

@@ -0,0 +1,14 @@
package com.njcn.device.pms.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo;
/**
* pqs
*
* @author cdf
* @date 2024/8/21
*/
public interface PqsDeviceUnitMapper extends BaseMapper<PqsDeviceUnit> {
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.PqsDeviceUnitMapper">
<select id="deviceUnitList" resultType="com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo$DeviceUnit">
SELECT
dev.id as id,
dev.pid as pid,
dev.NAME as `name`,
pd.Run_Flag as devFlag,
b.*
FROM
pq_line dev
INNER JOIN pq_device pd ON dev.id = pd.id and dev.State = 1
LEFT JOIN pqs_device_unit b ON dev.id = b.dev_index
<where>
<if test="devFlag!=null and devFlag!='' ">
pd.Run_Flag = #{devFlag}
</if>
</where>
</select>
<select id="deviceUnitByID" resultType="com.njcn.device.biz.pojo.po.PqsDeviceUnit">
SELECT
unit.*
FROM
pq_line line
INNER JOIN pq_line vo ON vo.id = line.pid
INNER JOIN pq_line dev ON dev.id = vo.pid
INNER JOIN pq_device pd ON pd.id = dev.id
LEFT JOIN pqs_device_unit unit ON unit.DEV_INDEX = dev.id
<where>
line.State = 1
<if test="ids!=null and ids!='' ">
and line.id = #{ids}
</if>
</where>
</select>
</mapper>

View File

@@ -85,7 +85,7 @@ public class PmsParkServiceImpl extends ServiceImpl<PmsParkMapper, PmsParkPO> im
public Page<PmsParkPO> pageList(PmsParkParam.PmsParkQuery parkQuery) {
List<String> deptCodes = deptFeignClient.getDepSonSelfCodetByDeptId(parkQuery.getMaintOrg()).getData();
LambdaQueryWrapper<PmsParkPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(PmsParkPO::getMaintOrg, deptCodes);
lambdaQueryWrapper.in(PmsParkPO::getMaintOrg, deptCodes).orderByDesc(PmsParkPO::getCreateTime,PmsParkPO::getCityOrgName);
return this.page(new Page<>(PageFactory.getPageNum(parkQuery), PageFactory.getPageSize(parkQuery)), lambdaQueryWrapper);
}
@@ -140,7 +140,7 @@ public class PmsParkServiceImpl extends ServiceImpl<PmsParkMapper, PmsParkPO> im
List<String> ids = deptFeignClient.getDepSonSelfCodetByCode(param.getCityOrg()).getData();
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(PmsMidLedger::getName,PmsMidLedger::getOperationName,PmsMidLedger::getId).in(PmsMidLedger::getOperationId,ids).eq(PmsMidLedger::getLevel,0);
lambdaQueryWrapper.select(PmsMidLedger::getName,PmsMidLedger::getOperationName,PmsMidLedger::getId).in(PmsMidLedger::getSectionId,ids).eq(PmsMidLedger::getLevel,0);
List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
return pmsMidLedgerList;
}

View File

@@ -0,0 +1,55 @@
package com.njcn.device.pms.service.majornetwork;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author wr
* @since 2023-08-21
*/
public interface IPqsDeviceUnitService extends IService<PqsDeviceUnit> {
/**
* @param devFlag
* @Description: 查询数据单位树
* @return: java.util.List<com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo>
* @Author: wr
* @Date: 2023/8/21 13:58
*/
List<DeviceUnitVo> nodeList(String devFlag);
/**
* @param unit
* @Description: 添加数据终端
* @return: java.lang.Boolean
* @Author: wr
* @Date: 2023/8/21 14:01
*/
Boolean saveDeviceUnit(PqsDeviceUnit unit);
/**
* @param lineID
* @Description: 根据监测点id查询数据单位
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
* @Author: wr
* @Date: 2023/8/21 14:02
*/
PqsDeviceUnit lineUnitDetail(String lineID);
/**
* @param devID
* @Description: 根据终端id查询数据单位
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
* @Author: wr
* @Date: 2023/8/21 14:02
*/
PqsDeviceUnit devUnitDetail(String devID);
}

View File

@@ -312,6 +312,14 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(monitorParam.getOrgId()).getData();
lambdaQueryWrapper.in(Monitor::getOrgId, deptIds).eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode());
}
//是否上送国网测点
if(Objects.nonNull(monitorParam.getIsUpToGrid())){
lambdaQueryWrapper.eq(Monitor::getIsUpToGrid, DataStateEnum.ENABLE.getCode());
}
//运行状态
if(StrUtil.isNotBlank(monitorParam.getMonitorState())){
lambdaQueryWrapper.eq(Monitor::getMonitorState,monitorParam.getMonitorState());
}
return this.list(lambdaQueryWrapper);
}
@@ -1242,7 +1250,7 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<DictData> wireList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
Map<String, DictData> wireListMap = wireList.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
DictData potentialDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.VOLTAGE_TRANSFORMER.getName(), DicDataEnum.Cap_V.getName()).getData();
DictData potentialDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.Cap_V.getCode(),DicDataTypeEnum.VOLTAGE_TRANSFORMER.getCode()).getData();
DictData neutralDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.Neutral_Point.getName(), DicDataEnum.Ground_Res.getName()).getData();

View File

@@ -0,0 +1,128 @@
package com.njcn.device.pms.service.majornetwork.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.mapper.majornetwork.PqsDeviceUnitMapper;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
import com.njcn.device.pms.service.majornetwork.ITerminalService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author wr
* @since 2023-08-21
*/
@Service
@RequiredArgsConstructor
public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, PqsDeviceUnit> implements IPqsDeviceUnitService {
private final ITerminalService terminalService;
private final IMonitorService monitorService;
@Override
public List<DeviceUnitVo> nodeList(String devFlag) {
List<DeviceUnitVo> pqsDeviceUnitVos = new ArrayList<>();
List<PmsTerminal> list = terminalService.list(new LambdaQueryWrapper<PmsTerminal>()
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
.eq(StrUtil.isNotBlank(devFlag), PmsTerminal::getTerminalState, devFlag)
);
if(CollUtil.isEmpty(list)){
return pqsDeviceUnitVos;
}
List<String> terminal = list.stream().map(PmsTerminal::getId).collect(Collectors.toList());
//获取所有终端信息
List<PqsDeviceUnit> pqsDeviceUnits = this.listByIds(terminal);
Map<String, PqsDeviceUnit> unitMap = pqsDeviceUnits.stream().collect(Collectors.toMap(PqsDeviceUnit::getDevIndex, Function.identity()));
Map<String, List<PmsTerminal>> orgMap = list.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
orgMap.forEach((key, value) -> {
DeviceUnitVo unitVo = new DeviceUnitVo();
unitVo.setId(key);
unitVo.setName(value.get(0).getOrgName());
Map<String, List<PmsTerminal>> subMap = value.stream().collect(Collectors.groupingBy(PmsTerminal::getPowerStationId));
List<DeviceUnitVo> subUnitVos = new ArrayList<>();
subMap.forEach((subKey, subValue) -> {
DeviceUnitVo subUnitVo = new DeviceUnitVo();
subUnitVo.setId(subKey);
subUnitVo.setName(subValue.get(0).getPowerrName());
Map<String, List<PmsTerminal>> terMap = subValue.stream().collect(Collectors.groupingBy(PmsTerminal::getId));
List<DeviceUnitVo.DeviceUnit> terUnitVos = new ArrayList<>();
terMap.forEach((terKey, terValue) -> {
for (PmsTerminal pmsTerminal : terValue) {
DeviceUnitVo.DeviceUnit terUnitVo = new DeviceUnitVo.DeviceUnit();
terUnitVo.setId(pmsTerminal.getId());
terUnitVo.setName(pmsTerminal.getName());
terUnitVo.setDevFlag(pmsTerminal.getTerminalState());
PqsDeviceUnit pqsDeviceUnit;
if (unitMap.containsKey(terKey)) {
pqsDeviceUnit = unitMap.get(terKey);
} else {
pqsDeviceUnit = new PqsDeviceUnit();
}
BeanUtil.copyProperties(pqsDeviceUnit,terUnitVo);
terUnitVos.add(terUnitVo);
}
});
subUnitVo.setChildren(terUnitVos);
subUnitVos.add(subUnitVo);
});
unitVo.setChildren(subUnitVos);
pqsDeviceUnitVos.add(unitVo);
});
return pqsDeviceUnitVos;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveDeviceUnit(PqsDeviceUnit unit) {
PqsDeviceUnit byId = this.getById(unit.getDevIndex());
if (ObjectUtil.isNotNull(byId)) {
return this.updateById(unit);
}
return this.save(unit);
}
@Override
public PqsDeviceUnit lineUnitDetail(String lineID) {
Monitor byId = monitorService.getById(lineID);
if (ObjectUtil.isNotNull(byId)) {
PqsDeviceUnit unit = this.getById(byId.getTerminalId());
if (ObjectUtil.isNotNull(unit)) {
return unit;
}
return new PqsDeviceUnit();
}
return new PqsDeviceUnit();
}
@Override
public PqsDeviceUnit devUnitDetail(String devID) {
PqsDeviceUnit byId = this.getById(devID);
if (ObjectUtil.isNotNull(byId)) {
return byId;
}
return new PqsDeviceUnit();
}
}

View File

@@ -7,7 +7,6 @@ import com.njcn.device.pq.pojo.po.DeptLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@@ -19,7 +18,10 @@ import java.util.Map;
@FeignClient(value = ServerInfo.DEVICE,path = "/deptLine",fallbackFactory = DeptLineFeignClientFallbackFactory.class,contextId = "deptLine")
public interface DeptLineFeignClient {
@PostMapping("/getLineByDeptId")
HttpResult<List<String>> getLineByDeptId(String id);
HttpResult<List<String>> getLineByDeptId(@RequestParam("id")String id);
@PostMapping("/getLineByDeptIdAndNewStation")
HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id")String id);
@PostMapping("/selectDeptBindLines")
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);

View File

@@ -356,9 +356,9 @@ public interface LineFeignClient {
/**
* 根据监测点名称和电网侧变电站名称模糊搜索
* @param name
* @param param
* @return
*/
@PostMapping("/getByName")
HttpResult<List<LineDetail>> getByName(@RequestParam("name") String name);
HttpResult<List<LineDetail>> getByName(@RequestBody LineBaseQueryParam param);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.NewStationClientFallbackFactory;
import com.njcn.device.pq.pojo.po.NewStation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 新能源场站高低电压穿越Feign客户端
* @author guofeihu
* @date 2024-08-14
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/newStation", fallbackFactory = NewStationClientFallbackFactory.class, contextId = "newStation")
public interface NewStationClient {
/**
* 根据ID获取新能源场站高低电压穿越表信息
*
* @return
*/
@GetMapping("/selectById")
HttpResult<NewStation> selectById(@RequestParam(name = "id") String id);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.PqsTerminalLogsClientFallbackFactory;
import com.njcn.device.pq.pojo.po.Node;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
/**
* @Description:
* @Author: wr
* @Date: 2024/8/13 10:14
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/node", fallbackFactory = PqsTerminalLogsClientFallbackFactory.class, contextId = "node")
public interface NodeClient {
@ApiOperation("获取全部前置机")
@GetMapping("/nodeAllList")
HttpResult<List<Node>> nodeAllList();
}

View File

@@ -39,6 +39,12 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory<DeptL
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<String>> getLineByDeptIdAndNewStation(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据部门id获取绑定的监测点且再根据NewStation进行过滤", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> selectDeptBindLines(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "部门Ids集合查询是否绑定", throwable.toString());

View File

@@ -283,7 +283,7 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
}
@Override
public HttpResult<List<LineDetail>> getByName(String name) {
public HttpResult<List<LineDetail>> getByName(LineBaseQueryParam param) {
log.error("{}异常,降级处理,异常为:{}", "根据监测点名称和电网侧变电站名称模糊搜索: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -0,0 +1,39 @@
package com.njcn.device.pq.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.NewStationClient;
import com.njcn.device.pq.pojo.po.NewStation;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 新能源场站高低电压穿越管理熔断降级
* @author guofeihu
* @date 2024-08-14
*/
@Slf4j
@Component
public class NewStationClientFallbackFactory implements FallbackFactory<NewStationClient> {
@Override
public NewStationClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new NewStationClient() {
@Override
public HttpResult<NewStation> selectById(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据ID获取新能源场站高低电压穿越表信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,46 @@
package com.njcn.device.pq.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.NodeClient;
import com.njcn.device.pq.api.PqsTerminalLogsClient;
import com.njcn.device.pq.pojo.po.Node;
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zbj
* @version 1.0.0
* @date 2023年04月13日 13:34
*/
@Slf4j
@Component
public class NodeClientFallbackFactory implements FallbackFactory<NodeClient> {
@Override
public NodeClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new NodeClient()
{
@Override
public HttpResult<List<Node>> nodeAllList() {
log.error("{}异常,降级处理,异常为:{}", "获取全部前置机", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -1,6 +1,11 @@
package com.njcn.device.pq.constant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author qijian
*/
@@ -21,4 +26,44 @@ public interface Param {
Integer WEEK = 4;
Integer DAY = 5;
//以下四个固定ID用于某些业务判断
//字典(sys_dict_data):电压暂升的ID
String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0";
//字典(sys_dict_data):电压暂降的ID
String LOWEREVENT = "c37861896dafab0883321e1d508caa51";
//字典(sys_dict_data):光伏电站的ID
String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e";
//字典(sys_dict_data):风电场的ID
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
/**
* 以下的四个Map为有功功率页面查看指标详情的四个指标分组下的具体指标(指标对应的可能不对 到时候直接改map里的key即可)
* 页面展示的指标名称 对应 的表ele_epd_pqd中的名称
* map的key为的表ele_epd_pqd中的名称value为页面上展示的名称
*/
Map<String,String> DATABSEMAP = new HashMap(){{
put("频率偏差","频率偏差");
put("线电压偏差","电压偏差");
put("相电压长时闪变","长时闪变");
put("线电压总有效值","谐波电压");
put("电流总有效值","谐波电流");
put("相电压总有效值","间谐波电压");
put("电压负序不平衡度","负序电压不平衡度");
put("电流负序不平衡度","负序电流");
put("总稳态指标","三相总有功功率");
put("相电压谐波总畸变率","电压总谐波畸变率");
}};
Map<String,String> UHARMMAP = new HashMap(){{
put("相电压谐波含有率序列","电压");
}};
Map<String,String> IHARMMAP = new HashMap(){{
put("谐波电流有效值","电流");
}};
Map<String,String> INTERHARMONICMAP = new HashMap(){{
put("间谐波电压有效值序列","间谐波电压含有率");
}};
}

View File

@@ -188,6 +188,7 @@ public class LineParam {
@ApiModelProperty(name = "updateFlag",value = "修改标识")
private Integer updateFlag;
@ApiModelProperty(name = "newStationId",value = "新能源场站信息ID")
private String newStationId;
}

View File

@@ -0,0 +1,68 @@
package com.njcn.device.pq.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 新能源场站高低电压穿越表查询类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Data
public class NewStationQueryParam extends BaseParam {
@ApiModelProperty("id")
private String id;
@ApiModelProperty("新能源场站名称")
private String name;
@ApiModelProperty("新能源场站类型")
private String stationType;
@ApiModelProperty("电压等级Guid")
private String scale;
@ApiModelProperty("额定有功功率")
private String ratedPower;
@ApiModelProperty("经度")
private String longitude;
@ApiModelProperty("维度")
private String latitude;
@Data
public static class NewStationEdit{
@ApiModelProperty("id")
private String id;
@NotBlank(message = "新能源场站名称不能为空")
@ApiModelProperty("新能源场站名称(*)")
private String name;
@NotBlank(message = "新能源场站类型不能为空")
@ApiModelProperty("新能源场站类型(*)")
private String stationType;
@ApiModelProperty("电压等级Guid")
private String scale;
@NotBlank(message = "额定有功功率不能为空")
@ApiModelProperty("额定有功功率(*)")
private String ratedPower;
@NotBlank(message = "经度不能为空")
@ApiModelProperty("经度(*)")
private String longitude;
@NotBlank(message = "维度不能为空")
@ApiModelProperty("维度(*)")
private String latitude;
}
}

View File

@@ -180,6 +180,11 @@ public class LineDetail{
*/
private Integer runFlag;
/**
* 新能源场站信息ID
*/
private String newStationId;
/**
* 通讯状态
*/

View File

@@ -0,0 +1,62 @@
package com.njcn.device.pq.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 新能源场站高低电压穿越表实体类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Getter
@Setter
@TableName("pq_new_station")
public class NewStation extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 新能源场站名称
*/
private String name;
/**
* 关联new_station_type字典表新能源场站类型风电场、光伏电站
*/
private String stationType;
/**
* 关联Dev_Voltage_Stand字典表电压等级Guid
*/
private String scale;
/**
* 额定有功功率
*/
private String ratedPower;
/**
* 经度
*/
private String longitude;
/**
* 维度
*/
private String latitude;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.device.pq.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2024/8/15 14:13
*/
@Data
public class DevAndLine {
@ApiModelProperty("终端id")
private String devId;
@ApiModelProperty("终端名称")
private String devName;
@ApiModelProperty("监测点集合")
private List<Line> lineList;
@Data
public static class Line {
@ApiModelProperty("监测点id")
private String lineId;
@ApiModelProperty("监测点名称")
private String lineName;
}
}

View File

@@ -121,4 +121,7 @@ public class LineDetailDataVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ApiModelProperty(name = "新能源场站信息ID")
private String newStationId;
}

View File

@@ -121,6 +121,7 @@ public class LineVO implements Serializable {
@ApiModelProperty(name = "sort",value = "排序",required = true)
private Integer sort;
@ApiModelProperty(name = "newStationId",value = "新能源场站信息ID")
private String newStationId;
}

View File

@@ -112,6 +112,15 @@ public class DeptLineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineByDeptIdAndNewStation")
@ApiOperation("根据部门id获取绑定的监测点且再根据NewStation进行过滤")
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation");
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineDetailByDeptId")
@ApiOperation("部门Id获取绑定监测点详情")

View File

@@ -418,12 +418,8 @@ public class LineController extends BaseController {
@ApiImplicitParam(name = "deviceInfoParam", value = "监测点查询条件", required = true)
})
public HttpResult<List<DeptLineCountVO>> getDeptLineCount(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("getDeptLineCount");
List<DeptLineCountVO> deptLineCountVOS = new ArrayList<> ();
deptLineCountVOS = lineService.getDeptLineCount(deviceInfoParam);
List<DeptLineCountVO> deptLineCountVOS = lineService.getDeptLineCount(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptLineCountVOS, methodDescribe);
}
@@ -537,9 +533,17 @@ public class LineController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据监测点名称和电网侧变电站名称模糊搜索")
@PostMapping("/getByName")
HttpResult<List<LineDetail>> getByName(@RequestParam("name") String name){
HttpResult<List<LineDetail>> getByName(@RequestBody LineBaseQueryParam param){
String methodDescribe = getMethodDescribe("getByName");
List<LineDetail> list = lineService.getByName(name);
List<LineDetail> list = lineService.getByName(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取部门下终端信息和终端下监测点信息")
@GetMapping("/getByDeptDevLine")
HttpResult<List<DevAndLine>> getByDeptDevLine(String id){
String methodDescribe = getMethodDescribe("getByDeptDevLine");
List<DevAndLine> list = lineService.getByDeptDevLine(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -0,0 +1,89 @@
package com.njcn.device.pq.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.service.INewStationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 前端控制器
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Api(tags = "新能源场站高低电压穿越表管理")
@Slf4j
@RestController
@RequestMapping("/newStation")
@RequiredArgsConstructor
public class NewStationController extends BaseController {
private final INewStationService iNewStationService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.QUERY)
@PostMapping("/queryPage")
@ApiOperation("新能源场站高低电压穿越表分页查询")
public HttpResult<Page<NewStation>> queryPage(@RequestBody @Validated NewStationQueryParam newStationQueryParam){
String methodDescribe = getMethodDescribe("queryPage");
Page<NewStation> page = iNewStationService.queryPage(newStationQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
@PostMapping("/editNewStation")
@ApiOperation("新能源场站高低电压穿越信息更新")
public HttpResult<Boolean> editNewStation(@RequestBody @Validated NewStationQueryParam.NewStationEdit newStationEdit) {
String methodDescribe = getMethodDescribe("editNewStation");
LogUtil.njcnDebug(log, "{},更新对象为:{}", methodDescribe, newStationEdit);
iNewStationService.editNewStation(newStationEdit);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
@DeleteMapping("/delNewStation")
@ApiOperation("新能源场站高低电压穿越信息删除")
public HttpResult<Boolean> delNewStation(@RequestParam(name = "ids") String ids) {
String methodDescribe = getMethodDescribe("delNewStation");
LogUtil.njcnDebug(log, "{}删除的Id的集合为{}", methodDescribe, ids);
iNewStationService.delNewStation(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@GetMapping("/selectDown")
@ApiOperation("获取新能源场站高低电压穿越信息下拉框(用于监测点维护界面)")
public HttpResult<List<Map>> selectDown(@RequestParam(name = "name",required = false) String name) {
String methodDescribe = getMethodDescribe("selectDown");
LogUtil.njcnDebug(log, "{},远程搜索值为:{}", methodDescribe, name);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectDown(name), methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@GetMapping("/selectById")
@ApiOperation("根据ID获取新能源场站高低电压穿越表信息")
public HttpResult<NewStation> selectById(@RequestParam(name = "id") String id) {
String methodDescribe = getMethodDescribe("selectById");
LogUtil.njcnDebug(log, "{}id值为{}", methodDescribe, id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectById(id), methodDescribe);
}
}

View File

@@ -82,4 +82,6 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
List<String> getLineByDeptIdAndNewStation(@Param("id") String id);
}

View File

@@ -62,4 +62,9 @@ public interface LineDetailMapper extends BaseMapper<LineDetail> {
* @return 结果
*/
List<LineDetail> getLineDetailByIds(@Param("ids") List<String> Ids);
/**
* 判断该新能源场站信息是否绑定了测点ID
*/
Integer checkExistsLineByNewStationId(@Param("newStationId") String newStationId);
}

View File

@@ -17,6 +17,7 @@ import com.njcn.device.pq.pojo.dto.OverLimitLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.WarningSubstationDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*;
@@ -558,6 +559,6 @@ public interface LineMapper extends BaseMapper<Line> {
List<Line> getSubByCondition(@Param("subIds") List<String> subIds, @Param("scale") List<SimpleDTO> scale);
List<LineDetail> selectByName(@Param("name") String name);
List<LineDetail> selectByName(@Param("param") LineBaseQueryParam param);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 Mapper 接口
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
public interface NewStationMapper extends BaseMapper<NewStation> {
Page<NewStation> queryPage(IPage<NewStation> page, @Param("newStationQueryParam") NewStationQueryParam newStationQueryParam);
List<Map> selectDown( @Param("name") String name);
}

View File

@@ -111,7 +111,7 @@
inner join pq_line dev on voltage.pid = dev.id
inner join pq_device device on dev.id = device.id
inner join pq_line substation on dev.pid = substation.id
inner join pq_substation sub on sub.id = substation.id
left join pq_substation sub on sub.id = substation.id
where device.Dev_Model = 1
and point.state = 1
and device.Run_Flag = 0
@@ -194,4 +194,11 @@
</if>
</where>
</select>
<select id="getLineByDeptIdAndNewStation" resultType="string">
select pdl.Line_Id from pq_dept_line pdl
inner join pq_line_detail pld on pdl.Line_Id = pld.Id
where pdl.Id = #{id}
and exists (select 1 from pq_new_station pns where pns.id = pld.New_Station_Id and pns.state = 1)
</select>
</mapper>

View File

@@ -41,7 +41,8 @@
select
a.name lineName,
c.Time_Interval,
e.name scale
e.name scale,
c.New_Station_Id newStationId
from pq_line a
inner join pq_line b on a.pid = b.id
inner join pq_line_detail c on a.id = c.id
@@ -96,4 +97,9 @@
set run_flag = #{runFlag}
where id = #{id}
</update>
<select id="checkExistsLineByNewStationId" resultType="int">
select count(1) from pq_line pl inner join pq_line_detail pld
on pl.id = pld.id and pl.State = 1 and pld.New_Station_Id = #{newStationId}
</select>
</mapper>

View File

@@ -308,7 +308,7 @@
FROM
pq_line t1,
pq_device t2
WHERE
<where>
t1.id = t2.id
<if test="deviceType.devModel!=null and deviceType.devModel.size()!=0">
AND t2.Dev_Model in
@@ -340,10 +340,14 @@
#{item.id}
</foreach>
</if>
<if test="devIds!=null and devIds.size()!=0">
AND t1.id IN
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
@@ -353,19 +357,25 @@
from
pq_line t1 ,
pq_voltage t2
where
<where>
t1.id = t2.id
and
t1.id in
<if test="voltageIds!=null and voltageIds.size()!=0">
and t1.id in
<foreach collection="voltageIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
<if test="scale!=null and scale.size()!=0">
AND t2.scale in
<foreach collection="scale" open="(" close=")" item="item" separator=",">
#{item.id}
</foreach>
</if>
</where>
</select>
<select id="getVoltageIdByScale" resultType="String">
@@ -1421,7 +1431,8 @@
vg.Scale AS voltageLevel,
pqd.Run_Flag as runFlag,
detail.PT_Type AS ptType,
detail.PT_Phase_Type AS ptPhaseType
detail.PT_Phase_Type AS ptPhaseType,
detail.New_Station_Id AS newStationId
FROM
pq_line line,
pq_line_detail detail,
@@ -1728,21 +1739,22 @@
select
t1.*
from
pq_line t1 ,
pq_substation t2
where
t1.id = t2.id
and
t1.id in
pq_line t1
left join pq_substation t2 on t1.id = t2.id
<where>
<if test="subIds!=null and subIds.size()!=0">
AND t1.id in
<foreach collection="subIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
<if test="scale!=null and scale.size()!=0">
AND t2.scale in
<foreach collection="scale" open="(" close=")" item="item" separator=",">
#{item.id}
</foreach>
</if>
</where>
</select>
<select id="selectByName" resultType="com.njcn.device.pq.pojo.po.LineDetail">
select
@@ -1751,9 +1763,15 @@
pq_line t1 ,
pq_line_detail t2
<where>
t1.id = t2.id
<if test="name!=null and name!=''">
AND (t1.name like CONCAT('%', #{name}, '%') or t2.Power_Substation_Name like CONCAT('%', #{name}, '%'))
t1.id = t2.id and t2.Run_Flag=0
<if test="param.lineIds!=null and param.lineIds.size()!=0">
AND t1.id in
<foreach collection="param.lineIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="param.searchValue!=null and param.searchValue!=''">
AND (t1.name like CONCAT('%', #{param.searchValue}, '%') or t2.Power_Substation_Name like CONCAT('%', #{param.searchValue}, '%'))
</if>
</where>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.NewStationMapper">
<resultMap id="BaseResultMap" type="com.njcn.device.pq.pojo.po.NewStation">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="station_type" jdbcType="VARCHAR" property="stationType"/>
<result column="scale" jdbcType="VARCHAR" property="scale" />
<result column="rated_power" jdbcType="VARCHAR" property="ratedPower" />
<result column="longitude" jdbcType="VARCHAR" property="longitude" />
<result column="latitude" jdbcType="INTEGER" property="latitude" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap>
<select id="queryPage" resultMap="BaseResultMap">
select * from pq_new_station ns
where ns.state = 1
<if test="newStationQueryParam.name != null and newStationQueryParam.name !=''">
and ns.name like concat('%',#{newStationQueryParam.name},'%')
</if>
<if test="newStationQueryParam.stationType != null and newStationQueryParam.stationType !=''">
and ns.station_type = #{newStationQueryParam.stationType}
</if>
<if test="newStationQueryParam.scale != null and newStationQueryParam.scale !=''">
and ns.scale = #{newStationQueryParam.scale}
</if>
</select>
<select id="selectDown" parameterType="string" resultType="map">
select id as value,name from pq_new_station ns
where state = 1
<if test="name != null and name !=''">
and ns.name like concat('%',#{name},'%')
</if>
</select>
</mapper>

View File

@@ -67,7 +67,13 @@ public interface DeptLineService extends IService<DeptLine> {
*/
List<String> getLineByDeptId(String id);
/**
* 功能描述: 根据部门id获取绑定的监测点且再根据NewStation进行过滤
* @param id,type
* @author guofeihu
* @date 2024/8/19
*/
List<String> getLineByDeptIdAndNewStation(String id);
/**
* @Description: 根据部门id获取所有子集部门所包含的部门信息

View File

@@ -0,0 +1,55 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 服务类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
public interface INewStationService extends IService<NewStation> {
/**
* 新能源场站高低电压穿越表分页查询
* @param newStationQueryParam
* @return
*/
Page<NewStation> queryPage(NewStationQueryParam newStationQueryParam);
/***
* 新能源场站高低电压穿越表更新
* @param newStationEdit
* @return Boolean
*/
Boolean editNewStation(NewStationQueryParam.NewStationEdit newStationEdit) ;
/***
* 新能源场站高低电压穿越表删除
* @param ids
* @return Boolean
*/
Boolean delNewStation(String ids);
/***
* 获取新能源场站高低电压穿越信息下拉框(用于监测点维护界面)
* @param name
* @return List
*/
List<Map> selectDown(String name);
/***
* 根据ID获取新能源场站高低电压穿越表信息
* @param id
* @return NewStation
*/
NewStation selectById(String id);
}

View File

@@ -7,10 +7,7 @@ import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DataParam;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.pojo.po.LineDetail;
@@ -226,5 +223,12 @@ public interface LineService extends IService<Line> {
List<ReportLineInfoVo> getReportLineInfo(List<String> ids);
List<LineDetail> getByName(String name);
List<LineDetail> getByName(LineBaseQueryParam param);
/**
* 获取部门下终端信息和终端下监测点信息
* @param id
* @return
*/
List<DevAndLine> getByDeptDevLine(String id);
}

View File

@@ -12,6 +12,7 @@ import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.service.DeptLineService;
import com.njcn.device.pq.constant.Param;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.pojo.param.DeptLineParam;
@@ -88,6 +89,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
return this.lambdaQuery().in(DeptLine::getId, id).list().stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList());
}
@Override
public List<String> getLineByDeptIdAndNewStation(String id) {
return this.baseMapper.getLineByDeptIdAndNewStation(id);
}
@Override
public List<String> getLineNodeByDeptId(String id) {
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();

View File

@@ -282,6 +282,9 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override
public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) {
param.getDeviceInfoParam().setLineRunFlag(0);
if(type==3){
param.getDeviceInfoParam().setPowerFlag(0);
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
Map<String, Long> map = new LinkedHashMap<>();
DateField dateField;
@@ -312,13 +315,29 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<Line> list = lineService.list(new LambdaQueryWrapper<Line>().in(CollUtil.isNotEmpty(ids), Line::getId, ids).eq(Line::getState, DataStateEnum.ENABLE.getCode()).eq(Line::getLevel, type));
times = list.stream().map(x -> Date.from(x.getCreateTime().atZone(ZoneId.systemDefault()).toInstant())).collect(Collectors.toList());
}
for (DateTime dateTime : dateTimes) {
long num =0;
for (int i = 0; i < dateTimes.size(); i++) {
if(i==0){
if (1 == param.getType()) {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(dateTime), DateUtil.endOfYear(dateTime))).count();
map.put(dateTime.toString().substring(0, 4), count);
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(DateUtil.parse("1970-01-01 00:00:00")), DateUtil.endOfYear(dateTimes.get(0)))).count();
num=num+count;
map.put(dateTimes.get(0).toString().substring(0, 4), num);
} else {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfMonth(dateTime), DateUtil.endOfMonth(dateTime))).count();
map.put(dateTime.toString().substring(0, 7), count);
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(DateUtil.parse("1970-01-01 00:00:00")), DateUtil.endOfMonth(dateTimes.get(0)))).count();
num=num+count;
map.put(dateTimes.get(0).toString().substring(0, 7), num);
}
}else{
int finalI = i;
if (1 == param.getType()) {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(dateTimes.get(finalI)), DateUtil.endOfYear(dateTimes.get(finalI)))).count();
num=num+count;
map.put(dateTimes.get(finalI).toString().substring(0, 4), num);
} else {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfMonth(dateTimes.get(finalI)), DateUtil.endOfMonth(dateTimes.get(finalI)))).count();
num=num+count;
map.put(dateTimes.get(finalI).toString().substring(0, 7), num);
}
}
}
return map;

View File

@@ -490,7 +490,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
} else {
groupLine = childrenData.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid));
}
targetData = targetData.stream().peek(lineAdministrationTree -> {
targetData.stream().peek(lineAdministrationTree -> {
List<Double> data = new ArrayList<>();
List<LineIntegrityDataVO> childList = new ArrayList<>();
Set<String> pids = groupLine.keySet();
@@ -514,7 +514,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
}
//父级完整性匹配
if (CollectionUtil.isNotEmpty(data)){
double avg = data.stream().collect(Collectors.averagingDouble(x -> x));
BigDecimal reduce = data.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
double avg = reduce.divide(new BigDecimal(data.size()),6,RoundingMode.HALF_UP).doubleValue();
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(avg));
} else {
lineAdministrationTree.setIntegrityData(3.14159);

View File

@@ -26,10 +26,7 @@ import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DataParam;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.service.DeptLineService;
@@ -504,10 +501,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
LineDTO lineDTO = this.baseMapper.selectLineDetail(id);
if(lineDTO != null){
if(dicMap.containsKey(lineDTO.getVoltageLevel())){
lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel()));
return lineDTO;
}
}
return null;
}
@@ -695,8 +694,37 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
}
@Override
public List<LineDetail> getByName(String name) {
return this.baseMapper.selectByName(name);
public List<LineDetail> getByName(LineBaseQueryParam param) {
return this.baseMapper.selectByName(param);
}
@Override
public List<DevAndLine> getByDeptDevLine(String id) {
List<DevAndLine> info=new ArrayList<>();
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(id).getData();
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
List<String> lineIDs = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(lineIDs)){
List<LineDetailVO.Detail> deptDeviceDetailData = this.baseMapper.getDeptDeviceDetailData(lineIDs, null, 3);
if(CollUtil.isNotEmpty(deptDeviceDetailData)){
Map<String, List<LineDetailVO.Detail>> collect = deptDeviceDetailData.stream().collect(Collectors.groupingBy(LineDetailVO.Detail::getDevId));
collect.forEach((k,v)->{
DevAndLine devAndLine = new DevAndLine();
List<DevAndLine.Line> lineList=new ArrayList<>();
devAndLine.setDevId(k);
devAndLine.setDevName(v.get(0).getDevName());
v.stream().distinct().forEach(v1->{
DevAndLine.Line line = new DevAndLine.Line();
line.setLineId(v1.getLineId());
line.setLineName(v1.getLineName());
lineList.add(line);
});
devAndLine.setLineList(lineList);
info.add(devAndLine);
});
}
}
return info;
}
@Override

View File

@@ -0,0 +1,89 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.mapper.LineDetailMapper;
import com.njcn.device.pq.mapper.NewStationMapper;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.service.INewStationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 服务实现类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Service
@RequiredArgsConstructor
public class NewStationServiceImpl extends ServiceImpl<NewStationMapper, NewStation> implements INewStationService {
private final LineDetailMapper lineDetailMapper;
@Override
public Page<NewStation> queryPage(NewStationQueryParam newStationQueryParam) {
Page<NewStation> returnpage = new Page<> (newStationQueryParam.getPageNum(),newStationQueryParam.getPageSize());
returnpage = this.getBaseMapper().queryPage(returnpage,newStationQueryParam);
return returnpage;
}
@Override
public Boolean editNewStation(NewStationQueryParam.NewStationEdit newStationEdit) {
NewStation newStation = new NewStation();
BeanUtil.copyProperties(newStationEdit, newStation);
newStation.setState(1);
boolean result ;
if(newStation.getId() != null){
result = this.updateById(newStation);
}else{
newStation.setId(IdUtil.simpleUUID());
result = this.save(newStation);
}
return result;
}
@Override
public Boolean delNewStation(String ids) {
List<String> listIds = Arrays.asList(ids.split(","));
//判断该新能源场站信息是否绑定了测点ID
for(String id : listIds){
if(lineDetailMapper.checkExistsLineByNewStationId(id)!=0){
LambdaUpdateWrapper<NewStation> queryWrapper = new LambdaUpdateWrapper<>();
queryWrapper.eq(NewStation::getId,id);
NewStation newStation = this.baseMapper.selectOne(queryWrapper);
throw new BusinessException(newStation == null?"":newStation.getName()+DeviceResponseEnum.NEWSTATION_IS_BIND_LINE.getMessage());
}
}
LambdaUpdateWrapper<NewStation> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.set(NewStation::getState,0)
.in(NewStation::getId, listIds);
boolean update = this.update(lambdaUpdateWrapper);
return update;
}
@Override
public List<Map> selectDown(String name) {
return this.baseMapper.selectDown(name);
}
@Override
public NewStation selectById(String id) {
LambdaQueryWrapper<NewStation> lambdaUpdateWrapper = new LambdaQueryWrapper<>();
lambdaUpdateWrapper.eq(NewStation::getId,id).eq(NewStation::getState,1);
return this.baseMapper.selectOne(lambdaUpdateWrapper);
}
}

View File

@@ -118,6 +118,11 @@ public class RunManageServiceImpl implements RunManageService {
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
deviceInfoParam.setServerName("pqs-common");
if(CollUtil.isNotEmpty(runManageParam.getRunFlag())){
if(runManageParam.getRunFlag().get(0)==0){
deviceInfoParam.setLineRunFlag(0);
}
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(generalDeviceDTOList)) {
throw new BusinessException("当前部门没有装置台账");

View File

@@ -2125,6 +2125,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
LambdaQueryWrapper<DeviceBak> deviceBakLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceBakLambdaQueryWrapper.eq(DeviceBak::getDevId, oracleTerminalExcel.getDeviceId());
List<DeviceBak> deviceBaks = deviceBakService.list(deviceBakLambdaQueryWrapper);
List<String> devIds = deviceBaks.stream().map(DeviceBak::getId).collect(Collectors.toList());
List<Line> devList = new ArrayList<>();
if(!CollectionUtil.isEmpty(devIds)){
@@ -2215,6 +2216,79 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
}
}
}
}else{
//先查询终端id是否存在存在则修改不存在这添加
//判断是否因为改了终端名称导致没有查到数据
// LambdaQueryWrapper<DeviceBak> deviceBakLambdaQueryWrapper = new LambdaQueryWrapper<>();
// deviceBakLambdaQueryWrapper.eq(DeviceBak::getDevId, temp.getId());
// DeviceBak byId = deviceBakService.getById(deviceBakLambdaQueryWrapper);
// if(Objects.isNull(byId)){
//插入新旧终端ID中间表
DeviceBak deviceBak = new DeviceBak();
deviceBak.setId(temp.getId());
deviceBak.setDevId(oracleTerminalExcel.getDeviceId());
deviceBakService.saveOrUpdate(deviceBak);
// }else{
// if(!byId.getDevId().equals(oracleTerminalExcel.getDeviceId())){
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "终端关系数据存入Oracle和excl不一样" + oracleTerminalExcel.getLineNum() + "需要排查"));
// continue;
// }
// }
//更新终端信息
List<Device> existIp = deviceMapper.getDeviceBySubId(pids.get(LineBaseEnum.SUB_LEVEL.getCode()), oracleTerminalExcel.getIp(), oracleTerminalExcel.getPort(), null);
if (CollectionUtil.isNotEmpty(existIp)) {
Device device = existIp.get(0);
if (!device.getId().equalsIgnoreCase(temp.getId())) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "IP地址" + oracleTerminalExcel.getIp() + "已存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
}
//处理终端厂家
DictData manufacturer = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName(),oracleTerminalExcel.getManufacturer()).getData();
if (Objects.isNull(manufacturer)) {
//在终端厂家字典内新增一条记录
manufacturer = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_MANUFACTURER.getName(), oracleTerminalExcel.getManufacturer()).getData();
}
Device device = new Device();
BeanUtils.copyProperties(oracleTerminalExcel, device);
device.setId(temp.getId());
device.setManufacturer(manufacturer.getId());
device.setIp(oracleTerminalExcel.getIp());
//处理前置ID
Node node = nodeService.getNodeByNodeName(oracleTerminalExcel.getNodeName());
if (Objects.isNull(node)) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "前置名:" + oracleTerminalExcel.getNodeName() + "不存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
device.setNodeId(node.getId());
String oracleDevType = oracleTerminalExcel.getDevType().toUpperCase();
String frontType = getComType(oracleDevType);
if (StringUtils.isBlank(frontType)) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "前置类型不存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
//处理前置类型
DictData frontTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.FRONT_TYPE.getName(), frontType).getData();
if (Objects.isNull(frontTypeDicData)) {
//在通讯类型字典内新增一条记录
frontTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.FRONT_TYPE.getName(), frontType).getData();
}
device.setFrontType(frontTypeDicData.getId());
String devType = oracleDevType.replace("_" + frontType, "");
//处理终端类型
DictData devTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_TYPE.getName(),devType).getData();
if (Objects.isNull(devTypeDicData)) {
//在终端类型字典内新增一条记录
devTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_TYPE.getName(), devType).getData();
}
device.setDevType(devTypeDicData.getId());
deviceMapper.updateById(device);
}
//添加终端索引
pids.add(temp.getId());
@@ -2256,6 +2330,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
}
//添加母线索引
pids.add(temp.getId());
/*
* 处理监测点
* 1、判断是否存在不存在则插入
@@ -2268,6 +2344,65 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
temp = queryLine(lineLambdaQueryWrapper, lineName, pids.get(LineBaseEnum.SUB_V_LEVEL.getCode()), LineBaseEnum.LINE_LEVEL.getCode(), DataStateEnum.ENABLE.getCode());
if (Objects.nonNull(temp)) {
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "监测点名称重复,请联系管理员"));
LineBak lineBak = new LineBak();
lineBak.setId(temp.getId());
lineBak.setLineId(oracleTerminalExcel.getId());
lineBakService.saveOrUpdate(lineBak);
//修改监测点信息
LineDetail lineDetail = new LineDetail();
BeanUtils.copyProperties(oracleTerminalExcel, lineDetail);
lineDetail.setId(temp.getId());
//判断监测点号是否已被占用
List<LineDetail> lineDetails = lineDetailMapper.getLineDetail(pids.get(LineBaseEnum.DEVICE_LEVEL.getCode()), Stream.of(oracleTerminalExcel.getLineNum()).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(lineDetails)) {
LineDetail lineDetail1 = lineDetails.get(0);
if (lineDetail1.getId().equalsIgnoreCase(temp.getId())) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "监测点线路号:" + oracleTerminalExcel.getLineNum() + "已存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
}
//获取该监测点的限值数据
// List<OverLimitExcel> overLimitList = overLimitExcels.stream()
// .filter(overLimitExcel -> overLimitExcel.getId().equals(oracleTerminalExcel.getId()))
// .collect(Collectors.toList());
// if (CollectionUtil.isEmpty(overLimitList)) {
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "没有找到该监测点的限值数据"));
// //删除刚刚新增装置信息
// this.baseMapper.deleteById(temp.getId());
// continue;
// }
lineDetail.setNum(oracleTerminalExcel.getLineNum());
//干扰源类型
DictData loadTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName(),oracleTerminalExcel.getLoadType()).getData();
if (Objects.isNull(loadTypeDicData)) {
//在电压等级内新增一条记录
loadTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName(), oracleTerminalExcel.getLoadType()).getData();
}
lineDetail.setLoadType(loadTypeDicData.getId());
//行业类型
DictData businessDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName(),oracleTerminalExcel.getBusinessType()).getData();
if (Objects.isNull(businessDicData)) {
//在电压等级内新增一条记录
businessDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.BUSINESS_TYPE.getName(), oracleTerminalExcel.getBusinessType()).getData();
}
lineDetail.setBusinessType(businessDicData.getId());
if (StringUtils.isBlank(oracleTerminalExcel.getMonitorId())) {
lineDetail.setMonitorFlag(0);
} else {
lineDetail.setMonitorFlag(1);
}
//终端等级,为空不处理,可以为空
if (StringUtils.isNotBlank(oracleTerminalExcel.getLineGrade())) {
DictData lineGradeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_LEVEL.getName(),oracleTerminalExcel.getLineGrade()).getData();
if (Objects.isNull(lineGradeDicData)) {
//在电压等级内新增一条记录
lineGradeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_LEVEL.getName(), oracleTerminalExcel.getLineGrade()).getData();
}
lineDetail.setLineGrade(lineGradeDicData.getId());
}
lineDetailMapper.updateById(lineDetail);
} else {
//判断是否因为改了终端名称导致没有查到数据
LambdaQueryWrapper<LineBak> lineBakLambdaQueryWrapper = new LambdaQueryWrapper<>();

View File

@@ -7,12 +7,11 @@ import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.GeneralVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -76,4 +75,10 @@ public interface EventDetailFeignClient {
*/
@PostMapping("/getEventDetailByEventType")
HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(@RequestBody EventCountParam param);
/**
* 根据开始时间及结束时间获取暂态事件信息
*/
@PostMapping("/getNewEventDetailByTime")
HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false)LocalDateTime lastTime,@RequestParam("currentTime")LocalDateTime currentTime);
}

View File

@@ -12,7 +12,7 @@ import com.njcn.event.utils.EventlEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -82,6 +82,11 @@ public class EventDetailFeignClientFallbackFactory implements FallbackFactory<Ev
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(LocalDateTime lastTime, LocalDateTime currentTime) {
log.error("{}异常,降级处理,异常为:{}", "根据开始时间及结束时间获取暂态事件信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -27,6 +27,4 @@ public interface Param {
String BEGIN =" 00:00:00";
String END =" 23:59:59";
}

View File

@@ -0,0 +1,31 @@
package com.njcn.event.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 高低电压穿越统计查询实体类
* @author guofeihu
* @since 2024-08-15
*/
@Data
public class VoltageRideThroughQueryParam extends BaseParam {
@ApiModelProperty("区域ID")
@NotBlank(message = "区域ID不能为空")
private String areaId;
@ApiModelProperty("1:风电场,2:光伏电厂")
@NotBlank(message = "新能源场站不能为空")
private String type;
@ApiModelProperty("1:高电压次数,2:低电压次数")
private String frequencyType;
@ApiModelProperty("监测点集合(用于后端使用)")
private List<String> lineIds;
}

View File

@@ -0,0 +1,42 @@
package com.njcn.event.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 高低电压穿越统计 暂降事件列表实体类
* @author guofeihu
* @since 2024-08-15
*/
@Data
public class EventNewStationVo implements Serializable {
@ApiModelProperty(value = "事件ID")
private String eventId;
@ApiModelProperty(value = "监测点ID")
private String lineId;
@ApiModelProperty(value = "电站名称")
private String newStationName;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startTime;
@ApiModelProperty(value = "特征幅值")
private Double featureAmplitude;
@ApiModelProperty(value = "暂降原因")
private String advanceReason;
@ApiModelProperty(value = "暂降严重度")
private Double severity;
@ApiModelProperty(value = "波形路径")
private String wavePath;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 高低电压穿越统计 地图实体类
* @author: guofeihu
* @date: 2024-08-15
*/
@Data
public class VoltageRideThroughVo implements Serializable {
@ApiModelProperty("地区ID")
private String id;
@ApiModelProperty("地区名称")
private String name;
@ApiModelProperty("中心点经度")
private BigDecimal lng;
@ApiModelProperty("中心点纬度")
private BigDecimal lat;
@ApiModelProperty("低压次数")
private String lowPressure;
@ApiModelProperty("高压次数")
private String highPressure;
}

View File

@@ -78,6 +78,12 @@
<artifactId>harmonic-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>prepare-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -212,4 +213,22 @@ public class EventDetailController extends BaseController {
);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据开始时间及结束时间获取暂态事件信息
* @return
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getNewEventDetailByTime")
@ApiOperation("根据开始时间及结束时间获取暂态事件信息")
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false) LocalDateTime lastTime, @RequestParam("currentTime")LocalDateTime currentTime) {
String methodDescribe = getMethodDescribe("getNewEventDetailByTime");
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.le(RmpEventDetailPO::getStartTime,currentTime);
if(lastTime != null){
lambdaQueryWrapper.gt(RmpEventDetailPO::getStartTime,lastTime);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailService.list(lambdaQueryWrapper), methodDescribe);
}
}

View File

@@ -0,0 +1,60 @@
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 高低电压穿越统计 前端控制器
* </p>
* @author guofeihu
* @since 2024-08-14
*/
@Api(tags = "高低电压穿越统计")
@Slf4j
@RestController
@RequestMapping("/voltageRideThrough")
@RequiredArgsConstructor
public class VoltageRideThroughEventController extends BaseController {
private final VoltageRideThroughEventService voltageRideThroughEventService;
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@PostMapping("/view")
@ApiOperation("查询高低电压穿越视图")
public HttpResult<List<VoltageRideThroughVo>> voltageRideThroughView(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
String methodDescribe = getMethodDescribe("voltageRideThroughView");
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughView(voltageRideThroughQueryParam), methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@PostMapping("/voltageRideThroughEventQueryPage")
@ApiOperation("查询高低电压穿越暂态事件列表")
public HttpResult<List<EventNewStationVo>> voltageRideThroughEventQueryPage(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
String methodDescribe = getMethodDescribe("voltageRideThroughEventQueryPage");
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam), methodDescribe);
}
}

View File

@@ -0,0 +1,118 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.njcn.device.pq.api.DeptLineFeignClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.NewStationClient;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.event.pojo.constant.Param;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
import com.njcn.prepare.harmonic.api.event.SpThroughFeignClient;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.pojo.po.Area;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 高低电压穿越统计 服务类实现类
* </p>
* @author guofeihu
* @since 2024-08-14
*/
@Service
@AllArgsConstructor
@Slf4j
public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEventService {
private final AreaFeignClient areaFeignClient;
private final DeptFeignClient deptFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final LineFeignClient lineFeignClient;
private final EventDetailService eventDetailService;
private final NewStationClient newStationClient;
private final SpThroughFeignClient spThroughFeignClient;
@Override
public List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
List<VoltageRideThroughVo> voltageRideThroughVos = new ArrayList<>();
//根据当前选择的部门ID获取其下的子部门集合
List<DeptDTO> deptDTOS = deptFeignClient.getDepSonDetailByDeptId(voltageRideThroughQueryParam.getAreaId()).getData();
for(DeptDTO deptDTO : deptDTOS){
//子部门信息
VoltageRideThroughVo voltageRideThroughVo = new VoltageRideThroughVo();
//赋值子部门名称及ID
BeanUtils.copyProperties(deptDTO,voltageRideThroughVo);
//根据部门的area获取经纬度
Area area = areaFeignClient.selectIdArea(deptDTO.getArea()).getData();
if(area != null){
voltageRideThroughVo.setLat(area.getLat());
voltageRideThroughVo.setLng(area.getLng());
}
//开始计算当前地区高低压穿越次数
//获取当前部门下所有的已绑定能源站的监测点
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId()).getData();
if(!lineIds.isEmpty()){
//根据已绑定能源站的监测点获取关联的暂态事件
List<EventDetail> eventDetails = eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null);
List<String> eventIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList());
if(!eventIds.isEmpty()){
SpThroughParam spThroughParam = new SpThroughParam(eventIds,voltageRideThroughQueryParam.getType());
//赋值子部门高低电压穿越次数
BeanUtils.copyProperties(spThroughFeignClient.getDataByEventIds(spThroughParam).getData(),voltageRideThroughVo);
}
}
voltageRideThroughVos.add(voltageRideThroughVo);
}
return voltageRideThroughVos;
}
@Override
public List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
List<EventNewStationVo> eventNewStationVos = new ArrayList<>();
List<String> lineIds = new ArrayList<>();
//获取当前部门下所有的已绑定能源站的监测点
lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId()).getData());
if(!lineIds.isEmpty()){
//根据监测点获取监测点下所有的事件集合
eventNewStationVos = BeanUtil.copyToList(eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null), EventNewStationVo.class);
if(!eventNewStationVos.isEmpty()){
SpThroughParam spThroughParam = new SpThroughParam(eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList()),voltageRideThroughQueryParam.getType());
//eventNewStationVos:事件集合中是包含了所有符合条件的事件,可能有部分事件并没有被高低电压穿越记录定时任务所执行 所以需要过滤下 具体逻辑说请看spThroughFeignClient.formatEventIds
List<String> eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData();
//过滤掉不符合的事件(eventIds为有效事件ID)
eventNewStationVos = eventNewStationVos.stream().filter(item->eventIds.contains(item.getEventId())).collect(Collectors.toList());
//特殊处理事件集合中新能源场站名称
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData();
if(!lineDetailDataVOS.isEmpty()){
NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData();
eventNewStationVo.setNewStationName(newStation.getName());
}
}
}
}
return eventNewStationVos;
}
}

View File

@@ -0,0 +1,32 @@
package com.njcn.event.service.majornetwork;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import java.util.List;
/**
* <p>
* 高低电压穿越统计 服务类
* </p>
* @author guofeihu
* @since 2024-08-14
*/
public interface VoltageRideThroughEventService {
/***
* 查询高低电压穿越视图
* @param voltageRideThroughQueryParam
* @return List
*/
List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam);
/***
* 高低电压穿越暂态事件分页
* @param voltageRideThroughQueryParam
* @return Page
*/
List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam);
}

View File

@@ -191,6 +191,7 @@ spring:
uri: lb://harmonic-boot
predicates:
- Path=/IndexAnalysis/**
- Path=/pms-tech-powerquality-start/**
#项目日志的配置
@@ -224,6 +225,7 @@ whitelist:
- /system-boot/dictType/dictDataCache
- /system-boot/file/**
- /system-boot/area/**
#开始
# - /advance-boot/**
# - /device-boot/**
# - /system-boot/**
@@ -238,6 +240,8 @@ whitelist:
# - /supervision-boot/**
# - /user-boot/**
# - /harmonic-boot/**
# - /cs-device-boot/**
#结束
- /user-boot/user/listAllUserByDeptId
- /IndexAnalysis/**
mqtt:

View File

@@ -27,4 +27,7 @@ public interface UploadGwDataFeignClient {
@PostMapping("/uploadEvaluationData")
HttpResult<String> uploadEvaluationData(@RequestBody UploadParam param);
@PostMapping("/upGwCommPoint")
HttpResult<String> upGwCommPoint(@RequestBody UploadParam param);
}

View File

@@ -45,6 +45,12 @@ public class UploadGwDataFallbackFactory implements FallbackFactory<UploadGwData
log.error("{}异常,降级处理,异常为:{}", "国网上送-母线基准水平评估数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
@Override
public HttpResult<String> upGwCommPoint(UploadParam param) {
log.error("{}异常,降级处理,异常为:{}", "国网上送-公共连接点数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
};
}
}

View File

@@ -67,4 +67,8 @@ public interface Param {
*/
String VALUE_TYPEAVG = "AVG";
//DecimalFormat格式化
String DECIMAL_FORMATSTR = "#0.0000";
String DECIMAL_FORMATTWOSTR = "#.##";
}

View File

@@ -32,6 +32,7 @@ public enum HarmonicResponseEnum {
REPORT_TEMPLATE_DOWNLOAD_ERROR("A00560","报表模板下载异常"),
NO_DATA("A00561","时间范围内暂无谐波数据"),
INSUFFICIENCY_OF_INTEGRITY("A00561","时间范围内谐波数据完整性不足"),
NO_LINE_DATA("A00562","监测点无有功功率数据"),
;
private final String code;

View File

@@ -0,0 +1,59 @@
package com.njcn.harmonic.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 有功功率趋势统计 查询实体类
* @author guofeihu
* @since 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class PowerStatisticsParam extends BaseParam {
@ApiModelProperty(name = "lineId", value = "监测点ID")
@NotBlank(message = "监测点ID不能为空")
private String lineId;
@ApiModelProperty(name = "statisticalId", value = "指标分类ID(用于查询指标详细数据的指标分类ID)")
private String statisticalId;
@ApiModelProperty(name = "field", value = "区间字段(用于查询指标越限列表)")
private String field;
@ApiModelProperty(name = "time0", value = "区间1时间集合")
private List<String> time0;
@ApiModelProperty(name = "time1", value = "区间2时间集合")
private List<String> time1;
@ApiModelProperty(name = "time2", value = "区间3时间集合")
private List<String> time2;
@ApiModelProperty(name = "time3", value = "区间4时间集合")
private List<String> time3;
@ApiModelProperty(name = "time4", value = "区间5时间集合")
private List<String> time4;
@ApiModelProperty(name = "time5", value = "区间6时间集合")
private List<String> time5;
@ApiModelProperty(name = "time6", value = "区间7时间集合")
private List<String> time6;
@ApiModelProperty(name = "time7", value = "区间8时间集合")
private List<String> time7;
@ApiModelProperty(name = "time8", value = "区间9时间集合")
private List<String> time8;
@ApiModelProperty(name = "time9", value = "区间10时间集合")
private List<String> time9;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.harmonic.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.time.LocalDate;
/**
* 有功功率趋势实分页查询类
* @author guofeihu
* @date 2024-08-20
*/
@Data
public class RActivePowerRangeQueryParam extends BaseParam {
@Data
public static class RActivePowerRangeEdit{
@ApiModelProperty("id")
private String id;
@NotBlank(message = "监测点ID不能为空")
@ApiModelProperty("监测点(*)")
private String lineId;
@NotBlank(message = "日期不能为空")
@ApiModelProperty("日期(*)")
private LocalDate timeId;
}
}

View File

@@ -29,7 +29,7 @@ public class RStatDataVDPO implements Serializable {
@MppMultiId
@TableField(value = "phasic_type")
private String phasicType;
private String phaseType;
@MppMultiId
@TableField(value = "value_type")

View File

@@ -0,0 +1,46 @@
package com.njcn.harmonic.pojo.po.pmsWifi;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author xy
* @since 2024-08-25
*/
@Getter
@Setter
@TableName("pms_real_data")
public class MonitorRealData {
private static final long serialVersionUID = 1L;
@TableField("id")
private String id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@TableField("time_Id")
private LocalDateTime timeId;
@MppMultiId
@TableField("line_id")
private String lineId;
@MppMultiId
@TableField("value_type")
private String valueType;
@TableField("pms_content")
private String pmsContent;
}

View File

@@ -0,0 +1,408 @@
package com.njcn.harmonic.pojo.po.upload;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 公共连接点母线电能质量统计
* </p>
*
* @author xy
* @since 2024-08-15
*/
@TableName("r_upload_comm_point_bus")
public class RUploadCommPointBus implements Serializable {
private static final long serialVersionUID = 1L;
/**
* uuid
*/
private String objId;
/**
* 统计类型
*/
@MppMultiId
private String statisticalType;
/**
* 统计时间
*/
@MppMultiId
private String statisticalDate;
/**
* 母线id
*/
@MppMultiId
private String busId;
/**
* 母线名称
*/
private String busName;
/**
* 所属省份,取ISC平台上的组织id
*/
private String provinceOrg;
private String provinceOrgName;
/**
* 所属地市,取ISC平台上的组织id
*/
private String cityOrg;
private String cityOrgName;
/**
* 运维单位
*/
private String maintOrg;
private String maintOrgName;
/**
* 站房类型
*/
private String stationType;
/**
* 所属电站
*/
private String stationId;
/**
* 所属电站名称
*/
private String stationName;
private String stationVoltageLevel;
/**
* 母线电压等级
*/
private String busVoltageLevel;
/**
* 总超标天数
*/
private Integer ovDays;
/**
* 电压有效值-平均值
*/
private Double avgVrms;
/**
* 电压有效值-95%概率大值
*/
private Double gVrms;
/**
* 谐波电压-超标天数
*/
private Integer harmVOvDays;
/**
* 谐波电压-超标时长(分钟)
*/
private Integer harmVOvDuration;
/**
* 三相不平衡-超标天数
*/
private Integer vunbanOvDays;
/**
* 三相不平衡-超标时长(分钟)
*/
private Integer vunbanOvDuration;
/**
* 长时闪变-超标天数
*/
private Integer pltOvDays;
/**
* 长时闪变-超标时长(分钟)
*/
private Integer pltOvDuration;
/**
* 最优监测点编号
*/
private String monitorId;
/**
* 关联监测点集合数
*/
private String monitorIds;
/**
* 数据来源
*/
private String dataSource;
@TableField(exist = false)
private String cnMonitorId;
private Integer uploadStatus;
public Integer getUploadStatus() {
return uploadStatus;
}
public void setUploadStatus(Integer uploadStatus) {
this.uploadStatus = uploadStatus;
}
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public String getStatisticalType() {
return statisticalType;
}
public void setStatisticalType(String statisticalType) {
this.statisticalType = statisticalType;
}
public String getStatisticalDate() {
return statisticalDate;
}
public void setStatisticalDate(String statisticalDate) {
this.statisticalDate = statisticalDate;
}
public String getBusId() {
return busId;
}
public void setBusId(String busId) {
this.busId = busId;
}
public String getBusName() {
return busName;
}
public void setBusName(String busName) {
this.busName = busName;
}
public String getProvinceOrg() {
return provinceOrg;
}
public void setProvinceOrg(String provinceOrg) {
this.provinceOrg = provinceOrg;
}
public String getProvinceOrgName() {
return provinceOrgName;
}
public void setProvinceOrgName(String provinceOrgName) {
this.provinceOrgName = provinceOrgName;
}
public String getCityOrg() {
return cityOrg;
}
public void setCityOrg(String cityOrg) {
this.cityOrg = cityOrg;
}
public String getCityOrgName() {
return cityOrgName;
}
public void setCityOrgName(String cityOrgName) {
this.cityOrgName = cityOrgName;
}
public String getMaintOrg() {
return maintOrg;
}
public void setMaintOrg(String maintOrg) {
this.maintOrg = maintOrg;
}
public String getMaintOrgName() {
return maintOrgName;
}
public void setMaintOrgName(String maintOrgName) {
this.maintOrgName = maintOrgName;
}
public String getStationType() {
return stationType;
}
public void setStationType(String stationType) {
this.stationType = stationType;
}
public String getStationId() {
return stationId;
}
public void setStationId(String stationId) {
this.stationId = stationId;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getStationVoltageLevel() {
return stationVoltageLevel;
}
public void setStationVoltageLevel(String stationVoltageLevel) {
this.stationVoltageLevel = stationVoltageLevel;
}
public String getBusVoltageLevel() {
return busVoltageLevel;
}
public void setBusVoltageLevel(String busVoltageLevel) {
this.busVoltageLevel = busVoltageLevel;
}
public Integer getOvDays() {
return ovDays;
}
public void setOvDays(Integer ovDays) {
this.ovDays = ovDays;
}
public Double getAvgVrms() {
return avgVrms;
}
public void setAvgVrms(Double avgVrms) {
this.avgVrms = avgVrms;
}
public Double getgVrms() {
return gVrms;
}
public void setgVrms(Double gVrms) {
this.gVrms = gVrms;
}
public Integer getHarmVOvDays() {
return harmVOvDays;
}
public void setHarmVOvDays(Integer harmVOvDays) {
this.harmVOvDays = harmVOvDays;
}
public Integer getHarmVOvDuration() {
return harmVOvDuration;
}
public void setHarmVOvDuration(Integer harmVOvDuration) {
this.harmVOvDuration = harmVOvDuration;
}
public Integer getVunbanOvDays() {
return vunbanOvDays;
}
public void setVunbanOvDays(Integer vunbanOvDays) {
this.vunbanOvDays = vunbanOvDays;
}
public Integer getVunbanOvDuration() {
return vunbanOvDuration;
}
public void setVunbanOvDuration(Integer vunbanOvDuration) {
this.vunbanOvDuration = vunbanOvDuration;
}
public Integer getPltOvDays() {
return pltOvDays;
}
public void setPltOvDays(Integer pltOvDays) {
this.pltOvDays = pltOvDays;
}
public Integer getPltOvDuration() {
return pltOvDuration;
}
public void setPltOvDuration(Integer pltOvDuration) {
this.pltOvDuration = pltOvDuration;
}
public String getMonitorId() {
return monitorId;
}
public void setMonitorId(String monitorId) {
this.monitorId = monitorId;
}
public String getMonitorIds() {
return monitorIds;
}
public void setMonitorIds(String monitorIds) {
this.monitorIds = monitorIds;
}
public String getDataSource() {
return dataSource;
}
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
public String getCnMonitorId() {
return cnMonitorId;
}
public void setCnMonitorId(String cnMonitorId) {
this.cnMonitorId = cnMonitorId;
}
}

View File

@@ -0,0 +1,80 @@
package com.njcn.harmonic.pojo.po.upload;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 电能质量报表上送
* </p>
*
* @author xy
* @since 2024-08-07
*/
@Getter
@Setter
@TableName("r_upload_report")
public class RUploadReport {
private static final long serialVersionUID = 1L;
@TableId
private String objId;
/**
* 省单位id
*/
private String provinceOrg;
/**
* 省单位名称
*/
private String provinceOrgName;
/**
* 报表类型
*/
@NotBlank(message = "报表类型不可为空")
private String reportType;
/**
* Json字符串
*/
@NotBlank(message = "Json字符串不可为空")
private String reportData;
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime updateTime;
private String isDelete;
private LocalDateTime deleteTime;
private Integer uploadStatus;
}

View File

@@ -0,0 +1,47 @@
package com.njcn.harmonic.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 有功功率趋势区间Excel 实体类
* @author guofeihu
* @since 2024-08-20
*/
@Data
public class PowerStatisticsExcelRangVO {
@Excel(name = "详情 区间")
private String text;
@Excel(name = "0%~10%")
private String minsNum0;
@Excel(name = "10%~20%")
private String minsNum1;
@Excel(name = "20%~30%")
private String minsNum2;
@Excel(name = "30%~40%")
private String minsNum3;
@Excel(name = "40%~50%")
private String minsNum4;
@Excel(name = "50%~60%")
private String minsNum5;
@Excel(name = "60%~70%")
private String minsNum6;
@Excel(name = "70%~80%")
private String minsNum7;
@Excel(name = "80%~90%")
private String minsNum8;
@Excel(name = "90%~100%")
private String minsNum9;
}

View File

@@ -0,0 +1,43 @@
package com.njcn.harmonic.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 有功功率趋势指标 实体类
* @author guofeihu
* @since 2024-08-20
*/
@Data
public class PowerStatisticsTargetVO {
@ApiModelProperty("时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String time;
@ApiModelProperty("电压偏差")
private Integer voltageOffset;
@ApiModelProperty(value = "谐波电压")
private Integer vTimes;
@ApiModelProperty(value = "谐波电流")
private Integer iTimes;
@ApiModelProperty("三相电压不平衡度")
private Integer ubalance;
@ApiModelProperty(value="电压波动")
private Integer voltageFluctuation;
@ApiModelProperty("闪变")
private Integer flicker;
@ApiModelProperty("间谐波电压含有率")
private Integer interHarmonic;
@ApiModelProperty("电流不平衡度")
private Integer sequenceCurrentUnbalance;
}

View File

@@ -0,0 +1,144 @@
package com.njcn.harmonic.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
/**
* 有功功率趋势 实体类
* @author guofeihu
* @since 2024-08-20
*/
@Data
public class PowerStatisticsVO {
@ApiModelProperty("ID")
private String id;
@ApiModelProperty("监测点ID")
private String lineId;
@ApiModelProperty("日期(天)")
private LocalDate timeId;
@ApiModelProperty("0%~10%区间时间Json")
private String minsTime0;
@ApiModelProperty("0%~10%区间个数")
private Integer minsNum0;
@ApiModelProperty("0%~10%区间是否越限")
private Integer isOrNot0;
@ApiModelProperty("0%~10%百分比")
private Double proportion0 = 0.0;
@ApiModelProperty("10%~20%区间时间Json")
private String minsTime1;
@ApiModelProperty("10%~20%区间个数")
private Integer minsNum1;
@ApiModelProperty("10%~20%区间是否越限")
private Integer isOrNot1;
@ApiModelProperty("10%~20%百分比")
private Double proportion1 = 0.0;;
@ApiModelProperty("20%~30%区间时间Json")
private String minsTime2;
@ApiModelProperty("20%~30%区间个数")
private Integer minsNum2;
@ApiModelProperty("20%~30%区间是否越限")
private Integer isOrNot2;
@ApiModelProperty("20%~30%百分比")
private Double proportion2 = 0.0;;
@ApiModelProperty("30%~40%区间时间Json")
private String minsTime3;
@ApiModelProperty("30%~40%区间个数")
private Integer minsNum3;
@ApiModelProperty("30%~40%区间是否越限")
private Integer isOrNot3;
@ApiModelProperty("30%~40%百分比")
private Double proportion3 = 0.0;;
@ApiModelProperty("40%~50%区间时间Json")
private String minsTime4;
@ApiModelProperty("40%~50%区间个数")
private Integer minsNum4;
@ApiModelProperty("40%~50%区间是否越限")
private Integer isOrNot4;
@ApiModelProperty("40%~50%百分比")
private Double proportion4 = 0.0;;
@ApiModelProperty("50%~60%区间时间Json")
private String minsTime5;
@ApiModelProperty("50%~60%区间个数")
private Integer minsNum5;
@ApiModelProperty("50%~60%区间是否越限")
private Integer isOrNot5;
@ApiModelProperty("50%~60%百分比")
private Double proportion5 = 0.0;;
@ApiModelProperty("60%~70%区间时间Json")
private String minsTime6;
@ApiModelProperty("60%~70%区间个数")
private Integer minsNum6;
@ApiModelProperty("60%~70%区间是否越限")
private Integer isOrNot6;
@ApiModelProperty("60%~70%百分比")
private Double proportion6 = 0.0;;
@ApiModelProperty("70%~80%区间时间Json")
private String minsTime7;
@ApiModelProperty("70%~80%区间个数")
private Integer minsNum7;
@ApiModelProperty("70%~80%区间是否越限")
private Integer isOrNot7;
@ApiModelProperty("70%~80%百分比")
private Double proportion7 = 0.0;;
@ApiModelProperty("80%~90%区间时间Json")
private String minsTime8;
@ApiModelProperty("80%~90%区间个数")
private Integer minsNum8;
@ApiModelProperty("80%~90%区间是否越限")
private Integer isOrNot8;
@ApiModelProperty("80%~90%百分比")
private Double proportion8 = 0.0;;
@ApiModelProperty("90%~100%区间时间Json")
private String minsTime9;
@ApiModelProperty("90%~100%区间个数")
private Integer minsNum9;
@ApiModelProperty("90%~100%区间是否越限")
private Integer isOrNot9;
@ApiModelProperty("90%~100%百分比")
private Double proportion9 = 0.0;;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.harmonic.pojo.vo;
import lombok.Data;
/**
* 指标详情数据实体类
* @author guofeihu
* @since 2024-08-20
*/
@Data
public class ThdDataVO {
private String anotherName;
private String unit;
private Double AVGPhaseA;
private Double AVGPhaseB;
private Double AVGPhaseC;
private Double CP95PhaseA;
private Double CP95PhaseB;
private Double CP95PhaseC;
private Double MINPhaseA;
private Double MINPhaseB;
private Double MINPhaseC;
private Double MAXPhaseA;
private Double MAXPhaseB;
private Double MAXPhaseC;
}

View File

@@ -99,6 +99,19 @@ public class EvaluationLevelVo {
@ApiModelProperty("闪变合格率")
private Double plt = 3.14159;
@ApiModelProperty("谐波电压含有率")
private Double uHarm = 3.14159;
@ApiModelProperty("谐波电流")
private Double iHarm = 3.14159;
@ApiModelProperty("闪变合格率")
private Double inuHarm = 3.14159;
@ApiModelProperty("负序电流")
private Double iNeg = 3.14159;
}
}

View File

@@ -94,6 +94,12 @@
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>prepare-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@@ -1233,11 +1233,13 @@ public class ExportModelController extends BaseController {
String reportFileUrl = "";
try {
String fileName = name + formatter.format(currentTime) + ".docx";
if(ObjectUtil.isNotNull(isUrl)){
if (isUrl) {
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx",null ,reportmap);
} else {
wordUtil2.getWord(rtfPath, reportmap, fileName,null, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, reportFileUrl, methodDescribe);
}
}
wordUtil2.getWord(rtfPath, reportmap, fileName,null, response);
} catch (Exception e) {
log.error("获取报告发生异常,异常是" + e.getMessage());
}

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
@@ -30,6 +31,7 @@ import com.njcn.harmonic.pojo.po.report.ReportTarget;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.harmonic.service.ReportService;
import com.njcn.harmonic.utils.WordUtil2;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.ThemeFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -87,7 +89,7 @@ public class ExportModelJBController extends BaseController {
private final DeviceUnitClient deviceUnitClient;
private final WordUtil2 wordUtil2;
private final EventDetailFeignClient eventDetailFeignClient;
private final FileStorageUtil fileStorageUtil;
/**
* @param response
* @param startTime 开始时间
@@ -199,7 +201,7 @@ public class ExportModelJBController extends BaseController {
}
String rtfPath;
String picPath = "file/default.jpg";
String picPath = "file/jxt.jpg";
Theme theme = themeFeignClient.getTheme().getData();
if (theme.getRemark().equals("国网")) {
@@ -262,7 +264,12 @@ public class ExportModelJBController extends BaseController {
InputStream inStream = null;
byte[] data = null;
try {
if(StrUtil.isNotBlank(lineDto.getWiringDiagram())){
String wiringDiagram = lineDto.getWiringDiagram();
inStream = fileStorageUtil.getFileStream(wiringDiagram.substring(wiringDiagram.indexOf("/")));
}else{
inStream = picPathResource.getInputStream();
}
data = new byte[inStream.available()];
inStream.read(data);
} catch (Exception e) {
@@ -481,8 +488,8 @@ public class ExportModelJBController extends BaseController {
String strTime = String.format("%s——%s。",
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒")});
reportmap.put("$number$", reportNumber); // 报告编号
reportmap.put("$titlePoint$", crmName); // 客户名称
reportmap.put("$number$", StrUtil.isBlank(reportNumber)?"":reportNumber); // 报告编号
reportmap.put("$titlePoint$",StrUtil.isBlank(crmName)?"":crmName); // 客户名称
reportmap.put("$TitleTime$", formatter.format(currentTime)); // 报告生成时间
reportmap.put("$ReportTitle$",
@@ -1496,11 +1503,13 @@ public class ExportModelJBController extends BaseController {
String reportFileUrl = "";
try {
String fileName = name + formatter.format(currentTime) + ".docx";
if(ObjectUtil.isNotNull(isUrl)){
if (isUrl) {
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx",tableList, reportmap);
} else {
wordUtil2.getWord(rtfPath, reportmap, fileName,tableList, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, reportFileUrl, methodDescribe);
}
}
wordUtil2.getWord(rtfPath, reportmap, fileName,tableList, response);
} catch (Exception e) {
log.error("获取报告发生异常,异常是" + e.getMessage());
}

View File

@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
@@ -63,7 +64,7 @@ public class HistoryResultController extends BaseController {
public HttpResult<List<HistoryDataResultVO>> getHistoryResult(@RequestBody @Validated HistoryParam historyParam) {
String methodDescribe = getMethodDescribe("getHistoryResult");
List<HistoryDataResultVO> list;
if (HistoryDataSource == 1) {
if (HistoryDataSource == 1 && !historyParam.getLineId()[0].contains("pmswifi_")) {
list = oracleResultService.getHistoryResult(historyParam);
} else {
list = historyResultService.getHistoryResult(historyParam);

View File

@@ -0,0 +1,51 @@
package com.njcn.harmonic.controller.pmsWifi;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.mapper.pmsWifi.PmsMonitorRealDataMapper;
import com.njcn.harmonic.pojo.po.pmsWifi.MonitorRealData;
import com.njcn.influx.service.IDataVService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 公共连接点母线电能质量统计 前端控制器
* </p>
*
* @author cdf
* @since 2024-08-15
*/
@RestController
@RequestMapping("/pmsWifi")
@RequiredArgsConstructor
public class PmsWifiController extends BaseController {
private final PmsMonitorRealDataMapper pmsMonitorRealDataMapper;
private final IDataVService iDataVService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getPmsInfo")
@ApiOperation("查询最新的一条电能质量数据")
public HttpResult<MonitorRealData> getPmsInfo(@RequestParam String monitorId,@RequestParam String valueType) {
String methodDescribe = getMethodDescribe("getPmsInfo");
LambdaUpdateWrapper<MonitorRealData> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(MonitorRealData::getValueType,valueType).eq(MonitorRealData::getLineId,monitorId);
MonitorRealData monitorRealData = pmsMonitorRealDataMapper.selectOne(lambdaUpdateWrapper);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorRealData, methodDescribe);
}
}

View File

@@ -0,0 +1,85 @@
package com.njcn.harmonic.controller.powerstatistics;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.PowerStatisticsParam;
import com.njcn.harmonic.pojo.vo.PowerStatisticsTargetVO;
import com.njcn.harmonic.pojo.vo.PowerStatisticsVO;
import com.njcn.harmonic.pojo.vo.ThdDataVO;
import com.njcn.harmonic.service.activepowerrange.PowerStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 有功功率趋势统计 前端控制器
* @author guofeihu
* @since 2024-08-20
*/
@Slf4j
@RestController
@RequestMapping("/powerStatistics")
@Api(tags = "有功功率趋势")
@AllArgsConstructor
public class PowerStatisticsController extends BaseController {
private final PowerStatisticsService powerStatisticsService;
/**
* 根据监测点ID及时间获取有功功率趋势
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDataByLineId")
@ApiOperation("根据监测点ID及时间获取有功功率趋势")
public HttpResult<PowerStatisticsVO> getDataByLineId(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getDataByLineId");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getDataByLineId(powerStatisticsParam), methodDescribe);
}
/**
* 根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getTargetLimitById")
@ApiOperation("根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表")
public HttpResult<List<PowerStatisticsTargetVO>> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getTargetLimitById");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetLimitById(powerStatisticsParam), methodDescribe);
}
/**
* 点击越限列表时间查询指标的详细数据
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getTargetByTime")
@ApiOperation("点击越限列表时间查询指标的详细数据")
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getTargetByTime");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetByTime(powerStatisticsParam), methodDescribe);
}
@ResponseBody
@ApiOperation("导出区间数据")
@PostMapping(value = "exportExcelRangTemplate")
public void exportExcelRangTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
powerStatisticsService.exportExcelRangTemplate(powerStatisticsParam,response);
}
@ResponseBody
@ApiOperation("导出指标越限列表数据")
@PostMapping(value = "exportExcelListTemplate")
public void exportExcelListTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
powerStatisticsService.exportExcelListTemplate(powerStatisticsParam,response);
}
}

Some files were not shown because too many files have changed in this diff Show More