Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39cfffbf7e | ||
|
|
1aad1aa86b | ||
| fa500ca600 | |||
| 7b9fb1628b | |||
| fcddc064f6 | |||
| 37c5e9cbf8 | |||
| a08c7db24d | |||
| 9225e82edb | |||
| e8cd6da8a0 | |||
| 559620ab66 | |||
| f0b3b81e65 | |||
| 475ca820c8 | |||
|
|
c0db2cf961 | ||
|
|
4e95159e01 | ||
|
|
eec2560fd2 |
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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -170,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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -214,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处理并保存结果
|
||||
@@ -358,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@
|
||||
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@
|
||||
@@ -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;
|
||||
|
||||
@@ -169,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<>();
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -59,4 +59,7 @@ public class RunTimeVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
||||
private Double onlineEvaluate;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "用户对象名称")
|
||||
private String objName;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -72,6 +73,12 @@ 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 = "总指标异常时间")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.CityDataExcel;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DataLineExcelUtil {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (LineDataExcel datum : data) {
|
||||
ArrayList<Object> row = Lists.newArrayList(datum.getLineNum(),
|
||||
ArrayList<Object> row = ListUtil.toList(datum.getLineNum(),
|
||||
datum.getLineName(),
|
||||
datum.getDeptName(),
|
||||
datum.getPowerSubstationName(),
|
||||
@@ -89,7 +89,7 @@ public class DataLineExcelUtil {
|
||||
List<List<Object>> result = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(data)){
|
||||
for (CityDataExcel datum : data) {
|
||||
ArrayList<Object> row = Lists.newArrayList(datum.getDeptName(),
|
||||
ArrayList<Object> row = ListUtil.toList(datum.getDeptName(),
|
||||
datum.getDeviceNum(),
|
||||
datum.getLineNum(),
|
||||
datum.getOnlineRate(),
|
||||
|
||||
@@ -132,8 +132,9 @@ public class FixedDynamicExcelExport {
|
||||
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(10, allFields.size());
|
||||
List<String> sortedFields = allFields.subList(11, allFields.size());
|
||||
for (String field : sortedFields) {
|
||||
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
||||
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
||||
@@ -209,6 +210,7 @@ public class FixedDynamicExcelExport {
|
||||
fieldAlls.add("objName");
|
||||
fieldAlls.add("powerSubstationName");
|
||||
fieldAlls.add("manufacturer");
|
||||
fieldAlls.add("powerFlag");
|
||||
fieldAlls.add("allTime");
|
||||
fieldAlls.addAll(fields);
|
||||
return fieldAlls;
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -156,8 +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");
|
||||
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
||||
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -45,7 +45,6 @@ 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.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -86,7 +85,6 @@ 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;
|
||||
@@ -197,7 +195,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
@Override
|
||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
if(CollectionUtils.isEmpty(monitorIds)){
|
||||
if (CollectionUtils.isEmpty(monitorIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
||||
@@ -437,6 +435,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setPowerFlag(areaLineInfoVO.getPowerFlag() == 0 ? "电网侧" : "非电网侧");
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -89,7 +116,7 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
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>
|
||||
|
||||
@@ -61,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;
|
||||
@@ -73,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;
|
||||
@@ -97,7 +97,6 @@ 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;
|
||||
@@ -140,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;
|
||||
@@ -886,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 {
|
||||
@@ -901,7 +899,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void decoderM3d(Device deviceDetail) {
|
||||
@@ -989,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());
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportRenewalMapper;
|
||||
import com.njcn.device.userledger.service.IUserReportRenewalService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalMapper, UserReportRenewalPO> implements IUserReportRenewalService {
|
||||
|
||||
}
|
||||
@@ -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.UserReportSensitivePOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportSensitivePOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportSensitivePOServiceImpl extends ServiceImpl<UserReportSensitivePOMapper, UserReportSensitivePO> implements UserReportSensitivePOService {
|
||||
|
||||
}
|
||||
@@ -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.UserReportSubstationPOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportSubstationPOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportSubstationPOServiceImpl extends ServiceImpl<UserReportSubstationPOMapper, UserReportSubstationPO> implements UserReportSubstationPOService {
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.device.pq.api.DeptLineFeignClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
@@ -14,7 +15,6 @@ import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.SpThroughService;
|
||||
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
|
||||
import com.njcn.event.pojo.param.SpThroughParam;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
|
||||
48
pqs-event/event-boot/src/main/resources/bootstrap-jb.yml
Normal file
48
pqs-event/event-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10203
|
||||
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
|
||||
#项目日志的配置
|
||||
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.event.pojo
|
||||
|
||||
|
||||
52
pqs-event/event-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
52
pqs-event/event-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10203
|
||||
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
|
||||
#项目日志的配置
|
||||
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.event.pojo
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
@@ -1,48 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10203
|
||||
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
|
||||
#项目日志的配置
|
||||
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.event.pojo
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.pojo.param.ExportParam;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
@@ -7,6 +8,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -24,4 +26,11 @@ public interface CommMonitorEventReportService {
|
||||
* @param index
|
||||
*/
|
||||
void createEventReport(List<String> index, HttpServletResponse response) throws IOException, InvalidFormatException;
|
||||
|
||||
/**
|
||||
* 暂态事件报告存储,返回文件路径
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
String saveStableEventReport(List<String> index, Map<String, AreaLineInfoVO> map);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,20 @@ public interface WaveService {
|
||||
*/
|
||||
WaveDataDTO getWavedata(RmpEventDetailPO eventDetail, AreaLineInfoVO line);
|
||||
|
||||
/**
|
||||
* 用于云平台设备获取波形数据
|
||||
* @param eventDetail
|
||||
* @param line
|
||||
* @return
|
||||
*/
|
||||
WaveDataDTO getWavedata2(RmpEventDetailPO eventDetail, AreaLineInfoVO line);
|
||||
|
||||
|
||||
List<EventEigDetail> eventDetailEigenvalue(String eventDetailIndex,Integer ptType);
|
||||
|
||||
/**
|
||||
* 用于云平台设备获取数据
|
||||
* @return
|
||||
*/
|
||||
List<EventEigDetail> eventDetailEigenvalue2(String eventDetailIndex,Integer ptType);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.advance.api.EventCauseFeignClient;
|
||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
@@ -14,12 +16,12 @@ import com.njcn.echarts.pojo.constant.PicCommonData;
|
||||
import com.njcn.echarts.util.DrawPicUtil;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.pojo.dto.EventEigDetail;
|
||||
import com.njcn.event.common.pojo.dto.EventInfoDetailVO;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.event.common.service.EventReportService;
|
||||
import com.njcn.event.common.service.WaveService;
|
||||
import com.njcn.event.common.pojo.dto.EventInfoDetailVO;
|
||||
import com.njcn.event.common.utils.WordUtil;
|
||||
import com.njcn.event.common.utils.WordUtils;
|
||||
import com.njcn.event.file.component.WavePicComponent;
|
||||
@@ -31,6 +33,7 @@ import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -47,7 +50,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
@@ -80,6 +85,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
||||
private final WavePicComponent wavePicComponent;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final EventCauseFeignClient eventCauseFeignClient;
|
||||
|
||||
|
||||
/**
|
||||
@@ -650,4 +656,63 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "导出暂降事件报告异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveStableEventReport(List<String> eventIndex, Map<String, AreaLineInfoVO> map) {
|
||||
WordUtil wordUtil = new WordUtil();
|
||||
for (String index : eventIndex) {
|
||||
RmpEventDetailPO detail = rmpEventDetailMapper.selectById(index);
|
||||
AreaLineInfoVO line = map.get(index);
|
||||
|
||||
//判断hdr文件是否存在,不存在先生成hdr文件
|
||||
String fullPath = detail.getWavePath();
|
||||
EventAnalysisDTO eventAnalysis = new EventAnalysisDTO();
|
||||
int lastSlashIndex = fullPath.lastIndexOf('/');
|
||||
eventAnalysis.setWaveName(fullPath.substring(lastSlashIndex + 1));
|
||||
eventAnalysis.setWlFilePath(fullPath);
|
||||
eventCauseFeignClient.analysisCauseAndType(eventAnalysis);
|
||||
|
||||
WaveDataDTO waveData = waveService.getWavedata2(detail, line);
|
||||
//数据筛选,如果是双路电压的话,会存在 2 个波形数据
|
||||
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveData);
|
||||
if (ObjUtil.isNull(waveData)) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "没有波形数据");
|
||||
} else {
|
||||
//获取瞬时波形
|
||||
String instantPath = wavePicComponent.generateImageShun(waveData, waveDataDetails);
|
||||
InputStream instantStream = fileStorageUtil.getFileStream(instantPath);
|
||||
String imageShun64 = cn.hutool.core.codec.Base64.encode(instantStream);
|
||||
|
||||
wordUtil.translateShun(index, imageShun64);
|
||||
//获取 rms 波形
|
||||
String rmsPath = wavePicComponent.generateImageRms(waveData, waveDataDetails);
|
||||
InputStream rmsStream = fileStorageUtil.getFileStream(rmsPath);
|
||||
String rmsShun64 = cn.hutool.core.codec.Base64.encode(rmsStream);
|
||||
wordUtil.translateRms(index, rmsShun64);
|
||||
|
||||
EventInfoDetailVO eventInfoList = new EventInfoDetailVO();
|
||||
eventInfoList.setLineName(line.getLineName());
|
||||
eventInfoList.setGdName(line.getGdName());
|
||||
eventInfoList.setBdzName(line.getSubName());
|
||||
eventInfoList.setDevName(line.getDeviceName());
|
||||
eventInfoList.setScale(line.getVoltageScale());
|
||||
eventInfoList.setIp(line.getIp());
|
||||
eventInfoList.setEventDetailIndex(detail.getEventId());
|
||||
eventInfoList.setTimeID(detail.getStartTime());
|
||||
eventInfoList.setPersistTime(detail.getDuration());
|
||||
eventInfoList.setMs(detail.getFirstMs());
|
||||
eventInfoList.setEventValue(detail.getFeatureAmplitude());
|
||||
wordUtil.setEventInfoList(index, eventInfoList);
|
||||
List<EventEigDetail> eventDetailEigenvalue = waveService.eventDetailEigenvalue2(index,line.getPtType());
|
||||
wordUtil.setEventDetailEigenvalue(index, eventDetailEigenvalue);
|
||||
}
|
||||
}
|
||||
try {
|
||||
InputStream inputStream = wordUtil.createReport2(eventIndex);
|
||||
String filePath = fileStorageUtil.uploadStream(inputStream, OssPath.APP_EVENT_REPORT, "暂降事件报告.docx");
|
||||
return filePath;
|
||||
} catch (IOException | InvalidFormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,43 @@ public class WaveServiceImpl implements WaveService {
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveDataDTO getWavedata2(RmpEventDetailPO eventDetail, AreaLineInfoVO line) {
|
||||
WaveDataDTO waveDataDTO = null;
|
||||
if (ObjectUtil.isNotEmpty(line)) {
|
||||
String waveName = eventDetail.getWavePath();
|
||||
if (StrUtil.isBlank(waveName)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
try (
|
||||
InputStream cfgStream = fileStorageUtil.getFileStream(waveName + GeneralConstant.CFG);
|
||||
InputStream datStream = fileStorageUtil.getFileStream(waveName + GeneralConstant.DAT)
|
||||
) {
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
InputStream cfgStreamLower = fileStorageUtil.getFileStream(waveName + GeneralConstant.CFG_LOWER);
|
||||
InputStream datStreamLower = fileStorageUtil.getFileStream(waveName + GeneralConstant.DAT_LOWER);
|
||||
if (Objects.isNull(cfgStreamLower) || Objects.isNull(datStreamLower)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStreamLower, datStreamLower, 1);
|
||||
} catch (Exception e1) {
|
||||
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
||||
}
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getValidData(waveDataDTO);
|
||||
waveDataDTO.setPtType(line.getPtType());
|
||||
waveDataDTO.setPt(line.getPt1() * 1.0 / line.getPt2());
|
||||
waveDataDTO.setCt(line.getCt1() * 1.0 / line.getCt2());
|
||||
waveDataDTO.setMonitorName(line.getLineName());
|
||||
}
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventEigDetail> eventDetailEigenvalue(String eventDetailIndex,Integer ptType) {
|
||||
List<EventEigDetail> eventInfoDetails = new ArrayList<>();
|
||||
@@ -121,5 +158,42 @@ public class WaveServiceImpl implements WaveService {
|
||||
return eventInfoDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventEigDetail> eventDetailEigenvalue2(String eventDetailIndex,Integer ptType) {
|
||||
List<EventEigDetail> eventInfoDetails = new ArrayList<>();
|
||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisFeignClient.analysisWlEvent(eventDetailIndex).getData() ;
|
||||
if (entityAdvancedData.backNumber != -1) {
|
||||
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
||||
EventEigDetail eventEigDetail = new EventEigDetail();
|
||||
eventEigDetail.setHold_time_dq(entityAdvancedData.evt_buf[i].hold_time_dq * 1000);
|
||||
eventEigDetail.setPow_a(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_a));
|
||||
eventEigDetail.setPow_b(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_b));
|
||||
eventEigDetail.setPow_c(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_c));
|
||||
|
||||
eventEigDetail.setVoltagechange_Va(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Va / 1000));
|
||||
eventEigDetail.setVoltagechange_Vb(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Vb / 1000));
|
||||
eventEigDetail.setVoltagechange_Vc(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Vc / 1000));
|
||||
|
||||
|
||||
eventEigDetail.setUa_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ua_min[0]));
|
||||
eventEigDetail.setUb_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ub_min[0]));
|
||||
eventEigDetail.setUc_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ua_min[0]));
|
||||
|
||||
eventEigDetail.setAngle_diff_ap(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_ap[0]));
|
||||
eventEigDetail.setAngle_diff_bp(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_bp[0]));
|
||||
eventEigDetail.setAngle_diff_cp(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_cp[0]));
|
||||
|
||||
eventEigDetail.setBph_max_value(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].bph_max_value[0]));
|
||||
eventEigDetail.setSagReason(entityAdvancedData.sagReason[0]);//暂降原因,暂降原因都一样
|
||||
eventEigDetail.setSagType(entityAdvancedData.sagType[i]);//暂降类型
|
||||
eventInfoDetails.add(eventEigDetail);
|
||||
eventEigDetail.setPttype(ptType);
|
||||
}
|
||||
} else {
|
||||
eventInfoDetails = null;
|
||||
}
|
||||
return eventInfoDetails;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
@@ -152,6 +153,89 @@ public class WordUtil {
|
||||
System.out.println("11");
|
||||
}
|
||||
|
||||
public InputStream createReport2(List<String> eventIndex) throws IOException, InvalidFormatException {
|
||||
setHeadingStyle(this.document);
|
||||
|
||||
// 添加标题
|
||||
XWPFParagraph titleParagraph = getCenterParagraph(this.document);
|
||||
addLine(titleParagraph, 11);
|
||||
// 设置段落居中
|
||||
XWPFRun titleParagraphBigRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphBigRun, "宋体", 28, "000000", "暂降事件报告", true);
|
||||
addLine(titleParagraph, 17);
|
||||
XWPFRun titleParagraphDateRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphDateRun, "宋体", 16, "000000", "南京灿能电力自动化股份有限公司", false);
|
||||
addLine(titleParagraph, 1);
|
||||
titleParagraphDateRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphDateRun, "宋体", 14, "000000", "生成时间:" + getRightNow(), false);
|
||||
addLine(titleParagraph, 8);
|
||||
titleParagraph = getLeftParagraph(this.document);
|
||||
titleParagraphDateRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphDateRun, "宋体", 10, "000000", "【申明】本公司保留对报告的修改权,恕不另行通知,敬请关注最新版本。", false);
|
||||
for (int m = 0; m < eventIndex.size(); m++) {
|
||||
String eventId = eventIndex.get(m);
|
||||
List<EventEigDetail> eventDetailEigenvaluetmp = this.eventDetailEigenvalue.get(eventId);
|
||||
String time = eventInfoList.get(eventId).getTimeID().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
createTitle(document, (m + 1) + ". " + time, "标题 1", 0, 20);
|
||||
createTitle(document, (m + 1) + "." + "1. 基本信息", "标题 2", 0, 15);
|
||||
XWPFParagraph introductionContentParagraph = getLeftParagraph(document);
|
||||
introductionContentParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun introductionContentRun = introductionContentParagraph.createRun();
|
||||
addParagraph(introductionContentRun, "宋体", 11, "000000", eventInfoList.get(eventId).getGdName() + "," + eventInfoList.get(eventId).getBdzName() + ",网络参数:" + eventInfoList.get(eventId).getIp() + "," + eventInfoList.get(eventId).getLineName() + "于" + time + "发生暂降事件,特征幅值:" + (eventInfoList.get(eventId).getEventValue()) + "%,持续时间:" + eventInfoList.get(eventId).getPersistTime() + "s。", false);
|
||||
createTitle(document, (m + 1) + "." + "2. 波形图", "标题 2", 0, 15);
|
||||
createTitle(document, (m + 1) + "." + "2.1 瞬时波形图", "标题 3", 200, 11);
|
||||
for (int shun = 0; shun < listShunPic.get(eventId).size(); shun++) {
|
||||
createPic(document, "瞬时波形" + (shun), listShunPic.get(eventId).get(shun));
|
||||
}
|
||||
createTitle(document, (m + 1) + "." + "2.2 RMS 波形图", "标题 3", 200, 11);
|
||||
for (int rms = 0; rms < listRmsPic.get(eventId).size(); rms++) {
|
||||
createPic(document, "RMS 波形" + (eventId), listRmsPic.get(eventId).get(rms));
|
||||
}
|
||||
createTitle(document, (m + 1) + "." + "3. 多特征值", "标题 2", 0, 15);
|
||||
|
||||
XWPFParagraph value = getLeftParagraph(document);
|
||||
XWPFRun valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "事件总分段数:" + eventDetailEigenvaluetmp.size(), false);
|
||||
addLine(value, 1);
|
||||
|
||||
if (eventDetailEigenvaluetmp.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "暂降原因:" + eventDetailEigenvaluetmp.get(0).getSagReason(), false);
|
||||
addLine(value, 1);
|
||||
|
||||
for (int i = 0; i < eventDetailEigenvaluetmp.size(); i++) {
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "分段" + (i + 1) + "多特征值", true);
|
||||
addLine(value, 1);
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "波形起始点相位 (°):" + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "A" : "AB") + "相" + eventDetailEigenvaluetmp.get(i).getPow_a() + " " + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "B" : "BC") + "相" + eventDetailEigenvaluetmp.get(i).getPow_b() + " " + ((eventDetailEigenvaluetmp.get(0).getPttype() == 2) ? "" : ((eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "C" : "CA") + "相" + eventDetailEigenvaluetmp.get(i).getPow_c())), false);
|
||||
addLine(value, 1);
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "跳变段电压变化率 (V/ms):" + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "A" : "AB") + "相" + eventDetailEigenvaluetmp.get(i).getVoltagechange_Va() + " " + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "B" : "BC") + "相" + eventDetailEigenvaluetmp.get(i).getVoltagechange_Vb() + " " + ((eventDetailEigenvaluetmp.get(0).getPttype() == 2) ? "" : ((eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "C" : "CA") + "相" + eventDetailEigenvaluetmp.get(i).getVoltagechange_Vc())), false);
|
||||
addLine(value, 1);
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "相位跳变 (°):" + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "A" : "AB") + "相" + eventDetailEigenvaluetmp.get(i).getAngle_diff_ap() + " " + (eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "B" : "BC") + "相" + eventDetailEigenvaluetmp.get(i).getAngle_diff_bp() + " " + ((eventDetailEigenvaluetmp.get(0).getPttype() == 2) ? "" : ((eventDetailEigenvaluetmp.get(0).getPttype() == 0 ? "C" : "CA") + "相" + eventDetailEigenvaluetmp.get(i).getAngle_diff_cp())), false);
|
||||
addLine(value, 1);
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "不平衡度 (%):" + eventDetailEigenvaluetmp.get(i).getBph_max_value(), false);
|
||||
addLine(value, 1);
|
||||
valuex = value.createRun();
|
||||
addParagraph(valuex, "宋体", 11, "000000", "暂降类型:" + eventDetailEigenvaluetmp.get(i).getSagType(), false);
|
||||
addLine(value, 1);
|
||||
}
|
||||
addLine(value, 1);
|
||||
}
|
||||
|
||||
// 将文档写入 ByteArrayOutputStream
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
document.write(baos);
|
||||
document.close();
|
||||
// 创建 ByteArrayInputStream 并返回
|
||||
return new ByteArrayInputStream(baos.toByteArray());
|
||||
}
|
||||
|
||||
public void createPic(XWPFDocument document, String name, byte[] base64Info) throws IOException, InvalidFormatException {
|
||||
XWPFParagraph picParagraph = getCenterParagraph(document);
|
||||
XWPFRun createRun = picParagraph.createRun();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.njcn.gateway.filter;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.nimbusds.jose.JWSObject;
|
||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||
import com.njcn.common.pojo.dto.UserTokenInfo;
|
||||
@@ -82,7 +82,7 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
}
|
||||
String blackUserKey = SecurityConstants.TOKEN_BLACKLIST_PREFIX + userIndex;
|
||||
List<UserTokenInfo> blackUsers = (List<UserTokenInfo>) redisUtil.getObjectByKey(blackUserKey);
|
||||
if (CollectionUtils.isNotEmpty(blackUsers)) {
|
||||
if (CollUtil.isNotEmpty(blackUsers)) {
|
||||
for (UserTokenInfo blackUser : blackUsers) {
|
||||
//存在当前的刷新token,则抛出业务异常
|
||||
if(blackUser.getAccessTokenJti().equalsIgnoreCase(jti)){
|
||||
|
||||
274
pqs-gateway/src/main/resources/bootstrap-jb.yml
Normal file
274
pqs-gateway/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,274 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: "@name@"
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10215
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
#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
|
||||
gateway:
|
||||
globalcors:
|
||||
corsConfigurations:
|
||||
'[/**]':
|
||||
allowCredentials: true
|
||||
exposedHeaders: "Content-Disposition,Content-Type,Cache-Control"
|
||||
allowedHeaders: "*"
|
||||
allowedOrigins: "*"
|
||||
allowedMethods: "*"
|
||||
discovery:
|
||||
locator:
|
||||
# 开启自动代理 (自动装载从配置中心serviceId)
|
||||
enabled: true
|
||||
# 服务id为true --> 这样小写服务就可访问了
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
- id: pqs-auth
|
||||
uri: lb://pqs-auth
|
||||
predicates:
|
||||
- Path=/pqs-auth/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: user-boot
|
||||
uri: lb://user-boot
|
||||
predicates:
|
||||
- Path=/user-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: device-boot
|
||||
uri: lb://device-boot
|
||||
predicates:
|
||||
- Path=/device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: system-boot
|
||||
uri: lb://system-boot
|
||||
predicates:
|
||||
- Path=/system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-boot
|
||||
uri: lb://harmonic-boot
|
||||
predicates:
|
||||
- Path=/harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: energy-boot
|
||||
uri: lb://energy-boot
|
||||
predicates:
|
||||
- Path=/energy-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: event-boot
|
||||
uri: lb://event-boot
|
||||
predicates:
|
||||
- Path=/event-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: quality-boot
|
||||
uri: lb://quality-boot
|
||||
predicates:
|
||||
- Path=/quality-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-prepare
|
||||
uri: lb://harmonic-prepare
|
||||
predicates:
|
||||
- Path=/harmonic-prepare/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: process-boot
|
||||
uri: lb://process-boot
|
||||
predicates:
|
||||
- Path=/process-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: prepare-boot
|
||||
uri: lb://prepare-boot
|
||||
predicates:
|
||||
- Path=/prepare-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: algorithm-boot
|
||||
uri: lb://algorithm-boot
|
||||
predicates:
|
||||
- Path=/algorithm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: access-boot
|
||||
uri: lb://access-boot
|
||||
predicates:
|
||||
- Path=/access-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-device-boot
|
||||
uri: lb://cs-device-boot
|
||||
predicates:
|
||||
- Path=/cs-device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-system-boot
|
||||
uri: lb://cs-system-boot
|
||||
predicates:
|
||||
- Path=/cs-system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-warn-boot
|
||||
uri: lb://cs-warn-boot
|
||||
predicates:
|
||||
- Path=/cs-warn-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-harmonic-boot
|
||||
uri: lb://cs-harmonic-boot
|
||||
predicates:
|
||||
- Path=/cs-harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: advance-boot
|
||||
uri: lb://advance-boot
|
||||
predicates:
|
||||
- Path=/advance-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: bpm-boot
|
||||
uri: lb://bpm-boot
|
||||
predicates:
|
||||
- Path=/bpm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: supervision-boot
|
||||
uri: lb://supervision-boot
|
||||
predicates:
|
||||
- Path=/supervision-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-report-boot
|
||||
uri: lb://cs-report-boot
|
||||
predicates:
|
||||
- Path=/cs-report-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
#冀北influxDB转换程序
|
||||
- id: migration-influxdb-read-boot
|
||||
uri: lb://migration-influxdb-read-boot
|
||||
predicates:
|
||||
- Path=/migration-influxdb-read-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
whitelist:
|
||||
urls:
|
||||
- /user-boot/user/generateSm2Key
|
||||
- /user-boot/theme/getTheme
|
||||
- /user-boot/user/updateFirstPassword
|
||||
- /user-boot/appUser/authCode
|
||||
- /user-boot/appUser/register
|
||||
- /user-boot/appUser/resetPsd
|
||||
- /pqs-auth/oauth/logout
|
||||
- /pqs-auth/oauth/token
|
||||
- /pqs-auth/oauth/autoLogin
|
||||
- /pqs-auth/auth/getImgCode
|
||||
- /pqs-auth/oauth/getPublicKey
|
||||
- /pqs-auth/judgeToken/heBei
|
||||
- /pqs-auth/judgeToken/guangZhou
|
||||
|
||||
- /webjars/**
|
||||
- /actuator/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /*/v2/api-docs
|
||||
- /favicon.ico
|
||||
- /system-boot/theme/getTheme
|
||||
- /system-boot/image/toStream
|
||||
- /system-boot/file/download
|
||||
- /cs-system-boot/appinfo/queryAppInfoByType
|
||||
- /system-boot/dictType/dictDataCache
|
||||
- /system-boot/file/**
|
||||
- /system-boot/area/**
|
||||
- /bpm-boot/**
|
||||
- /harmonic-boot/comAccess/getComAccessData
|
||||
- /harmonic-boot/harmonic/getHistoryResult
|
||||
- /event-boot/transient/getTransientAnalyseWave
|
||||
# - /**
|
||||
#开始
|
||||
# - /advance-boot/**
|
||||
# - /device-boot/**
|
||||
# - /system-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /energy-boot/**
|
||||
# - /event-boot/**
|
||||
# - /quality-boot/**
|
||||
# - /harmonic-prepare/**
|
||||
# - /process-boot/**
|
||||
# - /bpm-boot/**
|
||||
# - /system-boot/**
|
||||
# - /supervision-boot/**
|
||||
# - /user-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /cs-device-boot/**
|
||||
#结束
|
||||
- /user-boot/user/listAllUserByDeptId
|
||||
- /IndexAnalysis/**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
279
pqs-gateway/src/main/resources/bootstrap-sjzx.yml
Normal file
279
pqs-gateway/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,279 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: "@name@"
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10215
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
#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
|
||||
gateway:
|
||||
globalcors:
|
||||
corsConfigurations:
|
||||
'[/**]':
|
||||
allowCredentials: true
|
||||
exposedHeaders: "Content-Disposition,Content-Type,Cache-Control"
|
||||
allowedHeaders: "*"
|
||||
allowedOrigins: "*"
|
||||
allowedMethods: "*"
|
||||
discovery:
|
||||
locator:
|
||||
# 开启自动代理 (自动装载从配置中心serviceId)
|
||||
enabled: true
|
||||
# 服务id为true --> 这样小写服务就可访问了
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
- id: pqs-auth
|
||||
uri: lb://pqs-auth
|
||||
predicates:
|
||||
- Path=/pqs-auth/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: user-boot
|
||||
uri: lb://user-boot
|
||||
predicates:
|
||||
- Path=/user-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: device-boot
|
||||
uri: lb://device-boot
|
||||
predicates:
|
||||
- Path=/device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: system-boot
|
||||
uri: lb://system-boot
|
||||
predicates:
|
||||
- Path=/system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-boot
|
||||
uri: lb://harmonic-boot
|
||||
predicates:
|
||||
- Path=/harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: energy-boot
|
||||
uri: lb://energy-boot
|
||||
predicates:
|
||||
- Path=/energy-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: event-boot
|
||||
uri: lb://event-boot
|
||||
predicates:
|
||||
- Path=/event-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: quality-boot
|
||||
uri: lb://quality-boot
|
||||
predicates:
|
||||
- Path=/quality-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-prepare
|
||||
uri: lb://harmonic-prepare
|
||||
predicates:
|
||||
- Path=/harmonic-prepare/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: process-boot
|
||||
uri: lb://process-boot
|
||||
predicates:
|
||||
- Path=/process-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: prepare-boot
|
||||
uri: lb://prepare-boot
|
||||
predicates:
|
||||
- Path=/prepare-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: algorithm-boot
|
||||
uri: lb://algorithm-boot
|
||||
predicates:
|
||||
- Path=/algorithm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: access-boot
|
||||
uri: lb://access-boot
|
||||
predicates:
|
||||
- Path=/access-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-device-boot
|
||||
uri: lb://cs-device-boot
|
||||
predicates:
|
||||
- Path=/cs-device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-system-boot
|
||||
uri: lb://cs-system-boot
|
||||
predicates:
|
||||
- Path=/cs-system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-warn-boot
|
||||
uri: lb://cs-warn-boot
|
||||
predicates:
|
||||
- Path=/cs-warn-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-harmonic-boot
|
||||
uri: lb://cs-harmonic-boot
|
||||
predicates:
|
||||
- Path=/cs-harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: advance-boot
|
||||
uri: lb://advance-boot
|
||||
predicates:
|
||||
- Path=/advance-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: bpm-boot
|
||||
uri: lb://bpm-boot
|
||||
predicates:
|
||||
- Path=/bpm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: supervision-boot
|
||||
uri: lb://supervision-boot
|
||||
predicates:
|
||||
- Path=/supervision-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-report-boot
|
||||
uri: lb://cs-report-boot
|
||||
predicates:
|
||||
- Path=/cs-report-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
#冀北influxDB转换程序
|
||||
- id: migration-influxdb-read-boot
|
||||
uri: lb://migration-influxdb-read-boot
|
||||
predicates:
|
||||
- Path=/migration-influxdb-read-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
whitelist:
|
||||
urls:
|
||||
- /user-boot/user/generateSm2Key
|
||||
- /user-boot/theme/getTheme
|
||||
- /user-boot/user/updateFirstPassword
|
||||
- /user-boot/appUser/authCode
|
||||
- /user-boot/appUser/register
|
||||
- /user-boot/appUser/resetPsd
|
||||
- /pqs-auth/oauth/logout
|
||||
- /pqs-auth/oauth/token
|
||||
- /pqs-auth/oauth/autoLogin
|
||||
- /pqs-auth/auth/getImgCode
|
||||
- /pqs-auth/oauth/getPublicKey
|
||||
- /pqs-auth/judgeToken/heBei
|
||||
- /pqs-auth/judgeToken/guangZhou
|
||||
|
||||
- /webjars/**
|
||||
- /actuator/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /*/v2/api-docs
|
||||
- /favicon.ico
|
||||
- /system-boot/theme/getTheme
|
||||
- /system-boot/image/toStream
|
||||
- /system-boot/file/download
|
||||
- /cs-system-boot/appinfo/queryAppInfoByType
|
||||
- /system-boot/dictType/dictDataCache
|
||||
- /system-boot/file/**
|
||||
- /system-boot/area/**
|
||||
- /bpm-boot/**
|
||||
- /harmonic-boot/comAccess/getComAccessData
|
||||
- /harmonic-boot/harmonic/getHistoryResult
|
||||
- /event-boot/transient/getTransientAnalyseWave
|
||||
# - /**
|
||||
#开始
|
||||
# - /advance-boot/**
|
||||
# - /device-boot/**
|
||||
# - /system-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /energy-boot/**
|
||||
# - /event-boot/**
|
||||
# - /quality-boot/**
|
||||
# - /harmonic-prepare/**
|
||||
# - /process-boot/**
|
||||
# - /bpm-boot/**
|
||||
# - /system-boot/**
|
||||
# - /supervision-boot/**
|
||||
# - /user-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /cs-device-boot/**
|
||||
#结束
|
||||
- /user-boot/user/listAllUserByDeptId
|
||||
- /IndexAnalysis/**
|
||||
#mqtt:
|
||||
# client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,265 +1,3 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: "@name@"
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10215
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
#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
|
||||
gateway:
|
||||
globalcors:
|
||||
corsConfigurations:
|
||||
'[/**]':
|
||||
allowCredentials: true
|
||||
exposedHeaders: "Content-Disposition,Content-Type,Cache-Control"
|
||||
allowedHeaders: "*"
|
||||
allowedOrigins: "*"
|
||||
allowedMethods: "*"
|
||||
discovery:
|
||||
locator:
|
||||
# 开启自动代理 (自动装载从配置中心serviceId)
|
||||
enabled: true
|
||||
# 服务id为true --> 这样小写服务就可访问了
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
- id: pqs-auth
|
||||
uri: lb://pqs-auth
|
||||
predicates:
|
||||
- Path=/pqs-auth/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: user-boot
|
||||
uri: lb://user-boot
|
||||
predicates:
|
||||
- Path=/user-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: device-boot
|
||||
uri: lb://device-boot
|
||||
predicates:
|
||||
- Path=/device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: system-boot
|
||||
uri: lb://system-boot
|
||||
predicates:
|
||||
- Path=/system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-boot
|
||||
uri: lb://harmonic-boot
|
||||
predicates:
|
||||
- Path=/harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: energy-boot
|
||||
uri: lb://energy-boot
|
||||
predicates:
|
||||
- Path=/energy-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: event-boot
|
||||
uri: lb://event-boot
|
||||
predicates:
|
||||
- Path=/event-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: quality-boot
|
||||
uri: lb://quality-boot
|
||||
predicates:
|
||||
- Path=/quality-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: harmonic-prepare
|
||||
uri: lb://harmonic-prepare
|
||||
predicates:
|
||||
- Path=/harmonic-prepare/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: process-boot
|
||||
uri: lb://process-boot
|
||||
predicates:
|
||||
- Path=/process-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: prepare-boot
|
||||
uri: lb://prepare-boot
|
||||
predicates:
|
||||
- Path=/prepare-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: algorithm-boot
|
||||
uri: lb://algorithm-boot
|
||||
predicates:
|
||||
- Path=/algorithm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: access-boot
|
||||
uri: lb://access-boot
|
||||
predicates:
|
||||
- Path=/access-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-device-boot
|
||||
uri: lb://cs-device-boot
|
||||
predicates:
|
||||
- Path=/cs-device-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-system-boot
|
||||
uri: lb://cs-system-boot
|
||||
predicates:
|
||||
- Path=/cs-system-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-warn-boot
|
||||
uri: lb://cs-warn-boot
|
||||
predicates:
|
||||
- Path=/cs-warn-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: cs-harmonic-boot
|
||||
uri: lb://cs-harmonic-boot
|
||||
predicates:
|
||||
- Path=/cs-harmonic-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: advance-boot
|
||||
uri: lb://advance-boot
|
||||
predicates:
|
||||
- Path=/advance-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: bpm-boot
|
||||
uri: lb://bpm-boot
|
||||
predicates:
|
||||
- Path=/bpm-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
- id: supervision-boot
|
||||
uri: lb://supervision-boot
|
||||
predicates:
|
||||
- Path=/supervision-boot/**
|
||||
filters:
|
||||
- SwaggerHeaderFilter
|
||||
- StripPrefix=1
|
||||
#河北国网总部调用省侧接口,路径总部统一规定
|
||||
- id: hb_pms_down
|
||||
uri: lb://harmonic-boot
|
||||
predicates:
|
||||
- Path=/IndexAnalysis/**
|
||||
- Path=/pms-tech-powerquality-start/**
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
whitelist:
|
||||
urls:
|
||||
- /user-boot/user/generateSm2Key
|
||||
- /user-boot/theme/getTheme
|
||||
- /user-boot/user/updateFirstPassword
|
||||
- /user-boot/appUser/authCode
|
||||
- /user-boot/appUser/register
|
||||
- /user-boot/appUser/resetPsd
|
||||
- /pqs-auth/oauth/logout
|
||||
- /pqs-auth/oauth/token
|
||||
- /pqs-auth/oauth/autoLogin
|
||||
- /pqs-auth/auth/getImgCode
|
||||
- /pqs-auth/oauth/getPublicKey
|
||||
- /pqs-auth/judgeToken/heBei
|
||||
- /pqs-auth/judgeToken/guangZhou
|
||||
|
||||
- /webjars/**
|
||||
- /actuator/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
- /*/v2/api-docs
|
||||
- /favicon.ico
|
||||
- /system-boot/theme/getTheme
|
||||
- /system-boot/image/toStream
|
||||
- /system-boot/file/download
|
||||
- /cs-system-boot/appinfo/queryAppInfoByType
|
||||
- /system-boot/dictType/dictDataCache
|
||||
- /system-boot/file/**
|
||||
- /system-boot/area/**
|
||||
- /bpm-boot/**
|
||||
- /harmonic-boot/comAccess/getComAccessData
|
||||
- /harmonic-boot/harmonic/getHistoryResult
|
||||
- /event-boot/transient/getTransientAnalyseWave
|
||||
#开始
|
||||
# - /advance-boot/**
|
||||
# - /device-boot/**
|
||||
# - /system-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /energy-boot/**
|
||||
# - /event-boot/**
|
||||
# - /quality-boot/**
|
||||
# - /harmonic-prepare/**
|
||||
# - /process-boot/**
|
||||
# - /bpm-boot/**
|
||||
# - /system-boot/**
|
||||
# - /supervision-boot/**
|
||||
# - /user-boot/**
|
||||
# - /harmonic-boot/**
|
||||
# - /cs-device-boot/**
|
||||
#结束
|
||||
- /user-boot/user/listAllUserByDeptId
|
||||
- /IndexAnalysis/**
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.njcn.harmonic.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据公共工具类
|
||||
*
|
||||
@@ -7,6 +15,7 @@ package com.njcn.harmonic.utils;
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/14 - 10:07
|
||||
*/
|
||||
|
||||
public class PublicDataUtils {
|
||||
/**
|
||||
* 功能:下划线命名转驼峰命名
|
||||
@@ -27,4 +36,91 @@ public class PublicDataUtils {
|
||||
}
|
||||
return under;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算指定月份的第一天 (格式:yyyy-MM-dd)
|
||||
* @param monthStr 月份字符串,格式为 yyyy-MM
|
||||
* @return 月份第一天的日期字符串
|
||||
*/
|
||||
public static String calculateMonthStart(String monthStr) {
|
||||
if (StrUtil.isBlank(monthStr)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
Date date = DateUtil.parse(monthStr, "yyyy-MM");
|
||||
Date firstDayOfMonth = DateUtil.beginOfMonth(date);
|
||||
return DateUtil.format(firstDayOfMonth, "yyyy-MM-dd");
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("时间格式不正确,请使用 yyyy-MM 格式");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算指定月份的最后一天 (格式:yyyy-MM-dd)
|
||||
* @param monthStr 月份字符串,格式为 yyyy-MM
|
||||
* @return 月份最后一天的日期字符串
|
||||
*/
|
||||
public static String calculateMonthEnd(String monthStr) {
|
||||
if (StrUtil.isBlank(monthStr)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
Date date = DateUtil.parse(monthStr, "yyyy-MM");
|
||||
Date lastDayOfMonth = DateUtil.endOfMonth(date);
|
||||
return DateUtil.format(lastDayOfMonth, "yyyy-MM-dd");
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("时间格式不正确,请使用 yyyy-MM 格式");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的月份字符串获取时间范围
|
||||
* 如果传入的月份是当前月份,返回该月1号到昨天
|
||||
* 如果传入的月份不是当前月份,返回该月的第一天和最后一天
|
||||
*
|
||||
* @param timeStr 月份字符串,格式:yyyy-MM
|
||||
* @return 包含 startTime 和 endTime 的数组,格式:yyyy-MM-dd
|
||||
*/
|
||||
/**
|
||||
* 根据传入的月份字符串获取时间范围
|
||||
* 如果传入的月份是当前月份,返回该月 1 号到昨天
|
||||
* 如果传入的月份不是当前月份,返回该月的第一天和最后一天
|
||||
*
|
||||
* @param timeStr 月份字符串,格式:yyyy-MM
|
||||
* @return 包含 startTime 和 endTime 的数组,格式:yyyy-MM-dd
|
||||
*/
|
||||
public static String[] calculateTimeRange(String timeStr) {
|
||||
LocalDate now = LocalDate.now();
|
||||
LocalDate inputMonth;
|
||||
|
||||
try {
|
||||
// 解析传入的月份
|
||||
inputMonth = LocalDate.parse(timeStr + "-01", DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("时间格式不正确,请使用 yyyy-MM 格式");
|
||||
}
|
||||
|
||||
// 判断是否是当前月份
|
||||
boolean isCurrentMonth = inputMonth.getYear() == now.getYear() &&
|
||||
inputMonth.getMonthValue() == now.getMonthValue();
|
||||
|
||||
String startTime;
|
||||
String endTime;
|
||||
|
||||
startTime = inputMonth.withDayOfMonth(1).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
if (isCurrentMonth) {
|
||||
// 如果今天是 1 号,则结束时间也为 1 号,避免时间范围无效
|
||||
endTime = now.minusDays(1).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
// 确保结束时间不小于开始时间
|
||||
if (LocalDate.parse(endTime).isBefore(LocalDate.parse(startTime))) {
|
||||
endTime = startTime;
|
||||
}
|
||||
} else {
|
||||
// 如果不是当前月份,开始时间是该月 1 号,结束时间是该月最后一天
|
||||
endTime = inputMonth.withDayOfMonth(inputMonth.lengthOfMonth()).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
}
|
||||
|
||||
return new String[]{startTime, endTime};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.google.common.collect.Lists;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.OverLimitLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||
@@ -36,7 +37,6 @@ import com.njcn.harmonic.pojo.vo.WarningSubstationVO;
|
||||
import com.njcn.harmonic.mapper.RStatLimitRateDMapper;
|
||||
import com.njcn.harmonic.service.IAnalyzeService;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
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.api.DicDataFeignClient;
|
||||
@@ -82,7 +82,6 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
private final RStatLimitTargetMapper targetMapper;
|
||||
private final EventDetailFeignClient eventDetailFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.harmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -13,22 +12,19 @@ import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.harmonic.mapper.RStatComassesDMapper;
|
||||
import com.njcn.harmonic.pojo.dto.ComAssessDTO;
|
||||
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatComassesDPO;
|
||||
import com.njcn.harmonic.pojo.vo.ComAssessVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.service.ComAssessService;
|
||||
import com.njcn.harmonic.utils.HarmonicComAssesUtil;
|
||||
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.api.DicDataFeignClient;
|
||||
|
||||
@@ -11,12 +11,12 @@ import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.harmonic.constant.Param;
|
||||
@@ -27,7 +27,6 @@ import com.njcn.harmonic.pojo.po.LimitTarget;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.*;
|
||||
import com.njcn.harmonic.service.IHarmonicService;
|
||||
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.enums.DicDataEnum;
|
||||
@@ -57,15 +56,10 @@ import java.util.stream.Stream;
|
||||
public class HarmonicServiceImpl implements IHarmonicService {
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final RStatLimitTargetDMapper targetDMapper;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final SubstationFeignClient substationFeignClient;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.*;
|
||||
@@ -61,8 +62,6 @@ import com.njcn.harmonic.pojo.vo.SubstationVo;
|
||||
import com.njcn.harmonic.mapper.RStatLimitRateDMapper;
|
||||
import com.njcn.harmonic.service.PollutionSubstationService;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.api.UserReportManageFeignClient;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
@@ -133,7 +132,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final RmpEventDetailFeignClient detailFeignClient;
|
||||
private final CommLineClient commLineClient;
|
||||
private final UserReportManageFeignClient userReportManageFeignClient;
|
||||
|
||||
/**
|
||||
* @param pollutionSubstationQuryParam
|
||||
@@ -1282,7 +1280,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
SensitiveUserParam sensitiveUserParam = new SensitiveUserParam();
|
||||
sensitiveUserParam.setDeptId(param.getDeptId());
|
||||
sensitiveUserParam.setProjectName(param.getSearchValue());
|
||||
List<UserReportPO> userReportPOList = userReportManageFeignClient.getSensitiveUserByDept(sensitiveUserParam).getData();
|
||||
List<UserReportPO> userReportPOList = userLedgerFeignClient.getSensitiveUserByDept(sensitiveUserParam).getData();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
userReportPOList.forEach(item -> {
|
||||
|
||||
@@ -9,6 +9,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -24,7 +25,6 @@ import com.njcn.harmonic.mapper.RStatLimitRateDMapper;
|
||||
import com.njcn.harmonic.service.SteadyExceedRateService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -21,7 +22,6 @@ import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.service.SteadyQualifyService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -25,7 +26,6 @@ import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -49,7 +50,9 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
|
||||
|
||||
// 常量定义
|
||||
private static final String REPORT_TEMPLATE_PATH = "file/areaReportTemplate.docx";
|
||||
private static final String DEFAULT_PROVIDER_DEPT = "云网能源(曲靖)有限责任公司";
|
||||
|
||||
@Value("${areaReportTitle:上海电力有限公司电力科学研究院}")
|
||||
private String DEFAULT_PROVIDER_DEPT;
|
||||
private static final String NO_DATA_PLACEHOLDER = "无";
|
||||
private static final String UNKNOWN_VALUE = "/";
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10204
|
||||
#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-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
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.harmonic.pojo
|
||||
global-config:
|
||||
enable-sql-runner: true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10204
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
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: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
#PMS使用
|
||||
# - data-Id: share-config-harmonic-db.yaml
|
||||
# refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
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.harmonic.pojo
|
||||
global-config:
|
||||
enable-sql-runner: true
|
||||
|
||||
|
||||
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: 10204
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
#username: @nacos.username@
|
||||
#password: @nacos.password@
|
||||
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: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
#PMS使用
|
||||
# - data-Id: share-config-harmonic-db.yaml
|
||||
# refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
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.harmonic.pojo
|
||||
global-config:
|
||||
enable-sql-runner: true
|
||||
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
|
||||
|
||||
profiles:
|
||||
active: @spring.profiles.active@
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.harmonic.common.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
@@ -19,6 +20,7 @@ import java.util.Map;
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@DS("sjzx")
|
||||
public interface ExcelRptTempMapper extends BaseMapper<ExcelRptTemp> {
|
||||
|
||||
Page<ReportTemplateVO> getReportTemplateListPage(Page<BaseParam> page, @Param("baseParam")BaseParam baseParam);
|
||||
|
||||
@@ -24,4 +24,10 @@ public interface CustomReportTableService {
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, Map<String,String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 存储稳态事件报表,并返回存储路径
|
||||
*/
|
||||
String saveStableEventReport(ReportSearchParam reportSearchParam, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.harmonic.common.mapper.ExcelRptTempMapper;
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.common.service.CustomReportTableService;
|
||||
@@ -29,6 +27,7 @@ import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.enums.OssResponseEnum;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -40,13 +39,14 @@ import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
@@ -69,18 +69,9 @@ import java.util.stream.Collectors;
|
||||
public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
|
||||
private final ExcelRptTempMapper excelRptTempMapper;
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
||||
|
||||
private final String CELL_DATA = "celldata";
|
||||
@@ -113,8 +104,460 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveStableEventReport(ReportSearchParam reportSearchParam, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO) {
|
||||
String filePath = "";
|
||||
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
|
||||
if (Objects.isNull(excelRptTemp)) {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
|
||||
} else {
|
||||
if (Objects.isNull(reportSearchParam.getCustomType())) {
|
||||
filePath = this.analyzeReport2(reportSearchParam, excelRptTemp, newMap, deviceUnitCommDTO);
|
||||
}
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
private String analyzeReport2(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp,Map<String,String> newMap,DeviceUnitCommDTO deviceUnitCommDTO) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
//定义一个线程集合
|
||||
List<Future<?>> futures = new ArrayList<>();
|
||||
//指标
|
||||
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
||||
//限值
|
||||
List<ReportTemplateDTO> reportLimitList = new ArrayList<>();
|
||||
//台账
|
||||
List<ReportTemplateDTO> terminalList = new ArrayList<>();
|
||||
JSONArray jsonArray;
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(excelRptTemp.getContent())) {
|
||||
jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
||||
} catch (Exception e) {
|
||||
if(e instanceof BusinessException){
|
||||
throw new BusinessException(e.getMessage());
|
||||
}else {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||
}
|
||||
}
|
||||
//查询不分相别的指标
|
||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.EPD.getCode(), DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
||||
if(Objects.isNull(dictData)){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"字典类型模板缺少!");
|
||||
}
|
||||
|
||||
DictData epdDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.EPD.getCode(),DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
||||
List<EleEpdPqd> eleEpdPqdList= epdFeignClient.dictMarkByDataType(epdDic.getId()).getData();
|
||||
|
||||
Map<String, String> tMap = new HashMap<>();
|
||||
eleEpdPqdList.forEach(item->{
|
||||
String phase;
|
||||
if (Objects.isNull(PHASE_MAPPING.get(item.getPhase()))) {
|
||||
phase = item.getPhase();
|
||||
} else {
|
||||
phase = PHASE_MAPPING.get(item.getPhase());
|
||||
}
|
||||
if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) {
|
||||
for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) {
|
||||
tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
} else {
|
||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
});
|
||||
|
||||
eleEpdPqdList = eleEpdPqdList.stream().filter(it->"T".equals(it.getPhase())||"M".equals(it.getPhase())).collect(Collectors.toList());
|
||||
List<String> noPhaseList = eleEpdPqdList.stream().filter(it->StrUtil.isNotBlank(it.getOtherName())).map(it->it.getOtherName().toUpperCase()).collect(Collectors.toList());
|
||||
|
||||
//处理指标是否合格
|
||||
reportLimitList = new LinkedHashSet<>(reportLimitList).stream().sorted(Comparator.comparing(ReportTemplateDTO::getItemName)).collect(Collectors.toList());
|
||||
Map<String, Float> limitMap = overLimitDeal(reportLimitList, reportSearchParam);
|
||||
//存放限值指标的map
|
||||
Map<String, ReportTemplateDTO> limitTargetMapX = reportLimitList.stream().collect(Collectors.toMap(ReportTemplateDTO::getItemName, Function.identity()));
|
||||
|
||||
List<ReportTemplateDTO> endList = new CopyOnWriteArrayList<>();
|
||||
if (CollUtil.isNotEmpty(reportTemplateDTOList)) {
|
||||
//开始组织sql
|
||||
reportTemplateDTOList = new LinkedHashSet<>(reportTemplateDTOList).stream().sorted(Comparator.comparing(ReportTemplateDTO::getItemName)).collect(Collectors.toList());
|
||||
Map<String, List<ReportTemplateDTO>> classMap = reportTemplateDTOList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getResourceId));
|
||||
//定义存放越限指标的map
|
||||
Map<String, ReportTemplateDTO> assNoPassMap = new HashMap<>();
|
||||
classMap.forEach((classKey, templateValue) -> {
|
||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||
//每张表开启一个独立线程查询
|
||||
futures.add(executorService.submit(() -> {
|
||||
DynamicDataSourceContextHolder.push("sjzx");
|
||||
//avg.max,min,cp95
|
||||
try {
|
||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||
//相别分组
|
||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(tMap,newMap.get("LEVEL"),newMap.get("PT"),newMap.get("CT"),phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap,noPhaseList);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}finally {
|
||||
DynamicDataSourceContextHolder.poll();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
// 等待所有任务完成
|
||||
for (Future<?> future : futures) {
|
||||
try {
|
||||
future.get(); // 这会阻塞直到任务完成或抛出异常
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
log.error("自定义报表多线程查询流程出错!错误信息{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//处理指标最终判定合格还是不合格
|
||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||
}
|
||||
resultAssemble2(endList,reportSearchParam,newMap,deviceUnitCommDTO,jsonArray,dataMap);
|
||||
//存储自定义报表
|
||||
return saveReport(jsonArray,dataMap);
|
||||
}
|
||||
|
||||
public void resultAssemble2(List<ReportTemplateDTO> endList, ReportSearchParam reportSearchParam, Map<String, String> finalTerminalMap, DeviceUnitCommDTO deviceUnitCommDTO, JSONArray jsonArray,Map<String, Object> dataMap) {
|
||||
if (CollUtil.isNotEmpty(endList)) {
|
||||
Map<String, String> unit = this.unitMap(deviceUnitCommDTO);
|
||||
Map<String, List<ReportTemplateDTO>> assMap = (Map)endList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getItemName));
|
||||
jsonArray.forEach((item) -> {
|
||||
JSONObject jsonObject = (JSONObject)item;
|
||||
JSONArray itemArr = (JSONArray)jsonObject.get("celldata");
|
||||
itemArr.forEach((it) -> {
|
||||
if (Objects.nonNull(it) && !"null".equals(it.toString())) {
|
||||
JSONObject data = (JSONObject)it;
|
||||
JSONObject son = (JSONObject)data.get("v");
|
||||
if (son.containsKey("v")) {
|
||||
String v = son.getStr("v");
|
||||
String tem;
|
||||
List rDto;
|
||||
if (v.charAt(0) == '$' && v.contains("#")) {
|
||||
tem = "";
|
||||
rDto = (List)assMap.get(v.replace("$", "").toUpperCase());
|
||||
if (Objects.nonNull(rDto)) {
|
||||
tem = ((ReportTemplateDTO)rDto.get(0)).getValue();
|
||||
if (StringUtils.isBlank(tem)) {
|
||||
tem = "/";
|
||||
}
|
||||
|
||||
son.set("v", tem);
|
||||
dataMap.put(v, tem);
|
||||
if (Objects.nonNull(((ReportTemplateDTO)rDto.get(0)).getOverLimitFlag()) && ((ReportTemplateDTO)rDto.get(0)).getOverLimitFlag() == 1) {
|
||||
son.set("fc", "#990000");
|
||||
}
|
||||
}
|
||||
} else if (v.charAt(0) == '%' && v.contains("#")) {
|
||||
tem = "";
|
||||
rDto = (List)assMap.get(v.replace("%", "").toUpperCase());
|
||||
if (Objects.nonNull(rDto)) {
|
||||
tem = ((ReportTemplateDTO)rDto.get(0)).getValue();
|
||||
if (StringUtils.isBlank(tem)) {
|
||||
tem = "/";
|
||||
}
|
||||
|
||||
son.set("v", tem);
|
||||
dataMap.put(v, tem);
|
||||
if ("不合格".equals(tem)) {
|
||||
son.set("fc", "#990000");
|
||||
dataMap.put("fc", "#990000");
|
||||
}
|
||||
}
|
||||
} else if (v.charAt(0) == '&') {
|
||||
tem = v.replace("&", "").toUpperCase();
|
||||
if (finalTerminalMap.size() > 0) {
|
||||
if ("STATIS_TIME".equals(tem)) {
|
||||
String localTime = " 23:59:59";
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(reportSearchParam.getEndTime(), "yyyy-MM-dd");
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
if (nowDate.isAfter(localDate)) {
|
||||
son.set("v", reportSearchParam.getStartTime() + " 00:00:00" + "_" + reportSearchParam.getEndTime() + localTime);
|
||||
dataMap.put(v, reportSearchParam.getStartTime() + " 00:00:00" + "_" + reportSearchParam.getEndTime() + localTime);
|
||||
} else {
|
||||
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
||||
son.set("v", reportSearchParam.getStartTime() + " 00:00:00" + "_" + nowDate + localTime);
|
||||
dataMap.put(v, reportSearchParam.getStartTime() + " 00:00:00" + "_" + nowDate + localTime);
|
||||
}
|
||||
} else {
|
||||
son.set("v", finalTerminalMap.getOrDefault(tem, "/"));
|
||||
dataMap.put(v, finalTerminalMap.getOrDefault(tem, "/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (v.charAt(0) == '@' && v.contains("#")) {
|
||||
tem = v.replace("@", "");
|
||||
son.set("v", unit.getOrDefault(tem, "/"));
|
||||
dataMap.put(v, unit.getOrDefault(tem, "/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String saveReport(JSONArray jsonArray, Map<String, Object> dataMap) {
|
||||
String filePath = "";
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String sheetName = jsonObject.getStr("name");
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
|
||||
List<CellRangeAddress> mergeRegions = new ArrayList<>();
|
||||
List<MergedCellInfo> mergedCellInfos = new ArrayList<>();
|
||||
|
||||
if (data != null && !data.isEmpty()) {
|
||||
boolean hasMergeMark = false;
|
||||
|
||||
for (int j = 0; j < data.size(); j++) {
|
||||
Row row = sheet.createRow(j);
|
||||
JSONArray rowData = data.getJSONArray(j);
|
||||
|
||||
if (rowData != null) {
|
||||
for (int k = 0; k < rowData.size(); k++) {
|
||||
JSONObject cellObj = rowData.getJSONObject(k);
|
||||
|
||||
if (cellObj == null || cellObj.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject mc = cellObj.getJSONObject("mc");
|
||||
|
||||
if (mc != null && !mc.isEmpty()) {
|
||||
hasMergeMark = true;
|
||||
|
||||
Integer rs = mc.getInt("rs");
|
||||
Integer cs = mc.getInt("cs");
|
||||
Integer mr = mc.getInt("r");
|
||||
Integer mcCol = mc.getInt("c");
|
||||
|
||||
if (rs != null && cs != null && mr != null && mcCol != null) {
|
||||
if (mr == j && mcCol == k) {
|
||||
int endRow = j + rs - 1;
|
||||
int endCol = k + cs - 1;
|
||||
if (endRow > j || endCol > k) {
|
||||
mergeRegions.add(new CellRangeAddress(j, endRow, k, endCol));
|
||||
|
||||
MergedCellInfo info = new MergedCellInfo();
|
||||
info.row = j;
|
||||
info.col = k;
|
||||
info.cellObj = cellObj;
|
||||
mergedCellInfos.add(info);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cell cell = row.createCell(k);
|
||||
Object v = cellObj.get("v");
|
||||
|
||||
if (v != null) {
|
||||
Object vData = dataMap.get(v);
|
||||
if (vData != null) {
|
||||
setCellValue(cell, vData);
|
||||
} else {
|
||||
setCellValue(cell, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasMergeMark) {
|
||||
detectAndMergeCells(data, mergeRegions, mergedCellInfos);
|
||||
}
|
||||
}
|
||||
|
||||
for (CellRangeAddress mergeRegion : mergeRegions) {
|
||||
try {
|
||||
sheet.addMergedRegion(mergeRegion);
|
||||
} catch (Exception e) {
|
||||
log.warn("添加合并单元格失败:{}", mergeRegion.formatAsString());
|
||||
}
|
||||
}
|
||||
|
||||
for (MergedCellInfo info : mergedCellInfos) {
|
||||
Row row = sheet.getRow(info.row);
|
||||
if (row != null) {
|
||||
Cell cell = row.getCell(info.col);
|
||||
if (cell != null) {
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
Font font = workbook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setFontHeightInPoints((short) 11);
|
||||
style.setFont(font);
|
||||
style.setWrapText(true);
|
||||
|
||||
if (Objects.equals(cell.getStringCellValue(),"非谐波统计报表")
|
||||
|| Objects.equals(cell.getStringCellValue(),"谐波电压统计报表")
|
||||
|| Objects.equals(cell.getStringCellValue(),"谐波电流统计报表")) {
|
||||
font.setFontHeightInPoints((short) 18);
|
||||
font.setBold(true);
|
||||
}
|
||||
if (Objects.equals(cell.getStringCellValue(),"有效值")
|
||||
|| Objects.equals(cell.getStringCellValue(),"功率")
|
||||
|| Objects.equals(cell.getStringCellValue(),"电压闪变")
|
||||
|| Objects.equals(cell.getStringCellValue(),"畸变率")
|
||||
|| Objects.equals(cell.getStringCellValue(),"电压偏差")
|
||||
|| Objects.equals(cell.getStringCellValue(),"频率")
|
||||
|| Objects.equals(cell.getStringCellValue(),"三相不平衡度")
|
||||
|| Objects.equals(cell.getStringCellValue(),"谐波电压含有率")
|
||||
|| Objects.equals(cell.getStringCellValue(),"谐波电流幅值")) {
|
||||
font.setFontHeightInPoints((short) 15);
|
||||
font.setBold(true);
|
||||
}
|
||||
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
workbook.write(baos);
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException(OssResponseEnum.DOWNLOAD_FILE_STREAM_ERROR);
|
||||
}
|
||||
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
filePath = fileStorageUtil.uploadStream(bais, OssPath.APP_HARMONIC_REPORT, "稳态报表.xlsx");
|
||||
try {
|
||||
bais.close();
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测并合并单元格(当没有 mc 标记时)
|
||||
*/
|
||||
private void detectAndMergeCells(JSONArray data, List<CellRangeAddress> mergeRegions,
|
||||
List<MergedCellInfo> mergedCellInfos) {
|
||||
int rows = data.size();
|
||||
if (rows == 0) return;
|
||||
|
||||
int cols = 0;
|
||||
JSONArray firstRow = data.getJSONArray(0);
|
||||
if (firstRow != null) {
|
||||
cols = firstRow.size();
|
||||
}
|
||||
|
||||
boolean[][] merged = new boolean[rows][cols];
|
||||
|
||||
for (int j = 0; j < rows; j++) {
|
||||
JSONArray rowData = data.getJSONArray(j);
|
||||
if (rowData == null) continue;
|
||||
|
||||
for (int k = 0; k < rowData.size(); k++) {
|
||||
if (merged[j][k]) continue;
|
||||
|
||||
JSONObject cellObj = rowData.getJSONObject(k);
|
||||
if (cellObj == null || cellObj.isEmpty()) continue;
|
||||
|
||||
Object v = cellObj.get("v");
|
||||
if (v == null || StrUtil.isBlank(v.toString())) continue;
|
||||
|
||||
int mergeEndRow = j;
|
||||
int mergeEndCol = k;
|
||||
|
||||
for (int r = j + 1; r < rows; r++) {
|
||||
JSONArray nextRow = data.getJSONArray(r);
|
||||
if (nextRow == null || k >= nextRow.size()) break;
|
||||
|
||||
JSONObject nextCellObj = nextRow.getJSONObject(k);
|
||||
if (nextCellObj == null || nextCellObj.isEmpty()) break;
|
||||
|
||||
Object nextV = nextCellObj.get("v");
|
||||
if (nextV == null || !String.valueOf(v).equals(String.valueOf(nextV))) break;
|
||||
|
||||
mergeEndRow = r;
|
||||
merged[r][k] = true;
|
||||
}
|
||||
|
||||
for (int c = k + 1; c < cols; c++) {
|
||||
if (j >= rowData.size()) break;
|
||||
|
||||
JSONObject rightCellObj = rowData.getJSONObject(c);
|
||||
if (rightCellObj == null || rightCellObj.isEmpty()) break;
|
||||
|
||||
Object rightV = rightCellObj.get("v");
|
||||
if (rightV == null || !String.valueOf(v).equals(String.valueOf(rightV))) break;
|
||||
|
||||
mergeEndCol = c;
|
||||
merged[j][c] = true;
|
||||
}
|
||||
|
||||
if (mergeEndRow > j || mergeEndCol > k) {
|
||||
mergeRegions.add(new CellRangeAddress(j, mergeEndRow, k, mergeEndCol));
|
||||
|
||||
MergedCellInfo info = new MergedCellInfo();
|
||||
info.row = j;
|
||||
info.col = k;
|
||||
info.cellObj = cellObj;
|
||||
mergedCellInfos.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格值
|
||||
*/
|
||||
private void setCellValue(Cell cell, Object value) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
cell.setCellValue((String) value);
|
||||
} else if (value instanceof Number) {
|
||||
cell.setCellValue(((Number) value).doubleValue());
|
||||
} else if (value instanceof Boolean) {
|
||||
cell.setCellValue((Boolean) value);
|
||||
} else if (value instanceof Date) {
|
||||
cell.setCellValue((Date) value);
|
||||
} else {
|
||||
cell.setCellValue(value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并单元格信息内部类
|
||||
*/
|
||||
private static class MergedCellInfo {
|
||||
int row;
|
||||
int col;
|
||||
JSONObject cellObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理
|
||||
*
|
||||
* @author cdf
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user