Compare commits
13 Commits
4e95159e01
...
2026-03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39cfffbf7e | ||
|
|
1aad1aa86b | ||
| fa500ca600 | |||
| 7b9fb1628b | |||
| fcddc064f6 | |||
| 37c5e9cbf8 | |||
| a08c7db24d | |||
| 9225e82edb | |||
| e8cd6da8a0 | |||
| 559620ab66 | |||
| f0b3b81e65 | |||
| 475ca820c8 | |||
|
|
c0db2cf961 |
3
pom.xml
3
pom.xml
@@ -39,6 +39,7 @@
|
|||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<properties>
|
<properties>
|
||||||
|
<spring.profiles.active>sjzx</spring.profiles.active>
|
||||||
<!--中间件目标地址-->
|
<!--中间件目标地址-->
|
||||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||||
<middle.server.url>192.168.1.103</middle.server.url>
|
<middle.server.url>192.168.1.103</middle.server.url>
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
<!--nacos开启鉴权后的用户名-->
|
<!--nacos开启鉴权后的用户名-->
|
||||||
<nacos.username>nacos</nacos.username>
|
<nacos.username>nacos</nacos.username>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.password>nacos</nacos.password>
|
<nacos.password>njcnpqs</nacos.password>
|
||||||
<!--服务器发布内容为空-->
|
<!--服务器发布内容为空-->
|
||||||
<nacos.namespace>hswbpm</nacos.namespace>
|
<nacos.namespace>hswbpm</nacos.namespace>
|
||||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</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.api.fallback.EventWaveAnalysisFeignClientFallbackFactory;
|
||||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
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.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.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.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -27,4 +33,7 @@ public interface EventWaveAnalysisFeignClient {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("analysis")
|
@PostMapping("analysis")
|
||||||
HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex);
|
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());
|
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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 正常计算
|
* 1 正常计算
|
||||||
*/
|
*/
|
||||||
private Integer typeFlag = 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 {
|
public static class ByValue extends CauseStruct implements Structure.ByValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected List<String> getFieldOrder() { // 返回值填入的顺序
|
||||||
|
// return Arrays.asList(new String[] { "cause", "no_cal" });
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getFieldOrder() { // 返回值填入的顺序
|
protected List<String> getFieldOrder() {
|
||||||
return Arrays.asList(new String[] { "cause", "no_cal" });
|
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
|
@Override
|
||||||
protected List<String> getFieldOrder() {
|
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;
|
private final EventWaveAnalysisService eventWaveAnalysisService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("analysis")
|
@PostMapping("analysis")
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@ApiOperation("波形高级分析")
|
@ApiOperation("波形高级分析")
|
||||||
@@ -43,6 +42,15 @@ public class EventWaveAnalysisController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("analysis");
|
String methodDescribe = getMethodDescribe("analysis");
|
||||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
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;
|
package com.njcn.advance.event.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.jna.QvvrCauseDLL;
|
||||||
import com.njcn.advance.event.cause.model.DataFeature;
|
import com.njcn.advance.event.cause.model.DataFeature;
|
||||||
import com.njcn.advance.event.type.jna.*;
|
import com.njcn.advance.event.type.jna.*;
|
||||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
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.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
import com.njcn.event.file.component.WaveFileComponent;
|
||||||
@@ -18,6 +21,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,11 +48,12 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
String waveName = eventAnalysis.getWaveName();
|
String waveName = eventAnalysis.getWaveName();
|
||||||
|
String wlFilePath = eventAnalysis.getWlFilePath();
|
||||||
String cfgPath, datPath, cfgPath2, datPath2;
|
String cfgPath, datPath, cfgPath2, datPath2;
|
||||||
String ip = eventAnalysis.getIp();
|
String ip = eventAnalysis.getIp();
|
||||||
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
cfgPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
datPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT : wlFilePath + GeneralConstant.DAT;
|
||||||
log.info("本地磁盘波形文件路径----" + cfgPath);
|
log.info("本地磁盘波形文件路径----" + cfgPath);
|
||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||||
@@ -57,11 +62,11 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
||||||
} else {
|
} else {
|
||||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
cfgPath = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
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();
|
cfgPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase() : wlFilePath + GeneralConstant.CFG.toLowerCase();
|
||||||
datPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase();
|
datPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase() : wlFilePath + GeneralConstant.DAT.toLowerCase();
|
||||||
log.info("文件服务器波形文件路径----" + cfgPath);
|
log.info("文件服务器波形文件路径----" + cfgPath);
|
||||||
try (
|
try (
|
||||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
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);
|
eventAnalysis.setType(globalFaultType);
|
||||||
} else {
|
} else {
|
||||||
eventAnalysis.setType(DataFeature.TYPE10);
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
@@ -158,4 +178,306 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
System.out.println("cause:" + eventAnalysis);
|
System.out.println("cause:" + eventAnalysis);
|
||||||
return 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 {
|
public interface EventWaveAnalysisService {
|
||||||
|
|
||||||
EntityAdvancedData analysis(String eventIndex);
|
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.date.TimeInterval;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.advance.enums.EnumEvt;
|
import com.njcn.advance.enums.EnumEvt;
|
||||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||||
|
|
||||||
import com.njcn.advance.service.EventWaveAnalysisService;
|
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.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
@@ -26,7 +29,10 @@ import net.sf.json.JSONObject;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
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.nio.charset.StandardCharsets;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -170,17 +176,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
causeStruct.smp_len = pitchList.size();
|
causeStruct.smp_len = pitchList.size();
|
||||||
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
|
||||||
|
|
||||||
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR);
|
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR);
|
||||||
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
||||||
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||||
|
|
||||||
|
|
||||||
if (rmpEventDetailPO.getDealFlag() != 1) {
|
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||||
//如果存在三个文件但是没有调用dll/so计算
|
//如果存在三个文件但是没有调用dll/so计算
|
||||||
|
|
||||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,6 +216,167 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
return entityAdvancedData;
|
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处理并保存结果
|
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||||
@@ -358,7 +521,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
||||||
|
|
||||||
//暂降原因计算
|
//暂降原因计算
|
||||||
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_dll_cause");
|
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_cause_dll");
|
||||||
jnaCallDllReason.setPath();
|
jnaCallDllReason.setPath();
|
||||||
|
|
||||||
JnaCallBalance.Balancelibrary CAUSE = JnaCallBalance.Balancelibrary.INSTANTCE;
|
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: sjzx
|
||||||
#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}
|
|
||||||
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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}
|
|
||||||
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
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}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.njcn.microservice.listener;
|
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.LoggerContext;
|
||||||
import ch.qos.logback.classic.joran.JoranConfigurator;
|
import ch.qos.logback.classic.joran.JoranConfigurator;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -34,33 +36,46 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void environmentPrepared(ConfigurableEnvironment environment) {
|
public void environmentPrepared(ConfigurableEnvironment environment) {
|
||||||
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
String active = environment.getProperty("spring.profiles.active");
|
||||||
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
if(!"jb".equalsIgnoreCase(active)){
|
||||||
String projectName = environment.getProperty("microservice.ename");
|
String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||||
String logLevel = environment.getProperty("logging.level.root");
|
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||||
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
String projectName = environment.getProperty("microservice.ename");
|
||||||
HttpHeaders headers = new HttpHeaders();
|
String logLevel = environment.getProperty("logging.level.root");
|
||||||
headers.set("cndl408125hawen", "lanxia201");
|
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
HttpHeaders headers = new HttpHeaders();
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
headers.set("cndl408125hawen", "lanxia201");
|
||||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||||
if (response.getStatusCode().is2xxSuccessful()) {
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
String logbackConfigContent = response.getBody();
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||||
//替换项目名称
|
if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
String logbackConfigContent = response.getBody();
|
||||||
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
//替换项目名称
|
||||||
// 应用获取到的Logback配置
|
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||||
applyLogbackConfig(logbackConfigContent);
|
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();
|
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||||
JoranConfigurator configurator = new JoranConfigurator();
|
JoranConfigurator configurator = new JoranConfigurator();
|
||||||
configurator.setContext(context);
|
configurator.setContext(context);
|
||||||
context.reset();
|
context.reset();
|
||||||
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(logbackConfigContent.getBytes(StandardCharsets.UTF_8))) {
|
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(logbackConfigContent.getBytes(StandardCharsets.UTF_8))) {
|
||||||
configurator.doConfigure(inputStream);
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
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.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
@@ -25,7 +25,7 @@ public class BZEventMessageTemplate extends RocketMQEnhanceTemplate {
|
|||||||
public SendResult sendMember(Object message, String tag) {
|
public SendResult sendMember(Object message, String tag) {
|
||||||
BaseMessage baseMessage = new BaseMessage();
|
BaseMessage baseMessage = new BaseMessage();
|
||||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||||
baseMessage.setMessageBody(new Gson().toJson(message));
|
baseMessage.setMessageBody(JSON.toJSONString(message));
|
||||||
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
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.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
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.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
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.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -169,4 +169,14 @@ public interface OssPath {
|
|||||||
*/
|
*/
|
||||||
String CONFIGURATIONNAME = "configuration.json";
|
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.harmonic.controller",
|
||||||
"com.njcn.prepare.event.controller",
|
"com.njcn.prepare.event.controller",
|
||||||
"com.njcn.device.pq.controller",
|
"com.njcn.device.pq.controller",
|
||||||
|
"com.njcn.device.terminal.controller",
|
||||||
"com.njcn.device.pms.controller",
|
"com.njcn.device.pms.controller",
|
||||||
"com.njcn.auth.controller",
|
"com.njcn.auth.controller",
|
||||||
"com.njcn.system.controller",
|
"com.njcn.system.controller",
|
||||||
@@ -74,6 +75,7 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.cswarn.controller",
|
"com.njcn.cswarn.controller",
|
||||||
"com.njcn.csharmonic.controller",
|
"com.njcn.csharmonic.controller",
|
||||||
"com.njcn.cssystem.controller",
|
"com.njcn.cssystem.controller",
|
||||||
|
"com.njcn.csreport.controller",
|
||||||
"com.njcn.advance.controller",
|
"com.njcn.advance.controller",
|
||||||
"com.njcn.stat.controller",
|
"com.njcn.stat.controller",
|
||||||
"com.njcn.rt.controller",
|
"com.njcn.rt.controller",
|
||||||
@@ -86,7 +88,9 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.dataProcess",
|
"com.njcn.dataProcess",
|
||||||
"com.njcn.migration",
|
"com.njcn.migration",
|
||||||
"com.njcn.harmonic.rstatlimitrate.controller",
|
"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());
|
.collect(Collectors.toList());
|
||||||
List<GrantType> grantTypes = new ArrayList<>();
|
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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
|
|
||||||
@@ -59,4 +59,7 @@ public class RunTimeVO implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
||||||
private Double onlineEvaluate;
|
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 cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -72,6 +73,12 @@ public class DataVerifyExcel implements Serializable {
|
|||||||
@Excel(name = "厂商")
|
@Excel(name = "厂商")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty(value = "电网标志")
|
||||||
|
@Excel(name = "电网标志")
|
||||||
|
@ApiModelProperty(name = "powerFlag",value = "电网标志")
|
||||||
|
private String powerFlag;
|
||||||
|
|
||||||
@ColumnWidth(20)
|
@ColumnWidth(20)
|
||||||
@ExcelProperty(value = "总指标异常时间")
|
@ExcelProperty(value = "总指标异常时间")
|
||||||
@Excel(name = "总指标异常时间")
|
@Excel(name = "总指标异常时间")
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.device.pq.utils;
|
package com.njcn.device.pq.utils;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
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.CityDataExcel;
|
||||||
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class DataLineExcelUtil {
|
|||||||
List<List<Object>> result = new ArrayList<>();
|
List<List<Object>> result = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(data)){
|
if(CollUtil.isNotEmpty(data)){
|
||||||
for (LineDataExcel datum : data) {
|
for (LineDataExcel datum : data) {
|
||||||
ArrayList<Object> row = Lists.newArrayList(datum.getLineNum(),
|
ArrayList<Object> row = ListUtil.toList(datum.getLineNum(),
|
||||||
datum.getLineName(),
|
datum.getLineName(),
|
||||||
datum.getDeptName(),
|
datum.getDeptName(),
|
||||||
datum.getPowerSubstationName(),
|
datum.getPowerSubstationName(),
|
||||||
@@ -89,7 +89,7 @@ public class DataLineExcelUtil {
|
|||||||
List<List<Object>> result = new ArrayList<>();
|
List<List<Object>> result = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(data)){
|
if(CollUtil.isNotEmpty(data)){
|
||||||
for (CityDataExcel datum : data) {
|
for (CityDataExcel datum : data) {
|
||||||
ArrayList<Object> row = Lists.newArrayList(datum.getDeptName(),
|
ArrayList<Object> row = ListUtil.toList(datum.getDeptName(),
|
||||||
datum.getDeviceNum(),
|
datum.getDeviceNum(),
|
||||||
datum.getLineNum(),
|
datum.getLineNum(),
|
||||||
datum.getOnlineRate(),
|
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("厂商"));
|
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) {
|
for (String field : sortedFields) {
|
||||||
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
||||||
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
||||||
@@ -209,6 +210,7 @@ public class FixedDynamicExcelExport {
|
|||||||
fieldAlls.add("objName");
|
fieldAlls.add("objName");
|
||||||
fieldAlls.add("powerSubstationName");
|
fieldAlls.add("powerSubstationName");
|
||||||
fieldAlls.add("manufacturer");
|
fieldAlls.add("manufacturer");
|
||||||
|
fieldAlls.add("powerFlag");
|
||||||
fieldAlls.add("allTime");
|
fieldAlls.add("allTime");
|
||||||
fieldAlls.addAll(fields);
|
fieldAlls.addAll(fields);
|
||||||
return fieldAlls;
|
return fieldAlls;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.controller;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
@@ -156,8 +157,10 @@ public class DataVerifyController extends BaseController {
|
|||||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||||
response.setContentType("application/vnd.ms-excel");
|
response.setContentType("application/vnd.ms-excel");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
if(StrUtil.isNotBlank(monitorBaseParam.getSearchBeginTime())&&StrUtil.isNotBlank(monitorBaseParam.getSearchEndTime())){
|
||||||
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
||||||
|
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
||||||
|
}
|
||||||
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ public class RunManageController extends BaseController {
|
|||||||
|
|
||||||
private final RunManageService runManageService;
|
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)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineLedger")
|
@PostMapping("/getLineLedger")
|
||||||
@ApiOperation("监测点台账信息")
|
@ApiOperation("监测点台账信息")
|
||||||
@@ -54,18 +65,18 @@ public class RunManageController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getRuntimeData")
|
@PostMapping("/getRuntimeData")
|
||||||
@ApiOperation("终端台账信息")
|
@ApiOperation("终端台账信息(通用)")
|
||||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
@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");
|
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||||
List<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
Page<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getDeviceLedger")
|
@PostMapping("/getDeviceLedger")
|
||||||
@ApiOperation("获取基本的终端台账信息")
|
@ApiOperation("获取基本的终端台账信息(冀北)")
|
||||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
||||||
public HttpResult<Page<RunTimeVO>> getDeviceLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
public HttpResult<Page<RunTimeVO>> getDeviceLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
||||||
String methodDescribe = getMethodDescribe("getRuntimeData");
|
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import java.util.List;
|
|||||||
* @date 2022/3/30
|
* @date 2022/3/30
|
||||||
*/
|
*/
|
||||||
public interface RunManageService {
|
public interface RunManageService {
|
||||||
|
|
||||||
|
Page<RunManageVO> getLineLedgerComm(RunManageParam runManageParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取监测点台账信息
|
* 获取监测点台账信息
|
||||||
* @param runManageParam 参数
|
* @param runManageParam 参数
|
||||||
@@ -27,7 +30,7 @@ public interface RunManageService {
|
|||||||
* @param runManageParam 参数
|
* @param runManageParam 参数
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
||||||
|
|
||||||
|
|
||||||
Page<RunTimeVO> getDeviceLedger(RunManageParam runManageParam);
|
Page<RunTimeVO> getDeviceLedger(RunManageParam runManageParam);
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
|||||||
@Override
|
@Override
|
||||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
||||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||||
if(CollectionUtils.isEmpty(monitorIds)){
|
if (CollectionUtils.isEmpty(monitorIds)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
||||||
@@ -435,6 +435,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
|||||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||||
|
dataVerifyExcel.setPowerFlag(areaLineInfoVO.getPowerFlag() == 0 ? "电网侧" : "非电网侧");
|
||||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,33 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
|
|
||||||
private final UserLedgerService userLedgerService;
|
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
|
@Override
|
||||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||||
List<RunManageVO> resultList = new ArrayList<>();
|
List<RunManageVO> resultList = new ArrayList<>();
|
||||||
@@ -103,34 +130,18 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
public Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
||||||
List<RunTimeVO> runManageDevList = new ArrayList<>();
|
|
||||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||||
|
deviceInfoParam.setServerName("pqs-common");
|
||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
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());
|
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());
|
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(devIndexes)) {
|
if (CollectionUtil.isEmpty(devIndexes)) {
|
||||||
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
throw new BusinessException("当前部门没有装置台账");
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
return deviceMapper.getRunManageDevList(new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam)),devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
||||||
return runManageDevList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -193,13 +193,16 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
||||||
if (Objects.isNull(userReportPO)) {
|
|
||||||
System.out.println(map);
|
|
||||||
}
|
|
||||||
TerminalTree terminalTree = new TerminalTree();
|
TerminalTree terminalTree = new TerminalTree();
|
||||||
terminalTree.setName(userReportPO.getProjectName());
|
if (Objects.isNull(userReportPO)) {
|
||||||
terminalTree.setId(userReportPO.getId());
|
terminalTree.setName("用户对象缺失");
|
||||||
terminalTree.setPid(userReportPO.getStationId());
|
terminalTree.setId(objId);
|
||||||
|
terminalTree.setPid("");
|
||||||
|
}else {
|
||||||
|
terminalTree.setName(userReportPO.getProjectName());
|
||||||
|
terminalTree.setId(userReportPO.getId());
|
||||||
|
terminalTree.setPid(userReportPO.getStationId());
|
||||||
|
}
|
||||||
terminalTree.setPowerFlag(1);
|
terminalTree.setPowerFlag(1);
|
||||||
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||||
terminalTree.setChildren(temDevList);
|
terminalTree.setChildren(temDevList);
|
||||||
|
|||||||
@@ -885,11 +885,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
private void coderM3d(Device deviceDetail, Boolean updateFlag) {
|
private void coderM3d(Device deviceDetail, Boolean updateFlag) {
|
||||||
if (updateFlag) {
|
if (updateFlag) {
|
||||||
Device deviceRes = deviceMapper.selectById(deviceDetail.getId());
|
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()));
|
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD, deviceDetail.getDevKey()));
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(deviceRes.getSeries(),deviceDetail.getSeries())) {
|
||||||
if (StrUtil.isNotBlank(deviceDetail.getSeries()) && !deviceRes.getSeries().equals(deviceDetail.getSeries())) {
|
|
||||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -900,7 +899,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decoderM3d(Device deviceDetail) {
|
private void decoderM3d(Device deviceDetail) {
|
||||||
|
|||||||
@@ -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);
|
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 监测点集合
|
* @param list 监测点集合
|
||||||
@@ -57,7 +70,8 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
* @param searchValue
|
* @param searchValue
|
||||||
* @return 结果
|
* @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("comFlag") List<Integer> comFlag,
|
||||||
@Param("runFlag") List<Integer> runFlag,
|
@Param("runFlag") List<Integer> runFlag,
|
||||||
@Param("manufacturers") List<String> manufacturer,
|
@Param("manufacturers") List<String> manufacturer,
|
||||||
|
|||||||
@@ -16,6 +16,128 @@
|
|||||||
|
|
||||||
</select>
|
</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 id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||||
SELECT
|
SELECT
|
||||||
linedetail.Num AS id,
|
linedetail.Num AS id,
|
||||||
@@ -137,10 +259,12 @@
|
|||||||
|
|
||||||
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
DISTINCT
|
||||||
dev.Id AS id,
|
dev.Id AS id,
|
||||||
area.NAME AS areaName,
|
area.NAME AS areaName,
|
||||||
gd.NAME AS gdName,
|
gd.NAME AS gdName,
|
||||||
sub.NAME AS bdName,
|
sub.NAME AS bdName,
|
||||||
|
obj.project_name objName,
|
||||||
manufacturerId.NAME AS manufacturer,
|
manufacturerId.NAME AS manufacturer,
|
||||||
dev.NAME AS devName,
|
dev.NAME AS devName,
|
||||||
device.IP AS ip,
|
device.IP AS ip,
|
||||||
@@ -152,7 +276,7 @@
|
|||||||
WHEN 0 THEN
|
WHEN 0 THEN
|
||||||
'投运'
|
'投运'
|
||||||
WHEN 1 THEN
|
WHEN 1 THEN
|
||||||
'热备用'
|
'检修'
|
||||||
WHEN 2 THEN
|
WHEN 2 THEN
|
||||||
'停运'
|
'停运'
|
||||||
END AS runFlag,
|
END AS runFlag,
|
||||||
@@ -165,8 +289,12 @@
|
|||||||
END AS comFlag,
|
END AS comFlag,
|
||||||
device.Update_Time AS updateTime
|
device.Update_Time AS updateTime
|
||||||
FROM
|
FROM
|
||||||
pq_line dev
|
pq_line line
|
||||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
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 gd ON gd.Id = sub.Pid
|
||||||
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
||||||
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
||||||
@@ -197,10 +325,13 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="searchValue != '' and searchValue != null ">
|
<if test="searchValue != '' and searchValue != null ">
|
||||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||||
AND sub.NAME LIKE #{searchValueLike}
|
AND
|
||||||
|
(sub.NAME LIKE #{searchValueLike}
|
||||||
OR dev.NAME LIKE #{searchValueLike}
|
OR dev.NAME LIKE #{searchValueLike}
|
||||||
OR devT.Name LIKE #{searchValueLike}
|
OR devT.Name LIKE #{searchValueLike}
|
||||||
OR device.IP LIKE #{searchValueLike}
|
OR device.IP LIKE #{searchValueLike}
|
||||||
|
OR obj.project_name LIKE #{searchValueLike}
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
gdName,
|
gdName,
|
||||||
|
|||||||
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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}
|
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.event.common.service;
|
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.common.pojo.dto.LineDetailDataCommDTO;
|
||||||
import com.njcn.event.pojo.param.ExportParam;
|
import com.njcn.event.pojo.param.ExportParam;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
@@ -7,6 +8,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
@@ -24,4 +26,11 @@ public interface CommMonitorEventReportService {
|
|||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
void createEventReport(List<String> index, HttpServletResponse response) throws IOException, InvalidFormatException;
|
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);
|
WaveDataDTO getWavedata(RmpEventDetailPO eventDetail, AreaLineInfoVO line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于云平台设备获取波形数据
|
||||||
|
* @param eventDetail
|
||||||
|
* @param line
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WaveDataDTO getWavedata2(RmpEventDetailPO eventDetail, AreaLineInfoVO line);
|
||||||
|
|
||||||
|
|
||||||
List<EventEigDetail> eventDetailEigenvalue(String eventDetailIndex,Integer ptType);
|
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.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.njcn.advance.api.EventCauseFeignClient;
|
||||||
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
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.echarts.util.DrawPicUtil;
|
||||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||||
import com.njcn.event.common.pojo.dto.EventEigDetail;
|
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.pojo.dto.LineDetailDataCommDTO;
|
||||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||||
import com.njcn.event.common.service.EventAnalysisService;
|
import com.njcn.event.common.service.EventAnalysisService;
|
||||||
import com.njcn.event.common.service.EventReportService;
|
import com.njcn.event.common.service.EventReportService;
|
||||||
import com.njcn.event.common.service.WaveService;
|
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.WordUtil;
|
||||||
import com.njcn.event.common.utils.WordUtils;
|
import com.njcn.event.common.utils.WordUtils;
|
||||||
import com.njcn.event.file.component.WavePicComponent;
|
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.EventDetail;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.event.pojo.vo.*;
|
import com.njcn.event.pojo.vo.*;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
@@ -47,7 +50,9 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
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.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -80,6 +85,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
|||||||
private final WavePicComponent wavePicComponent;
|
private final WavePicComponent wavePicComponent;
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final LineFeignClient lineFeignClient;
|
private final LineFeignClient lineFeignClient;
|
||||||
|
private final EventCauseFeignClient eventCauseFeignClient;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -650,4 +656,63 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
|||||||
throw new BusinessException(CommonResponseEnum.FAIL, "导出暂降事件报告异常");
|
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;
|
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
|
@Override
|
||||||
public List<EventEigDetail> eventDetailEigenvalue(String eventDetailIndex,Integer ptType) {
|
public List<EventEigDetail> eventDetailEigenvalue(String eventDetailIndex,Integer ptType) {
|
||||||
List<EventEigDetail> eventInfoDetails = new ArrayList<>();
|
List<EventEigDetail> eventInfoDetails = new ArrayList<>();
|
||||||
@@ -121,5 +158,42 @@ public class WaveServiceImpl implements WaveService {
|
|||||||
return eventInfoDetails;
|
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 sun.misc.BASE64Decoder;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@@ -152,6 +153,89 @@ public class WordUtil {
|
|||||||
System.out.println("11");
|
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 {
|
public void createPic(XWPFDocument document, String name, byte[] base64Info) throws IOException, InvalidFormatException {
|
||||||
XWPFParagraph picParagraph = getCenterParagraph(document);
|
XWPFParagraph picParagraph = getCenterParagraph(document);
|
||||||
XWPFRun createRun = picParagraph.createRun();
|
XWPFRun createRun = picParagraph.createRun();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.njcn.gateway.filter;
|
package com.njcn.gateway.filter;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
||||||
import com.nimbusds.jose.JWSObject;
|
import com.nimbusds.jose.JWSObject;
|
||||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
import com.njcn.common.pojo.dto.UserTokenInfo;
|
import com.njcn.common.pojo.dto.UserTokenInfo;
|
||||||
@@ -82,7 +82,7 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
|||||||
}
|
}
|
||||||
String blackUserKey = SecurityConstants.TOKEN_BLACKLIST_PREFIX + userIndex;
|
String blackUserKey = SecurityConstants.TOKEN_BLACKLIST_PREFIX + userIndex;
|
||||||
List<UserTokenInfo> blackUsers = (List<UserTokenInfo>) redisUtil.getObjectByKey(blackUserKey);
|
List<UserTokenInfo> blackUsers = (List<UserTokenInfo>) redisUtil.getObjectByKey(blackUserKey);
|
||||||
if (CollectionUtils.isNotEmpty(blackUsers)) {
|
if (CollUtil.isNotEmpty(blackUsers)) {
|
||||||
for (UserTokenInfo blackUser : blackUsers) {
|
for (UserTokenInfo blackUser : blackUsers) {
|
||||||
//存在当前的刷新token,则抛出业务异常
|
//存在当前的刷新token,则抛出业务异常
|
||||||
if(blackUser.getAccessTokenJti().equalsIgnoreCase(jti)){
|
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
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}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
package com.njcn.harmonic.utils;
|
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
|
* @version 1.0.0
|
||||||
* @createTime 2022/10/14 - 10:07
|
* @createTime 2022/10/14 - 10:07
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PublicDataUtils {
|
public class PublicDataUtils {
|
||||||
/**
|
/**
|
||||||
* 功能:下划线命名转驼峰命名
|
* 功能:下划线命名转驼峰命名
|
||||||
@@ -27,4 +36,91 @@ public class PublicDataUtils {
|
|||||||
}
|
}
|
||||||
return under;
|
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};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.njcn.user.api.DeptFeignClient;
|
|||||||
import com.njcn.user.pojo.po.Dept;
|
import com.njcn.user.pojo.po.Dept;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
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 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 NO_DATA_PLACEHOLDER = "无";
|
||||||
private static final String UNKNOWN_VALUE = "/";
|
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:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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,5 +1,6 @@
|
|||||||
package com.njcn.harmonic.common.mapper;
|
package com.njcn.harmonic.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||||
@@ -19,6 +20,7 @@ import java.util.Map;
|
|||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/8/16
|
* @date 2022/8/16
|
||||||
*/
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
public interface ExcelRptTempMapper extends BaseMapper<ExcelRptTemp> {
|
public interface ExcelRptTempMapper extends BaseMapper<ExcelRptTemp> {
|
||||||
|
|
||||||
Page<ReportTemplateVO> getReportTemplateListPage(Page<BaseParam> page, @Param("baseParam")BaseParam baseParam);
|
Page<ReportTemplateVO> getReportTemplateListPage(Page<BaseParam> page, @Param("baseParam")BaseParam baseParam);
|
||||||
|
|||||||
@@ -24,4 +24,10 @@ public interface CustomReportTableService {
|
|||||||
* @date 2022/10/18
|
* @date 2022/10/18
|
||||||
*/
|
*/
|
||||||
void getCustomReport(ReportSearchParam reportSearchParam, Map<String,String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response);
|
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.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
|
||||||
import com.njcn.harmonic.common.mapper.ExcelRptTempMapper;
|
import com.njcn.harmonic.common.mapper.ExcelRptTempMapper;
|
||||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||||
import com.njcn.harmonic.common.service.CustomReportTableService;
|
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.harmonic.pojo.po.ExcelRptTemp;
|
||||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.enums.OssResponseEnum;
|
import com.njcn.oss.enums.OssResponseEnum;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
@@ -40,13 +39,14 @@ import com.njcn.system.pojo.po.EleEpdPqd;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
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.apache.tomcat.util.http.fileupload.IOUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.*;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -69,18 +69,9 @@ import java.util.stream.Collectors;
|
|||||||
public class CustomReportTableServiceImpl implements CustomReportTableService {
|
public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||||
|
|
||||||
private final ExcelRptTempMapper excelRptTempMapper;
|
private final ExcelRptTempMapper excelRptTempMapper;
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
|
|
||||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
|
||||||
|
|
||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
|
||||||
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
||||||
|
|
||||||
private final String CELL_DATA = "celldata";
|
private final String CELL_DATA = "celldata";
|
||||||
@@ -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
|
* @author cdf
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10232
|
||||||
|
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.supervision.pojo
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10232
|
||||||
|
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.supervision.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: 10232
|
|
||||||
max-http-header-size: 1048576
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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.supervision.pojo
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
|
|
||||||
@@ -1,112 +1,112 @@
|
|||||||
package com.njcn.system.handler;
|
//package com.njcn.system.handler;
|
||||||
|
//
|
||||||
import cn.hutool.core.collection.CollUtil;
|
//import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
//import cn.hutool.json.JSONObject;
|
||||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
//import com.github.tocrhz.mqtt.annotation.Payload;
|
||||||
import com.njcn.common.pojo.constant.LogInfo;
|
//import com.njcn.common.pojo.constant.LogInfo;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
//import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
//import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||||
import com.njcn.common.utils.PubUtils;
|
//import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
//import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
//import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.service.IUserLogService;
|
//import com.njcn.system.service.IUserLogService;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
//import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.po.User;
|
//import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.web.utils.EmailUtil;
|
//import com.njcn.web.utils.EmailUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
//import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import java.nio.charset.StandardCharsets;
|
//import java.nio.charset.StandardCharsets;
|
||||||
import java.time.format.DateTimeFormatter;
|
//import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Objects;
|
//import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
//import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
//import java.util.stream.Collectors;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author hongawen
|
// * @author hongawen
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @date 2022年07月13日 13:35
|
// * @date 2022年07月13日 13:35
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class MqttMessageHandler {
|
//public class MqttMessageHandler {
|
||||||
|
//
|
||||||
private final IUserLogService userLogService;
|
// private final IUserLogService userLogService;
|
||||||
private final UserFeignClient userFeignClient;
|
// private final UserFeignClient userFeignClient;
|
||||||
private final EmailUtil emailUtil;
|
// private final EmailUtil emailUtil;
|
||||||
|
//
|
||||||
private final RedisUtil redisUtil;
|
// private final RedisUtil redisUtil;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
private JSONObject jsonObject = null;
|
// private JSONObject jsonObject = null;
|
||||||
/**
|
// /**
|
||||||
* 订阅审计日志的记录,并进行入库操作
|
// * 订阅审计日志的记录,并进行入库操作
|
||||||
*/
|
// */
|
||||||
// @MqttSubscribe(value = "/userLog")
|
//// @MqttSubscribe(value = "/userLog")
|
||||||
public void subUserLog(String topic, MqttMessage message, @Payload String payload) {
|
// public void subUserLog(String topic, MqttMessage message, @Payload String payload) {
|
||||||
if(Objects.isNull(jsonObject)){
|
// if(Objects.isNull(jsonObject)){
|
||||||
jsonObject = (JSONObject) redisUtil.getObjectByKey(RedisKeyEnum.USER_ROLE_TYPE_KEY.getKey());
|
// jsonObject = (JSONObject) redisUtil.getObjectByKey(RedisKeyEnum.USER_ROLE_TYPE_KEY.getKey());
|
||||||
if(Objects.isNull(jsonObject)){
|
// if(Objects.isNull(jsonObject)){
|
||||||
userFeignClient.userRoleList();
|
// userFeignClient.userRoleList();
|
||||||
jsonObject = (JSONObject) redisUtil.getObjectByKey(RedisKeyEnum.USER_ROLE_TYPE_KEY.getKey());
|
// jsonObject = (JSONObject) redisUtil.getObjectByKey(RedisKeyEnum.USER_ROLE_TYPE_KEY.getKey());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
LogInfoDTO logInfoDTO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),LogInfoDTO.class);
|
// LogInfoDTO logInfoDTO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),LogInfoDTO.class);
|
||||||
if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER) && !logInfoDTO.getOperate().equals(LogInfo.UNKNOWN_OPERATE) && !logInfoDTO.getIp().equals(LogInfo.UNKNOWN_IP)){
|
// if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER) && !logInfoDTO.getOperate().equals(LogInfo.UNKNOWN_OPERATE) && !logInfoDTO.getIp().equals(LogInfo.UNKNOWN_IP)){
|
||||||
if("注销".equals(logInfoDTO.getOperateType()) || "认证".equals(logInfoDTO.getOperateType())){
|
// if("注销".equals(logInfoDTO.getOperateType()) || "认证".equals(logInfoDTO.getOperateType())){
|
||||||
logInfoDTO.setType(1);
|
// logInfoDTO.setType(1);
|
||||||
}else {
|
// }else {
|
||||||
String loginName = logInfoDTO.getLoginName();
|
// String loginName = logInfoDTO.getLoginName();
|
||||||
if(StrUtil.isNotBlank(loginName) && jsonObject.containsKey(loginName)){
|
// if(StrUtil.isNotBlank(loginName) && jsonObject.containsKey(loginName)){
|
||||||
if((Integer) jsonObject.get(loginName)==2){
|
// if((Integer) jsonObject.get(loginName)==2){
|
||||||
logInfoDTO.setType(0);
|
// logInfoDTO.setType(0);
|
||||||
}else {
|
// }else {
|
||||||
logInfoDTO.setType(1);
|
// logInfoDTO.setType(1);
|
||||||
};
|
// };
|
||||||
}else {
|
// }else {
|
||||||
logInfoDTO.setType(1);
|
// logInfoDTO.setType(1);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
userLogService.addUserLog(logInfoDTO);
|
// userLogService.addUserLog(logInfoDTO);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 订阅审计日志的记录,并进行入库操作
|
// * 订阅审计日志的记录,并进行入库操作
|
||||||
*/
|
// */
|
||||||
// @MqttSubscribe(value = "/userLogEmailPush")
|
//// @MqttSubscribe(value = "/userLogEmailPush")
|
||||||
public void subUserLogEmail(String topic, MqttMessage message, @Payload String payload) {
|
// public void subUserLogEmail(String topic, MqttMessage message, @Payload String payload) {
|
||||||
LogInfoDTO auditLogVO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),LogInfoDTO.class);
|
// LogInfoDTO auditLogVO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),LogInfoDTO.class);
|
||||||
List<User> data = userFeignClient.getUserListByRoleCode("audit_manager").getData();
|
// List<User> data = userFeignClient.getUserListByRoleCode("audit_manager").getData();
|
||||||
List<String> emails = data.stream()
|
// List<String> emails = data.stream()
|
||||||
.filter(x -> Pattern.matches(PatternRegex.EMAIL_REGEX,x.getEmail()))
|
// .filter(x -> Pattern.matches(PatternRegex.EMAIL_REGEX,x.getEmail()))
|
||||||
.filter(x -> StrUtil.isNotBlank(x.getEmail()) && x.getEmailNotice() == 1)
|
// .filter(x -> StrUtil.isNotBlank(x.getEmail()) && x.getEmailNotice() == 1)
|
||||||
.map(User::getEmail).collect(Collectors.toList());
|
// .map(User::getEmail).collect(Collectors.toList());
|
||||||
if(CollUtil.isNotEmpty(emails)){
|
// if(CollUtil.isNotEmpty(emails)){
|
||||||
StringBuilder describe = new StringBuilder();
|
// StringBuilder describe = new StringBuilder();
|
||||||
describe.append(auditLogVO.getType() == 0 ? "业务事件 -> " : "系统事件 -> ");
|
// describe.append(auditLogVO.getType() == 0 ? "业务事件 -> " : "系统事件 -> ");
|
||||||
describe.append(auditLogVO.getUserName()).append("在")
|
// describe.append(auditLogVO.getUserName()).append("在")
|
||||||
.append(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(auditLogVO.getCreateTime()))
|
// .append(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(auditLogVO.getCreateTime()))
|
||||||
.append("在")
|
// .append("在")
|
||||||
.append(auditLogVO.getIp())
|
// .append(auditLogVO.getIp())
|
||||||
.append("执行了")
|
// .append("执行了")
|
||||||
.append(auditLogVO.getOperate())
|
// .append(auditLogVO.getOperate())
|
||||||
.append(",结果为");
|
// .append(",结果为");
|
||||||
if (auditLogVO.getResult() == 1) {
|
// if (auditLogVO.getResult() == 1) {
|
||||||
describe.append("成功");
|
// describe.append("成功");
|
||||||
}
|
// }
|
||||||
if (auditLogVO.getResult() == 0) {
|
// if (auditLogVO.getResult() == 0) {
|
||||||
describe.append("失败").append(",失败原因为").append(auditLogVO.getFailReason());
|
// describe.append("失败").append(",失败原因为").append(auditLogVO.getFailReason());
|
||||||
}
|
// }
|
||||||
emailUtil.sendMultiple(emails,"告警消息",describe.toString(),false);
|
// emailUtil.sendMultiple(emails,"告警消息",describe.toString(),false);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
65
pqs-system/system-boot/src/main/resources/bootstrap-jb.yml
Normal file
65
pqs-system/system-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10207
|
||||||
|
#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.system.pojo
|
||||||
|
|
||||||
|
runTake:
|
||||||
|
#最大重试次数
|
||||||
|
maxRetryCount: 10
|
||||||
|
#等待时间(毫秒)
|
||||||
|
delayTime: 25000
|
||||||
|
|
||||||
|
#清除日志月份
|
||||||
|
clear:
|
||||||
|
num: 3
|
||||||
70
pqs-system/system-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
70
pqs-system/system-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10207
|
||||||
|
#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-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.system.pojo
|
||||||
|
|
||||||
|
runTake:
|
||||||
|
#最大重试次数
|
||||||
|
maxRetryCount: 10
|
||||||
|
#等待时间(毫秒)
|
||||||
|
delayTime: 25000
|
||||||
|
|
||||||
|
#清除日志月份
|
||||||
|
clear:
|
||||||
|
num: 3
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
@@ -1,66 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10207
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#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-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.system.pojo
|
|
||||||
|
|
||||||
runTake:
|
|
||||||
#最大重试次数
|
|
||||||
maxRetryCount: 10
|
|
||||||
#等待时间(毫秒)
|
|
||||||
delayTime: 25000
|
|
||||||
|
|
||||||
#清除日志月份
|
|
||||||
clear:
|
|
||||||
num: 3
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
@@ -26,11 +26,11 @@ public class AppInfoSetParam {
|
|||||||
@ApiModelProperty(value = "设备告警")
|
@ApiModelProperty(value = "设备告警")
|
||||||
private Integer alarmInfo;
|
private Integer alarmInfo;
|
||||||
|
|
||||||
@ApiModelProperty("是否开启出厂调试0:false ;1:true")
|
@ApiModelProperty("0:false ;1:true itic功能是否开启")
|
||||||
private Integer exFactoryBug;
|
private Integer iticFunction;
|
||||||
|
|
||||||
@ApiModelProperty("是否开启功能调试0:false ;1:true")
|
@ApiModelProperty("0:false ;1:true f47功能是否开启")
|
||||||
private Integer functionBug;
|
private Integer f47Function;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ public class AppInfoSet {
|
|||||||
@ApiModelProperty("设备告警")
|
@ApiModelProperty("设备告警")
|
||||||
private Integer alarmInfo;
|
private Integer alarmInfo;
|
||||||
|
|
||||||
@ApiModelProperty("是否开启出厂调试0:false ;1:true")
|
@ApiModelProperty("0:false ;1:true itic功能是否开启")
|
||||||
private Integer exFactoryBug;
|
private Integer iticFunction;
|
||||||
|
|
||||||
@ApiModelProperty("是否开启功能调试0:false ;1:true")
|
@ApiModelProperty("0:false ;1:true f47功能是否开启")
|
||||||
private Integer functionBug;
|
private Integer f47Function;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
|
||||||
import com.njcn.user.enums.UserResponseEnum;
|
import com.njcn.user.enums.UserResponseEnum;
|
||||||
import com.njcn.user.pojo.po.Role;
|
import com.njcn.user.pojo.po.Role;
|
||||||
import com.njcn.user.pojo.po.UserRole;
|
import com.njcn.user.pojo.po.UserRole;
|
||||||
import com.njcn.user.pojo.po.app.AppInfoSet;
|
|
||||||
import com.njcn.user.service.IAppInfoSetService;
|
import com.njcn.user.service.IAppInfoSetService;
|
||||||
import com.njcn.user.service.IAppRoleService;
|
import com.njcn.user.service.IAppRoleService;
|
||||||
import com.njcn.user.service.IRoleService;
|
import com.njcn.user.service.IRoleService;
|
||||||
@@ -58,13 +56,13 @@ public class AppRoleServiceImpl implements IAppRoleService {
|
|||||||
LambdaUpdateWrapper<UserRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<UserRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(UserRole::getUserId, userId).set(UserRole::getRoleId, roleByCode.getId());
|
lambdaUpdateWrapper.eq(UserRole::getUserId, userId).set(UserRole::getRoleId, roleByCode.getId());
|
||||||
userRoleService.update(lambdaUpdateWrapper);
|
userRoleService.update(lambdaUpdateWrapper);
|
||||||
if (Objects.equals(roleByCode.getCode(), AppRoleEnum.ENGINEERING_USER.getCode())) {
|
// if (Objects.equals(roleByCode.getCode(), AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||||
iAppInfoSetService.lambdaUpdate().
|
// iAppInfoSetService.lambdaUpdate().
|
||||||
eq(AppInfoSet::getUserId, userId).
|
// eq(AppInfoSet::getUserId, userId).
|
||||||
set(AppInfoSet::getExFactoryBug, 1).
|
// set(AppInfoSet::getExFactoryBug, 1).
|
||||||
set(AppInfoSet::getFunctionBug, 1).
|
// set(AppInfoSet::getFunctionBug, 1).
|
||||||
update();
|
// update();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:
|
* 类的介绍:
|
||||||
@@ -195,8 +192,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
appInfoSet.setEventInfo(1);
|
appInfoSet.setEventInfo(1);
|
||||||
appInfoSet.setRunInfo(1);
|
appInfoSet.setRunInfo(1);
|
||||||
appInfoSet.setAlarmInfo(1);
|
appInfoSet.setAlarmInfo(1);
|
||||||
appInfoSet.setFunctionBug(0);
|
appInfoSet.setIticFunction(0);
|
||||||
appInfoSet.setExFactoryBug(0);
|
appInfoSet.setF47Function(0);
|
||||||
appInfoSetService.save(appInfoSet);
|
appInfoSetService.save(appInfoSet);
|
||||||
//发送用户初始密码
|
//发送用户初始密码
|
||||||
password = redisUtil.getStringByKey(newUser.getId());
|
password = redisUtil.getStringByKey(newUser.getId());
|
||||||
@@ -365,7 +362,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<User> getAdminInfo() {
|
public List<User> getAdminInfo() {
|
||||||
return this.lambdaQuery().eq(User::getType,1).eq(User::getState,1).list();
|
return this.lambdaQuery().in(User::getType, Arrays.asList(0,1)).ne(User::getState,Arrays.asList(0,3)).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -580,7 +580,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
if (CollectionUtil.isEmpty(ids)) {
|
if (CollectionUtil.isEmpty(ids)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return this.baseMapper.getUserVOByIdList(ids);
|
List<UserVO> list = this.baseMapper.getUserVOByIdList(ids);
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(item->{
|
||||||
|
List<Role> roles = userRoleService.getRoleListByUserId(item.getId());
|
||||||
|
item.setRoleList(roles.stream().map(Role::getId).collect(Collectors.toList()));
|
||||||
|
item.setRoleCode(roles.stream().map(Role::getCode).collect(Collectors.toList()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
53
pqs-user/user-boot/src/main/resources/bootstrap-jb.yml
Normal file
53
pqs-user/user-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10201
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
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
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
84
pqs-user/user-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
84
pqs-user/user-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10201
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
# main:
|
||||||
|
# allow-bean-definition-overriding: true
|
||||||
|
# #nacos注册中心以及配置中心的指定
|
||||||
|
# cloud:
|
||||||
|
# servicecomb:
|
||||||
|
# service:
|
||||||
|
# name: ${spring.application.name}
|
||||||
|
# version: 0.0.1
|
||||||
|
# application: pms-application
|
||||||
|
# environment: production
|
||||||
|
# discovery:
|
||||||
|
# address: https://116.63.42.60:30100
|
||||||
|
# health-check-interval: 10
|
||||||
|
# poll-interval: 15000
|
||||||
|
# wait-time-for-shut-down-in-millis: 15000
|
||||||
|
# config:
|
||||||
|
# server-addr: https://116.63.42.60:30110
|
||||||
|
# server-type: kie
|
||||||
|
# kie:
|
||||||
|
# custom-label: ${spring.application.name}
|
||||||
|
# custom-label-value: default
|
||||||
|
# 自定义配置,使用文本的key/value配置项作为yaml格式配置
|
||||||
|
# fileSource: cse.share.yaml,cse.db.yaml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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,80 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10201
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
# main:
|
|
||||||
# allow-bean-definition-overriding: true
|
|
||||||
# #nacos注册中心以及配置中心的指定
|
|
||||||
# cloud:
|
|
||||||
# servicecomb:
|
|
||||||
# service:
|
|
||||||
# name: ${spring.application.name}
|
|
||||||
# version: 0.0.1
|
|
||||||
# application: pms-application
|
|
||||||
# environment: production
|
|
||||||
# discovery:
|
|
||||||
# address: https://116.63.42.60:30100
|
|
||||||
# health-check-interval: 10
|
|
||||||
# poll-interval: 15000
|
|
||||||
# wait-time-for-shut-down-in-millis: 15000
|
|
||||||
# config:
|
|
||||||
# server-addr: https://116.63.42.60:30110
|
|
||||||
# server-type: kie
|
|
||||||
# kie:
|
|
||||||
# custom-label: ${spring.application.name}
|
|
||||||
# custom-label-value: default
|
|
||||||
# 自定义配置,使用文本的key/value配置项作为yaml格式配置
|
|
||||||
# fileSource: cse.share.yaml,cse.db.yaml
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user