Compare commits
51 Commits
0684bdf503
...
2026-03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39cfffbf7e | ||
|
|
1aad1aa86b | ||
| fa500ca600 | |||
| 7b9fb1628b | |||
| fcddc064f6 | |||
| 37c5e9cbf8 | |||
| a08c7db24d | |||
| 9225e82edb | |||
| e8cd6da8a0 | |||
| 559620ab66 | |||
| f0b3b81e65 | |||
| 475ca820c8 | |||
|
|
c0db2cf961 | ||
|
|
4e95159e01 | ||
|
|
eec2560fd2 | ||
|
|
94037d588b | ||
| 01a77fa92d | |||
| 9d9150e418 | |||
| ee1ca85a5d | |||
|
|
2c3c716607 | ||
|
|
e1d17c63a2 | ||
|
|
6234ac8ce9 | ||
| 6c91774200 | |||
| fc951e913c | |||
| d138d4353f | |||
| aecee4de49 | |||
|
|
fd04c21997 | ||
| 08d8b5b488 | |||
| 82457bc9c2 | |||
|
|
63330a04a6 | ||
|
|
ad45661c3c | ||
|
|
23de6313a6 | ||
|
|
7a5ef040bb | ||
| 140ed85108 | |||
|
|
99ab77dcf0 | ||
|
|
c772c9cd81 | ||
| 996ec87ea8 | |||
|
|
b6eaff3b1e | ||
|
|
56bf5bb7c9 | ||
|
|
7410d32241 | ||
|
|
41ba37b723 | ||
|
|
3f77d30cfd | ||
| f71f87ced4 | |||
| 32295f60c0 | |||
|
|
d2945b0fb2 | ||
|
|
133766a2c7 | ||
| 2a5a5087ad | |||
| 4edb27d20b | |||
| 71d6636be0 | |||
|
|
8ccdb84ea9 | ||
|
|
5389903ed7 |
3
pom.xml
3
pom.xml
@@ -39,6 +39,7 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<spring.profiles.active>sjzx</spring.profiles.active>
|
||||
<!--中间件目标地址-->
|
||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||
<middle.server.url>192.168.1.103</middle.server.url>
|
||||
@@ -51,7 +52,7 @@
|
||||
<!--nacos开启鉴权后的用户名-->
|
||||
<nacos.username>nacos</nacos.username>
|
||||
<!--nacos的ip:port-->
|
||||
<nacos.password>nacos</nacos.password>
|
||||
<nacos.password>njcnpqs</nacos.password>
|
||||
<!--服务器发布内容为空-->
|
||||
<nacos.namespace>hswbpm</nacos.namespace>
|
||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
||||
|
||||
@@ -2,8 +2,14 @@ package com.njcn.advance.api;
|
||||
|
||||
import com.njcn.advance.api.fallback.EventWaveAnalysisFeignClientFallbackFactory;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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 io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -27,4 +33,7 @@ public interface EventWaveAnalysisFeignClient {
|
||||
*/
|
||||
@PostMapping("analysis")
|
||||
HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex);
|
||||
|
||||
@PostMapping("analysisWlEvent")
|
||||
HttpResult<EntityAdvancedData> analysisWlEvent(@RequestParam("eventIndex") String eventIndex);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFact
|
||||
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<EntityAdvancedData> analysisWlEvent(String eventIndex) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "物联测点波形高级分析异常", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,4 +73,10 @@ public class EventAnalysisDTO {
|
||||
* 1 正常计算
|
||||
*/
|
||||
private Integer typeFlag = 1;
|
||||
|
||||
/**
|
||||
* 文件全路径
|
||||
* 适配物联的暂态事件解析 物联那边事件的路径是全路径,不需要拼接,这个参数可为空
|
||||
*/
|
||||
private String wlFilePath;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.List;
|
||||
* angle_diff_cn C相相位负跳变
|
||||
* bph_max_value 不平衡度(单位%)
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true,value = {"pointer"})
|
||||
public class BackData extends Structure {
|
||||
public int qvvr_cata_cause[] = new int[256];
|
||||
public int qvvr_phasetype[] = new int[256];
|
||||
|
||||
@@ -23,8 +23,13 @@ public class CauseStruct extends Structure {
|
||||
public static class ByValue extends CauseStruct implements Structure.ByValue {
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected List<String> getFieldOrder() { // 返回值填入的顺序
|
||||
// return Arrays.asList(new String[] { "cause", "no_cal" });
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected List<String> getFieldOrder() { // 返回值填入的顺序
|
||||
return Arrays.asList(new String[] { "cause", "no_cal" });
|
||||
protected List<String> getFieldOrder() {
|
||||
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "threshold", "cause", "no_cal");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,13 @@ public class Rect extends Structure {
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected List<String> getFieldOrder() {
|
||||
// return Arrays.asList(new String[] { "evt_num","evt_buf" });
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected List<String> getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "evt_num","evt_buf" });
|
||||
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "evt_num", "evt_buf");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class EventWaveAnalysisController extends BaseController {
|
||||
|
||||
private final EventWaveAnalysisService eventWaveAnalysisService;
|
||||
|
||||
|
||||
@PostMapping("analysis")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("波形高级分析")
|
||||
@@ -43,6 +42,15 @@ public class EventWaveAnalysisController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("analysis");
|
||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("analysisWlEvent")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("物联事件波形高级分析")
|
||||
@ApiImplicitParam(name = "eventIndex", value = "暂降事件id", required = true)
|
||||
public HttpResult<EntityAdvancedData> analysisWlEvent(@RequestParam("eventIndex") String eventIndex) {
|
||||
String methodDescribe = getMethodDescribe("analysisWlEvent");
|
||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysisWlEvent(eventIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.njcn.advance.event.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.advance.enums.EnumEvt;
|
||||
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
||||
import com.njcn.advance.event.cause.model.DataFeature;
|
||||
import com.njcn.advance.event.type.jna.*;
|
||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.Rect;
|
||||
import com.njcn.advance.utils.Utils;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
@@ -18,6 +21,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
@@ -44,11 +48,12 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
||||
WaveDataDTO waveDataDTO;
|
||||
String waveName = eventAnalysis.getWaveName();
|
||||
String wlFilePath = eventAnalysis.getWlFilePath();
|
||||
String cfgPath, datPath, cfgPath2, datPath2;
|
||||
String ip = eventAnalysis.getIp();
|
||||
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
||||
cfgPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||
datPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT : wlFilePath + GeneralConstant.DAT;
|
||||
log.info("本地磁盘波形文件路径----" + cfgPath);
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||
@@ -57,11 +62,11 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
||||
} else {
|
||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||
cfgPath = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||
datPath = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT : wlFilePath + GeneralConstant.DAT;
|
||||
//适配文件后缀小写
|
||||
cfgPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase();
|
||||
datPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase();
|
||||
cfgPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase() : wlFilePath + GeneralConstant.CFG.toLowerCase();
|
||||
datPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase() : wlFilePath + GeneralConstant.DAT.toLowerCase();
|
||||
log.info("文件服务器波形文件路径----" + cfgPath);
|
||||
try (
|
||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
||||
@@ -122,6 +127,21 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
}
|
||||
}
|
||||
}
|
||||
String str = WriteData2File(typeDataStruct);
|
||||
if (Objects.isNull(wlFilePath)) {
|
||||
String hdrPath = OssPath.WAVE_DIR + ip+StrUtil.SLASH;
|
||||
String hdrName = waveName + GeneralConstant.HDR_LOWER;
|
||||
fileStorageUtil.uploadStreamSpecifyName(new ByteArrayInputStream(str.getBytes()),hdrPath,hdrName);
|
||||
} else {
|
||||
// comtrade/00:B7:8D:00:A8:7A/PQMonitor_PQM1_00100_20260204_162453_071_WAV.hdr
|
||||
String fullPath = wlFilePath + GeneralConstant.HDR_LOWER;
|
||||
int lastSlashIndex = fullPath.lastIndexOf('/');
|
||||
String hdrPath = fullPath.substring(0, lastSlashIndex + 1);
|
||||
String hdrName = fullPath.substring(lastSlashIndex + 1);
|
||||
fileStorageUtil.uploadStreamSpecifyName(new ByteArrayInputStream(str.getBytes()),hdrPath,hdrName);
|
||||
}
|
||||
|
||||
//上传HR
|
||||
eventAnalysis.setType(globalFaultType);
|
||||
} else {
|
||||
eventAnalysis.setType(DataFeature.TYPE10);
|
||||
@@ -158,4 +178,306 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
System.out.println("cause:" + eventAnalysis);
|
||||
return eventAnalysis;
|
||||
}
|
||||
|
||||
public String WriteData2File(QvvrDLL.QvvrDataStruct rect) throws Exception {
|
||||
StringBuilder stringBuilder = new StringBuilder("{" + EnumEvt.NEWLINE.getProperty());
|
||||
|
||||
/**
|
||||
* @写入返回事件总数
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.EVT_NUM.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_num), 1));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.EVT_BUF.getProperty()) + "[");
|
||||
|
||||
/**
|
||||
* @写入返回事件参数
|
||||
*/
|
||||
for (int i = 0; i < rect.evt_num; i++) {
|
||||
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(2));
|
||||
/**
|
||||
* @波形起始点
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_A.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_a), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_B.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_b), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_C.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_c), 3));
|
||||
/**
|
||||
* @跳变段电压变化率
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VA.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Va), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VB.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Vb), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VC.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Vc), 3));
|
||||
/**
|
||||
* @持续时间
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.HOLD_TIME_RMS.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].hold_time_rms), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.HOLD_TIME_DQ.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].hold_time_dq), 3));
|
||||
/**
|
||||
* @分段数目
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.SEG_T_NUM.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].SEG_T_num), 3));
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.SEG_T_IDX.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(3));
|
||||
|
||||
for (int j = 0; j < rect.evt_buf[i].SEG_T_num; j++) {
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(Utils.int2String(j)));
|
||||
|
||||
if (rect.evt_buf[i].SEG_T_num - 1 == j) {
|
||||
stringBuilder.append(Utils.int2String(rect.evt_buf[i].SEG_T_idx[j]));
|
||||
} else {
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].SEG_T_idx[j]), 4));
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @特征幅值
|
||||
*/
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.U_MIN_NUM.getProperty()));
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].u_min_num), 3));
|
||||
|
||||
/**
|
||||
* @最小值位置
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ORDER_MIN_IDX.getProperty(), null,
|
||||
rect.evt_buf[i].order_min_idx[k]);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @A相电压特征值
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.UA_MIN.getProperty(), rect.evt_buf[i].ua_min[k], null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @B相电压特征值
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.UB_MIN.getProperty(), rect.evt_buf[i].ub_min[k], null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @C相电压特征值
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.UC_MIN.getProperty(), rect.evt_buf[i].uc_min[k], null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @三相电压特征值
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.U3_MIN.getProperty(), rect.evt_buf[i].u3_min[k], null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @A相相位正跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_AP.getProperty(), rect.evt_buf[i].angle_diff_ap[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @B相相位正跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_BP.getProperty(), rect.evt_buf[i].angle_diff_bp[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @C相相位正跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_CP.getProperty(), rect.evt_buf[i].angle_diff_cp[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @A相相位负跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_AN.getProperty(), rect.evt_buf[i].angle_diff_an[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @B相相位负跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_BN.getProperty(), rect.evt_buf[i].angle_diff_bn[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @C相相位负跳变
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_CN.getProperty(), rect.evt_buf[i].angle_diff_cn[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @不平衡度
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.BPH_MAX_VALUE.getProperty(), rect.evt_buf[i].bph_max_value[k],
|
||||
null);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @暂降原因
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_CATA_CAUSE.getProperty(), null,
|
||||
rect.evt_buf[i].qvvr_cata_cause[k]);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @暂降类型
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_CATA_TYPE.getProperty(), null,
|
||||
rect.evt_buf[i].qvvr_cata_type[k]);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||
|
||||
/**
|
||||
* @暂降相别
|
||||
*/
|
||||
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_PHASETYPE.getProperty(), null,
|
||||
rect.evt_buf[i].qvvr_phasetype[k]);
|
||||
|
||||
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setClose(3));
|
||||
|
||||
if (rect.evt_num - 1 == i) {
|
||||
stringBuilder.append(EnumEvt.setClose(2));
|
||||
stringBuilder.append("]" + EnumEvt.ENTER.getProperty());
|
||||
} else {
|
||||
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(2), 2));
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append("}");
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
/**
|
||||
* @特征值处理
|
||||
*/
|
||||
public void setEigenVlaue(int len, StringBuilder stringBuilder, String string, Float f, Integer integer) {
|
||||
if (0 == len) {
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(string));
|
||||
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(3));
|
||||
}
|
||||
|
||||
stringBuilder.append(EnumEvt.setEvtProperty(Integer.toString(len)));
|
||||
|
||||
if (null == f) {
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(integer.intValue()), 4));
|
||||
} else {
|
||||
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(f.floatValue()), 4));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,4 +11,6 @@ import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||
public interface EventWaveAnalysisService {
|
||||
|
||||
EntityAdvancedData analysis(String eventIndex);
|
||||
|
||||
EntityAdvancedData analysisWlEvent(String eventIndex);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgMachineMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||
@@ -56,12 +58,34 @@ public class SgMachineServiceImpl extends ServiceImpl<SgMachineMapper, SgMachine
|
||||
@Override
|
||||
public String addMachine(SgMachineParam sgMachineParam) {
|
||||
SgMachine sgMachine = new SgMachine();
|
||||
checkMachineName(sgMachineParam, false);
|
||||
|
||||
BeanUtil.copyProperties(sgMachineParam, sgMachine);
|
||||
//默认为正常状态
|
||||
sgMachine.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.save(sgMachine);
|
||||
return sgMachine.getId();
|
||||
}
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的业务用户
|
||||
*/
|
||||
private void checkMachineName(SgMachineParam sgMachineParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<SgMachine> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sgUserLambdaQueryWrapper
|
||||
.eq(SgMachine::getName, sgMachineParam.getName())
|
||||
.eq(SgMachine::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (sgMachineParam instanceof SgMachineParam.SgMachineUpdateParam) {
|
||||
sgUserLambdaQueryWrapper.ne(SgMachine::getId, ((SgMachineParam.SgMachineUpdateParam) sgMachineParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备
|
||||
@@ -70,6 +94,8 @@ public class SgMachineServiceImpl extends ServiceImpl<SgMachineMapper, SgMachine
|
||||
@Override
|
||||
public boolean updateSgMachine(SgMachineParam.SgMachineUpdateParam updateParam) {
|
||||
SgMachine sgMachine = new SgMachine();
|
||||
checkMachineName(updateParam, true);
|
||||
|
||||
BeanUtil.copyProperties(updateParam, sgMachine);
|
||||
return this.updateById(sgMachine);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.njcn.advance.service.govern.voltage.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||
@@ -54,12 +57,34 @@ public class SgSensitiveUnitServiceImpl extends ServiceImpl<SgSensitiveUnitMappe
|
||||
@Override
|
||||
public String addSensitiveUnit(SgSensitiveUnitParam sgSensitiveUnitParam) {
|
||||
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
||||
checkSensitiveUnitName(sgSensitiveUnitParam, false);
|
||||
|
||||
BeanUtil.copyProperties(sgSensitiveUnitParam, sgSensitiveUnit);
|
||||
//默认为正常状态
|
||||
sgSensitiveUnit.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.save(sgSensitiveUnit);
|
||||
return sgSensitiveUnit.getId();
|
||||
}
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的业务用户
|
||||
*/
|
||||
private void checkSensitiveUnitName(SgSensitiveUnitParam sgSensitiveUnitParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<SgSensitiveUnit> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sgUserLambdaQueryWrapper
|
||||
.eq(SgSensitiveUnit::getName, sgSensitiveUnitParam.getName())
|
||||
.eq(SgSensitiveUnit::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (sgSensitiveUnitParam instanceof SgSensitiveUnitParam.SgSensitiveUnitUpdateParam) {
|
||||
sgUserLambdaQueryWrapper.ne(SgSensitiveUnit::getId, ((SgSensitiveUnitParam.SgSensitiveUnitUpdateParam) sgSensitiveUnitParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新元器件
|
||||
@@ -69,6 +94,8 @@ public class SgSensitiveUnitServiceImpl extends ServiceImpl<SgSensitiveUnitMappe
|
||||
@Override
|
||||
public boolean updateSgSensitiveUnit(SgSensitiveUnitParam.SgSensitiveUnitUpdateParam updateParam) {
|
||||
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
||||
checkSensitiveUnitName(updateParam, true);
|
||||
|
||||
BeanUtil.copyProperties(updateParam, sgSensitiveUnit);
|
||||
return this.updateById(sgSensitiveUnit);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import io.swagger.models.auth.In;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -511,7 +512,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
lambdaQueryWrapper.like(RmpEventDetailAssPO::getContentDes, baseParam.getSearchValue());
|
||||
}
|
||||
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
||||
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
||||
.orderByDesc(RmpEventDetailAssPO::getTimeId);
|
||||
return rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -733,7 +734,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
||||
|
||||
|
||||
advanceEventDetailVOLsit = advanceEventDetailVOLsit.stream().filter(temp-> StringUtils.isNotEmpty(temp.getAdvanceType())).collect(Collectors.toList());
|
||||
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
||||
//母线id
|
||||
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
||||
|
||||
@@ -2,13 +2,16 @@ package com.njcn.advance.service.impl;
|
||||
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.advance.enums.EnumEvt;
|
||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||
|
||||
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||
import com.njcn.advance.utils.*;
|
||||
import com.njcn.advance.utils.JnaCallBalance;
|
||||
import com.njcn.advance.utils.JnaCallDllOrSo;
|
||||
import com.njcn.advance.utils.Utils;
|
||||
import com.njcn.advance.utils.WaveUtils;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
@@ -26,7 +29,10 @@ import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -81,7 +87,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
||||
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||
try {
|
||||
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG.toLowerCase());
|
||||
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT.toLowerCase());
|
||||
} catch (Exception e1) {
|
||||
|
||||
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
//读取
|
||||
@@ -164,17 +176,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
causeStruct.smp_len = pitchList.size();
|
||||
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||
|
||||
|
||||
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR);
|
||||
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
||||
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||
|
||||
|
||||
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||
//如果存在三个文件但是没有调用dll/so计算
|
||||
|
||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +216,167 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
return entityAdvancedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityAdvancedData analysisWlEvent(String eventIndex) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
//调用方法获取暂降事件详情
|
||||
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
||||
EntityAdvancedData entityAdvancedData;
|
||||
|
||||
if (rmpEventDetailPO.getFileFlag() == 1) {
|
||||
//获取所有暂态原因
|
||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||
InputStream inputStreamCfg;
|
||||
InputStream inputStreamDat;
|
||||
try {
|
||||
inputStreamCfg = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath()+ GeneralConstant.CFG);
|
||||
inputStreamDat = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
inputStreamCfg = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.CFG.toLowerCase());
|
||||
inputStreamDat = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.DAT.toLowerCase());
|
||||
} catch (Exception e1) {
|
||||
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
//读取
|
||||
BufferedReader bufferedReader;
|
||||
InputStreamReader read = null;
|
||||
String strFileLine;
|
||||
byte[] array = {};
|
||||
List<String> temCfgList = new ArrayList<>();
|
||||
try {
|
||||
// 判断文件是否存在
|
||||
array = IoUtil.readBytes(inputStreamDat);
|
||||
// 考虑到编码格式
|
||||
read = new InputStreamReader(inputStreamCfg, StandardCharsets.UTF_8);
|
||||
bufferedReader = new BufferedReader(read);
|
||||
|
||||
while ((strFileLine = bufferedReader.readLine()) != null) {
|
||||
temCfgList.add(strFileLine);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (read != null) {
|
||||
read.close();
|
||||
}
|
||||
if (inputStreamDat != null) {
|
||||
inputStreamDat.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//原始波形
|
||||
WaveData waveOriginalData = getWavedata(rmpEventDetailPO, temCfgList, array, 3);
|
||||
List<List<Float>> originalList = waveOriginalData.getSunData();
|
||||
|
||||
entityAdvancedData = new EntityAdvancedData(originalList.size());
|
||||
|
||||
for (int i = 0; i < originalList.size(); i++) {
|
||||
//坐标轴
|
||||
entityAdvancedData.smp_x[i] = originalList.get(i).get(0);
|
||||
entityAdvancedData.smp_a[i] = originalList.get(i).get(1);
|
||||
entityAdvancedData.smp_b[i] = originalList.get(i).get(2);
|
||||
entityAdvancedData.smp_c[i] = originalList.get(i).get(3);
|
||||
}
|
||||
entityAdvancedData.smp_len = originalList.size();
|
||||
|
||||
//抽点方法计算波形
|
||||
WaveData wavePitchData = getWavedata(rmpEventDetailPO, temCfgList, array, 0);
|
||||
List<List<Float>> pitchList = wavePitchData.getSunData();
|
||||
|
||||
// 将获取到的数据填充到结构体内
|
||||
Rect rect = new Rect();
|
||||
CauseStruct causeStruct = new CauseStruct();
|
||||
|
||||
for (int i = 0; i < pitchList.size(); i++) {
|
||||
rect.smp_va[i] = pitchList.get(i).get(1);
|
||||
causeStruct.smp_va[i] = pitchList.get(i).get(1);
|
||||
|
||||
rect.smp_vb[i] = pitchList.get(i).get(2);
|
||||
causeStruct.smp_vb[i] = pitchList.get(i).get(2);
|
||||
|
||||
rect.smp_vc[i] = pitchList.get(i).get(3);
|
||||
causeStruct.smp_vc[i] = pitchList.get(i).get(3);
|
||||
}
|
||||
|
||||
rect.smp_len = pitchList.size();
|
||||
|
||||
//超过60s的波形直接抛异常给上面处理
|
||||
/*
|
||||
* 波形最大值计算
|
||||
*/
|
||||
int MAX_LENGTH = 128 * 3000;
|
||||
if (rect.smp_len >= MAX_LENGTH) {
|
||||
throw new BusinessException("波形超过60S");
|
||||
}
|
||||
|
||||
rect.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||
causeStruct.smp_len = pitchList.size();
|
||||
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||
|
||||
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||
//如果存在三个文件但是没有调用dll/so计算
|
||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||
} else {
|
||||
//已经处理过了,那就根据id获取暂降原因
|
||||
String reason = rmpEventDetailPO.getAdvanceReason();
|
||||
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||
Map<String, DictData> eventReasonMap = reasonList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
if (ObjectUtil.isNotNull(eventReasonMap.get(reason))) {
|
||||
entityAdvancedData.sagReason[0] = eventReasonMap.get(reason).getName();
|
||||
}
|
||||
}
|
||||
|
||||
String hdrStr = null;
|
||||
try {
|
||||
hdrStr = waveUtils.getFile(rmpEventDetailPO.getWavePath() + GeneralConstant.HDR.toLowerCase());
|
||||
} catch (Exception e) {
|
||||
log.error("读取文件服务器波形数据异常:{}",e.getMessage());
|
||||
}
|
||||
if (hdrStr != null) {
|
||||
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
||||
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||
}
|
||||
|
||||
// if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||
// //如果存在三个文件但是没有调用dll/so计算
|
||||
// getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||
// }
|
||||
|
||||
/****************************************************************
|
||||
* 根据返回的结果计算,获取暂降类型描述
|
||||
****************************************************************/
|
||||
if (entityAdvancedData.backNumber > 0) {
|
||||
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
||||
entityAdvancedData.sagType[i] = eventTypeMap.get(entityAdvancedData.evt_buf[i].qvvr_cata_type[0]).getName();
|
||||
switch (entityAdvancedData.evt_buf[i].qvvr_phasetype[0]) {
|
||||
case 1:
|
||||
entityAdvancedData.sagPhaseType[i] = "单相";
|
||||
break;
|
||||
case 2:
|
||||
entityAdvancedData.sagPhaseType[i] = "两相";
|
||||
break;
|
||||
case 3:
|
||||
entityAdvancedData.sagPhaseType[i] = "三相";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||
}
|
||||
log.info("高级算法波形计算" + timeInterval.interval());
|
||||
return entityAdvancedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||
@@ -352,7 +521,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
||||
|
||||
//暂降原因计算
|
||||
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_dll_cause");
|
||||
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_cause_dll");
|
||||
jnaCallDllReason.setPath();
|
||||
|
||||
JnaCallBalance.Balancelibrary CAUSE = JnaCallBalance.Balancelibrary.INSTANTCE;
|
||||
|
||||
56
pqs-advance/advance-boot/src/main/resources/bootstrap-jb.yml
Normal file
56
pqs-advance/advance-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10211
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.advance.pojo
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10211
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.advance.pojo
|
||||
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
@@ -1,57 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10211
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.advance.pojo
|
||||
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
profiles:
|
||||
active: sjzx
|
||||
52
pqs-auth/src/main/resources/bootstrap-jb.yml
Normal file
52
pqs-auth/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10214
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.user.pojo
|
||||
|
||||
57
pqs-auth/src/main/resources/bootstrap-sjzx.yml
Normal file
57
pqs-auth/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10214
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.user.pojo
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
@@ -1,53 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10214
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.user.pojo
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -88,7 +88,7 @@ public class BpmSignParam extends BaseEntity implements Serializable {
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("标识key")
|
||||
private String key;
|
||||
private String signKey;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ public class BpmCategoryServiceImpl extends ServiceImpl<BpmCategoryMapper, BpmCa
|
||||
@Override
|
||||
public Page<BpmCategoryVO> getCategoryPage(BpmCategoryParam.BpmCategoryQueryParam bpmCategoryQueryParam) {
|
||||
QueryWrapper<BpmCategoryVO> categoryVOQueryWrapper = new QueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getName())) {
|
||||
categoryVOQueryWrapper.like("bpm_category.name", bpmCategoryQueryParam.getName());
|
||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getSearchValue())) {
|
||||
categoryVOQueryWrapper.like("bpm_category.name", bpmCategoryQueryParam.getSearchValue());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getCode())) {
|
||||
|
||||
@@ -106,8 +106,8 @@ public class BpmSignServiceImpl extends ServiceImpl<BpmSignMapper, BpmSign> impl
|
||||
bpmSignVOQueryWrapper.like("bpm_sign.name", bpmSignQueryParam.getName());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(bpmSignQueryParam.getKey())) {
|
||||
bpmSignVOQueryWrapper.like("bpm_sign.signKey", bpmSignQueryParam.getKey());
|
||||
if (StrUtil.isNotBlank(bpmSignQueryParam.getSignKey())) {
|
||||
bpmSignVOQueryWrapper.like("bpm_sign.sign_key", bpmSignQueryParam.getSignKey());
|
||||
}
|
||||
bpmSignVOQueryWrapper.eq("bpm_sign.state", DataStateEnum.ENABLE.getCode());
|
||||
bpmSignVOQueryWrapper.orderByAsc("bpm_sign.sort");
|
||||
|
||||
71
pqs-bpm/bpm-boot/src/main/resources/bootstrap-jb.yml
Normal file
71
pqs-bpm/bpm-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10321
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: Asia/Shanghai
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
flowable:
|
||||
database-schema-update: false
|
||||
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||
async-executor-activate: false
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
type-aliases-package: com.njcn.bpm.pojo
|
||||
|
||||
gw:
|
||||
url: dwzyywzt-pms3-proxy.com
|
||||
code: 13B9B47F1E483324E05338297A0A0595
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
76
pqs-bpm/bpm-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
76
pqs-bpm/bpm-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,76 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10321
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: Asia/Shanghai
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: bpm-config.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
flowable:
|
||||
database-schema-update: false
|
||||
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||
async-executor-activate: false
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
type-aliases-package: com.njcn.bpm.pojo
|
||||
|
||||
gw:
|
||||
url: dwzyywzt-pms3-proxy.com
|
||||
code: 13B9B47F1E483324E05338297A0A0595
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,72 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10321
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: Asia/Shanghai
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: bpm-config.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
flowable:
|
||||
database-schema-update: false
|
||||
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||
async-executor-activate: false
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
type-aliases-package: com.njcn.bpm.pojo
|
||||
|
||||
gw:
|
||||
url: dwzyywzt-pms3-proxy.com
|
||||
code: 13B9B47F1E483324E05338297A0A0595
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
|
||||
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -75,9 +75,9 @@ public interface PatternRegex {
|
||||
String ROLE_REGEX = "^[a-zA-Z][a-zA-Z0-9]{2,50}$";
|
||||
|
||||
/**
|
||||
* 部门名称由汉字组成,长度为0-20
|
||||
* 部门名称由汉字组成,长度为0-32 (前端统一32了这边改下长度)
|
||||
*/
|
||||
String DEPT_NAME_REGEX = "^[\\u4e00-\\u9fa5]{1,20}$";
|
||||
String DEPT_NAME_REGEX = "^[\\u4e00-\\u9fa5]{1,32}$";
|
||||
|
||||
/**
|
||||
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
|
||||
@@ -258,7 +258,7 @@ public interface PatternRegex {
|
||||
/**
|
||||
* 任意字符,长度在1-20位,常用于名称、编码等常规录入
|
||||
*/
|
||||
String ALL_CHAR_1_20 = "^[-_A-Za-z0-9\\u4e00-\\u9fa5]{1,20}$";
|
||||
String ALL_CHAR_1_20 = "^[-_A-Za-z0-9\\u4e00-\\u9fa5]{1,32}$";
|
||||
|
||||
String SPECIALCHARACTER ="[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html";
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ public class PieGenerator {
|
||||
Option reasonOption = new Option();
|
||||
//取消渲染动画
|
||||
reasonOption.setAnimation(false);
|
||||
String[] colorArr = {"#526ADE", "#00BFF5","#FFBF00","#77DA63","#D5FF6B"};
|
||||
reasonOption.setColor(colorArr);
|
||||
//背景色
|
||||
reasonOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
||||
//标题
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.njcn.microservice.listener;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import ch.qos.logback.classic.joran.JoranConfigurator;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,33 +36,46 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
|
||||
|
||||
@Override
|
||||
public void environmentPrepared(ConfigurableEnvironment environment) {
|
||||
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||
String projectName = environment.getProperty("microservice.ename");
|
||||
String logLevel = environment.getProperty("logging.level.root");
|
||||
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("cndl408125hawen", "lanxia201");
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||
if (response.getStatusCode().is2xxSuccessful()) {
|
||||
String logbackConfigContent = response.getBody();
|
||||
//替换项目名称
|
||||
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||
// 应用获取到的Logback配置
|
||||
applyLogbackConfig(logbackConfigContent);
|
||||
}*/
|
||||
String active = environment.getProperty("spring.profiles.active");
|
||||
if(!"jb".equalsIgnoreCase(active)){
|
||||
String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||
String projectName = environment.getProperty("microservice.ename");
|
||||
String logLevel = environment.getProperty("logging.level.root");
|
||||
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("cndl408125hawen", "lanxia201");
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||
if (response.getStatusCode().is2xxSuccessful()) {
|
||||
String logbackConfigContent = response.getBody();
|
||||
//替换项目名称
|
||||
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||
// 应用获取到的Logback配置
|
||||
applyLogbackConfig(logbackConfigContent,logLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLogbackConfig(String logbackConfigContent) {
|
||||
private void applyLogbackConfig(String logbackConfigContent,String logLevel) {
|
||||
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
JoranConfigurator configurator = new JoranConfigurator();
|
||||
configurator.setContext(context);
|
||||
context.reset();
|
||||
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(logbackConfigContent.getBytes(StandardCharsets.UTF_8))) {
|
||||
configurator.doConfigure(inputStream);
|
||||
Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
|
||||
if("debug".equalsIgnoreCase(logLevel)){
|
||||
root.setLevel(Level.DEBUG);
|
||||
}
|
||||
if("info".equalsIgnoreCase(logLevel)){
|
||||
root.setLevel(Level.INFO);
|
||||
}
|
||||
if("error".equalsIgnoreCase(logLevel)){
|
||||
root.setLevel(Level.ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
@@ -25,7 +25,7 @@ public class BZEventMessageTemplate extends RocketMQEnhanceTemplate {
|
||||
public SendResult sendMember(Object message, String tag) {
|
||||
BaseMessage baseMessage = new BaseMessage();
|
||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||
baseMessage.setMessageBody(new Gson().toJson(message));
|
||||
baseMessage.setMessageBody(JSON.toJSONString(message));
|
||||
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
|
||||
@@ -12,6 +12,8 @@ public interface OssPath {
|
||||
*/
|
||||
String WAVE_DIR="comtrade/";
|
||||
|
||||
String WAVE_FILE="wave/";
|
||||
|
||||
/***
|
||||
* 下载文件
|
||||
*/
|
||||
@@ -167,4 +169,14 @@ public interface OssPath {
|
||||
*/
|
||||
String CONFIGURATIONNAME = "configuration.json";
|
||||
|
||||
/**
|
||||
* APP 稳态报告路径
|
||||
*/
|
||||
String APP_HARMONIC_REPORT = "app/report/harmonic/";
|
||||
|
||||
/**
|
||||
* APP 暂态报告路径
|
||||
*/
|
||||
String APP_EVENT_REPORT = "app/report/event/";
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.prepare.harmonic.controller",
|
||||
"com.njcn.prepare.event.controller",
|
||||
"com.njcn.device.pq.controller",
|
||||
"com.njcn.device.terminal.controller",
|
||||
"com.njcn.device.pms.controller",
|
||||
"com.njcn.auth.controller",
|
||||
"com.njcn.system.controller",
|
||||
@@ -74,6 +75,7 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.cswarn.controller",
|
||||
"com.njcn.csharmonic.controller",
|
||||
"com.njcn.cssystem.controller",
|
||||
"com.njcn.csreport.controller",
|
||||
"com.njcn.advance.controller",
|
||||
"com.njcn.stat.controller",
|
||||
"com.njcn.rt.controller",
|
||||
@@ -86,7 +88,9 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.dataProcess",
|
||||
"com.njcn.migration",
|
||||
"com.njcn.harmonic.rstatlimitrate.controller",
|
||||
"com.njcn.device.device.controller"
|
||||
"com.njcn.device.device.controller",
|
||||
"com.njcn.device.userledger.controller",
|
||||
"com.njcn.migration.read.controller"
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
List<GrantType> grantTypes = new ArrayList<>();
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface ValidMessage {
|
||||
|
||||
String NAME_NOT_BLANK = "名称不能为空,请检查name参数";
|
||||
|
||||
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过20字符,请检查name参数";
|
||||
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过32字符,请检查name参数";
|
||||
|
||||
String INDUSTRY_NOT_BLANK = "行业不能为空,请检查industry参数";
|
||||
String INDUSTRY_FORMAT_ERROR = "行业格式错误,请检查industry参数";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.njcn.web.utils;
|
||||
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.net.URI;
|
||||
@@ -15,8 +15,11 @@ import java.util.Map;
|
||||
* @createDate 2019-02-08
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class RestTemplateUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RestTemplateUtil.class);
|
||||
|
||||
private static final RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// ----------------------------------GET-------------------------------------------------------
|
||||
@@ -263,6 +266,24 @@ public class RestTemplateUtil {
|
||||
return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables);
|
||||
}
|
||||
|
||||
public <T> ResponseEntity<T> post(String url, Object requestBody, HttpHeaders headers, Class<T> responseType) {
|
||||
try {
|
||||
if (headers == null) {
|
||||
headers = new HttpHeaders();
|
||||
}
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
HttpEntity<Object> entity = new HttpEntity<>(requestBody, headers);
|
||||
log.info("发送POST请求到: {}", url);
|
||||
ResponseEntity<T> response = restTemplate.postForEntity(url, entity, responseType);
|
||||
log.info("POST请求响应状态: {}", response.getStatusCode());
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("POST请求异常: {}", e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------PUT-------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.biz.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
public interface PqSensitiveUserMapper extends BaseMapper<PqSensitiveUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.device.biz.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-02-10
|
||||
* @Description:
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("pq_sensitive_user")
|
||||
public class PqSensitiveUser extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
private String substationName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
67
pqs-device/device-boot/src/main/resources/bootstrap-jb.yml
Normal file
67
pqs-device/device-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10202
|
||||
max-http-header-size: 1048576
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
#上传文件总的最大值
|
||||
max-request-size: 200MB
|
||||
#上传文件的最大值
|
||||
max-file-size: 200MB
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||
|
||||
#是否是冀北设备台账树
|
||||
isJb: false
|
||||
|
||||
oracle:
|
||||
isSync: false
|
||||
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
||||
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
||||
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
||||
72
pqs-device/device-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
72
pqs-device/device-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10202
|
||||
max-http-header-size: 1048576
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
#上传文件总的最大值
|
||||
max-request-size: 200MB
|
||||
#上传文件的最大值
|
||||
max-file-size: 200MB
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||
|
||||
#是否是冀北设备台账树
|
||||
isJb: false
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
oracle:
|
||||
isSync: false
|
||||
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
||||
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
||||
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
||||
@@ -1,68 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10202
|
||||
max-http-header-size: 1048576
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
#上传文件总的最大值
|
||||
max-request-size: 200MB
|
||||
#上传文件的最大值
|
||||
max-file-size: 200MB
|
||||
|
||||
#项目日志的配置
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||
|
||||
#是否是冀北设备台账树
|
||||
isJb: false
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
oracle:
|
||||
isSync: false
|
||||
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
||||
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
||||
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -27,6 +27,12 @@
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
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.UserLedgerFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/userReport", fallbackFactory = UserLedgerFeignClientFallbackFactory.class)
|
||||
public interface UserLedgerFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/selectUserList")
|
||||
HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam);
|
||||
|
||||
@GetMapping("/selectUserInfo")
|
||||
HttpResult<UserLedgerVO> selectUserInfo(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping(value = "/bindUserStation")
|
||||
HttpResult<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId);
|
||||
|
||||
@PostMapping("/getUserReportByIds")
|
||||
HttpResult<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids);
|
||||
|
||||
@PostMapping("/getSensitiveUserByDept")
|
||||
@ApiOperation("根据部门获取敏感用户信息")
|
||||
HttpResult<List<UserReportPO>> getSensitiveUserByDept(@RequestBody @Validated SensitiveUserParam param) ;
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
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.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
@@ -52,6 +54,12 @@ public class UserLedgerFeignClientFallbackFactory implements FallbackFactory<Use
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(SensitiveUserParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据部门获取敏感用户信息异常", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.njcn.device.pq.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-12-02
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class PqSensitiveUserParam {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
@NotBlank(message = "用户名称不可为空")
|
||||
@ApiModelProperty(name = "name",value = "用户名称不可为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
@NotBlank(message = "敏感负荷类型不可为空")
|
||||
@ApiModelProperty(name = "loadType",value = "敏感负荷类型")
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
@Range(min = 0,max = 10000000 )
|
||||
@ApiModelProperty(name = "userAgreementCapacity",value = "用户协议容量")
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
@Range(min = 0,max = 10000000 )
|
||||
@ApiModelProperty(name = "installedCapacity",value = "装机容量")
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
@NotBlank(message = "所属厂站名称不可为空")
|
||||
@ApiModelProperty(name = "substationName",value = "所属厂站名称")
|
||||
private String substationName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不可为空")
|
||||
@ApiModelProperty(name = "sort",value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdatePqSensitiveUserParam extends PqSensitiveUserParam{
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotBlank(message = "id不可为空")
|
||||
@ApiModelProperty(name = "id",value = "id")
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,9 @@ public class AreaLineInfoVO implements Serializable {
|
||||
@ApiModelProperty(name = "pt2",value = "pt2")
|
||||
private Integer pt2;
|
||||
|
||||
@ApiModelProperty(name = "ptType",value = "接线类型(0:星型接法;1:三角型接法;2:开口三角型接法)")
|
||||
private Integer ptType;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "对象名称")
|
||||
private String objName;
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/2/2 15:16
|
||||
*/
|
||||
@Data
|
||||
public class LineInfoMonitorIdVO {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "gdName",value = "供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "对象名称")
|
||||
private String objName;
|
||||
|
||||
@ApiModelProperty(name = "subName",value = "变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty(name = "powerSubstationName", value = "电网侧变电站")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ApiModelProperty(name = "deviceId",value = "装置Id")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(name = "deviceName",value = "装置名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(name = "ip",value = "装置ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "供应商名称")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "monitorId",value = "国网ID")
|
||||
private String monitorId;
|
||||
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志(0-电网侧;1-非电网侧)")
|
||||
private Integer powerFlag;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@Data
|
||||
public class PqSensitiveUserVo implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否监测
|
||||
*/
|
||||
private String isMonitor;
|
||||
|
||||
/**
|
||||
* 是否治理
|
||||
*/
|
||||
private String isGovern;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
private String substationName;
|
||||
}
|
||||
@@ -59,4 +59,7 @@ public class RunTimeVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
||||
private Double onlineEvaluate;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "用户对象名称")
|
||||
private String objName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/07/18 11:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class CityDataExcel implements Serializable {
|
||||
|
||||
|
||||
@ExcelProperty(value = "单位")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty(value = "监测终端数量")
|
||||
private BigDecimal deviceNum;
|
||||
|
||||
@ExcelProperty(value = "监测点个数")
|
||||
private BigDecimal lineNum;
|
||||
|
||||
@ExcelProperty(value = "在线率(%)")
|
||||
private BigDecimal onlineRate;
|
||||
|
||||
@ExcelProperty(value = "完整率(%)")
|
||||
private BigDecimal integrity;
|
||||
|
||||
@ExcelProperty(value = "问题监测点")
|
||||
private BigDecimal abnormalNum;
|
||||
|
||||
@ExcelProperty(value = "问题监测点")
|
||||
private List<String> abnormalList;
|
||||
|
||||
}
|
||||
@@ -3,11 +3,14 @@ package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -70,9 +73,15 @@ public class DataVerifyExcel implements Serializable {
|
||||
@Excel(name = "厂商")
|
||||
private String manufacturer;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电网标志")
|
||||
@Excel(name = "电网标志")
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志")
|
||||
private String powerFlag;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "总指标异常时间")
|
||||
@Excel(name = "总")
|
||||
@Excel(name = "总指标异常时间")
|
||||
private Integer allTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@@ -191,4 +200,33 @@ public class DataVerifyExcel implements Serializable {
|
||||
private Integer riseTime;
|
||||
|
||||
|
||||
// 字段名 ↔ Excel列名 映射
|
||||
public static final Map<String, String> FIELD_COLUMN_MAP = new HashMap<>();
|
||||
static {
|
||||
// 按代码中字段顺序整理,确保一一对应
|
||||
FIELD_COLUMN_MAP.put("freqTime", "频率");
|
||||
FIELD_COLUMN_MAP.put("freqDevTime", "频率偏差");
|
||||
FIELD_COLUMN_MAP.put("vRmsTime", "相电压有效值");
|
||||
FIELD_COLUMN_MAP.put("vPosTime", "正序电压");
|
||||
FIELD_COLUMN_MAP.put("vNegTime", "负序电压");
|
||||
FIELD_COLUMN_MAP.put("vZeroTime", "零序电压");
|
||||
FIELD_COLUMN_MAP.put("vUnbalanceTime", "电压不平衡度");
|
||||
FIELD_COLUMN_MAP.put("rmsLvrTime", "线电压有效值");
|
||||
FIELD_COLUMN_MAP.put("vuDevTime", "电压正偏差");
|
||||
FIELD_COLUMN_MAP.put("vlDevTime", "电压负偏差");
|
||||
FIELD_COLUMN_MAP.put("vThdTime", "电压总谐波畸变率");
|
||||
FIELD_COLUMN_MAP.put("vTime", "相电压基波有效值");
|
||||
FIELD_COLUMN_MAP.put("iRmsTime", "电流有效值");
|
||||
FIELD_COLUMN_MAP.put("pltTime", "长时闪变");
|
||||
FIELD_COLUMN_MAP.put("vInharmTime", "间谐波电压含有率");
|
||||
FIELD_COLUMN_MAP.put("vHarmTime", "谐波电压含有率");
|
||||
FIELD_COLUMN_MAP.put("pfTime", "功率因数");
|
||||
FIELD_COLUMN_MAP.put("vPhasicTime", "谐波电压相角");
|
||||
FIELD_COLUMN_MAP.put("v1PhasicTime", "谐波电压基波相角");
|
||||
FIELD_COLUMN_MAP.put("flucTime", "电压波动");
|
||||
FIELD_COLUMN_MAP.put("pstTime", "短时闪变");
|
||||
FIELD_COLUMN_MAP.put("dipTime", "电压暂降");
|
||||
FIELD_COLUMN_MAP.put("riseTime", "电压暂升");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/07/18 11:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class LineDataExcel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
private BigDecimal lineNum;
|
||||
|
||||
@ExcelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ExcelProperty(value = "所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty(value = "接入电网侧变电站名")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ExcelProperty(value = "监测点对象名称")
|
||||
private String objName;
|
||||
|
||||
@ExcelProperty(value = "装置编号")
|
||||
private String deviceName;
|
||||
|
||||
@ExcelProperty(value = "IP地址")
|
||||
private String ip;
|
||||
|
||||
@ExcelProperty(value = "终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ExcelProperty(value = "在线率")
|
||||
private BigDecimal onlineRate;
|
||||
|
||||
@ExcelProperty(value = "数据完整性")
|
||||
private BigDecimal integrity;
|
||||
|
||||
@ExcelProperty(value = "国网ID")
|
||||
private BigDecimal monitorId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.njcn.device.pq.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.CityDataExcel;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/2/2 10:13
|
||||
*/
|
||||
public class DataLineExcelUtil {
|
||||
|
||||
/**
|
||||
* 创建监测点信息表头
|
||||
* @param FlyMonitorId
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> lineHeader(Boolean FlyMonitorId) {
|
||||
List<List<String>> header = new ArrayList<>();
|
||||
header.add(Collections.singletonList("序号"));
|
||||
header.add(Collections.singletonList("监测点名称"));
|
||||
header.add(Collections.singletonList("所属部门"));
|
||||
header.add(Collections.singletonList("接入电网侧变电站名"));
|
||||
header.add(Collections.singletonList("监测点对象名称"));
|
||||
header.add(Collections.singletonList("装置编号"));
|
||||
header.add(Collections.singletonList("IP地址"));
|
||||
header.add(Collections.singletonList("终端厂家"));
|
||||
header.add(Collections.singletonList("在线率"));
|
||||
header.add(Collections.singletonList("数据完整性"));
|
||||
if(FlyMonitorId){
|
||||
header.add(Collections.singletonList("国网ID"));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* 监测点信息表头数据写入
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static List<List<Object>> lineBody(List<LineDataExcel> data) {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (LineDataExcel datum : data) {
|
||||
ArrayList<Object> row = ListUtil.toList(datum.getLineNum(),
|
||||
datum.getLineName(),
|
||||
datum.getDeptName(),
|
||||
datum.getPowerSubstationName(),
|
||||
datum.getObjName(),
|
||||
datum.getDeviceName(),
|
||||
datum.getIp(),
|
||||
datum.getManufacturer(),
|
||||
datum.getOnlineRate(),
|
||||
datum.getIntegrity());
|
||||
if(ObjUtil.isNotNull(datum.getMonitorId())){
|
||||
row.add(datum.getMonitorId());
|
||||
}
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
// 插入一个空行
|
||||
result.add(Collections.emptyList());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建地市信息表头
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> cityHeader() {
|
||||
List<List<String>> header = new ArrayList<>();
|
||||
header.add(Collections.singletonList("单位"));
|
||||
header.add(Collections.singletonList("监测终端数量"));
|
||||
header.add(Collections.singletonList("监测点个数"));
|
||||
header.add(Collections.singletonList("在线率(%)"));
|
||||
header.add(Collections.singletonList("完整率(%)"));
|
||||
header.add(Collections.singletonList("问题监测点"));
|
||||
return header;
|
||||
}
|
||||
|
||||
public static List<List<Object>> cityBody(List<CityDataExcel> data) {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (CityDataExcel datum : data) {
|
||||
ArrayList<Object> row = ListUtil.toList(datum.getDeptName(),
|
||||
datum.getDeviceNum(),
|
||||
datum.getLineNum(),
|
||||
datum.getOnlineRate(),
|
||||
datum.getIntegrity(),
|
||||
datum.getAbnormalNum());
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
// 插入一个空行
|
||||
result.add(Collections.emptyList());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.njcn.device.pq.utils;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.DataVerifyExcel;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 修复版:按数据量动态排序Excel列,解决列挤在一行的问题
|
||||
* 关键改动:表头构建方式 + 列宽匹配逻辑
|
||||
*/
|
||||
public class FixedDynamicExcelExport {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// 1. 模拟测试数据(相电压数据量最多,频率次之,频率偏差最少)
|
||||
List<DataVerifyExcel> dataList = EasyExcel.read("F:\\usr\\response.xlsx")
|
||||
.head(DataVerifyExcel.class)
|
||||
.doReadAllSync();
|
||||
// 2. 导出Excel(替换为你的本地路径,比如桌面)
|
||||
dataList.sort(Comparator.comparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName()+"_"+item.getDevName())
|
||||
.thenComparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
);
|
||||
exportExcelByDataSize(dataList, "D:/dynamic_excel_fixed.xlsx");
|
||||
System.out.println("导出完成!打开桌面的「测试导出.xlsx」查看效果");
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心方法:按数据量排序导出Excel
|
||||
*/
|
||||
public static void exportExcelByDataSize(List<DataVerifyExcel> dataList, String outputPath) throws Exception {
|
||||
// 步骤1:统计每个字段的有效数据量
|
||||
Map<String, Integer> fieldCount = countValidData(dataList);
|
||||
// 步骤2:按数据量降序排序字段名
|
||||
List<String> sortedFields = sortFields(fieldCount);
|
||||
// 步骤3:构建正确的动态表头
|
||||
List<List<String>> head = buildCorrectHead(sortedFields);
|
||||
// 步骤4:构建对应顺序的行数据
|
||||
List<List<Object>> data = buildRowData(dataList, sortedFields);
|
||||
|
||||
// 步骤5:导出Excel(含列宽设置)
|
||||
try (FileOutputStream out = new FileOutputStream(outputPath)) {
|
||||
EasyExcel.write(out)
|
||||
.head(head)
|
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(20))
|
||||
.registerWriteHandler(new FreezeHeaderHandler()) // 用修复后的表头
|
||||
.sheet("数据统计")
|
||||
.doWrite(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, List> exportExcelByDataSize(List<DataVerifyExcel> dataList) {
|
||||
Map<String, List> map = new HashMap<>(2);
|
||||
Map<String, Integer> fieldCount = countValidData(dataList);
|
||||
List<String> sortedFields = sortFields(fieldCount);
|
||||
map.put("head", buildCorrectHead(sortedFields));
|
||||
map.put("data", buildRowData(dataList, sortedFields));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static class FreezeHeaderHandler implements SheetWriteHandler {
|
||||
@Override
|
||||
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
// 表格创建前无需操作
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
Sheet sheet = writeSheetHolder.getSheet();
|
||||
// freezePane(c, r):c=冻结列数,r=冻结行数;这里r=1表示冻结第1行(表头),c=0表示不冻结列
|
||||
// 比如 freezePane(1, 1) 表示冻结第一列+第一行
|
||||
sheet.createFreezePane(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static HorizontalCellStyleStrategy writeCenterStyle() {
|
||||
// 内容的策略
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
//设置 自动换行
|
||||
contentWriteCellStyle.setWrapped(true);
|
||||
//设置 垂直居中
|
||||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
//设置 水平居中
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
//设置边框样式
|
||||
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
|
||||
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
|
||||
|
||||
WriteFont bodyWriteFont = new WriteFont();
|
||||
bodyWriteFont.setFontHeightInPoints((short) 11);
|
||||
bodyWriteFont.setBold(false);
|
||||
bodyWriteFont.setFontName("宋体");
|
||||
contentWriteCellStyle.setWriteFont(bodyWriteFont);
|
||||
|
||||
// 头部
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
// 设置字体居中
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
WriteFont headWriteFont = new WriteFont();
|
||||
// 设置字体大小为20
|
||||
headWriteFont.setFontHeightInPoints((short) 11);
|
||||
headWriteFont.setBold(false);
|
||||
headWriteFont.setFontName("宋体");
|
||||
headWriteCellStyle.setWriteFont(headWriteFont);
|
||||
|
||||
return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||
}
|
||||
// ★ 修复点1:构建正确的表头(每个列名独立成List)
|
||||
private static List<List<String>> buildCorrectHead(List<String> allFields) {
|
||||
List<List<String>> head = new ArrayList<>();
|
||||
head.add(Collections.singletonList("供电公司"));
|
||||
head.add(Collections.singletonList("所属变电站"));
|
||||
head.add(Collections.singletonList("终端名称"));
|
||||
head.add(Collections.singletonList("监测点名称"));
|
||||
head.add(Collections.singletonList("IP"));
|
||||
head.add(Collections.singletonList("干扰源类型"));
|
||||
head.add(Collections.singletonList("监测对象名称"));
|
||||
head.add(Collections.singletonList("电网侧变电站"));
|
||||
head.add(Collections.singletonList("厂商"));
|
||||
head.add(Collections.singletonList("电网标志"));
|
||||
head.add(Collections.singletonList("总指标异常时间"));
|
||||
List<String> sortedFields = allFields.subList(11, allFields.size());
|
||||
for (String field : sortedFields) {
|
||||
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
||||
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
|
||||
// 统计有效数据量(无改动,保留)
|
||||
private static Map<String, Integer> countValidData(List<DataVerifyExcel> dataList) {
|
||||
// 1. 初始化计数字典(反射自动提取所有Time结尾的Integer字段,初始值0)
|
||||
Map<String, Integer> countMap = initCountMap();
|
||||
// 2. 判空,避免空指针异常
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return countMap;
|
||||
}
|
||||
// 3. 获取DataStatistic类的所有字段
|
||||
Field[] fields = DataVerifyExcel.class.getDeclaredFields();
|
||||
try {
|
||||
// 4. 遍历每个数据对象
|
||||
for (DataVerifyExcel data : dataList) {
|
||||
// 5. 遍历每个字段,累加数值
|
||||
for (Field field : fields) {
|
||||
// 过滤条件:Integer类型 + 以Time结尾
|
||||
if (field.getType() == Integer.class && field.getName().endsWith("Time") ) {
|
||||
if(!field.getName().equals("allTime")){
|
||||
// 设置可访问私有字段
|
||||
field.setAccessible(true);
|
||||
// 获取当前对象的该字段值
|
||||
Integer value = (Integer) field.get(data);
|
||||
// 非空则累加
|
||||
if (value != null) {
|
||||
String fieldName = field.getName();
|
||||
countMap.put(fieldName, countMap.get(fieldName) + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
// 捕获反射访问异常,便于排查问题
|
||||
throw new RuntimeException("统计字段时反射访问失败", e);
|
||||
}
|
||||
return countMap;
|
||||
}
|
||||
|
||||
// 反射初始化计数字典(复用之前的逻辑)
|
||||
private static Map<String, Integer> initCountMap() {
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
Field[] fields = DataVerifyExcel.class.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getType() == Integer.class && field.getName().endsWith("Time")) {
|
||||
if(!field.getName().equals("allTime")){
|
||||
countMap.put(field.getName(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return countMap;
|
||||
}
|
||||
|
||||
|
||||
// 按数据量排序字段(无改动,保留)
|
||||
private static List<String> sortFields(Map<String, Integer> fieldCount) {
|
||||
List<String> fields = new ArrayList<>(fieldCount.keySet());
|
||||
fields.sort((f1, f2) -> fieldCount.get(f2) - fieldCount.get(f1)); // 降序
|
||||
List<String> fieldAlls=new ArrayList<>();
|
||||
fieldAlls.add("city");
|
||||
fieldAlls.add("stationName");
|
||||
fieldAlls.add("devName");
|
||||
fieldAlls.add("lineName");
|
||||
fieldAlls.add("ip");
|
||||
fieldAlls.add("loadType");
|
||||
fieldAlls.add("objName");
|
||||
fieldAlls.add("powerSubstationName");
|
||||
fieldAlls.add("manufacturer");
|
||||
fieldAlls.add("powerFlag");
|
||||
fieldAlls.add("allTime");
|
||||
fieldAlls.addAll(fields);
|
||||
return fieldAlls;
|
||||
}
|
||||
|
||||
// 构建行数据(无改动,保留)
|
||||
private static List<List<Object>> buildRowData(List<DataVerifyExcel> dataList, List<String> sortedFields) {
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
for (DataVerifyExcel data : dataList) {
|
||||
List<Object> row = new ArrayList<>();
|
||||
for (String field : sortedFields) {
|
||||
try {
|
||||
Field f = DataVerifyExcel.class.getDeclaredField(field);
|
||||
f.setAccessible(true);
|
||||
row.add(f.get(data));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("导出异常数据转换异常:"+e);
|
||||
}
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -155,6 +157,10 @@ public class DataVerifyController extends BaseController {
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
if(StrUtil.isNotBlank(monitorBaseParam.getSearchBeginTime())&&StrUtil.isNotBlank(monitorBaseParam.getSearchEndTime())){
|
||||
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
||||
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
||||
}
|
||||
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.pq.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.device.pq.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.device.pqUser.service.IPqSensitiveUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/pqSensitiveUser")
|
||||
@Api(tags = "敏感负荷用户管理")
|
||||
@AllArgsConstructor
|
||||
public class PqSensitiveUserController extends BaseController {
|
||||
|
||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation("获取敏感负荷用户列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSensitiveUserVo>> getList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
Page<PqSensitiveUserVo> page = pqSensitiveUserService.getList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getListByIds")
|
||||
@ApiOperation("根据id集合获取敏感负荷用户列表")
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getListByIds");
|
||||
List<PqSensitiveUser> list;
|
||||
list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>().in(PqSensitiveUser::getId, ids)
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增用户对象")
|
||||
public HttpResult<Boolean> save(@RequestBody @Validated PqSensitiveUserParam pqSensitiveUserParam) {
|
||||
String methodDescribe = getMethodDescribe("save");
|
||||
pqSensitiveUserService.save(pqSensitiveUserParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改用户对象")
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
pqSensitiveUserService.update(pqSensitiveUserParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除用户对象")
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
pqSensitiveUserService.removeByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,17 @@ public class RunManageController extends BaseController {
|
||||
|
||||
private final RunManageService runManageService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineLedgerComm")
|
||||
@ApiOperation("监测点台账信息")
|
||||
@ApiImplicitParam(name = "runManageParam", value = "监测点台账参数", required = true)
|
||||
public HttpResult<Page<RunManageVO>> getLineLedgerComm(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
String methodDescribe = getMethodDescribe("getLineLedgerComm");
|
||||
Page<RunManageVO> res = runManageService.getLineLedgerComm(runManageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineLedger")
|
||||
@ApiOperation("监测点台账信息")
|
||||
@@ -54,18 +65,18 @@ public class RunManageController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRuntimeData")
|
||||
@ApiOperation("终端台账信息")
|
||||
@ApiOperation("终端台账信息(通用)")
|
||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
||||
public HttpResult<List<RunTimeVO>> getRuntimeData(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
public HttpResult<Page<RunTimeVO>> getRuntimeData(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||
List<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
||||
Page<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDeviceLedger")
|
||||
@ApiOperation("获取基本的终端台账信息")
|
||||
@ApiOperation("获取基本的终端台账信息(冀北)")
|
||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
||||
public HttpResult<Page<RunTimeVO>> getDeviceLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
STATUS = 1
|
||||
</select>
|
||||
<select id="sortTransformer" resultType="java.lang.Integer">
|
||||
select IFNULL(max(pqs_transformer.sort),0) from pqs_transformer order by update_time desc
|
||||
select IFNULL(max(pqs_transformer.sort),0) from pqs_transformer
|
||||
<!-- order by update_time desc-->
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
@@ -10,7 +9,6 @@ import com.njcn.device.pq.pojo.vo.dataClean.PowerQualityIndicatorsVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -22,19 +20,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IDataVerifyService extends IService<DataVerify> {
|
||||
|
||||
|
||||
VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
List<PowerQualityIndicatorsVO> getMonitorLimitDataDay(MonitorBaseParam monitorBaseParam);
|
||||
@@ -43,6 +28,5 @@ public interface IDataVerifyService extends IService<DataVerify> {
|
||||
|
||||
DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.util.List;
|
||||
* @date 2022/3/30
|
||||
*/
|
||||
public interface RunManageService {
|
||||
|
||||
Page<RunManageVO> getLineLedgerComm(RunManageParam runManageParam);
|
||||
|
||||
/**
|
||||
* 获取监测点台账信息
|
||||
* @param runManageParam 参数
|
||||
@@ -27,7 +30,7 @@ public interface RunManageService {
|
||||
* @param runManageParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
||||
Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
||||
|
||||
|
||||
Page<RunTimeVO> getDeviceLedger(RunManageParam runManageParam);
|
||||
|
||||
@@ -31,13 +31,11 @@ import com.njcn.device.pq.mapper.DataVerifyMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IDataVerifyService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -51,7 +49,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -76,7 +73,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
private final CommTerminalService commTerminalService;
|
||||
private final LineMapper lineMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
||||
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||
@@ -86,121 +82,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
if (CollUtil.isEmpty(monitorIds)) {
|
||||
throw new BusinessException(DeviceResponseEnum.QUERY_LINE_DATA_EMPTY);
|
||||
}
|
||||
List<DataVerify> dataVerifyList = commQuery(monitorIds, monitorBaseParam);
|
||||
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
|
||||
verifyMonitorVO.setRunNum(monitorIds.size());
|
||||
verifyMonitorVO.setAbnormalNum(dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getLineId)).size());
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, dataVerifyList));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(dataVerifyList, monitorBaseParam));
|
||||
return verifyMonitorVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
List<DataVerify> dataVerifyList = commQuery(monitorIds, monitorBaseParam);
|
||||
return getAbnormalTable(dataVerifyList, monitorBaseParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam) {
|
||||
List<DetailAbnormalVO> result = new ArrayList<>();
|
||||
List<LineDevGetDTO> lineDetailList = lineMapper.getMonitorListDetail(monitorBaseParam.getMonitorIds());
|
||||
Map<String, LineDevGetDTO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, Function.identity()));
|
||||
|
||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
String[] target = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, target[0]).eq(DataVerify::getIndexTable, target[1]);
|
||||
}
|
||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
Map<String, List<DataVerify>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(it -> it.getTime().format(DATE_FORMAT)));
|
||||
dataMap.forEach((dateStr, data) -> {
|
||||
Map<String, List<DataVerify>> lineMap = data.stream().collect(Collectors.groupingBy(DataVerify::getLineId));
|
||||
lineMap.forEach((lineId, lineList) -> {
|
||||
long count = lineList.stream().map(DataVerify::getTime).distinct().count();
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
LineDevGetDTO lineDevGetDTO = lineDetailMap.get(lineId);
|
||||
detailAbnormalVO.setTimeSum("");
|
||||
detailAbnormalVO.setDate(dateStr);
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getPointName());
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getPointId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
|
||||
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
|
||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
String[] queryTarget = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, queryTarget[0]).eq(DataVerify::getIndexTable, queryTarget[1]);
|
||||
}
|
||||
|
||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
Map<LocalDateTime, List<DataVerify>> listMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getTime, TreeMap::new,
|
||||
Collectors.toList()));
|
||||
listMap.forEach((time, timeList) -> {
|
||||
Map<String, List<DataVerify>> indexMap = timeList.stream().collect(Collectors.groupingBy(it -> it.getIndexCode() + SEPARATOR + it.getIndexTable() + SEPARATOR + it.getIndexName()));
|
||||
indexMap.forEach((target, list) -> {
|
||||
String[] temKey = target.split(SEPARATOR);
|
||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(temKey[0] + SEPARATOR + temKey[1]);
|
||||
String unit;
|
||||
if (StrUtil.isNotBlank(pqReasonableRangeDto.getUnit())) {
|
||||
unit = pqReasonableRangeDto.getUnit();
|
||||
} else {
|
||||
unit = "";
|
||||
}
|
||||
|
||||
Map<String, List<DataVerify>> phaseMap = list.stream().collect(Collectors.groupingBy(DataVerify::getPhasicType));
|
||||
phaseMap.forEach((phaseKey, valueList) -> {
|
||||
DetailAbnormalVO.DetailAbnormalInnerVO vo = new DetailAbnormalVO.DetailAbnormalInnerVO();
|
||||
vo.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||
vo.setTargetName(temKey[2]);
|
||||
vo.setTargetKey(temKey[0] + temKey[1]);
|
||||
vo.setPhaseType(phaseKey);
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
valueList.forEach(it -> {
|
||||
switch (it.getValueType()) {
|
||||
case "AVG":
|
||||
vo.setAvg(it.getAbnormalValue().toString());
|
||||
break;
|
||||
case "MAX":
|
||||
vo.setMax(it.getAbnormalValue().toString());
|
||||
break;
|
||||
case "MIN":
|
||||
vo.setMin(it.getAbnormalValue().toString());
|
||||
break;
|
||||
case "CP95":
|
||||
vo.setCp95(it.getAbnormalValue().toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
result.add(vo);
|
||||
});
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
|
||||
@@ -29,10 +29,10 @@ import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.DeviceRunEvaluateService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyCountService;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -64,7 +64,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
private final RStatOnlinerateDMapper onLineRateDMapper;
|
||||
private final RStatIntegrityDMapper integrityDMapper;
|
||||
private final LineMapper lineMapper;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
private final DeptLineService deptLineService;
|
||||
private final GeneralDeviceService deviceService;
|
||||
private final OnLineRateMapper onLineRateMapper;
|
||||
@@ -523,7 +523,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
|
||||
|
||||
private Map<String, NewUserReportVO> getUserLedgerByObjIds(List<String> objIds) {
|
||||
List<NewUserReportVO> userReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
List<NewUserReportVO> userReportVOList = userLedgerService.getUserReportByIds(objIds);
|
||||
return userReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
@@ -28,8 +27,8 @@ import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
@@ -38,8 +37,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.Collator;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -59,18 +56,12 @@ import java.util.stream.Stream;
|
||||
public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataMapper, LineIntegrityDataVO> implements LineIntegrityDataService {
|
||||
|
||||
private final LineIntegrityDataMapper lineIntegrityDataMapper;
|
||||
|
||||
private final AlarmClient alarmClient;
|
||||
|
||||
private final GeneralDeviceService generalDeviceService;
|
||||
|
||||
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
/**
|
||||
* 监测点数据完整性
|
||||
@@ -88,7 +79,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||
if (lineIntegrityDataParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerService.selectUserList(new UserReportParam());
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
} else {
|
||||
userLedgerVOMap = new HashMap<>();
|
||||
@@ -101,12 +92,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if (CollectionUtil.isEmpty(alarmStrategyVos)) {
|
||||
throw new BusinessException(DeviceResponseEnum.QUERY_ALARMSTRATEGY_DATA_EMPTY);
|
||||
}
|
||||
List<AlarmStrategyVO> alarmAlgoDescribe = lineIntegrityDataMapper.getAlarmAlgoDescribe(alarmStrategyVos);
|
||||
Map<Integer, Integer> mapAlarm = alarmAlgoDescribe.stream().collect(Collectors.toMap(AlarmStrategyVO::getAlgoDescribe, AlarmStrategyVO::getIntegrityValue));
|
||||
|
||||
Map<String, Integer> mapA = alarmStrategyVos.stream().collect(Collectors.toMap(AlarmStrategyVO::getId, AlarmStrategyVO::getIntegrityValue));
|
||||
|
||||
|
||||
// 遍历集合
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -11,38 +12,49 @@ import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONTokener;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.WriteTable;
|
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.device.pq.utils.DataLineExcelUtil;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -51,6 +63,9 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.njcn.device.pq.utils.FixedDynamicExcelExport.exportExcelByDataSize;
|
||||
import static com.njcn.device.pq.utils.FixedDynamicExcelExport.writeCenterStyle;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@@ -70,9 +85,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
private final LineMapper lineMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final DeptLineService deptLineService;
|
||||
private final GeneralDeviceService deviceService;
|
||||
private final RStatIntegrityDMapper integrityDMapper;
|
||||
private final OnLineRateMapper onLineRateMapper;
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
@@ -178,6 +195,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
@Override
|
||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
if (CollectionUtils.isEmpty(monitorIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
||||
return getAbnormalTable(dataVerifyList, monitorBaseParam);
|
||||
}
|
||||
@@ -371,35 +391,226 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
@Override
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getDeptId())) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
monitorBaseParam.setMonitorIds(monitorIds);
|
||||
}
|
||||
List<DataVerifyExcel> dataVerifyExcels = this.baseMapper.selectDataVerifySum(monitorBaseParam);
|
||||
List<String> ids = dataVerifyExcels.stream().map(DataVerifyExcel::getLineId).collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> map = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
for (DataVerifyExcel dataVerifyExcel : dataVerifyExcels) {
|
||||
if (map.containsKey(dataVerifyExcel.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(dataVerifyExcel.getLineId());
|
||||
dataVerifyExcel.setCity(areaLineInfoVO.getGdName());
|
||||
dataVerifyExcel.setLineName(areaLineInfoVO.getLineName());
|
||||
dataVerifyExcel.setLoadType(areaLineInfoVO.getLoadType());
|
||||
dataVerifyExcel.setObjName(areaLineInfoVO.getObjName());
|
||||
dataVerifyExcel.setStationName(areaLineInfoVO.getSubName());
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
DeviceInfoParam param = new DeviceInfoParam();
|
||||
param.setDeptIndex(monitorBaseParam.getDeptId());
|
||||
param.setStatisticalType(new SimpleDTO());
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, Arrays.asList(0), Arrays.asList(1));
|
||||
List<String> lineIds = deviceInfo.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<String> devIds = deviceInfo.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> areaLineInfoVOList = lineMapper.getBaseLineInfoMonitorIdInfo(lineIds);
|
||||
List<LineInfoMonitorIdVO> monitorLine = areaLineInfoVOList.stream().filter(x -> StrUtil.isNotBlank(x.getMonitorId())).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> gridSide = areaLineInfoVOList.stream().filter(x -> x.getPowerFlag() == 0).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> nonGridSide = areaLineInfoVOList.stream().filter(x -> x.getPowerFlag() == 1).collect(Collectors.toList());
|
||||
|
||||
OnlineRateParam onlineRateParam = new OnlineRateParam();
|
||||
onlineRateParam.setIds(devIds);
|
||||
onlineRateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
onlineRateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
//完整率
|
||||
List<RStatIntegrityVO> integrityList = integrityDMapper.getLineIntegrityRateInfo(lineIds,
|
||||
monitorBaseParam.getSearchBeginTime(),
|
||||
monitorBaseParam.getSearchEndTime());
|
||||
//获取所有终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
|
||||
List<CityDataExcel> cityData1 = new ArrayList<>();
|
||||
List<CityDataExcel> cityData2 = new ArrayList<>();
|
||||
List<CityDataExcel> cityData3 = new ArrayList<>();
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
cityData1.add(addCityDataExcel(dto, monitorLine, onlineRateByDev, integrityList));
|
||||
cityData2.add(addCityDataExcel(dto, gridSide, onlineRateByDev, integrityList));
|
||||
cityData3.add(addCityDataExcel(dto, nonGridSide, onlineRateByDev, integrityList));
|
||||
}
|
||||
monitorBaseParam.setMonitorIds(lineIds);
|
||||
List<DataVerifyExcel> dataVerifyExcels = this.baseMapper.selectDataVerifySum(monitorBaseParam);
|
||||
Map<String, LineInfoMonitorIdVO> lineInfomap = areaLineInfoVOList.stream().collect(Collectors.toMap(LineInfoMonitorIdVO::getLineId, Function.identity()));
|
||||
for (DataVerifyExcel dataVerifyExcel : dataVerifyExcels) {
|
||||
if (lineInfomap.containsKey(dataVerifyExcel.getLineId())) {
|
||||
LineInfoMonitorIdVO areaLineInfoVO = lineInfomap.get(dataVerifyExcel.getLineId());
|
||||
dataVerifyExcel.setCity(areaLineInfoVO.getGdName());
|
||||
dataVerifyExcel.setLineName(areaLineInfoVO.getLineName());
|
||||
dataVerifyExcel.setLoadType(areaLineInfoVO.getLoadType());
|
||||
dataVerifyExcel.setObjName(areaLineInfoVO.getObjName());
|
||||
dataVerifyExcel.setStationName(areaLineInfoVO.getSubName());
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setPowerFlag(areaLineInfoVO.getPowerFlag() == 0 ? "电网侧" : "非电网侧");
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
}
|
||||
}
|
||||
dataVerifyExcels.sort(Comparator
|
||||
.comparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
.thenComparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName() + "_" + item.getDevName())
|
||||
);
|
||||
Map<String, List> map = exportExcelByDataSize(dataVerifyExcels);
|
||||
// 步骤5:导出Excel(含列宽设置)
|
||||
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
|
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(20))
|
||||
.registerWriteHandler(writeCenterStyle()).build();
|
||||
WriteSheet writeSheet0 = EasyExcel.writerSheet("监测点异常指标统计").build();
|
||||
WriteTable writeTable0 = EasyExcel.writerTable(0).needHead(Boolean.TRUE).head(map.get("head")).build();
|
||||
excelWriter.write(map.get("data"), writeSheet0, writeTable0);
|
||||
|
||||
Map<Integer, List<CityDataExcel>> cityData = new HashMap<>();
|
||||
cityData.put(1, cityData1);
|
||||
cityData.put(2, cityData2);
|
||||
cityData.put(3, cityData3);
|
||||
|
||||
Map<Integer, List<LineDataExcel>> lineData = new HashMap<>();
|
||||
addLineDataExcel(cityData1, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 1);
|
||||
addLineDataExcel(cityData2, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 2);
|
||||
addLineDataExcel(cityData3, areaLineInfoVOList, onlineRateByDev, integrityList, lineData, 3);
|
||||
|
||||
excelExtracted(excelWriter, "数据质量", new HashMap<>(), cityData, true);
|
||||
excelExtracted(excelWriter, "数据质量表格", lineData, new HashMap<>(), false);
|
||||
excelWriter.finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void addLineDataExcel(List<CityDataExcel> cityData1, List<LineInfoMonitorIdVO> areaLineInfoVOList, List<RStatOnlineRateVO> onlineRateByDev, List<RStatIntegrityVO> integrityList, Map<Integer, List<LineDataExcel>> lineData, Integer num) {
|
||||
List<LineDataExcel> lineDataExcels1 = new ArrayList<>();
|
||||
List<String> lineData1 = cityData1.stream().flatMap(x -> x.getAbnormalList().stream()).collect(Collectors.toList());
|
||||
List<LineInfoMonitorIdVO> lineInfoData1 = areaLineInfoVOList.stream().filter(x -> lineData1.contains(x.getLineId())).collect(Collectors.toList());
|
||||
LineDataExcel lineDataExcel;
|
||||
for (int i = 0; i < lineInfoData1.size(); i++) {
|
||||
LineInfoMonitorIdVO dto = lineInfoData1.get(i);
|
||||
lineDataExcel = new LineDataExcel();
|
||||
lineDataExcel.setLineNum(BigDecimal.valueOf((i + 1)));
|
||||
lineDataExcel.setLineName(dto.getLineName());
|
||||
lineDataExcel.setDeptName(dto.getDeviceName());
|
||||
lineDataExcel.setPowerSubstationName(dto.getPowerSubstationName());
|
||||
lineDataExcel.setObjName(dto.getObjName());
|
||||
lineDataExcel.setDeviceName(dto.getDeviceName());
|
||||
lineDataExcel.setIp(dto.getIp());
|
||||
lineDataExcel.setManufacturer(dto.getManufacturer());
|
||||
lineDataExcel.setOnlineRate(onLineRate(onlineRateByDev, Arrays.asList(dto.getDeviceId())));
|
||||
lineDataExcel.setIntegrity(integrity(integrityList, Arrays.asList(dto.getLineId())));
|
||||
if (num == 1) {
|
||||
lineDataExcel.setMonitorId(new BigDecimal(dto.getMonitorId()));
|
||||
}
|
||||
lineDataExcels1.add(lineDataExcel);
|
||||
}
|
||||
lineData.put(num, lineDataExcels1);
|
||||
}
|
||||
|
||||
|
||||
private CityDataExcel addCityDataExcel(GeneralDeviceDTO dto, List<LineInfoMonitorIdVO> monitorLine, List<RStatOnlineRateVO> onlineRateByDev, List<RStatIntegrityVO> integrityList) {
|
||||
CityDataExcel data = new CityDataExcel();
|
||||
List<String> monitorLineList = monitorLine.stream()
|
||||
.filter(x -> dto.getLineIndexes().contains(x.getLineId()))
|
||||
.map(LineInfoMonitorIdVO::getLineId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<String> devList = monitorLine.stream()
|
||||
.filter(x -> dto.getDeviceIndexes().contains(x.getDeviceId()))
|
||||
.map(LineInfoMonitorIdVO::getDeviceId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
data.setDeptName(dto.getName());
|
||||
data.setDeviceNum(BigDecimal.valueOf(devList.size()));
|
||||
data.setLineNum(BigDecimal.valueOf(monitorLineList.size()));
|
||||
data.setOnlineRate(onLineRate(onlineRateByDev, devList));
|
||||
data.setIntegrity(integrity(integrityList, monitorLineList));
|
||||
List<String> abnormalList = integrityList.stream()
|
||||
.filter(x -> ObjUtil.isNotNull(x.getIntegrityRate()))
|
||||
.filter(x -> x.getIntegrityRate().compareTo(BigDecimal.ZERO) == 0)
|
||||
.filter(x -> monitorLineList.contains(x.getLineIndex()))
|
||||
.map(RStatIntegrityVO::getLineIndex)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
data.setAbnormalNum(BigDecimal.valueOf(abnormalList.size()));
|
||||
data.setAbnormalList(abnormalList);
|
||||
return data;
|
||||
}
|
||||
|
||||
private BigDecimal integrity(List<RStatIntegrityVO> integrityList, List<String> lineIds) {
|
||||
//监测完整率
|
||||
List<RStatIntegrityVO> integrityDS = integrityList.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getDueTime).sum();
|
||||
if (dueTime == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(realTime * 100.0 / dueTime, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal onLineRate(List<RStatOnlineRateVO> onlineRateByDev, List<String> devIds) {
|
||||
//终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateDS = onlineRateByDev.stream().filter(x -> devIds.contains(x.getDevIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
|
||||
if ((onlineTime + offlineTime) == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void excelExtracted(ExcelWriter excelWriter, String sheetName, Map<Integer, List<LineDataExcel>> lineData, Map<Integer, List<CityDataExcel>> cityData, Boolean fly) {
|
||||
// 构建sheet页--表示不加表头
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).needHead(Boolean.FALSE).build();
|
||||
// 表头的数量
|
||||
int num = 0;
|
||||
Boolean first = false;
|
||||
// 模拟写5张表
|
||||
for (int i = 1; i < 4; i++) {
|
||||
String name = "";
|
||||
if (i == 1) {
|
||||
if (fly) {
|
||||
name = "一类监测点";
|
||||
} else {
|
||||
name = "冀北公司一类监测点数据质量问题";
|
||||
}
|
||||
first = true;
|
||||
}
|
||||
if (i == 2) {
|
||||
if (fly) {
|
||||
name = "电网侧";
|
||||
} else {
|
||||
name = "冀北公司电网侧监测点数据质量问题(不包含一类监测点)";
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
if (i == 3) {
|
||||
if (fly) {
|
||||
name = "非电网侧";
|
||||
} else {
|
||||
name = "冀北公司非电网侧问题监测点(不包含一类监测点)";
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
String finalName = name;
|
||||
List<List<String>> contentHeader;
|
||||
if (fly) {
|
||||
contentHeader = DataLineExcelUtil.cityHeader();
|
||||
} else {
|
||||
contentHeader = DataLineExcelUtil.lineHeader(first);
|
||||
}
|
||||
List<List<String>> nameHeader = contentHeader.stream().map(item -> Collections.singletonList(finalName)).collect(Collectors.toList());
|
||||
// 这里必须指定需要头,table 会继承sheet的配置,sheet配置了不需要,table 默认也是不需要
|
||||
// 创建一个表头
|
||||
WriteTable writeTable1 = EasyExcel.writerTable(num).needHead(Boolean.TRUE).head(nameHeader).build();
|
||||
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
|
||||
//创建数据
|
||||
WriteTable writeTable2 = EasyExcel.writerTable(num + 1).needHead(Boolean.TRUE).head(contentHeader).build();
|
||||
List<List<Object>> body;
|
||||
if (fly) {
|
||||
body = DataLineExcelUtil.cityBody(cityData.get(i));
|
||||
} else {
|
||||
body = DataLineExcelUtil.lineBody(lineData.get(i));
|
||||
}
|
||||
excelWriter.write(body, writeSheet, writeTable2);
|
||||
// 插入两次表头加2
|
||||
num = num + 2;
|
||||
}
|
||||
Set<String> excludeColumnFiledNames = new HashSet<>(1);
|
||||
excludeColumnFiledNames.add("lineId");
|
||||
dataVerifyExcels.sort(Comparator.comparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName()+"_"+item.getDevName())
|
||||
.thenComparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
);
|
||||
EasyExcel.write(response.getOutputStream(), DataVerifyExcel.class)
|
||||
.excludeColumnFiledNames(excludeColumnFiledNames).sheet("sheet")
|
||||
.doWrite(dataVerifyExcels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class PqsTflgployServiceImpl extends ServiceImpl<PqsTflgployMapper, PqsTf
|
||||
}
|
||||
|
||||
private void addList(TflgployParam param, PqsTflgploy tflgploy, boolean save, List<PqsTflgployass> info) {
|
||||
if(save){
|
||||
// if(save){
|
||||
List<String> tfIndexs = param.getTfIndexs();
|
||||
if(CollUtil.isNotEmpty(tfIndexs)){
|
||||
PqsTflgployass ass;
|
||||
@@ -129,7 +129,7 @@ public class PqsTflgployServiceImpl extends ServiceImpl<PqsTflgployMapper, PqsTf
|
||||
ass.setTfIndex(tfIndex);
|
||||
info.add(ass);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.njcn.device.pq.pojo.vo.RunManageVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalLedgerVO;
|
||||
import com.njcn.device.pq.service.RunManageService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -70,7 +70,34 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
|
||||
/**
|
||||
* 通用监测点台账,区别冀北版本的
|
||||
* @author cdf
|
||||
* @date 2026/3/22
|
||||
*/
|
||||
@Override
|
||||
public Page<RunManageVO> getLineLedgerComm(RunManageParam runManageParam) {
|
||||
Page<RunManageVO> pageResult = new Page<>(PageFactory.getPageNum(runManageParam),PageFactory.getPageSize(runManageParam));
|
||||
List<String> lineIndexes ;
|
||||
if(CollUtil.isNotEmpty(runManageParam.getIds())){
|
||||
lineIndexes =runManageParam.getIds();
|
||||
}else{
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
deviceInfoParam.setServerName("pqs-common");
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
}
|
||||
if(CollectionUtil.isEmpty(lineIndexes)){
|
||||
return pageResult;
|
||||
}
|
||||
pageResult = deviceMapper.getRunManageCommList(new Page<>(PageFactory.getPageNum(runManageParam),PageFactory.getPageSize(runManageParam)),lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||
@@ -86,10 +113,10 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
if(CollUtil.isNotEmpty(resultList)){
|
||||
List<String> objIds = resultList.stream().map(RunManageVO::getObjId).collect(Collectors.toList());
|
||||
Map<String,NewUserReportVO> runManageVOMap = userLedgerFeignClient.getUserReportByIds(objIds).getData().stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
||||
Map<String,NewUserReportVO> runManageVOMap = userLedgerService.getUserReportByIds(objIds).stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
||||
resultList.forEach(it->{
|
||||
if(StrUtil.isNotBlank(it.getObjId())){
|
||||
if(runManageVOMap.containsKey(it.getObjId())){
|
||||
@@ -103,34 +130,18 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
||||
List<RunTimeVO> runManageDevList = new ArrayList<>();
|
||||
public Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
deviceInfoParam.setServerName("pqs-common");
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
||||
|
||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
if (StrUtil.isNotBlank(runManageParam.getSearchBeginTime()) && StrUtil.isNotBlank(runManageParam.getSearchEndTime())) {
|
||||
runManageParam.setSearchBeginTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchBeginTime()))));
|
||||
runManageParam.setSearchEndTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchEndTime()))));
|
||||
}
|
||||
|
||||
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(devIndexes)) {
|
||||
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
||||
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVOList = deviceMapper.getOnlineEvaluate(devIndexes, runManageParam.getSearchBeginTime(), runManageParam.getSearchEndTime());
|
||||
Map<String, LineInfluxDbOnlineVO> map = lineInfluxDbOnlineVOList.stream().collect(Collectors.toMap(LineInfluxDbOnlineVO::getDevIndex, Function.identity()));
|
||||
runManageDevList = runManageDevList.stream().peek(item -> item.setOnlineEvaluate(!map.containsKey(item.getId()) ? 3.14159 : NumberUtil.round(map.get(item.getId()).getOnlineRate(), 4).doubleValue())).collect(Collectors.toList());
|
||||
String evaluate = runManageParam.getEvaluate();
|
||||
if (StrUtil.isNotBlank(evaluate)) {
|
||||
runManageDevList = runManageDevList.stream().filter(x -> filterOnlineEvaluate(evaluate, x.getOnlineEvaluate())).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtil.isEmpty(devIndexes)) {
|
||||
throw new BusinessException("当前部门没有装置台账");
|
||||
}
|
||||
}
|
||||
return runManageDevList;
|
||||
return deviceMapper.getRunManageDevList(new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam)),devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,14 +23,13 @@ import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.DeptLineTreeVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.device.pq.service.TerminalTreeService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -66,7 +65,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
private final TreeMapper treeMapper;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
/**
|
||||
* 台账页面终端树
|
||||
@@ -114,7 +113,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerService.selectUserList(userReportParam);
|
||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String, List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
|
||||
|
||||
@@ -194,13 +193,16 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
});
|
||||
|
||||
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
||||
if (Objects.isNull(userReportPO)) {
|
||||
System.out.println(map);
|
||||
}
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setName(userReportPO.getProjectName());
|
||||
terminalTree.setId(userReportPO.getId());
|
||||
terminalTree.setPid(userReportPO.getStationId());
|
||||
if (Objects.isNull(userReportPO)) {
|
||||
terminalTree.setName("用户对象缺失");
|
||||
terminalTree.setId(objId);
|
||||
terminalTree.setPid("");
|
||||
}else {
|
||||
terminalTree.setName(userReportPO.getProjectName());
|
||||
terminalTree.setId(userReportPO.getId());
|
||||
terminalTree.setPid(userReportPO.getStationId());
|
||||
}
|
||||
terminalTree.setPowerFlag(1);
|
||||
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
terminalTree.setChildren(temDevList);
|
||||
@@ -272,7 +274,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
} else {
|
||||
// 获取用户
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerService.selectUserList(userReportParam);
|
||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
|
||||
@@ -29,12 +29,7 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.text.StrBuilder;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -60,6 +61,7 @@ import com.njcn.device.pq.utils.DeviceUtil;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.utils.ExcelStyleUtil;
|
||||
import com.njcn.message.api.ProduceFeignClient;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
@@ -72,7 +74,6 @@ import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -96,10 +97,10 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -138,7 +139,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private final NodeDeviceService nodeDeviceService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
private final ProduceFeignClient produceFeignClient;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
@Value("${oracle.isSync}")
|
||||
private Boolean isSync;
|
||||
@@ -681,6 +682,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
BeanUtils.copyProperties(updateDeviceParam, deviceDetail);
|
||||
deviceDetail.setId(updateDeviceParam.getDevIndex());
|
||||
coderM3d(deviceDetail, true);
|
||||
deviceDetail.setLoginTime(LocalDate.parse(updateDeviceParam.getLoginTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
deviceDetail.setThisTimeCheck(LocalDate.parse(updateDeviceParam.getThisTimeCheck(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
deviceDetail.setNextTimeCheck(LocalDate.parse(updateDeviceParam.getNextTimeCheck(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
|
||||
this.updateById(device);
|
||||
deviceMapper.updateById(deviceDetail);
|
||||
@@ -881,11 +885,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private void coderM3d(Device deviceDetail, Boolean updateFlag) {
|
||||
if (updateFlag) {
|
||||
Device deviceRes = deviceMapper.selectById(deviceDetail.getId());
|
||||
if (StrUtil.isNotBlank(deviceDetail.getDevKey()) && !deviceRes.getDevKey().equals(deviceDetail.getDevKey())) {
|
||||
if (!Objects.equals(deviceRes.getDevKey(),deviceDetail.getDevKey())) {
|
||||
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD, deviceDetail.getDevKey()));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(deviceDetail.getSeries()) && !deviceRes.getSeries().equals(deviceDetail.getSeries())) {
|
||||
if (!Objects.equals(deviceRes.getSeries(),deviceDetail.getSeries())) {
|
||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||
}
|
||||
} else {
|
||||
@@ -896,7 +899,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void decoderM3d(Device deviceDetail) {
|
||||
@@ -984,7 +986,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
Line obj;
|
||||
if (level == 700) {
|
||||
obj = new Line();
|
||||
UserLedgerVO userLedgerVO = userLedgerFeignClient.selectUserInfo(id).getData();
|
||||
UserLedgerVO userLedgerVO = userLedgerService.selectUserInfo(id);
|
||||
if (Objects.nonNull(userLedgerVO)) {
|
||||
obj.setId(userLedgerVO.getId());
|
||||
obj.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
|
||||
@@ -198,7 +198,7 @@ public class DeviceController extends BaseController {
|
||||
@ApiOperation("修改装置通讯状态及时间")
|
||||
public HttpResult<Boolean> updateDevComFlag(@RequestBody DevComFlagDTO devComFlagDTO) {
|
||||
String methodDescribe = getMethodDescribe("updateDevComFlag");
|
||||
boolean update = iDeviceService.lambdaUpdate().set(Objects.nonNull(devComFlagDTO.getStatus()),Device::getComFlag,devComFlagDTO.getStatus() ).set(Device::getUpdateTime, devComFlagDTO.getDate()).eq(Device::getId, devComFlagDTO.getId()).update();
|
||||
boolean update = iDeviceService.lambdaUpdate().set(Objects.nonNull(devComFlagDTO.getStatus()),Device::getComFlag,devComFlagDTO.getStatus() ).set(Objects.nonNull(devComFlagDTO.getDate()),Device::getUpdateTime, devComFlagDTO.getDate()).eq(Device::getId, devComFlagDTO.getId()).update();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, update, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,19 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||
List<Device> getDeviceBySubId(@Param("subId") String subId,@Param("ip") String ip,@Param("port") Integer port,@Param("devId")String devId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取监测点台账信息
|
||||
* @param list 监测点集合
|
||||
* @param comFlag 状态
|
||||
* @param searchValue
|
||||
* @return 结果
|
||||
*/
|
||||
Page<RunManageVO> getRunManageCommList(@Param("page")Page<RunTimeVO> page,
|
||||
@Param("list") List<String> list,
|
||||
@Param("comFlag") List<Integer> comFlag,
|
||||
@Param("runFlag") List<Integer> runFlag,
|
||||
@Param("searchValue") String searchValue);
|
||||
|
||||
/**
|
||||
* 获取监测点台账信息
|
||||
* @param list 监测点集合
|
||||
@@ -57,7 +70,8 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||
* @param searchValue
|
||||
* @return 结果
|
||||
*/
|
||||
List<RunTimeVO> getRunManageDevList(@Param("list") List<String> list,
|
||||
Page<RunTimeVO> getRunManageDevList(@Param("page")Page<RunTimeVO> page,
|
||||
@Param("list") List<String> list,
|
||||
@Param("comFlag") List<Integer> comFlag,
|
||||
@Param("runFlag") List<Integer> runFlag,
|
||||
@Param("manufacturers") List<String> manufacturer,
|
||||
|
||||
@@ -16,6 +16,128 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRunManageCommList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||
SELECT
|
||||
linedetail.Num AS id,
|
||||
line.NAME AS lineName,
|
||||
area.NAME AS areaName,
|
||||
gd.NAME AS gdName,
|
||||
sub.NAME AS bdName,
|
||||
scaleId.Name as scale,
|
||||
manufacturerId.name as manufacturer,
|
||||
dev.name as devName,
|
||||
device.IP as ip,
|
||||
case linedetail.Run_Flag
|
||||
when 0 then '投运'
|
||||
when 1 then '检修'
|
||||
when 2 then '停运'
|
||||
when 3 then '调试'
|
||||
when 4 then '退运'
|
||||
end as runFlag,
|
||||
case device.Com_Flag
|
||||
when 0 then '中断'
|
||||
when 1 then '正常'
|
||||
end as comFlag,
|
||||
loadtypeId.Name as loadType,
|
||||
businesstypeId.name as businessType,
|
||||
IFNULL(obj.project_name,'/') as objName,
|
||||
case linedetail.PT_Type
|
||||
when 0 then '星型接线'
|
||||
when 1 then '三角型接线'
|
||||
when 2 then '开口三角型接线'
|
||||
end as ptType,
|
||||
CONCAT(linedetail.PT1,'/', linedetail.PT2) as pt,
|
||||
CONCAT(linedetail.CT1,'/', linedetail.CT2) as ct,
|
||||
linedetail.Standard_Capacity as standardCapacity,
|
||||
linedetail.Short_Capacity as shortCapacity,
|
||||
linedetail.Dev_Capacity as devCapacity,
|
||||
linedetail.Deal_Capacity as dealCapacity,
|
||||
overlimit.Freq_Dev as freqDev,
|
||||
overlimit.Voltage_Dev as voltageDev,
|
||||
overlimit.Uvoltage_Dev as uvoltageDev,
|
||||
overlimit.Ubalance as ubalance,
|
||||
overlimit.I_Neg as iNeg,
|
||||
overlimit.Flicker as flicker,
|
||||
overlimit.Uaberrance as uaberrance,
|
||||
overlimit.Uharm_3 as oddHarm,
|
||||
overlimit.Uharm_2 as evenHarm,
|
||||
overlimit.Iharm_2 as iharm2,
|
||||
overlimit.Iharm_3 as iharm3,
|
||||
overlimit.Iharm_4 as iharm4,
|
||||
overlimit.Iharm_5 as iharm5,
|
||||
overlimit.Iharm_6 as iharm6,
|
||||
overlimit.Iharm_7 as iharm7,
|
||||
overlimit.Iharm_8 as iharm8,
|
||||
overlimit.Iharm_9 as iharm9,
|
||||
overlimit.Iharm_10 as iharm10,
|
||||
overlimit.Iharm_11 as iharm11,
|
||||
overlimit.Iharm_12 as iharm12,
|
||||
overlimit.Iharm_13 as iharm13,
|
||||
overlimit.Iharm_14 as iharm14,
|
||||
overlimit.Iharm_15 as iharm15,
|
||||
overlimit.Iharm_16 as iharm16,
|
||||
overlimit.Iharm_17 as iharm17,
|
||||
overlimit.Iharm_18 as iharm18,
|
||||
overlimit.Iharm_19 as iharm19,
|
||||
overlimit.Iharm_20 as iharm20,
|
||||
overlimit.Iharm_21 as iharm21,
|
||||
overlimit.Iharm_22 as iharm22,
|
||||
overlimit.Iharm_23 as iharm23,
|
||||
overlimit.Iharm_24 as iharm24,
|
||||
overlimit.Iharm_25 as iharm25,
|
||||
overlimit.InUharm_1 as inUharm,
|
||||
overlimit.InUharm_16 as inUharm16
|
||||
FROM pq_line line
|
||||
inner join pq_line_detail detail on line.id = detail.id
|
||||
left join supervision_user_report obj on obj.id = detail.obj_id
|
||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
||||
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
||||
INNER JOIN pq_overlimit overlimit ON overlimit.Id = line.Id
|
||||
INNER JOIN pq_voltage voltage ON voltage.Id = vol.Id
|
||||
INNER JOIN sys_dict_data scaleId ON scaleId.Id = voltage.Scale
|
||||
INNER JOIN pq_device device ON device.Id = dev.Id
|
||||
INNER JOIN sys_dict_data manufacturerId ON manufacturerId.Id = device.Manufacturer
|
||||
INNER JOIN pq_line_detail linedetail ON linedetail.Id = line.Id
|
||||
INNER JOIN sys_dict_data loadtypeId ON loadtypeId.Id = linedetail.Load_Type
|
||||
INNER JOIN sys_dict_data businesstypeId ON businesstypeId.Id = linedetail.Business_Type
|
||||
WHERE line.Id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="comFlag.size()!=0">
|
||||
and device.Com_Flag in
|
||||
<foreach item="item2" collection="comFlag" open="(" separator="," close=")">
|
||||
#{item2}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="runFlag.size()!=0">
|
||||
and linedetail.run_Flag in
|
||||
<foreach item="item" collection="runFlag" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="searchValue != '' and searchValue != null ">
|
||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||
AND (sub.NAME LIKE #{searchValueLike}
|
||||
OR dev.name LIKE #{searchValueLike}
|
||||
OR line.NAME LIKE #{searchValueLike}
|
||||
OR loadtypeId.Name LIKE #{searchValueLike}
|
||||
OR manufacturerId.name LIKE #{searchValueLike}
|
||||
OR obj.project_name LIKE #{searchValueLike}
|
||||
)
|
||||
</if>
|
||||
ORDER BY
|
||||
gdName,
|
||||
bdName,
|
||||
devNAME,
|
||||
objName
|
||||
</select>
|
||||
|
||||
<select id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||
SELECT
|
||||
linedetail.Num AS id,
|
||||
@@ -137,10 +259,12 @@
|
||||
|
||||
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
||||
SELECT
|
||||
DISTINCT
|
||||
dev.Id AS id,
|
||||
area.NAME AS areaName,
|
||||
gd.NAME AS gdName,
|
||||
sub.NAME AS bdName,
|
||||
obj.project_name objName,
|
||||
manufacturerId.NAME AS manufacturer,
|
||||
dev.NAME AS devName,
|
||||
device.IP AS ip,
|
||||
@@ -152,7 +276,7 @@
|
||||
WHEN 0 THEN
|
||||
'投运'
|
||||
WHEN 1 THEN
|
||||
'热备用'
|
||||
'检修'
|
||||
WHEN 2 THEN
|
||||
'停运'
|
||||
END AS runFlag,
|
||||
@@ -165,8 +289,12 @@
|
||||
END AS comFlag,
|
||||
device.Update_Time AS updateTime
|
||||
FROM
|
||||
pq_line dev
|
||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||
pq_line line
|
||||
left join pq_line_detail detail on line.id = detail.id
|
||||
left join supervision_user_report obj on obj.id = detail.obj_id
|
||||
inner join pq_line busBar on line.pid = busBar.id
|
||||
inner join pq_line dev on busBar.pid = dev.id
|
||||
INNER JOIN pq_line sub ON sub.id = dev.Pid
|
||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
||||
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
||||
@@ -197,10 +325,13 @@
|
||||
</if>
|
||||
<if test="searchValue != '' and searchValue != null ">
|
||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||
AND sub.NAME LIKE #{searchValueLike}
|
||||
AND
|
||||
(sub.NAME LIKE #{searchValueLike}
|
||||
OR dev.NAME LIKE #{searchValueLike}
|
||||
OR devT.Name LIKE #{searchValueLike}
|
||||
OR device.IP LIKE #{searchValueLike}
|
||||
OR obj.project_name LIKE #{searchValueLike}
|
||||
)
|
||||
</if>
|
||||
ORDER BY
|
||||
gdName,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.njcn.device.device.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.device.service.DeviceProcessService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
@@ -28,10 +30,7 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -73,31 +72,59 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
|
||||
Integer nodeDevNum = node.getNodeDevNum();
|
||||
Integer maxProcessNum = node.getMaxProcessNum();
|
||||
List<Device> list = iDeviceService.lambdaQuery().eq(Device::getNodeId, nodeId).list();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(PvDeviceResponseEnum.NO_DEVICE);
|
||||
|
||||
}
|
||||
List<String> deviceIdList = list.stream().map(Device::getId).collect(Collectors.toList());
|
||||
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
|
||||
Integer devNum = list.size();
|
||||
if(nodeDevNum<devNum){
|
||||
if(nodeDevNum<list.size()){
|
||||
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
|
||||
}
|
||||
//单个进程支持最大装置数
|
||||
int maxDevNum = nodeDevNum / maxProcessNum;
|
||||
|
||||
List<List<DeviceProcess>> partition = ListUtils.partition(deviceProcessList, maxProcessNum);
|
||||
for (int i = 0; i < partition.size(); i++) {
|
||||
int processNo = i+1;
|
||||
partition.get(i).forEach(temp->{
|
||||
temp.setProcessNo(processNo);
|
||||
});
|
||||
List<String> deviceIdList = list.stream().map(Device::getId).collect(Collectors.toList());
|
||||
List<DeviceProcess> existingProcesses = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
|
||||
if(existingProcesses.size() >= nodeDevNum){
|
||||
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
|
||||
}
|
||||
List<String> hasProcess = existingProcesses.stream().map(DeviceProcess::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
//过滤掉已经分配的装置
|
||||
List<String> needDevice = deviceIdList.stream().filter(it->!hasProcess.contains(it)).collect(Collectors.toList());
|
||||
// 无待分配设备直接抛出异常(保留你的原判断)
|
||||
if (CollUtil.isEmpty(needDevice)) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "不存在未分配的进程的装置");
|
||||
}
|
||||
//单个进程支持最大装置数
|
||||
int maxDevNumPerProcess = (int) Math.ceil((double) nodeDevNum / maxProcessNum);
|
||||
Map<Integer, Long> mapCount = existingProcesses.stream().collect(Collectors.groupingBy(DeviceProcess::getProcessNo,Collectors.counting()));
|
||||
List<DeviceProcess> poList = new ArrayList<>();
|
||||
Iterator<String> deviceIterator = needDevice.iterator();
|
||||
|
||||
for (int processNo = 1; processNo <= maxProcessNum && deviceIterator.hasNext(); processNo++) {
|
||||
Long usedCount = mapCount.getOrDefault(processNo, 0L);
|
||||
int remainingCapacity = (int) (maxDevNumPerProcess - usedCount);
|
||||
|
||||
if (remainingCapacity <= 0) {
|
||||
continue;
|
||||
}
|
||||
// 分配设备给当前进程
|
||||
for (int i = 0; i < remainingCapacity && deviceIterator.hasNext(); i++) {
|
||||
String deviceId = deviceIterator.next();
|
||||
DeviceProcess deviceProcess = buildDeviceProcess(deviceId, processNo);
|
||||
poList.add(deviceProcess);
|
||||
}
|
||||
}
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"不存在可以分配的进程或装置");
|
||||
}
|
||||
List<DeviceProcess> collect = partition.stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
|
||||
//更新进程号
|
||||
deviceProcessService.updateBatchById(collect);
|
||||
deviceProcessService.saveBatch(poList,100);
|
||||
}
|
||||
|
||||
|
||||
private DeviceProcess buildDeviceProcess(String deviceId, Integer processNo) {
|
||||
DeviceProcess deviceProcess = new DeviceProcess();
|
||||
deviceProcess.setId(deviceId); // 核心修复:设置设备关联字段,而非主键id
|
||||
deviceProcess.setProcessNo(processNo);
|
||||
return deviceProcess;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TerminalVersionServiceImpl implements TerminalVersionService {
|
||||
|
||||
List<TerminalVersionVO> devList = terminalVersionMapper.getTerminalVersionInfo(terminalMainQueryParam);
|
||||
if(CollectionUtil.isEmpty(devList)){
|
||||
throw new BusinessException(DeviceResponseEnum.DEVICE_EMPTY);
|
||||
return devList;
|
||||
}
|
||||
List<String> subIndexes = devList.stream().map(TerminalVersionVO::getPid).collect(Collectors.toList());
|
||||
List<TerminalVersionVO> subList =terminalVersionMapper.getPqLineGdAndSubList(subIndexes);
|
||||
|
||||
@@ -216,6 +216,8 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
*/
|
||||
List<AreaLineInfoVO> getBaseLineAreaInfo(@Param("list") List<String> lineIndex, @Param("searchValue") String searchValue, @Param("comFlag") Integer comFlag);
|
||||
|
||||
List<LineInfoMonitorIdVO> getBaseLineInfoMonitorIdInfo(@Param("list") List<String> lineIndex);
|
||||
|
||||
/**
|
||||
* 返回监测点信息及通讯状态
|
||||
*
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
a.name lineName,
|
||||
c.Time_Interval,
|
||||
d.Scale AS scale,
|
||||
c.Obj_Id obyId,
|
||||
c.Obj_Id objId,
|
||||
c.Big_Obj_Type bigObjType
|
||||
from pq_line a
|
||||
inner join pq_line b on a.pid = b.id
|
||||
|
||||
@@ -557,12 +557,13 @@
|
||||
detail.ct2,
|
||||
detail.pt1,
|
||||
detail.pt2,
|
||||
detail.PT_Type as ptType,
|
||||
detail.obj_name,
|
||||
detail.Dev_Capacity deviceCapacity,
|
||||
detail.Short_Capacity,
|
||||
detail.Standard_Capacity,
|
||||
detail.Deal_Capacity,
|
||||
detail.Business_Type,
|
||||
detail.Business_Type businessType,
|
||||
detail.Calssification_Grade,
|
||||
detail.Superiors_Substation,
|
||||
detail.Hang_Line,
|
||||
@@ -1269,7 +1270,8 @@
|
||||
SELECT
|
||||
voltage.id as id,
|
||||
sub.id as pid,
|
||||
concat( sub.NAME, " ", voltage.NAME ) as name,
|
||||
<!-- 兼容国产数据库-->
|
||||
concat( sub.NAME, ' ', voltage.NAME ) as name,
|
||||
voltage.Sort as sort
|
||||
FROM
|
||||
pq_line voltage
|
||||
@@ -1511,17 +1513,9 @@
|
||||
<select id="getCustomDetailByLineId" resultType="map">
|
||||
SELECT
|
||||
line.id AS lineId,
|
||||
CONCAT(sub.NAME, '_', vo.NAME, '_', line.NAME) AS lineName,
|
||||
CONCAT(
|
||||
IFNULL(CAST(detail.pt1 AS CHAR), 'N/A'),
|
||||
':',
|
||||
IFNULL(CAST(detail.pt2 AS CHAR), 'N/A')
|
||||
) AS pt,
|
||||
CONCAT(
|
||||
IFNULL(CAST(detail.ct1 AS CHAR), 'N/A'),
|
||||
':',
|
||||
IFNULL(CAST(detail.ct2 AS CHAR), 'N/A')
|
||||
) AS ct,
|
||||
CONCAT(CONCAT(CONCAT(sub.NAME, '_'), vo.NAME), CONCAT('_', line.NAME)) AS lineName,
|
||||
CONCAT(CONCAT(COALESCE(detail.pt1, 'N/A'), ':'), COALESCE(detail.pt2, 'N/A')) AS pt,
|
||||
CONCAT(CONCAT(COALESCE(detail.ct1, 'N/A'), ':'), COALESCE(detail.ct2, 'N/A')) AS ct,
|
||||
detail.Dev_Capacity AS Dev_Capacity,
|
||||
detail.Short_Capacity AS Short_Capacity,
|
||||
detail.Standard_Capacity AS Standard_Capacity,
|
||||
@@ -1540,6 +1534,7 @@
|
||||
WHERE
|
||||
line.id = #{lineId}
|
||||
</select>
|
||||
|
||||
<select id="selectByIds" resultType="com.njcn.device.pq.pojo.vo.LineDetailVO$Detail">
|
||||
SELECT DISTINCT
|
||||
line.id as lineId,
|
||||
@@ -1948,5 +1943,83 @@
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
<select id="getBaseLineInfoMonitorIdInfo" resultType="com.njcn.device.pq.pojo.vo.LineInfoMonitorIdVO">
|
||||
SELECT
|
||||
line.Id lineId,
|
||||
line.Name lineName,
|
||||
gd.Name gdName,
|
||||
substation.id subId,
|
||||
substation.Name subName,
|
||||
subscale.name subScale,
|
||||
device.id deviceId,
|
||||
device.name deviceName,
|
||||
pqdevice.IP ip,
|
||||
factory.Name manufacturer,
|
||||
voltage.id voltageId,
|
||||
voltage.Name voltageName,
|
||||
scale.Name voltageScale,
|
||||
pqdevice.run_flag,
|
||||
pqdevice.com_flag,
|
||||
pqsubstation.Lng,
|
||||
pqsubstation.lat,
|
||||
detail.num,
|
||||
detail.ct1,
|
||||
detail.ct2,
|
||||
detail.pt1,
|
||||
detail.pt2,
|
||||
detail.obj_name,
|
||||
detail.Dev_Capacity deviceCapacity,
|
||||
detail.Short_Capacity,
|
||||
detail.Standard_Capacity,
|
||||
detail.Deal_Capacity,
|
||||
detail.Business_Type businessType,
|
||||
detail.Calssification_Grade,
|
||||
detail.Superiors_Substation,
|
||||
detail.Hang_Line,
|
||||
loadtype.name loadType,
|
||||
detail.New_Station_Id as newStationId,
|
||||
detail.obj_id,
|
||||
detail.big_obj_type,
|
||||
detail.small_obj_type,
|
||||
detail.Power_Flag powerFlag,
|
||||
detail.Power_Substation_Name powerSubstationName,
|
||||
detail.Monitor_Id monitorId
|
||||
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
pq_line voltage,
|
||||
pq_voltage pqvoltage,
|
||||
pq_line device,
|
||||
pq_device pqdevice,
|
||||
pq_line substation,
|
||||
pq_substation pqsubstation,
|
||||
pq_line gd,
|
||||
sys_dict_data scale,
|
||||
sys_dict_data factory,
|
||||
sys_dict_data loadtype,
|
||||
sys_dict_data subscale
|
||||
WHERE
|
||||
line.id = detail.id
|
||||
AND line.pid = voltage.id
|
||||
AND voltage.id = pqvoltage.id
|
||||
AND pqvoltage.Scale = scale.id
|
||||
AND voltage.pid = device.id
|
||||
AND voltage.pid = pqdevice.id
|
||||
AND pqdevice.Manufacturer = factory.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.id = pqsubstation.id
|
||||
AND pqsubstation.scale = subscale.id
|
||||
AND substation.pid = gd.id
|
||||
AND detail.load_type = loadtype.id
|
||||
<if test="list !=null and list.size() >0">
|
||||
AND line.Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
@@ -27,7 +27,6 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -52,7 +51,7 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
private final LineMapper lineMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final LineDetailMapper detailMapper;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -251,7 +250,7 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objIds)){
|
||||
List<NewUserReportVO> data = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
List<NewUserReportVO> data = userLedgerService.getUserReportByIds(objIds);
|
||||
Map<String, String> userMap = data.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getProjectName));
|
||||
for (DevDetailVO lineDeviceByDevId : lineDeviceByDevIds) {
|
||||
if(StrUtil.isNotBlank(lineDeviceByDevId.getObjId())){
|
||||
|
||||
@@ -39,11 +39,11 @@ import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.TerminalMaintainMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -106,8 +106,10 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
private final TerminalMaintainMapper terminalMaintainMapper;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final DeptLineService deptLineService;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
private final PqDevTypeService pqDevTypeService;
|
||||
|
||||
|
||||
@Override
|
||||
public LineDetailDataVO getLineDetailData(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
@@ -744,7 +746,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
List<String> objIds = userLedgerList.stream().map(LineDetail::getObjId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> newUserReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
List<NewUserReportVO> newUserReportVOList = userLedgerService.getUserReportByIds(objIds);
|
||||
Map<String, NewUserReportVO> map = newUserReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
@@ -892,7 +894,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<String> userIds = resList.stream().map(AreaLineInfoVO::getObjId).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
Map<String, NewUserReportVO> userReportVOMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
List<NewUserReportVO> data = userLedgerFeignClient.getUserReportByIds(userIds).getData();
|
||||
List<NewUserReportVO> data = userLedgerService.getUserReportByIds(userIds);
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
userReportVOMap = data.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.pqUser.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.pq.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.device.pq.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
|
||||
|
||||
Page<PqSensitiveUserVo> getList(BaseParam param);
|
||||
|
||||
boolean save(PqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.njcn.device.pqUser.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
|
||||
import com.njcn.device.biz.mapper.PqSensitiveUserMapper;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.pq.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.device.pq.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.device.pqUser.service.IPqSensitiveUserService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMapper, PqSensitiveUser> implements IPqSensitiveUserService {
|
||||
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
||||
Page<PqSensitiveUserVo> result = new Page<>(param.getPageNum(),param.getPageSize());
|
||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.orderByDesc(PqSensitiveUser::getSort);
|
||||
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||
lambdaQueryWrapper.like(PqSensitiveUser::getName, param.getSearchValue());
|
||||
}
|
||||
Page<PqSensitiveUser> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||
List<PqSensitiveUserVo> dataGroupEventVOList = new ArrayList<>();
|
||||
page.getRecords().forEach(item->{
|
||||
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||
BeanUtil.copyProperties(item,vo);
|
||||
dataGroupEventVOList.add(vo);
|
||||
});
|
||||
result.setRecords(dataGroupEventVOList);
|
||||
result.setTotal(page.getTotal());
|
||||
result.setSize(page.getSize());
|
||||
result.setCurrent(page.getCurrent());
|
||||
result.setPages(page.getPages());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(PqSensitiveUserParam pqSensitiveUserParam) {
|
||||
checkParam(pqSensitiveUserParam,false);
|
||||
|
||||
PqSensitiveUser pqSensitiveUser = new PqSensitiveUser();
|
||||
BeanUtil.copyProperties(pqSensitiveUserParam,pqSensitiveUser);
|
||||
return this.save(pqSensitiveUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam) {
|
||||
checkParam(pqSensitiveUserParam,true);
|
||||
PqSensitiveUser pqSensitiveUser = new PqSensitiveUser();
|
||||
BeanUtil.copyProperties(pqSensitiveUserParam,pqSensitiveUser);
|
||||
return this.updateById(pqSensitiveUser);
|
||||
}
|
||||
|
||||
|
||||
private void checkParam(PqSensitiveUserParam param,boolean update){
|
||||
DictData data = dicDataFeignClient.getDicDataById(param.getLoadType()).getData();
|
||||
if(Objects.isNull(data)){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"字典负荷类型缺失!");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PqSensitiveUser::getName,param.getName());
|
||||
if(update){
|
||||
if(param instanceof PqSensitiveUserParam.UpdatePqSensitiveUserParam){
|
||||
lambdaQueryWrapper.ne(PqSensitiveUser::getId,((PqSensitiveUserParam.UpdatePqSensitiveUserParam) param).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(lambdaQueryWrapper);
|
||||
if(count>0){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"用户名称重复!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -148,7 +148,7 @@
|
||||
|
||||
<select id="getMonthFlow" resultType="com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO">
|
||||
select t.*,
|
||||
(t.statisValue)/t.flowMeal flowProportion
|
||||
(t.statisValue / t.flowMeal) as flowProportion
|
||||
from (
|
||||
SELECT
|
||||
a.id id,
|
||||
@@ -158,8 +158,6 @@
|
||||
gd.name electricPowerCompany,
|
||||
b.IP DeviceIP,
|
||||
b.id deviceId,
|
||||
-- ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
|
||||
-- ifnull(convert(m.Actual_Value/1024/1024,decimal(7,2)),0) statisValue
|
||||
COALESCE(d.flow, (SELECT flow FROM cld_flow_meal WHERE type = 0 AND flag = 1)) + COALESCE(d1.flow, 0) AS flowMeal,
|
||||
COALESCE(CAST(m.Actual_Value / 1024 / 1024 AS DECIMAL(7, 2)), 0) AS statisValue
|
||||
FROM pq_line a
|
||||
@@ -170,16 +168,20 @@
|
||||
LEFT JOIN cld_dev_meal c ON b.id = c.line_id
|
||||
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
|
||||
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
|
||||
WHERE a.id IN
|
||||
<where>
|
||||
a.id IN
|
||||
<foreach item="item" collection="devs" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND
|
||||
m.Time_Id between #{startTime} and #{endTime}
|
||||
AND
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND
|
||||
m.Time_Id between #{startTime} and #{endTime}
|
||||
</if>
|
||||
AND
|
||||
b.Run_Flag != 2
|
||||
</where>
|
||||
) t
|
||||
ORDER BY flowProportion DESC
|
||||
ORDER BY flowProportion DESC ;
|
||||
</select>
|
||||
|
||||
<select id="getMonthFlowNew" resultType="com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO">
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.njcn.device.userledger.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.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.file.FileUrl;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 干扰源用户管理
|
||||
*
|
||||
* @author qijian
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/11/11 - 9:20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/userReport")
|
||||
@Api(tags = "干扰源用户管理")
|
||||
@AllArgsConstructor
|
||||
public class UserLedgerController extends BaseController {
|
||||
|
||||
private final UserLedgerService userReportPOService;
|
||||
|
||||
|
||||
@PostMapping(value = "/selectUserList")
|
||||
@ApiOperation("查询用户台账")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam) {
|
||||
String methodDescribe = getMethodDescribe("selectUserList");
|
||||
List<UserLedgerVO> b = userReportPOService.selectUserList(userReportParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/selectUserInfo")
|
||||
@ApiOperation("查询用户基本详情")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<UserLedgerVO> selectUserInfo(@RequestParam String id) {
|
||||
String methodDescribe = getMethodDescribe("selectUserInfo");
|
||||
UserLedgerVO b = userReportPOService.selectUserInfo(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/bindUserStation")
|
||||
@ApiOperation("绑定用户电站信息")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId) {
|
||||
String methodDescribe = getMethodDescribe("bindUserStation");
|
||||
userReportPOService.bindUserStation(userId,stationId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getUserReportByIds")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据ids获取非电网侧用户信息")
|
||||
public HttpResult<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getUserReportByIds");
|
||||
List<NewUserReportVO> userReportByIds = userReportPOService.getUserReportByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportByIds, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSensitiveUserByDept")
|
||||
@ApiOperation("根据部门获取敏感用户信息")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(@RequestBody @Validated SensitiveUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSensitiveUserByDept");
|
||||
List<UserReportPO> list = userReportPOService.getSensitiveUserByDept(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUserLedgerPage")
|
||||
@ApiOperation("分页查询干扰源用户台账")
|
||||
@ApiImplicitParam(name = "userReportQueryParam", value = "参数", required = true)
|
||||
public HttpResult<Page<UserReportVO>> getUserLedgerPage(@RequestBody @Validated UserReportParam.UserReportQueryParam userReportQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("getUserLedgerPage");
|
||||
Page<UserReportVO> out = userReportPOService.getUserLedgerPage(userReportQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据id获取用户档案录入的详细数据")
|
||||
public HttpResult<UserReportVO.UserReportListVO> getById(String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
UserReportVO.UserReportListVO userReportVO = userReportPOService.getVOById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getFileById")
|
||||
@ApiOperation("根据id查询文件信息集合")
|
||||
public HttpResult<List<FileUrl>> getFileUrlList(String id) {
|
||||
String methodDescribe = getMethodDescribe("getFileUrlList");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增干扰源用户")
|
||||
@ApiImplicitParam(name = "userReportParam", value = "实体参数", required = true)
|
||||
public HttpResult<String> addUserReport(@RequestBody @Validated UserReportParam userReportParam) {
|
||||
String methodDescribe = getMethodDescribe("addUserReport");
|
||||
String userReportId = userReportPOService.addUserReport(userReportParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportId, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/deleteUserReport")
|
||||
@ApiOperation("干扰源接入功能删除流程")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.DELETE)
|
||||
public HttpResult<Boolean> deleteUserReport(@RequestBody List<String> supervisionId) {
|
||||
String methodDescribe = getMethodDescribe("deleteUserReport");
|
||||
Boolean b = userReportPOService.deleteUserReport(supervisionId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping("/getUserReportById")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据id获取用户档案录入数据")
|
||||
public HttpResult<UserReportVO> getUserReportById(String id) {
|
||||
String methodDescribe = getMethodDescribe("getUserReportById");
|
||||
UserReportVO userReportVO = userReportPOService.getUserReportById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface UserReportNormalMapper extends BaseMapper<UserReportNormalPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:07【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportPOMapper extends BaseMapper<UserReportPO> {
|
||||
|
||||
Page<UserReportVO> page(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<UserReportVO> userReportVOQueryWrapper);
|
||||
|
||||
|
||||
UserReportVO getUserReportById(@Param("ew")QueryWrapper<UserReportVO> userReportVOQueryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportProjectPOMapper extends BaseMapper<UserReportProjectPO> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
public interface UserReportRenewalMapper extends BaseMapper<UserReportRenewalPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSensitivePOMapper extends BaseMapper<UserReportSensitivePO> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSubstationPOMapper extends BaseMapper<UserReportSubstationPO> {
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.userledger.mapper.UserReportPOMapper">
|
||||
|
||||
<!--获取流程表单分页列表-->
|
||||
<select id="page" resultType="com.njcn.supervision.pojo.vo.user.UserReportVO">
|
||||
SELECT
|
||||
supervision_user_report.id,
|
||||
supervision_user_report.report_date,
|
||||
supervision_user_report.org_id,
|
||||
supervision_user_report.expected_production_date,
|
||||
supervision_user_report.user_type,
|
||||
supervision_user_report.city,
|
||||
supervision_user_report.rate_power,
|
||||
supervision_user_report.responsible_department,
|
||||
supervision_user_report.user_status,
|
||||
supervision_user_report.substation,
|
||||
supervision_user_report.voltage_level,
|
||||
supervision_user_report.project_name,
|
||||
supervision_user_report.evaluation_dept,
|
||||
supervision_user_report.data_type,
|
||||
supervision_user_report.evaluation_conclusion,
|
||||
supervision_user_report.process_instance_id,
|
||||
supervision_user_report.history_instance_id,
|
||||
supervision_user_report.create_time,
|
||||
supervision_user_report.create_by,
|
||||
supervision_user_report.status,
|
||||
supervision_user_report.dev_id,
|
||||
supervision_user_report.line_id,
|
||||
supervision_user_report.second_assessment_id secondAssessmentId
|
||||
FROM supervision_user_report supervision_user_report
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="getUserReportById" resultType="com.njcn.supervision.pojo.vo.user.UserReportVO">
|
||||
SELECT
|
||||
supervision_user_report.id,
|
||||
supervision_user_report.report_date,
|
||||
supervision_user_report.org_id,
|
||||
supervision_user_report.expected_production_date,
|
||||
supervision_user_report.user_type,
|
||||
supervision_user_report.city,
|
||||
supervision_user_report.responsible_department,
|
||||
supervision_user_report.user_status,
|
||||
supervision_user_report.substation,
|
||||
supervision_user_report.voltage_level,
|
||||
supervision_user_report.project_name,
|
||||
supervision_user_report.evaluation_dept,
|
||||
supervision_user_report.data_type,
|
||||
supervision_user_report.evaluation_conclusion,
|
||||
supervision_user_report.process_instance_id,
|
||||
supervision_user_report.history_instance_id,
|
||||
supervision_user_report.create_time,
|
||||
supervision_user_report.create_by,
|
||||
supervision_user_report.status,
|
||||
supervision_user_report.dev_id,
|
||||
supervision_user_report.line_id
|
||||
FROM supervision_user_report supervision_user_report
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IUserReportNormalService extends IService<UserReportNormalPO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
public interface IUserReportRenewalService extends IService<UserReportRenewalPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2026/3/4 9:12
|
||||
*/
|
||||
public interface UserLedgerService extends IService<UserReportPO> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户台账
|
||||
* @param userReportParam
|
||||
* @return
|
||||
*/
|
||||
List<UserLedgerVO> selectUserList(UserReportParam userReportParam);
|
||||
|
||||
/**
|
||||
* 查询用户基本详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserLedgerVO selectUserInfo(String id);
|
||||
|
||||
/**
|
||||
* 绑定用户电站信息
|
||||
* @param userId
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
Boolean bindUserStation(String userId,String stationId);
|
||||
|
||||
/**
|
||||
* 根据ids获取非电网侧用户信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<NewUserReportVO> getUserReportByIds(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门获取敏感用户信息
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<UserReportPO> getSensitiveUserByDept(SensitiveUserParam param);
|
||||
|
||||
/**
|
||||
* 分页查询干扰源用户台账
|
||||
* @param userReportQueryParam
|
||||
* @return
|
||||
*/
|
||||
Page<UserReportVO> getUserLedgerPage(UserReportParam.UserReportQueryParam userReportQueryParam);
|
||||
|
||||
/**
|
||||
* 根据id获取用户档案录入的详细数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserReportVO.UserReportListVO getVOById(String id);
|
||||
|
||||
/**
|
||||
* 新增干扰源用户
|
||||
* @param userReportParam
|
||||
* @return
|
||||
*/
|
||||
String addUserReport(UserReportParam userReportParam);
|
||||
|
||||
/**
|
||||
* 干扰源接入功能删除流程
|
||||
* @param supervisionId
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteUserReport(List<String> supervisionId);
|
||||
|
||||
/**
|
||||
* 根据id获取用户档案录入数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserReportVO getUserReportById(String id);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportProjectPOService extends IService<UserReportProjectPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSensitivePOService extends IService<UserReportSensitivePO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSubstationPOService extends IService<UserReportSubstationPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
|
||||
import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportPOMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.userledger.service.UserReportProjectPOService;
|
||||
import com.njcn.device.userledger.service.UserReportSensitivePOService;
|
||||
import com.njcn.device.userledger.service.UserReportSubstationPOService;
|
||||
import com.njcn.supervision.enums.FlowStatusEnum;
|
||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
||||
import com.njcn.supervision.enums.UserNatureEnum;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.*;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/3/3 16:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserReportPO> implements UserLedgerService {
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final UserReportProjectPOService userReportProjectPOService;
|
||||
private final UserReportSubstationPOService userReportSubstationPOService;
|
||||
private final UserReportNormalMapper userReportNormalMapper;
|
||||
private final UserReportSensitivePOService userReportSensitivePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@Override
|
||||
public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
|
||||
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(userReportParam.getCity())) {
|
||||
lambdaQueryWrapper.in(UserReportPO::getCity, Stream.of(userReportParam.getCity()).collect(Collectors.toList()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(userReportParam.getStationId())) {
|
||||
lambdaQueryWrapper.eq(UserReportPO::getStationId, userReportParam.getStationId());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(userReportParam.getUserType())) {
|
||||
lambdaQueryWrapper.eq(UserReportPO::getUserType, userReportParam.getUserType());
|
||||
}
|
||||
lambdaQueryWrapper.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<UserReportPO> list = this.list(lambdaQueryWrapper);
|
||||
return BeanUtil.copyToList(list, UserLedgerVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLedgerVO selectUserInfo(String id) {
|
||||
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserReportPO::getId, id).eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
UserReportPO userReportPO = this.getById(id);
|
||||
if (Objects.nonNull(userReportPO)) {
|
||||
return BeanUtil.copyProperties(userReportPO, UserLedgerVO.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean bindUserStation(String userId, String stationId) {
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
userReportPO.setId(userId);
|
||||
userReportPO.setStationId(stationId);
|
||||
return this.updateById(userReportPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NewUserReportVO> getUserReportByIds(List<String> ids) {
|
||||
List<UserReportPO> userReportPOS = this.listByIds(ids);
|
||||
List<NewUserReportVO> info = new ArrayList<>();
|
||||
for (UserReportPO userReportNormalPO : userReportPOS) {
|
||||
NewUserReportVO newUserReportVO = new NewUserReportVO();
|
||||
|
||||
BeanUtil.copyProperties(userReportNormalPO, newUserReportVO);
|
||||
info.add(newUserReportVO);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserReportPO> getSensitiveUserByDept(SensitiveUserParam param) {
|
||||
QueryWrapper<UserReportPO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(param.getDeptId()).getData();
|
||||
//此处仅查询敏感及重要用户
|
||||
userReportVOQueryWrapper.and(wrapper ->
|
||||
wrapper.in("supervision_user_report.org_id", data)
|
||||
)
|
||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode())
|
||||
.eq("supervision_user_report.user_type", UserNatureEnum.SENSITIVE_USER.getCode())
|
||||
.in("supervision_user_report.status", Arrays.asList(FlowStatusEnum.AUDIT.getCode(), FlowStatusEnum.APPROVE.getCode()));
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(param.getProjectName()), "supervision_user_report.project_name", param.getProjectName());
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
return this.baseMapper.selectList(userReportVOQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<UserReportVO> getUserLedgerPage(UserReportParam.UserReportQueryParam userReportQueryParam) {
|
||||
//正则校验
|
||||
Pattern pattern = Pattern.compile(PatternRegex.ALL_CHAR_1_20);
|
||||
Matcher matcher = pattern.matcher(userReportQueryParam.getProjectName());
|
||||
if (StringUtils.isNotBlank(userReportQueryParam.getProjectName()) && !matcher.matches()) {
|
||||
throw new BusinessException(ValidMessage.SEARCH_DATA_ERROR);
|
||||
}
|
||||
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
//此处仅查询敏感及重要用户
|
||||
userReportVOQueryWrapper
|
||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode());
|
||||
|
||||
if (Objects.nonNull(userReportQueryParam)) {
|
||||
if (StrUtil.isNotBlank(userReportQueryParam.getCity())) {
|
||||
//查询所有区域下的数据
|
||||
userReportVOQueryWrapper.in("supervision_user_report.city", userReportQueryParam.getCity());
|
||||
}
|
||||
if (Objects.nonNull(userReportQueryParam.getDataType())) {
|
||||
userReportVOQueryWrapper.eq("data_type", userReportQueryParam.getDataType());
|
||||
}
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(userReportQueryParam.getProjectName()), "supervision_user_report.project_name", userReportQueryParam.getProjectName());
|
||||
if (StrUtil.isNotBlank(userReportQueryParam.getSearchBeginTime()) && StrUtil.isNotBlank(userReportQueryParam.getSearchEndTime())) {
|
||||
userReportVOQueryWrapper.and(wrapper -> wrapper.between("supervision_user_report.report_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
|
||||
.or()
|
||||
.between("supervision_user_report.expected_production_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
|
||||
);
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.Update_Time");
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
Page<UserReportVO> page;
|
||||
page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
|
||||
page.getRecords().forEach(temp -> {
|
||||
Integer needGovernance = 0;
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(temp.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
needGovernance = userReportProjectPOService.getById(temp.getId()).getNeedGovernance();
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(temp.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
|
||||
needGovernance = userReportSubstationPOService.getById(temp.getId()).getNeedGovernance();
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(temp.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
|
||||
}
|
||||
temp.setNeedGovernance(needGovernance);
|
||||
//添加治理评估文件,需先判断入网评估是否审核通过
|
||||
boolean type = true;
|
||||
if (1 == temp.getNeedGovernance()) {
|
||||
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
|
||||
.eq(UserReportNormalPO::getUserReportId, temp.getId())
|
||||
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
|
||||
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
|
||||
.eq(UserReportNormalPO::getType, 0)
|
||||
.orderByDesc(UserReportNormalPO::getCreateTime)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<String> collect = list.stream().filter(x -> !Objects.equals(x.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus()))
|
||||
.map(UserReportNormalPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
type = false;
|
||||
}
|
||||
} else {
|
||||
type = false;
|
||||
}
|
||||
}
|
||||
temp.setType(type);
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserReportVO.UserReportListVO getVOById(String id) {
|
||||
UserReportVO.UserReportListVO userReportVO = new UserReportVO.UserReportListVO();
|
||||
UserReportPO userReportPO = this.baseMapper.selectById(id);
|
||||
//复制基础信息
|
||||
BeanUtil.copyProperties(userReportPO, userReportVO);
|
||||
//处理特殊字段,用户名、部门名
|
||||
if (StrUtil.isNotBlank(userReportPO.getReporter())){
|
||||
UserVO userVO = userFeignClient.getUserById(userReportPO.getReporter()).getData();
|
||||
if(ObjUtil.isNotNull(userVO)){
|
||||
userReportVO.setReporter(userVO.getName());
|
||||
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(userReportPO.getReporter())){
|
||||
Dept dept = deptFeignClient.getDeptById(userReportPO.getOrgId()).getData();
|
||||
if(ObjUtil.isNotNull(dept)){
|
||||
userReportVO.setOrgName(dept.getName());
|
||||
}
|
||||
}
|
||||
/*
|
||||
根据用户性质获取自己特有的字段,此处需要特殊处理
|
||||
1、每个附件需要返回文件名称以及可以预览的url
|
||||
todo...by黄正剑
|
||||
*/
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
UserReportProjectPO byId = userReportProjectPOService.getById(id);
|
||||
userReportVO.setUserReportProjectPO(byId);
|
||||
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
UserReportSubstationPO byId = userReportSubstationPOService.getById(id);
|
||||
userReportSubstationPOService.saveOrUpdate(byId);
|
||||
userReportVO.setUserReportSubstationPO(byId);
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportPO.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
UserReportSensitivePO byId = userReportSensitivePOService.getById(id);
|
||||
userReportVO.setUserReportSensitivePO(byId);
|
||||
}
|
||||
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
|
||||
.eq(UserReportNormalPO::getUserReportId, id)
|
||||
.eq(UserReportNormalPO::getStatus, BpmTaskStatusEnum.APPROVE.getStatus())
|
||||
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(UserReportNormalPO::getCreateTime)
|
||||
);
|
||||
Optional<String> netInReport = list.stream().filter(x -> 0 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
|
||||
Optional<String> governReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
|
||||
Optional<String> simulationReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getSimulationReportUrl).findFirst();
|
||||
userReportVO.setNetInReport(Collections.singletonList(netInReport.orElse(null)));
|
||||
userReportVO.setGovernReport(Collections.singletonList(governReport.orElse(null)));
|
||||
userReportVO.setSimulationReport(Collections.singletonList(simulationReport.orElse(null)));
|
||||
return userReportVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addUserReport(UserReportParam userReportParam) {
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
BeanUtils.copyProperties(userReportParam, userReportPO);
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "2")) {
|
||||
checkProjectName(userReportParam, !StringUtils.isEmpty(userReportParam.getId()));
|
||||
}
|
||||
//判断工程名称是否有重复的
|
||||
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "1")) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
|
||||
checkProjectName(userReportParam, !StringUtils.isEmpty(userReportParam.getId()));
|
||||
} else {
|
||||
//常态化干扰源用户信息更新的用的
|
||||
if (!Objects.equals(userReportParam.getSaveOrCheckflag(), "0")) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(userReportParam.getDataType())) {
|
||||
userReportPO.setDataType(userReportParam.getDataType());
|
||||
if (userReportParam.getDataType() == 1) {
|
||||
if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportParam.getUserType())) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.APPROVE.getStatus());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
userReportPO.setDataType(0);
|
||||
}
|
||||
this.saveOrUpdate(userReportPO);
|
||||
userReportPO = this.getById(userReportPO.getId());
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
UserReportProjectPO userReportProjectPO = userReportParam.getUserReportProjectPO();
|
||||
userReportProjectPO.setId(userReportPO.getId());
|
||||
userReportProjectPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportProjectPOService.saveOrUpdate(userReportProjectPO);
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
UserReportSubstationPO userReportSubstationPO = userReportParam.getUserReportSubstationPO();
|
||||
userReportSubstationPO.setId(userReportPO.getId());
|
||||
userReportSubstationPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSubstationPOService.saveOrUpdate(userReportSubstationPO);
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportPO.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
UserReportSensitivePO userReportSensitivePO = userReportParam.getUserReportSensitivePO();
|
||||
userReportSensitivePO.setId(userReportPO.getId());
|
||||
userReportSensitivePO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSensitivePOService.saveOrUpdate(userReportSensitivePO);
|
||||
}
|
||||
return userReportPO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteUserReport(List<String> supervisionId) {
|
||||
List<UserReportPO> userReportPOS = this.listByIds(supervisionId);
|
||||
if (CollUtil.isEmpty(userReportPOS)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
|
||||
}
|
||||
//先判断是否是删除管理员,如果是就有全部删除权限,否则就只能删除带提交审批的
|
||||
List<String> deleteUser = userReportPOS.stream().map(UserReportPO::getCreateBy).distinct().collect(Collectors.toList());
|
||||
long statusCount = userReportPOS.stream().filter(x -> !BpmTaskStatusEnum.WAIT.getStatus().equals(x.getStatus())).count();
|
||||
//判断是否有权限操作
|
||||
if (CollUtil.isEmpty(deleteUser)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
|
||||
}
|
||||
//如果为空则需要判断信息,先判断全部数据是否都是自己创建的,然后判断是否是都是带提交数据
|
||||
if (CollUtil.isEmpty(deleteUser)) {
|
||||
long count = deleteUser.stream().filter(x -> !RequestUtil.getUserIndex().equals(x)).count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException(SupervisionResponseEnum.NO_POWER);
|
||||
} else {
|
||||
if (statusCount > 0) {
|
||||
throw new BusinessException(SupervisionResponseEnum.DELETE_TO_BE_SUBMITTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.update(new LambdaUpdateWrapper<UserReportPO>().set(UserReportPO::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(UserReportPO::getId, supervisionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserReportVO getUserReportById(String id) {
|
||||
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
userReportVOQueryWrapper.eq("supervision_user_report.id", id);
|
||||
return this.baseMapper.getUserReportById(userReportVOQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工程名称是否重复,如果重复则提示用户XXX已经创建该工程
|
||||
*
|
||||
* @param userReportParam 用户申请数据
|
||||
* @param isExcludeSelf 是否排除自己,一般新增不排除,更新时需要排除自己
|
||||
*/
|
||||
protected void checkProjectName(UserReportParam userReportParam, boolean isExcludeSelf) {
|
||||
if (!StringUtils.isEmpty(userReportParam.getProjectName())) {
|
||||
LambdaQueryWrapper<UserReportPO> userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userReportPOLambdaQueryWrapper
|
||||
.eq(UserReportPO::getProjectName, userReportParam.getProjectName())
|
||||
.in(UserReportPO::getStatus, CollectionUtil.newArrayList(BpmProcessInstanceStatusEnum.AWAIT.getStatus(), BpmProcessInstanceStatusEnum.RUNNING.getStatus(), BpmProcessInstanceStatusEnum.APPROVE.getStatus()))
|
||||
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (userReportParam instanceof UserReportParam.UserReportUpdate) {
|
||||
userReportPOLambdaQueryWrapper.ne(UserReportPO::getId, ((UserReportParam.UserReportUpdate) userReportParam).getId());
|
||||
} else {
|
||||
userReportPOLambdaQueryWrapper.ne(UserReportPO::getId, (userReportParam).getId());
|
||||
}
|
||||
}
|
||||
List<UserReportPO> userReportPOList = this.baseMapper.selectList(userReportPOLambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
//过滤已取消的申请
|
||||
userReportPOList = userReportPOList.stream()
|
||||
.filter(userReportPO -> !userReportPO.getStatus().equals(FlowStatusEnum.CANCEL.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
//如果还存在,则说明有人申请过了
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
UserVO userVO = userFeignClient.getUserById(userReportPOList.get(0).getReporter()).getData();
|
||||
throw new BusinessException(userReportParam.getProjectName().concat(",该工程已被:").concat(userVO.getName()).concat("申请"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.service.IUserReportNormalService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMapper, UserReportNormalPO> implements IUserReportNormalService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportProjectPOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportProjectPOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportProjectPOServiceImpl extends ServiceImpl<UserReportProjectPOMapper, UserReportProjectPO> implements UserReportProjectPOService {
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user