Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f1ae1886a | ||
|
|
af4863af65 | ||
| 2012221b73 | |||
|
|
f4df52dd1c | ||
| 41c557118c | |||
| 6596a572d6 | |||
|
|
786bd5d660 | ||
|
|
21d2c2b7a7 | ||
|
|
48fa4c2390 | ||
|
|
9d15351fba | ||
|
|
2339a006ec | ||
|
|
7fd904ab79 | ||
|
|
40cb153656 | ||
|
|
f922ee97aa | ||
|
|
26c5e933f5 | ||
|
|
c7d8fc3168 | ||
|
|
bb22857fc9 | ||
|
|
6ef908ff60 | ||
|
|
7461801657 | ||
|
|
4ecec5e6ef | ||
|
|
04a667531b | ||
|
|
a0f6846f53 | ||
|
|
a177d7991c | ||
|
|
f8fb45cf6f | ||
|
|
910069a463 | ||
| 56477157aa | |||
| a6b0509179 | |||
|
|
b5e5286411 | ||
|
|
d01c0e14c0 | ||
|
|
0cf8bbc3d5 | ||
|
|
3a239b5123 | ||
|
|
0eabe977cb | ||
|
|
f1f86ea854 | ||
|
|
e048c92ad1 | ||
|
|
65f46a22f5 |
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.detection.handler;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -627,7 +628,7 @@ public class SocketDevResponseService {
|
||||
|
||||
private void assemblyEntity(List<DevData> deList, DevXiNumData.F F, DevXiNumData.GF startF, CoefficientVO coefficientVO, CoefficientVO.DevParameter devParameter) {
|
||||
//表示接收完成,必须保证3个数
|
||||
if (deList.size() >= 3) {
|
||||
if (deList.size() >= 7) {
|
||||
List<Double> aList = deList.stream().map(it -> it.getSqlData().get(0).getList().getA()).collect(Collectors.toList());
|
||||
List<Double> bList = deList.stream().map(it -> it.getSqlData().get(0).getList().getB()).collect(Collectors.toList());
|
||||
List<Double> cList = deList.stream().map(it -> it.getSqlData().get(0).getList().getC()).collect(Collectors.toList());
|
||||
@@ -702,7 +703,7 @@ public class SocketDevResponseService {
|
||||
*/
|
||||
private Double reduceList(List<Double> valList) {
|
||||
// valList.subList(0, 5).clear();
|
||||
// valList.subList(valList.size() - 3, valList.size() - 1).clear();
|
||||
valList.subList(valList.size() - 2, valList.size()).clear();
|
||||
return valList.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
|
||||
}
|
||||
|
||||
@@ -1725,6 +1726,9 @@ public class SocketDevResponseService {
|
||||
|
||||
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
|
||||
FormalTestManager.devList = pqDevList;
|
||||
FormalTestManager.devList.forEach(x -> {
|
||||
x.setDevType(x.getIcdType());
|
||||
});
|
||||
FormalTestManager.devMapMonitorNum = pqDevList.stream().collect(Collectors.toMap(PreDetection::getDevIP, it -> it.getMonitorList().stream().map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList())));
|
||||
FormalTestManager.monitorIdListComm = pqDevList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -134,16 +134,13 @@ public class SocketSourceResponseService {
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
break;
|
||||
case UNKNOWN_ERROR:
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
break;
|
||||
case UNABLE_TO_RESPOND:
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
break;
|
||||
default:
|
||||
CnSocketUtil.sendUnSocket(param.getUserPageId());
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -197,8 +194,10 @@ public class SocketSourceResponseService {
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
phaseSequenceParam.setMoniterIdList(monitorIdList);
|
||||
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$IRMS"));
|
||||
phaseSequenceParam.setReadCount(3);
|
||||
phaseSequenceParam.setIgnoreCount(4);
|
||||
// 读取3次数据用于系数计算
|
||||
phaseSequenceParam.setReadCount(7); //3
|
||||
// 忽略前4次数据,等待测量稳定
|
||||
phaseSequenceParam.setIgnoreCount(3); //4
|
||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
|
||||
@@ -234,9 +233,9 @@ public class SocketSourceResponseService {
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
String s = param.getUserPageId() + DEV;
|
||||
//开始设备通讯检测(发送设备初始化)
|
||||
List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
||||
//List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
||||
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||
map.put("deviceList", devList);
|
||||
map.put("deviceList", FormalTestManager.devList);
|
||||
String jsonString = JSON.toJSONString(map);
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.device.pojo.enums.CheckResultEnum;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||
@@ -774,6 +775,9 @@ public class DetectionServiceImpl {
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
DetectionData a = setDetectionData(isQualified, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
||||
if (CollUtil.isEmpty(mag.get(TYPE_A))) {
|
||||
a.setIsData(2);
|
||||
}
|
||||
result.setAValue(JSON.toJSONString(a));
|
||||
result.setTValue(JSON.toJSONString(a));
|
||||
result.setResultFlag(a.getIsData());
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.Getter;
|
||||
public enum DevReportStateEnum {
|
||||
NOT_GENERATED("未生成", 0),
|
||||
GENERATED("已生成", 1),
|
||||
GENERATED_UPLOADED("已生成且已上传", 3),
|
||||
UNCHECKED("未检", 2);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
@@ -351,7 +351,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
.like(StrUtil.isNotBlank(param.getName()), PqDev::getName, param.getName())
|
||||
.in(ObjectUtil.isNotEmpty(param.getCheckStateList()), PqDev::getCheckState, param.getCheckStateList())
|
||||
.eq(ObjectUtil.isNotNull(param.getCheckResult()), PqDev::getCheckResult, param.getCheckResult())
|
||||
.eq(ObjectUtil.isNotNull(param.getCheckResult()), PqDev::getCheckResult, param.getCheckResult())
|
||||
.eq(ObjectUtil.isNotNull(param.getReportState()), PqDev::getReportState, param.getReportState())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(PqDev::getCreateTime)
|
||||
|
||||
@@ -156,4 +156,15 @@ public class ReportController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/uploadReportToCloud")
|
||||
@ApiOperation("批量上传检测报告到云端")
|
||||
@ApiImplicitParam(name = "deviceIds", value = "被检设备ID列表,为空时上传所有已生成报告的设备", required = false)
|
||||
public HttpResult<Object> uploadReportToCloud(@RequestBody(required = false) List<String> deviceIds) {
|
||||
String methodDescribe = getMethodDescribe("uploadReportToCloud");
|
||||
LogUtil.njcnDebug(log, "{},设备ID列表为:{}", methodDescribe, deviceIds);
|
||||
pqReportService.uploadReportToCloud(deviceIds);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,10 @@ public enum BaseReportKeyEnum {
|
||||
YEAR_MONTH_DAY("year-month-day","年-月-日"),
|
||||
TEMPERATURE("temp","温度"),
|
||||
HUMIDITY("hum","相对湿度"),
|
||||
DELEGATE("delegate","委托方");
|
||||
DELEGATE("delegate","委托方"),
|
||||
CREATEDATE("createDate","出厂日期"),
|
||||
HW_VERSION("hardwareVersion","硬件版本"),
|
||||
SW_VERSION("softwareVersion","软件版本");
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
@@ -76,6 +76,11 @@ public interface IPqReportService extends IService<PqReport> {
|
||||
*/
|
||||
boolean documented(List<String> id);
|
||||
|
||||
|
||||
/**
|
||||
* 批量上传检测报告到云端
|
||||
*
|
||||
* @param deviceIds 被检设备ID列表,为空时上传所有已生成报告的设备
|
||||
*/
|
||||
void uploadReportToCloud(List<String> deviceIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -100,8 +100,10 @@ import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -156,6 +158,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
@Value("${qr.gcDev.path}")
|
||||
private String gcDevPath;
|
||||
|
||||
@Value("${report.dateFormat}")
|
||||
private String dateFormat;
|
||||
|
||||
private final IPqDevService iPqDevService;
|
||||
private final PqDevMapper pqDevMapper;
|
||||
|
||||
@@ -615,17 +620,30 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
out.close();
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||
// // 检测报告上云
|
||||
// Future<?> future = executor.submit(() -> {
|
||||
// sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||
// });
|
||||
// try {
|
||||
// future.get();
|
||||
// } catch (Exception e) {
|
||||
// log.error("检测报告上云异常,异常为:"+e.getMessage());
|
||||
// }
|
||||
|
||||
// 异步将有效的二维码下装到被检设备
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
sendQrToDevice(pqDevVO.getIp(), pqDevVO.getCreateId() + ".docx");
|
||||
log.info("二维码下装成功,设备IP: {}", pqDevVO.getIp());
|
||||
} catch (Exception e) {
|
||||
log.error("二维码下装失败,设备IP: {}", pqDevVO.getIp(), e);
|
||||
}
|
||||
});
|
||||
// 异步将检测报告上传到云端,但是不一定成功,需要无线网支撑
|
||||
CompletableFuture.runAsync(() -> {
|
||||
File file = new File(reportFullPath);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
ResponseEntity<String> responseEntity = restTemplateUtil.uploadFile(cloudUrl + "/upload", file);
|
||||
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
||||
// 将被检设备的报告状态改为已生成且已上传
|
||||
iPqDevService.updatePqDevReportState(devReportParam.getDevId(), DevReportStateEnum.GENERATED_UPLOADED.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("文件上传到云端失败", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
@@ -633,6 +651,68 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void sendQrToDevice(String devIp, String reportName) {
|
||||
try {
|
||||
// 上传没问题后,拼接url生成二维码,并将二维码转为bin格式文件传递给设备通讯模块
|
||||
String qrUrl = cloudUrl + "/download/" + reportName;
|
||||
BufferedImage bufferedImage = QrCodeUtil.generate(qrUrl, 148, 148);
|
||||
// 将 BufferedImage 转换为单色图像
|
||||
BufferedImage monoImage = new BufferedImage(148, 148, BufferedImage.TYPE_BYTE_BINARY);
|
||||
Graphics2D g2d = monoImage.createGraphics();
|
||||
g2d.drawImage(bufferedImage, 0, 0, null);
|
||||
g2d.dispose();
|
||||
// 3. 【关键修正】创建一个新的1-bit单色图像,并将原始图像绘制上去,以强制转换为单色位图
|
||||
BufferedImage monochromeImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
|
||||
monochromeImage.getGraphics().drawImage(bufferedImage, 0, 0, null);
|
||||
// 4. 将单色图像在内存中编码为完整的BMP文件流
|
||||
byte[] finalBinData = ImageConverter.convertToBinFormat(bufferedImage);
|
||||
String base64String = Base64.getEncoder().encodeToString(finalBinData);
|
||||
|
||||
// 测试ftp是否连接成功
|
||||
|
||||
|
||||
// 组装设备通讯模块的参数
|
||||
SocketMsg<String> sendFileMsg = new SocketMsg<>();
|
||||
sendFileMsg.setOperateCode(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
||||
sendFileMsg.setRequestId(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
||||
|
||||
// 组装业务数据
|
||||
JSONObject data = new JSONObject();
|
||||
if (testFTPConnection(devIp, devPort, devName, devPsd)) {
|
||||
data.set("name", devName);
|
||||
data.set("password", devPsd);
|
||||
data.set("port", devPort);
|
||||
data.set("path", "ftp://" + devIp + devPath);
|
||||
} else if (testFTPConnection(devIp, gcDevPort, gcDevName, gcDevPsd)) {
|
||||
data.set("name", gcDevName);
|
||||
data.set("password", gcDevPsd);
|
||||
data.set("port", gcDevPort);
|
||||
data.set("path", "ftp://" + devIp + gcDevPath);
|
||||
} else {
|
||||
throw new BusinessException(ReportResponseEnum.FTP_CONNECTION_FAILED);
|
||||
}
|
||||
data.set("file", base64String);
|
||||
sendFileMsg.setData(data.toString());
|
||||
String msg = JSON.toJSONString(sendFileMsg);
|
||||
Channel channel = SocketManager.getChannelByUserId("cdf" + DetectionCommunicateConstant.DEV);
|
||||
if (Objects.isNull(channel) || !channel.isActive()) {
|
||||
// 进行源通信连接
|
||||
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||
preDetectionParam.setUserPageId("cdf");
|
||||
preDetectionParam.setSendWebMsg(false);
|
||||
|
||||
NettyClient.socketClient(ip, port, preDetectionParam, msg, new NettyDevClientHandler(preDetectionParam, socketDevResponseService));
|
||||
} else {
|
||||
channel.writeAndFlush(msg + "\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 进行日志记录入口
|
||||
System.out.println("异常为:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试FTP连接
|
||||
*
|
||||
@@ -682,83 +762,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理检测报告上传云服务器并生成二维码下装到装置
|
||||
* 做成异步执行
|
||||
*
|
||||
* @param devIp 设备IP
|
||||
* @param reportFullPath 检测报告本地全路径
|
||||
* @param reportName 检测报告名称
|
||||
*/
|
||||
public void sendReportToCloud(String devIp, String reportFullPath, String reportName) {
|
||||
// 将文件上传至目标服务器
|
||||
File file = new File(reportFullPath);
|
||||
try {
|
||||
ResponseEntity<String> responseEntity = restTemplateUtil.uploadFile(cloudUrl + "/upload", file);
|
||||
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
||||
// 上传没问题后,拼接url生成二维码,并将二维码转为bin格式文件传递给设备通讯模块
|
||||
String qrUrl = cloudUrl + "/download/" + reportName;
|
||||
BufferedImage bufferedImage = QrCodeUtil.generate(qrUrl, 148, 148);
|
||||
// 将 BufferedImage 转换为单色图像
|
||||
BufferedImage monoImage = new BufferedImage(148, 148, BufferedImage.TYPE_BYTE_BINARY);
|
||||
Graphics2D g2d = monoImage.createGraphics();
|
||||
g2d.drawImage(bufferedImage, 0, 0, null);
|
||||
g2d.dispose();
|
||||
// 3. 【关键修正】创建一个新的1-bit单色图像,并将原始图像绘制上去,以强制转换为单色位图
|
||||
BufferedImage monochromeImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
|
||||
monochromeImage.getGraphics().drawImage(bufferedImage, 0, 0, null);
|
||||
// 4. 将单色图像在内存中编码为完整的BMP文件流
|
||||
byte[] finalBinData = ImageConverter.convertToBinFormat(bufferedImage);
|
||||
String base64String = Base64.getEncoder().encodeToString(finalBinData);
|
||||
|
||||
// 测试ftp是否连接成功
|
||||
|
||||
|
||||
// 组装设备通讯模块的参数
|
||||
SocketMsg<String> sendFileMsg = new SocketMsg<>();
|
||||
sendFileMsg.setOperateCode(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
||||
sendFileMsg.setRequestId(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
||||
|
||||
// 组装业务数据
|
||||
JSONObject data = new JSONObject();
|
||||
if (testFTPConnection(cloudUrl, devPort, devName, devPsd)) {
|
||||
data.set("name", devName);
|
||||
data.set("password", devPsd);
|
||||
data.set("port", devPort);
|
||||
data.set("path", "ftp://" + devIp + devPath);
|
||||
} else if (testFTPConnection(cloudUrl, gcDevPort, gcDevName, gcDevPsd)) {
|
||||
data.set("name", gcDevName);
|
||||
data.set("password", gcDevPsd);
|
||||
data.set("port", gcDevPort);
|
||||
data.set("path", "ftp://" + devIp + gcDevPath);
|
||||
} else {
|
||||
throw new BusinessException(ReportResponseEnum.FTP_CONNECTION_FAILED);
|
||||
}
|
||||
data.set("file", base64String);
|
||||
sendFileMsg.setData(data.toString());
|
||||
String msg = JSON.toJSONString(sendFileMsg);
|
||||
Channel channel = SocketManager.getChannelByUserId("cdf" + DetectionCommunicateConstant.DEV);
|
||||
if (Objects.isNull(channel) || !channel.isActive()) {
|
||||
// 进行源通信连接
|
||||
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||
preDetectionParam.setUserPageId("cdf");
|
||||
preDetectionParam.setSendWebMsg(false);
|
||||
|
||||
NettyClient.socketClient(ip, port, preDetectionParam, msg, new NettyDevClientHandler(preDetectionParam, socketDevResponseService));
|
||||
} else {
|
||||
channel.writeAndFlush(msg + "\n");
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 进行日志记录入口
|
||||
System.out.println("异常为:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据计划绑定的报告模板生成报告
|
||||
* 注:该方法目前属于同用信息占位符替换,数据页为面向对象动态填充拼凑方式
|
||||
@@ -1229,16 +1232,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
Tr existingRow = (Tr) tbl.getContent().get(rows.size() - 1);
|
||||
// 获取现有样式
|
||||
TrPr trPr = existingRow.getTrPr();
|
||||
JAXBElement<Tc> element = (JAXBElement<Tc>) existingRow.getContent().get(0);
|
||||
TcPr tcPr = element.getValue().getTcPr();
|
||||
TblWidth cellWidth = factory.createTblWidth();
|
||||
cellWidth.setType("dxa");
|
||||
cellWidth.setW(BigInteger.valueOf(5000 / tableKeys.size()));
|
||||
tcPr.setTcW(cellWidth);
|
||||
// 获取每个单元格的TcPr(保留各单元格独立的边框设置)
|
||||
List<TcPr> tcPrList = new ArrayList<>();
|
||||
RPr templateRPr = null;
|
||||
for (Object cellObj : existingRow.getContent()) {
|
||||
if (cellObj instanceof JAXBElement) {
|
||||
JAXBElement<Tc> cellElement = (JAXBElement<Tc>) cellObj;
|
||||
Tc templateCell = cellElement.getValue();
|
||||
TcPr tcPr = templateCell.getTcPr();
|
||||
// 设置单元格宽度
|
||||
if (tcPr == null) {
|
||||
tcPr = factory.createTcPr();
|
||||
}
|
||||
TblWidth cellWidth = factory.createTblWidth();
|
||||
cellWidth.setType("dxa");
|
||||
cellWidth.setW(BigInteger.valueOf(5000 / tableKeys.size()));
|
||||
tcPr.setTcW(cellWidth);
|
||||
tcPrList.add(tcPr);
|
||||
// 从第一个单元格获取字体样式
|
||||
if (templateRPr == null && !templateCell.getContent().isEmpty() && templateCell.getContent().get(0) instanceof P) {
|
||||
P templateP = (P) templateCell.getContent().get(0);
|
||||
templateRPr = Docx4jUtil.getTcPrFromParagraph(templateP);
|
||||
}
|
||||
}
|
||||
}
|
||||
tbl.getContent().remove(existingRow);
|
||||
// 迭代增加行,需要填充的表格keys在tableKeys集合中
|
||||
for (Map<String, String> stringStringMap : dataList) {
|
||||
Tr newRow = Docx4jUtil.createCustomRow(factory, stringStringMap, tableKeys, trPr, tcPr, true);
|
||||
Tr newRow = Docx4jUtil.createCustomRow(factory, stringStringMap, tableKeys, trPr, tcPrList, templateRPr, true);
|
||||
tbl.getContent().add(newRow);
|
||||
}
|
||||
} else {
|
||||
@@ -1407,11 +1428,24 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.DEV_TYPE.getKey() + suffix, devType.getName());
|
||||
// 检测员
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.INSPECTOR.getKey() + suffix, pqDevVO.getCheckBy() + "");
|
||||
String datePattern = DatePattern.NORM_DATE_PATTERN;
|
||||
if (DatePattern.CHINESE_DATE_PATTERN.equals(dateFormat)) {
|
||||
datePattern = DatePattern.CHINESE_DATE_PATTERN;
|
||||
}
|
||||
|
||||
|
||||
// 出厂日期
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.CREATEDATE.getKey() + suffix, pqDevVO.getCreateDate().format(DateTimeFormatter.ofPattern(datePattern)));
|
||||
// 硬件版本
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.HW_VERSION.getKey() + suffix, StrUtil.isNotBlank(pqDevVO.getHardwareVersion()) ? pqDevVO.getHardwareVersion() : StrUtil.EMPTY);
|
||||
// 软件版本
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.SW_VERSION.getKey() + suffix, StrUtil.isNotBlank(pqDevVO.getSoftwareVersion()) ? pqDevVO.getSoftwareVersion() : StrUtil.EMPTY);
|
||||
|
||||
// 调试日期
|
||||
if (pqDevVO.getCheckTime() != null) {
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, DateUtil.format(pqDevVO.getCheckTime(), datePattern));
|
||||
} else {
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, DateUtil.format(new Date(), DatePattern.CHINESE_DATE_PATTERN));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, DateUtil.format(new Date(), datePattern));
|
||||
}
|
||||
// 装置编码
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.DEV_CODE.getKey() + suffix, pqDevVO.getCreateId());
|
||||
@@ -1451,15 +1485,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
// 样品编号
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.SAMPLE_ID.getKey() + suffix, StrUtil.isEmpty(pqDevVO.getSampleId()) ? StrPool.TAB : pqDevVO.getSampleId());
|
||||
// 收样日期
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.ARRIVED_DATE.getKey() + suffix, Objects.isNull(pqDevVO.getArrivedDate()) ? StrPool.TAB : String.valueOf(pqDevVO.getArrivedDate()));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.ARRIVED_DATE.getKey() + suffix, Objects.isNull(pqDevVO.getArrivedDate()) ? StrPool.TAB : pqDevVO.getArrivedDate().format(DateTimeFormatter.ofPattern(datePattern)));
|
||||
// 检测日期
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEST_DATE.getKey() + suffix, Objects.isNull(pqDevVO.getCheckTime()) ? StrPool.TAB : String.valueOf(pqDevVO.getCheckTime()).substring(0, 10));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.TEMPERATURE.getKey() + suffix, Objects.isNull(pqDevVO.getTemperature()) ? StrPool.TAB : pqDevVO.getTemperature().toString());
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.HUMIDITY.getKey() + suffix, Objects.isNull(pqDevVO.getHumidity()) ? StrPool.TAB : pqDevVO.getHumidity().toString());
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.YEAR.getKey() + suffix, DateUtil.format(new Date(), DatePattern.NORM_YEAR_PATTERN));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.MONTH.getKey() + suffix, DateUtil.format(new Date(), DatePattern.SIMPLE_MONTH_PATTERN).substring(4));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.DAY.getKey() + suffix, DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN).substring(6));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.YEAR_MONTH_DAY.getKey() + suffix, DateUtil.format(new Date(), DatePattern.NORM_DATE_PATTERN));
|
||||
baseModelMap.put(prefix + BaseReportKeyEnum.YEAR_MONTH_DAY.getKey() + suffix, DateUtil.format(new Date(), datePattern));
|
||||
return baseModelMap;
|
||||
}
|
||||
|
||||
@@ -1475,7 +1508,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
//String scriptId = adPlan.getScriptId();
|
||||
Integer devChns = pqDevVO.getDevChns();
|
||||
for (int i = 1; i <= devChns; i++) {
|
||||
ClassPathResource resource = new ClassPathResource("/model/report_table.docx");
|
||||
String path = "/model/report_table.docx";
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (devType.getName().equals("PQ-COM")) {
|
||||
path = "/model/report_table - PQ-COM.docx";
|
||||
}
|
||||
ClassPathResource resource = new ClassPathResource(path);
|
||||
XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream());
|
||||
|
||||
SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();
|
||||
@@ -1503,11 +1541,20 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||
|
||||
// 填充数据
|
||||
int finalI = i;
|
||||
indexKeysMap.forEach((index, keys) -> {
|
||||
String s1 = keys.stream().findFirst().get();
|
||||
// 谐波类
|
||||
if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) {
|
||||
fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index);
|
||||
// 查找一下U1
|
||||
double u1 = 57.74;
|
||||
List<AdHarmonicResult> rawData = adHarmonicService.listAllRawData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + finalI);
|
||||
AdHarmonicResult adHarmonicResult = rawData.stream().filter(obj -> obj.getAdType().equals(DetectionCodeEnum.V2_50.getCode())).sorted((obj1, obj2) -> obj2.getTimeId().compareTo(obj1.getTimeId())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotNull(adHarmonicResult)) {
|
||||
String aValue1 = adHarmonicResult.getAValue1();
|
||||
u1 = Double.parseDouble(aValue1);
|
||||
}
|
||||
fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index, u1);
|
||||
} else {
|
||||
// 非谐波类
|
||||
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
||||
@@ -1575,14 +1622,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
* @param keys
|
||||
* @param index
|
||||
*/
|
||||
private void fillMapValueHarm(List<AdHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||
private void fillMapValueHarm(List<AdHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index, double baseValue) {
|
||||
keys.forEach(key -> {
|
||||
List<AdHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
AdHarmonicResult adHarmonicResult = resultList.get(0);
|
||||
if (Objects.nonNull(adHarmonicResult)) {
|
||||
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100);
|
||||
fillHarm(dataModelMap, adHarmonicResult, index, key, baseValue, 100);
|
||||
}
|
||||
if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) {
|
||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);
|
||||
@@ -1748,5 +1795,62 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadReportToCloud(List<String> deviceIds) {
|
||||
log.info("开始批量上传检测报告到云端,设备ID列表:{}", deviceIds);
|
||||
|
||||
// 查询条件:报告状态为已生成(1)的设备
|
||||
LambdaQueryWrapper<PqDev> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PqDev::getReportState, DevReportStateEnum.GENERATED.getValue());
|
||||
|
||||
// 如果指定了设备ID列表,则只查询这些设备
|
||||
if (CollUtil.isNotEmpty(deviceIds)) {
|
||||
wrapper.in(PqDev::getId, deviceIds);
|
||||
}
|
||||
|
||||
List<PqDev> devices = iPqDevService.list(wrapper);
|
||||
|
||||
if (CollUtil.isEmpty(devices)) {
|
||||
log.warn("未找到符合条件的设备,无需上传");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("找到{}台设备需要上传报告", devices.size());
|
||||
String dirPath = reportPath;
|
||||
// 确保目录存在
|
||||
ensureDirectoryExists(dirPath);
|
||||
// 异步批量上传每台设备的报告
|
||||
CompletableFuture.runAsync(() -> {
|
||||
for (PqDev device : devices) {
|
||||
try {
|
||||
// 构建报告文件路径
|
||||
String fileName = device.getCreateId() + ".docx";
|
||||
String reportFullPath = dirPath.concat(File.separator).concat(device.getCreateId()).concat(".docx");
|
||||
File reportFile = new File(reportFullPath);
|
||||
|
||||
if (!reportFile.exists()) {
|
||||
log.warn("设备{}的报告文件不存在:{}", device.getId(), fileName);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 上传文件到云端
|
||||
ResponseEntity<String> responseEntity = restTemplateUtil.uploadFile(cloudUrl + "/upload", reportFile);
|
||||
|
||||
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
||||
// 更新设备报告状态为已生成且已上传
|
||||
iPqDevService.updatePqDevReportState(device.getId(), DevReportStateEnum.GENERATED_UPLOADED.getValue());
|
||||
log.info("设备{}报告上传成功", device.getId());
|
||||
} else {
|
||||
log.error("设备{}报告上传失败,HTTP状态码:{}", device.getId(), responseEntity.getStatusCode());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("设备{}报告上传异常", device.getId(), e);
|
||||
}
|
||||
}
|
||||
log.info("批量上传任务完成");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -93,18 +93,19 @@ public class BookmarkUtil {
|
||||
idx = idx + 1;
|
||||
parentContent.add(idx, p);
|
||||
}
|
||||
else if (textFromP.startsWith(PowerIndexEnum.IMBV.getDesc())
|
||||
|| textFromP.startsWith(PowerIndexEnum.HV.getDesc())
|
||||
|| textFromP.startsWith(PowerIndexEnum.HI.getDesc())
|
||||
|
||||
) {
|
||||
// 另起一页
|
||||
P pagePara = Docx4jUtil.getPageBreak();
|
||||
idx = idx + 1;
|
||||
parentContent.add(idx, pagePara);
|
||||
idx = idx + 1;
|
||||
parentContent.add(idx, element);
|
||||
}else if(textFromP.startsWith("注:基波电流幅值5.000A,基波频率50.0Hz,各次间谐波电流含有率均为3.0%。")){
|
||||
// else if (textFromP.startsWith(PowerIndexEnum.IMBV.getDesc())
|
||||
// || textFromP.startsWith(PowerIndexEnum.HV.getDesc())
|
||||
// || textFromP.startsWith(PowerIndexEnum.HI.getDesc())
|
||||
//
|
||||
// ) {
|
||||
// // 另起一页
|
||||
// P pagePara = Docx4jUtil.getPageBreak();
|
||||
// idx = idx + 1;
|
||||
// parentContent.add(idx, pagePara);
|
||||
// idx = idx + 1;
|
||||
// parentContent.add(idx, element);
|
||||
// }
|
||||
else if(textFromP.startsWith("注:基波电流幅值5.000A,基波频率50.0Hz,各次间谐波电流含有率均为3.0%。")){
|
||||
idx = idx + 1;
|
||||
parentContent.add(idx, element);
|
||||
P pagePara = Docx4jUtil.getPageBreak();
|
||||
|
||||
@@ -322,17 +322,20 @@ public class Docx4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据已知信息创建新航
|
||||
* 根据已知信息创建新行
|
||||
*
|
||||
* @param factory 工厂
|
||||
* @param valueMap 数据
|
||||
* @param tableKeys keys
|
||||
* @param trPr 行样式
|
||||
* @param tcPr 单元格样式
|
||||
* @param factory 工厂
|
||||
* @param valueMap 数据
|
||||
* @param tableKeys keys
|
||||
* @param trPr 行样式
|
||||
* @param tcPrList 每个单元格的样式列表(用于保留各单元格独立的边框设置)
|
||||
* @param templateRPr 模板中的字体样式(可为null,为null时使用默认宋体10号)
|
||||
* @param centerFlag 是否居中
|
||||
*/
|
||||
public static Tr createCustomRow(ObjectFactory factory, Map<String, String> valueMap, List<String> tableKeys, TrPr trPr, TcPr tcPr, boolean centerFlag) {
|
||||
public static Tr createCustomRow(ObjectFactory factory, Map<String, String> valueMap, List<String> tableKeys, TrPr trPr, List<TcPr> tcPrList, RPr templateRPr, boolean centerFlag) {
|
||||
Tr row = factory.createTr();
|
||||
for (String tableKey : tableKeys) {
|
||||
for (int i = 0; i < tableKeys.size(); i++) {
|
||||
String tableKey = tableKeys.get(i);
|
||||
Tc cell = factory.createTc();
|
||||
P paragraph = factory.createP();
|
||||
R run = factory.createR();
|
||||
@@ -341,20 +344,41 @@ public class Docx4jUtil {
|
||||
text.setValue(value);
|
||||
run.getContent().add(text);
|
||||
paragraph.getContent().add(run);
|
||||
// 字体
|
||||
// 设置字体
|
||||
|
||||
// 从模板复制字体样式
|
||||
RPr rPr = factory.createRPr();
|
||||
RFonts rFonts = factory.createRFonts();
|
||||
if (containsChinese(value)) {
|
||||
if (templateRPr != null) {
|
||||
// 复制字体
|
||||
if (templateRPr.getRFonts() != null) {
|
||||
RFonts rFonts = factory.createRFonts();
|
||||
rFonts.setEastAsia(templateRPr.getRFonts().getEastAsia());
|
||||
rFonts.setAscii(templateRPr.getRFonts().getAscii());
|
||||
rFonts.setHAnsi(templateRPr.getRFonts().getHAnsi());
|
||||
rPr.setRFonts(rFonts);
|
||||
}
|
||||
// 复制字号
|
||||
if (templateRPr.getSz() != null) {
|
||||
HpsMeasure sz = factory.createHpsMeasure();
|
||||
sz.setVal(templateRPr.getSz().getVal());
|
||||
rPr.setSz(sz);
|
||||
}
|
||||
if (templateRPr.getSzCs() != null) {
|
||||
HpsMeasure szCs = factory.createHpsMeasure();
|
||||
szCs.setVal(templateRPr.getSzCs().getVal());
|
||||
rPr.setSzCs(szCs);
|
||||
}
|
||||
} else {
|
||||
// 默认使用宋体10号
|
||||
RFonts rFonts = factory.createRFonts();
|
||||
rFonts.setEastAsia("宋体");
|
||||
rFonts.setAscii("宋体");
|
||||
rFonts.setHAnsi("宋体");
|
||||
} else {
|
||||
rFonts.setEastAsia("Arial");
|
||||
rFonts.setAscii("Arial");
|
||||
rFonts.setHAnsi("Arial");
|
||||
rPr.setRFonts(rFonts);
|
||||
HpsMeasure sz = factory.createHpsMeasure();
|
||||
sz.setVal(new BigInteger("20"));
|
||||
rPr.setSz(sz);
|
||||
}
|
||||
rPr.setRFonts(rFonts);
|
||||
|
||||
// 设置段落居中
|
||||
if (centerFlag) {
|
||||
PPr pPr = factory.createPPr();
|
||||
@@ -363,20 +387,19 @@ public class Docx4jUtil {
|
||||
pPr.setJc(jc);
|
||||
paragraph.setPPr(pPr);
|
||||
}
|
||||
if (value.equals("不合格")) {
|
||||
// 不合格标红
|
||||
if (value != null && value.equals("不合格")) {
|
||||
Color color = factory.createColor();
|
||||
// 红色
|
||||
color.setVal("FF0000");
|
||||
rPr.setColor(color);
|
||||
run.setRPr(rPr);
|
||||
}
|
||||
HpsMeasure sz = factory.createHpsMeasure();
|
||||
// 10号字体 = 20 half-points
|
||||
sz.setVal(new BigInteger("20"));
|
||||
rPr.setSz(sz);
|
||||
run.setRPr(rPr);
|
||||
|
||||
cell.getContent().add(paragraph);
|
||||
cell.setTcPr(tcPr);
|
||||
// 使用对应位置的单元格样式(保留边框设置)
|
||||
if (tcPrList != null && i < tcPrList.size()) {
|
||||
cell.setTcPr(tcPrList.get(i));
|
||||
}
|
||||
row.getContent().add(cell);
|
||||
row.setTrPr(trPr);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> v = scriptDtlIndexList.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue().intValue() + unit);
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue() + unit);
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
@@ -367,7 +367,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
unitI = ResultUnitEnum.I_ABSOLUTELY.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> I = scriptDtlIndexList.stream().filter(x -> "CUR".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue().intValue() + unitI);
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue() + unitI);
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
@@ -392,7 +392,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
+ "次" + dictTree.getName()); // + "(含有率为GB/T)"
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
}
|
||||
break;
|
||||
/**
|
||||
@@ -426,7 +426,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
dtlType.setScriptTypeName(a.toString());
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -483,7 +483,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
});
|
||||
} else {
|
||||
PqScriptDtls dtls = harmNumVMap.entrySet().iterator().next().getValue().get(0);
|
||||
a.append(dtls.getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + dtls.getHarmNum().intValue() + ResultUnitEnum.HV.getName());
|
||||
a.append(dtls.getValue() + ResultUnitEnum.HV.getUnit() + "的" + dtls.getHarmNum().intValue() + ResultUnitEnum.HV.getName());
|
||||
}
|
||||
a.append(",");
|
||||
if (harmNumIMap.size() > 1) {
|
||||
@@ -502,7 +502,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
});
|
||||
} else {
|
||||
PqScriptDtls dtls = harmNumIMap.entrySet().iterator().next().getValue().get(0);
|
||||
a.append(dtls.getValue().intValue() + ResultUnitEnum.HI.getUnit() + "的" + dtls.getHarmNum().intValue() + "次" + ResultUnitEnum.HI.getName());
|
||||
a.append(dtls.getValue() + ResultUnitEnum.HI.getUnit() + "的" + dtls.getHarmNum().intValue() + "次" + ResultUnitEnum.HI.getName());
|
||||
}
|
||||
dtlType.setScriptTypeName(a.toString());
|
||||
break;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
@@ -886,6 +887,22 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
queryWrapper.eq(PqScriptDtls::getScriptIndex, -1)
|
||||
.eq(PqScriptDtls::getEnable, 1);
|
||||
pqScriptDtls = this.list(queryWrapper);
|
||||
// 相序校验中电流需加量需要依据企标10650.2中章节5.5.3的描述过载能力:2 倍额定电流连续,10 倍额定电流持续 1 s。
|
||||
// 考虑到有可能存在1A的额定电流,本处做特殊处理,加量分别为额定电流的0.2/0.4/0.6的标幺乘积加量
|
||||
// 电压暂不做处理,原因:1、电压的企标描述过载能力为4倍,空间较大;2、额定电压比如57.74V为浮点数,存在不确定小数位,避免引起算术误差;
|
||||
// 1. 获取额定电流,前端已做限制,相同额定电流才能一起检测
|
||||
String deviceId = param.getDevIds().get(0);
|
||||
PqDevVO pqDev = pqDevService.getPqDevById(deviceId);
|
||||
String devTypeId = pqDev.getDevType();
|
||||
DevType devType = devTypeService.getById(devTypeId);
|
||||
Double devCurr = devType.getDevCurr();
|
||||
for (int i = 0; i < pqScriptDtls.size(); i++) {
|
||||
PqScriptDtls scriptDtls = pqScriptDtls.get(i);
|
||||
// 注意此处scriptDtls.getValue() < 1.0,考虑到有些已经投入运行的地方,可能没有改库,避免不必要的异常
|
||||
if(scriptDtls.getValueType().equalsIgnoreCase("CUR") && scriptDtls.getValue() < 1.0){
|
||||
scriptDtls.setValue(devCurr * scriptDtls.getValue());
|
||||
}
|
||||
}
|
||||
} else if (param.getIsPhaseSequence().equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
||||
//系数
|
||||
queryWrapper.in(PqScriptDtls::getScriptIndex, param.getIndexList())
|
||||
@@ -1015,11 +1032,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
PqScriptDtls dip = dipList.get(0);
|
||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||
if (devFly) {
|
||||
if (isValueType) {
|
||||
// if (isValueType) {
|
||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||
} else {
|
||||
dipDataDTO.setFTransValue(NumberUtil.round(dip.getTransValue() / dtls.getValue(), 4).doubleValue());
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// dipDataDTO.setFTransValue(NumberUtil.round(dip.getTransValue() / dtls.getValue(), 4).doubleValue());
|
||||
// }
|
||||
}
|
||||
// 1.0/频率*持续时间(周波)= 暂态持续时间(s)
|
||||
dipDataDTO.setFRetainTime(NumberUtil.round(1.0 / fFreq * dip.getRetainTime(), 3).doubleValue());
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs91003?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100_bj?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: njcnpqs
|
||||
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
@@ -49,10 +49,10 @@ phaseAngle:
|
||||
|
||||
socket:
|
||||
source:
|
||||
ip: 192.168.1.138
|
||||
ip: 192.168.1.125
|
||||
port: 62000
|
||||
device:
|
||||
ip: 192.168.1.138
|
||||
ip: 192.168.1.125
|
||||
port: 61000
|
||||
# source:
|
||||
# ip: 192.168.1.121
|
||||
@@ -87,7 +87,7 @@ log:
|
||||
report:
|
||||
template: D:\template
|
||||
reportDir: D:\report
|
||||
|
||||
dateFormat: yyyy年MM月dd日
|
||||
qr:
|
||||
cloud: http://pqmcc.com:18082/api/file
|
||||
dev:
|
||||
|
||||
BIN
entrance/src/main/resources/model/NPQS-580.docx
Normal file
BIN
entrance/src/main/resources/model/NPQS-580.docx
Normal file
Binary file not shown.
BIN
entrance/src/main/resources/model/NPQS680.docx
Normal file
BIN
entrance/src/main/resources/model/NPQS680.docx
Normal file
Binary file not shown.
BIN
entrance/src/main/resources/model/PQ-COM.docx
Normal file
BIN
entrance/src/main/resources/model/PQ-COM.docx
Normal file
Binary file not shown.
BIN
entrance/src/main/resources/model/PQV-700.docx
Normal file
BIN
entrance/src/main/resources/model/PQV-700.docx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
Binary file not shown.
Binary file not shown.
@@ -38,6 +38,7 @@
|
||||
PQ_SUBVOLTAGE.name busBarName,
|
||||
pq_device.dev_index devId,
|
||||
pq_device.name devName,
|
||||
pq_device.Status runFlag,
|
||||
PQ_SUBSTATION.sub_index stationId,
|
||||
PQ_SUBSTATION.name stationName
|
||||
from
|
||||
|
||||
@@ -23,5 +23,6 @@ public class DeviceDTO {
|
||||
private LocalDateTime updateTime;
|
||||
private String devFlag;
|
||||
private String ip;
|
||||
//通讯状态
|
||||
private Integer runFlag=0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ public class LedgerBaseInfoDTO {
|
||||
private Integer stationId;
|
||||
|
||||
private String stationName;
|
||||
//通讯状态
|
||||
private Integer runFlag=0;
|
||||
|
||||
private Integer runFlag=0;;
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,15 @@ public class LargeScreenCountController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
@OperateInfo
|
||||
@PostMapping("/alarmAnalysisDetail")
|
||||
@ApiOperation("告警统计分析详情")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||
public HttpResult<AlarmAnalysisVO> alarmAnalysisDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("alarmAnalysisDetail");
|
||||
AlarmAnalysisVO result = largeScreenCountService.alarmAnalysisDetail(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
@OperateInfo
|
||||
@PostMapping("/eventTrend")
|
||||
@ApiOperation("暂降事件趋势")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||
|
||||
@@ -41,5 +41,5 @@ public interface LargeScreenCountService {
|
||||
boolean msgHandle(MessageEventFeedbackParam messageEventFeedbackParam);
|
||||
|
||||
|
||||
|
||||
AlarmAnalysisVO alarmAnalysisDetail(LargeScreenCountParam largeScreenCountParam);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.gather.event.transientes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MsgEventInfoService extends IService<MsgEventInfo> {
|
||||
|
||||
List<MsgEventInfo> getMsgByIds(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
long runDevCount = runDevList.stream().count();
|
||||
List<Integer> runSubList = list.stream().map(PqDevice::getSubIndex).distinct().collect(Collectors.toList());
|
||||
long runSubCount = runSubList.stream().count();
|
||||
List<Integer> runLineList = pqLineList.stream().filter(temp->runDevList.contains(temp.getDevIndex())).map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLineInfo(allLineIds);
|
||||
List<Integer> runLineList = ledgerBaseInfoDTOS.stream().filter(temp->Objects.equals(temp.getRunFlag(),1)).map(LedgerBaseInfoDTO::getLineId).collect(Collectors.toList());
|
||||
|
||||
long runLineCount = runLineList.stream().count();
|
||||
|
||||
@@ -138,7 +139,6 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
ledgerCountVO.setRunSubCount(runSubCount);
|
||||
ledgerCountVO.setRunLineCount(runLineCount);
|
||||
|
||||
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLineInfo(allLineIds);
|
||||
ledgerBaseInfoDTOS.stream().forEach(temp->temp.setRunFlag(runLineList.contains(temp.getLineId())?1:0));
|
||||
ledgerCountVO.setAllLineList(ledgerBaseInfoDTOS);
|
||||
List<DeviceDTO> deviceDTOS = pqDeviceService.queryListByIds(devList);
|
||||
@@ -205,25 +205,12 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
Integer eventCount = eventdetails.size();
|
||||
// 告警
|
||||
List<PqsEventdetail> aLarmEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() < 0.5).collect(Collectors.toList());
|
||||
aLarmEvent.forEach(temp->temp.setEventSeverity(1));
|
||||
// 预警
|
||||
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
||||
warnEvent.forEach(temp->temp.setEventSeverity(2));
|
||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
//通知
|
||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(eventIds)){
|
||||
if(eventIds.size()>1000){
|
||||
List<List<String>> listEven = CollUtil.split(eventIds,1000);
|
||||
for(List<String> pList: listEven){
|
||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eventIds).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
}
|
||||
|
||||
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -247,14 +234,14 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
alarmAnalysisVO.setLookWarnCount(lookWarnCount);
|
||||
alarmAnalysisVO.setLookNoticeCount(lookNoticeCount);
|
||||
|
||||
|
||||
alarmAnalysisVO.setEventdetails(change(eventdetails,msgEventInfoList));
|
||||
alarmAnalysisVO.setALarmEvent(change(aLarmEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setWarnEvent(change(warnEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setNoticeEvent(msgEventInfoList);
|
||||
alarmAnalysisVO.setLookALarmEvent(change(lookALarmEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setLookWarnEvent(change(lookWarnEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setLookNoticeEvent(handleMsg);
|
||||
//
|
||||
// alarmAnalysisVO.setEventdetails(change(eventdetails,msgEventInfoList));
|
||||
// alarmAnalysisVO.setALarmEvent(change(aLarmEvent,msgEventInfoList));
|
||||
// alarmAnalysisVO.setWarnEvent(change(warnEvent,msgEventInfoList));
|
||||
// alarmAnalysisVO.setNoticeEvent(msgEventInfoList);
|
||||
// alarmAnalysisVO.setLookALarmEvent(change(lookALarmEvent,msgEventInfoList));
|
||||
// alarmAnalysisVO.setLookWarnEvent(change(lookWarnEvent,msgEventInfoList));
|
||||
// alarmAnalysisVO.setLookNoticeEvent(handleMsg);
|
||||
|
||||
|
||||
|
||||
@@ -314,20 +301,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
if (Objects.equals(largeScreenCountParam.getEventtype(), 1)) {
|
||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
//通知
|
||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(eventIds)){
|
||||
if(eventIds.size()>1000){
|
||||
List<List<String>> listEven = CollUtil.split(eventIds,1000);
|
||||
for(List<String> pList: listEven){
|
||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eventIds).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
|
||||
}
|
||||
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||
// 使用 for 循环处理日期范围
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||
EventTrendVO eventTrendVO = new EventTrendVO();
|
||||
@@ -613,7 +587,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
List<String> eveIdndex = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
List<MsgEventInfo> temp = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(eveIdndex)){
|
||||
temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eveIdndex).list();
|
||||
temp =msgEventInfoService.getMsgByIds(eveIdndex);
|
||||
|
||||
}
|
||||
List<EventDetailVO> change = change(eventdetails,temp);
|
||||
|
||||
@@ -670,16 +645,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
}
|
||||
|
||||
List<String> eventIds = allEventList.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
if (eventIds.size() > 1000) {
|
||||
List<List<String>> listEven = CollUtil.split(eventIds, 1000);
|
||||
for (List<String> pList : listEven) {
|
||||
List<MsgEventInfo> msgEventInfoList = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex, pList).list();
|
||||
result.addAll(msgEventInfoList);
|
||||
}
|
||||
} else {
|
||||
List<MsgEventInfo> msgEventInfoList = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex, eventIds).list();
|
||||
result.addAll(msgEventInfoList);
|
||||
}
|
||||
result =msgEventInfoService.getMsgByIds(eventIds);
|
||||
result = result.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime, Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
if (result.size() > 200) {
|
||||
result = result.subList(0, 200);
|
||||
@@ -719,6 +685,103 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmAnalysisVO alarmAnalysisDetail(LargeScreenCountParam largeScreenCountParam) {
|
||||
AlarmAnalysisVO alarmAnalysisVO = new AlarmAnalysisVO();
|
||||
//起始时间
|
||||
LocalDateTime startTime;
|
||||
//结束时间
|
||||
LocalDateTime endTime;
|
||||
if (largeScreenCountParam.getType() == 3) {
|
||||
//起始时间
|
||||
startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
//结束时间
|
||||
endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
} else if (largeScreenCountParam.getType() == 4) {
|
||||
//起始时间
|
||||
startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
//结束时间
|
||||
endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
} else {
|
||||
throw new BusinessException("统计类型有误类型");
|
||||
}
|
||||
|
||||
//根据用户获取当前部门及子部门id
|
||||
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId());
|
||||
//获取对应监测点id
|
||||
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(deptslineIds)) {
|
||||
throw new BusinessException("部门下暂无监测点");
|
||||
|
||||
}
|
||||
List<PqsEventdetail> eventdetails = new ArrayList<>();
|
||||
if(deptslineIds.size()>1000){
|
||||
List<List<Integer>> listIds = CollUtil.split(deptslineIds,1000);
|
||||
for(List<Integer> itemIds : listIds){
|
||||
List<PqsEventdetail> temp = pqsEventdetailService.lambdaQuery()
|
||||
.between(PqsEventdetail::getTimeid,startTime, endTime)
|
||||
.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType())
|
||||
.in(PqsEventdetail::getLineid,listIds)
|
||||
.orderByDesc(PqsEventdetail::getTimeid).list()
|
||||
;
|
||||
eventdetails.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
List<PqsEventdetail> temp = pqsEventdetailService.lambdaQuery()
|
||||
.between(PqsEventdetail::getTimeid, startTime, endTime)
|
||||
.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType())
|
||||
.in(PqsEventdetail::getLineid,deptslineIds)
|
||||
.orderByDesc(PqsEventdetail::getTimeid).list();
|
||||
eventdetails.addAll(temp);
|
||||
}
|
||||
|
||||
Integer eventCount = eventdetails.size();
|
||||
// 告警
|
||||
List<PqsEventdetail> aLarmEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() < 0.5).collect(Collectors.toList());
|
||||
// 预警
|
||||
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
//通知
|
||||
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||
|
||||
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
List<PqsEventdetail> lookALarmEvent = aLarmEvent.stream().filter(temp ->Objects.equals(temp.getLookFlag(),1 )).collect(Collectors.toList());
|
||||
List<PqsEventdetail> lookWarnEvent = warnEvent.stream().filter(temp ->Objects.equals(temp.getLookFlag(),1 ) ).collect(Collectors.toList());
|
||||
List<MsgEventInfo> handleMsg = msgEventInfoList.stream().filter(temp -> Objects.equals(temp.getIsHandle(), 1)).collect(Collectors.toList());
|
||||
|
||||
Integer aLarmCount =aLarmEvent.size();
|
||||
Integer warnCount =warnEvent.size();
|
||||
Integer noticeCount =msgEventInfoList.size();
|
||||
Integer lookALarmCount =lookALarmEvent.size();
|
||||
Integer lookWarnCount =lookWarnEvent.size();
|
||||
Integer lookNoticeCount =handleMsg.size();
|
||||
|
||||
alarmAnalysisVO.setEventCount(eventCount);
|
||||
alarmAnalysisVO.setALarmCount(aLarmCount);
|
||||
alarmAnalysisVO.setWarnCount(warnCount);
|
||||
alarmAnalysisVO.setNoticeCount(noticeCount);
|
||||
alarmAnalysisVO.setLookALarmCount(lookALarmCount);
|
||||
alarmAnalysisVO.setLookWarnCount(lookWarnCount);
|
||||
alarmAnalysisVO.setLookNoticeCount(lookNoticeCount);
|
||||
|
||||
|
||||
alarmAnalysisVO.setEventdetails(change(eventdetails,msgEventInfoList));
|
||||
alarmAnalysisVO.setALarmEvent(change(aLarmEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setWarnEvent(change(warnEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setNoticeEvent(msgEventInfoList);
|
||||
alarmAnalysisVO.setLookALarmEvent(change(lookALarmEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setLookWarnEvent(change(lookWarnEvent,msgEventInfoList));
|
||||
alarmAnalysisVO.setLookNoticeEvent(handleMsg);
|
||||
|
||||
|
||||
|
||||
return alarmAnalysisVO;
|
||||
}
|
||||
|
||||
private List<EventDetailVO> change(List<PqsEventdetail> list,List<MsgEventInfo> handleMsg){
|
||||
List<EventDetailVO> result = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
@@ -740,10 +803,11 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
eventDetailVO.setEventvalue(temp.getEventvalue());
|
||||
eventDetailVO.setLookFlag(temp.getLookFlag());
|
||||
eventDetailVO.setNoticeFlag(temp.getNoticeFlag());
|
||||
if(Objects.nonNull(temp.getEventSeverity())){
|
||||
eventDetailVO.setEventSeverity(temp.getEventSeverity());
|
||||
if( temp.getEventvalue()< 0.5){
|
||||
eventDetailVO.setEventSeverity(1);
|
||||
}else{
|
||||
eventDetailVO.setEventSeverity(2);
|
||||
}
|
||||
|
||||
eventDetailVO.setMsgEventInfoSize(handleMsg.stream().filter(msg->Objects.equals(msg.getEventIndex(),temp.getEventdetailIndex())).count());
|
||||
if(ledgerBaseInfoDTOMap.containsKey(temp.getLineid())){
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = ledgerBaseInfoDTOMap.get(temp.getLineid());
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.njcn.gather.event.transientes.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.event.transientes.mapper.MsgEventInfoMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
||||
import com.njcn.gather.event.transientes.service.MsgEventInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
@@ -13,4 +18,22 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class MsgEventInfoServiceImpl extends ServiceImpl<MsgEventInfoMapper, MsgEventInfo> implements MsgEventInfoService {
|
||||
@Override
|
||||
public List<MsgEventInfo> getMsgByIds(List<String> ids) {
|
||||
//通知
|
||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(ids)){
|
||||
if(ids.size()>1000){
|
||||
List<List<String>> listEven = CollUtil.split(ids,1000);
|
||||
for(List<String> pList: listEven){
|
||||
List<MsgEventInfo> temp = this.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
List<MsgEventInfo> temp = this.lambdaQuery().in(MsgEventInfo::getEventIndex,ids).list();
|
||||
msgEventInfoList.addAll(temp);
|
||||
}
|
||||
}
|
||||
return msgEventInfoList;
|
||||
}
|
||||
}
|
||||
|
||||
1
license.key
Normal file
1
license.key
Normal file
@@ -0,0 +1 @@
|
||||
AoNUHvLQag9nPPxWDsf5EwwBqifh5wnoFjrU01w+kIA7TPdRl0AQDBSA3IU7AY28Liubt6Rl8CsDtxEDrz8L5m0FqQrmZ1TmIJtZWbBR16NxXRgf8izM5JurYEY6ZbjU021yCu0fitxB0DJZ8LB8zfUDsV1MFGHl+yPjh4ZQrYDffID4rk/mRe/EE6F7bS19upStSOnQxVQVJSXwCVVHgsuFXqiuagM21OmxpYNjqaPnvAKoHRXTTxXn9BrSgZBocxuHB/IE+a0a+Q2eQo4RZa2IQpneEA/QIKEqezqsABxmM33duQ4eKt17hAttISV1J0R1cKpwZ4tYuSoHCuMONA==
|
||||
@@ -70,7 +70,7 @@ public class AuthController extends BaseController {
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, UserValidMessage.LOGIN_FAILED);
|
||||
} else {
|
||||
String accessToken = JwtUtil.getAccessToken(user.getId());
|
||||
String accessToken = JwtUtil.getAccessToken(user.getId(),user.getLoginName());
|
||||
String refreshToken = JwtUtil.getRefreshToken(accessToken);
|
||||
Token token = new Token();
|
||||
token.setAccessToken(accessToken);
|
||||
@@ -117,7 +117,7 @@ public class AuthController extends BaseController {
|
||||
Map<String, Object> map = JwtUtil.parseToken(accessToken);
|
||||
String userId = (String) map.get(SecurityConstants.USER_ID);
|
||||
SysUser user = sysUserService.getById(userId);
|
||||
String accessTokenNew = JwtUtil.getAccessToken(userId);
|
||||
String accessTokenNew = JwtUtil.getAccessToken(userId,user.getLoginName());
|
||||
request.setAttribute(SecurityConstants.AUTHENTICATE_USERNAME, user.getLoginName());
|
||||
// String refreshTokenNew = JwtUtil.getRefreshToken(accessTokenNew);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user