27 Commits

Author SHA1 Message Date
caozehui
ac1d98efdc 微调 2025-10-23 15:15:49 +08:00
caozehui
5d161acfad 导入测试后数据,查看数据报错BUG 2025-10-23 13:28:14 +08:00
caozehui
1534327f6f Merge remote-tracking branch 'origin/master' 2025-10-23 13:27:56 +08:00
贾同学
04ada8740a UPDATE: 修改数据合并问题 2025-10-23 13:18:54 +08:00
caozehui
98cca582f6 Merge remote-tracking branch 'origin/master' 2025-10-22 15:49:14 +08:00
贾同学
a2de4b80a7 UPDATE: 修改激活逻辑 2025-10-22 13:27:24 +08:00
caozehui
071c6e3d64 谐波(间谐波)结果展示调整 2025-10-22 09:19:31 +08:00
b4878d4a25 调整检测报告 2025-10-21 17:01:55 +08:00
caozehui
b0a4458c56 Bug修改 2025-10-21 15:23:13 +08:00
6357cde72b 调整检测报告 2025-10-21 15:09:05 +08:00
dddffe43cb 调整检测报告 2025-10-21 15:07:49 +08:00
贾同学
51fdf6bf59 UPDATE: 修复被检设备分页查询排序问题 2025-10-21 14:24:38 +08:00
贾同学
b53ef274cf UPDATE: 重新修改导入被检设备逻辑 2025-10-21 14:02:22 +08:00
贾同学
90d618b66f UPDATE: 新建计划可选择所有标准设备 2025-10-20 14:25:26 +08:00
e81413eaa9 增加报告模板友好提示信息 2025-10-20 13:37:38 +08:00
33cefdd0b1 端口调整 2025-10-20 10:30:53 +08:00
80a886a5eb 增加日志输出,以便观察实际波形信息 2025-10-20 09:01:37 +08:00
0a85b433ba 不采用降低采样率,严格对比对应窗口数据。避免没必要的降采抽点工作 2025-10-17 17:29:47 +08:00
caozehui
66786200bd 设备、计划状态修改 2025-10-16 15:40:20 +08:00
15e93b6734 调整检测报告 2025-10-16 13:36:14 +08:00
caozehui
6843497908 微调 2025-10-16 10:56:35 +08:00
caozehui
cd486f419f Merge remote-tracking branch 'origin/master' 2025-10-16 10:22:53 +08:00
caozehui
7394762e28 闪变、重新计算逻辑调整 2025-10-16 10:19:13 +08:00
贾同学
2f75fe062b UPDATE: 优化程序激活码工具。 2025-10-15 14:27:36 +08:00
贾同学
d4e09a09cf UPDATE: 优化程序激活码工具。 2025-10-15 14:25:39 +08:00
贾同学
d58452012d UPDATE: 程序激活码生成工具集成。 2025-10-14 20:29:55 +08:00
贾同学
014ac7931e ADD: 程序激活流程:1、生成设备申请码;2、验证设备激活码;3、读取许可信息;4、激活码生成工具。 2025-10-14 18:54:32 +08:00
189 changed files with 2341 additions and 10104 deletions

View File

@@ -139,6 +139,12 @@
<artifactId>report-generator</artifactId>
<version>1.0.0</version>
</dependency>
<!--激活工具-->
<dependency>
<groupId>com.njcn.gather</groupId>
<artifactId>activate-tool</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>

View File

@@ -67,6 +67,8 @@ public enum SourceOperateCodeEnum {
SERVER_ERROR("server_error","服务端主动关闭连接,请稍后再试"),
DEVICE_ERROR("device_error","设备主动关闭连接,请稍后再试"),
FLICKER_DATA_CHECK("flicker_data_check","闪变数据校验"),

View File

@@ -42,8 +42,9 @@ public enum SourceResponseCodeEnum {
FAIL(25002,"失败"),
ALL_FAIL(25003,"校验失败"),
RECEIVE_DATA_TIME_OUT(25004,"接收数据超时"),
REAL_DATA_CHECK_FAIL(25005,"实时数据校验失败"),
STATISTICS_DATA_CHECK_FAIL(25006,"统计数据校验失败")
REAL_DATA_CHECK_FAIL(25005,"实时数据不符合"),
STATISTICS_DATA_CHECK_FAIL(25006,"统计数据不符合"),
FLICKER_DATA_START(25007,"开始接收闪变数据")

View File

@@ -1605,13 +1605,13 @@ public class DetectionServiceImpl {
switch (anEnum) {
case FREQ:
if (ObjectUtil.isNull(waveNum)) {
devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
listDTO.setT(55.0);
sqlData.setList(listDTO);
}));
}
// if (ObjectUtil.isNull(waveNum)) {
// devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
// DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
// listDTO.setT(55.0);
// sqlData.setList(listDTO);
// }));
// }
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
break;
case VRMS:
@@ -1654,7 +1654,7 @@ public class DetectionServiceImpl {
resultMap.put(PowerIndexEnum.HSI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
break;
case PST:
resultMap.put(PowerIndexEnum.PST.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn , DetectionCodeEnum.PST.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
resultMap.put(PowerIndexEnum.F.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn , DetectionCodeEnum.PST.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, DataSourceEnum.MINUTE_STATISTICS_AVG));
break;
case UNKNOWN_ERROR:
break;
@@ -1852,6 +1852,9 @@ public class DetectionServiceImpl {
}
Map<String, List<Map<Double, List<Double>>>> devMap = devHarmListMap(devDataList, standardDevDataList, fundCode, harmCode, harmonicFlag, dataRule);
if (ObjectUtil.isNull(devMap)) {
return 4;
}
ContrastHarmonicResult result = new ContrastHarmonicResult();
result.setWaveNum(waveNum);
@@ -2106,9 +2109,12 @@ public class DetectionServiceImpl {
fund2 = first2.get();
}
List<DevData.SqlDataHarmDTO> devHarmList = dev.get(i).getSqlDataHarm().stream().filter(x -> x.getDesc().equals(harmCode)).collect(Collectors.toList());
List<DevData.SqlDataHarmDTO> stdDevHarmList = standardDev.get(i).getSqlDataHarm().stream().filter(x -> x.getDesc().equals(harmCode)).collect(Collectors.toList());
List<DevData.SqlDataHarmDTO> devHarmList = dev.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
List<DevData.SqlDataHarmDTO> stdDevHarmList = standardDev.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
if (CollUtil.isEmpty(devHarmList) || CollUtil.isEmpty(stdDevHarmList)) {
return null;
}
// // 如果角型接法中,不存在线电压谐波电压含有率,则取相电压谐波电压含有率进行计算
// if (CollUtil.isEmpty(devHarmList)) {
// if (DetectionCodeEnum.PV2_50.getCode().equals(harmCode)) {

View File

@@ -180,4 +180,19 @@ public class FormalTestManager {
public static boolean isWaveCheck;
public static List<String> pstDataType;
public static boolean isPstData;
/**
* 是否在检测中
*/
public static boolean isTesting;
public static boolean realProtocol;
public static boolean statisticsProtocol;
public static boolean voltageProtocol;
}

View File

@@ -88,20 +88,33 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
System.out.println(LocalDateTime.now() + "contrastClientHandler触发读超时函数**************************************");
if (FormalTestManager.isTesting) {
System.out.println(LocalDateTime.now() + "contrastClientHandler触发读超时函数**************************************");
if (!FormalTestManager.isRemoveSocket && ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
long time = SocketManager.contrastClockMap.get(FormalTestManager.nonWaveDataSourceEnum) + 60L;
SocketManager.contrastClockMap.put(FormalTestManager.nonWaveDataSourceEnum, time);
if (!FormalTestManager.isRemoveSocket && ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
long time = SocketManager.contrastClockMap.get(FormalTestManager.nonWaveDataSourceEnum) + 60L;
SocketManager.contrastClockMap.put(FormalTestManager.nonWaveDataSourceEnum, time);
if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
if (time >= 60) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_02);
if (FormalTestManager.isPstData) {
if (time > 60 * 10) {
if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
}
if (FormalTestManager.isWaveCheck) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
}
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, true);
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
}
} else if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
if (time >= 60) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_02);
}
} else if (time >= FormalTestManager.maxTime) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, true);
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
}
} else if (time >= FormalTestManager.maxTime) {
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
}
}
}

View File

@@ -5,9 +5,7 @@ import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.util.socket.CnSocketUtil;
import com.njcn.gather.detection.util.socket.FormalTestManager;
import com.njcn.gather.detection.util.socket.SocketManager;
import com.njcn.gather.device.pojo.enums.PatternEnum;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.CorruptedFrameException;
@@ -373,34 +371,43 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
// 使用该用户的检测参数关闭Socket连接
log.info("使用用户检测参数关闭Socket连接userId: {}", userId);
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
if (FormalTestManager.isRemoveSocket) {
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
if (channelActive) {
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
}
} else {
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
} else {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
}
if (FormalTestManager.isWaveCheck) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
}
} else {
if (FormalTestManager.isWaveCheck) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
}
}
} else {
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
}
}
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// if (FormalTestManager.isRemoveSocket) {
// boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// if (channelActive) {
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// }
// } else {
// if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// } else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
// if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
// if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
// if (FormalTestManager.statisticsProtocol) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// } else {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// if (FormalTestManager.isWaveCheck) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// }
// } else {
// if (FormalTestManager.statisticsProtocol) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// if (FormalTestManager.isWaveCheck) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// }
// }
// } else {
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// }
// }
} else {
CnSocketUtil.quitSendSource(preDetectionParam);
CnSocketUtil.quitSend(preDetectionParam);

View File

@@ -12,7 +12,6 @@ import com.njcn.common.utils.LogUtil;
import com.njcn.gather.device.pojo.param.PqDevParam;
import com.njcn.gather.device.pojo.vo.PqDevVO;
import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.type.service.IDevTypeService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.FileUtil;
@@ -137,7 +136,7 @@ public class PqDevController extends BaseController {
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
})
public HttpResult<Boolean> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, HttpServletResponse response) {
public HttpResult importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, @RequestParam(value = "cover", defaultValue = "0") Integer cover, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("importDev");
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
@@ -147,12 +146,7 @@ public class PqDevController extends BaseController {
if ("null".equals(planId)) {
planId = null;
}
Boolean result = pqDevService.importDev(file, patternId, planId, response);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
return pqDevService.importDev(file, patternId, planId, response, cover);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)

View File

@@ -134,6 +134,7 @@
#{item}
</foreach>
</if>
order by dev.Create_Time DESC, dev.Name ASC
</select>
</mapper>

View File

@@ -111,4 +111,9 @@ public class PqDevVO extends PqDev {
* 是否已经分配。0-未分配、1-已分配、2-所有
*/
private Integer assign;
/**
* 检测点结果
*/
private List<Integer> monitorResults;
}

View File

@@ -3,6 +3,7 @@ package com.njcn.gather.device.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.poi.PullDown;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
import com.njcn.gather.device.pojo.param.PqDevParam;
import com.njcn.gather.device.pojo.po.PqDev;
@@ -124,7 +125,7 @@ public interface IPqDevService extends IService<PqDev> {
* @param devId
* @param userId
*/
void updateResult(String devId,String userId);
void updateResult(String devId, String userId);
void updatePqDevReportState(String devId, int i);
@@ -160,7 +161,7 @@ public interface IPqDevService extends IService<PqDev> {
* @param planId 计划Id
* @param response 响应
*/
boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
HttpResult importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover);
/**
* 导入灿能二楼设备数据
@@ -254,7 +255,7 @@ public interface IPqDevService extends IService<PqDev> {
* @param planId 计划Id
* @param response 响应
*/
boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
HttpResult importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover);
/**
* 导入比对式设备数据
@@ -262,7 +263,7 @@ public interface IPqDevService extends IService<PqDev> {
* @param contrastDevExcelList
* @param patternId
*/
boolean importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId);
HttpResult importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId, Integer cover);
/**
* 获取比对式设备导出、导出文件模板的下拉列表

View File

@@ -11,6 +11,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
@@ -19,8 +20,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.poi.PullDown;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.EncryptionUtil;
import com.njcn.db.mybatisplus.constant.DbConstant;
import com.njcn.gather.device.mapper.PqDevMapper;
@@ -34,6 +37,7 @@ import com.njcn.gather.device.service.IPqDevSubService;
import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
import com.njcn.gather.monitor.service.IPqMonitorService;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
@@ -49,6 +53,7 @@ import com.njcn.gather.user.user.pojo.po.SysUser;
import com.njcn.gather.user.user.service.ISysUserService;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.ExcelUtil;
import com.njcn.web.utils.HttpResultUtil;
import com.njcn.web.utils.PoiUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -212,7 +217,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
for (String id : param.getIds()) {
if (ObjectUtils.isNotEmpty(pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(id)))) {
throw new BusinessException(DetectionResponseEnum.PQ_DEV_HAS_MONITOR);
// throw new BusinessException(DetectionResponseEnum.PQ_DEV_HAS_MONITOR);
pqMonitorService.removeByDevId(id);
}
}
}
@@ -286,6 +292,33 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
return Collections.emptyList();
}
List<PqDevVO> pqDevList = this.baseMapper.selectByQueryParam(param);
pqDevList.forEach(pqDev -> {
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(pqDev.getId()));
List<PqMonitor> enabledMonitorList = monitorList.stream().filter(x -> x.getCheckFlag() == 1).collect(Collectors.toList());
pqDev.setMonitorResults(enabledMonitorList.stream().map(x -> {
if (ObjectUtil.isNull(x.getResultType())) {
return CheckResultEnum.UNCHECKED.getValue();
} else {
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(x.getResultType());
switch (dataSourceEnum) {
case REAL_DATA:
return x.getRealtimeResult();
case MINUTE_STATISTICS_AVG:
case MINUTE_STATISTICS_CP95:
case MINUTE_STATISTICS_MIN:
case MINUTE_STATISTICS_MAX:
return x.getStatisticsResult();
case WAVE_DATA:
return x.getRecordedResult();
default:
break;
}
}
return CheckResultEnum.UNCHECKED.getValue();
}).collect(Collectors.toList()));
});
return pqDevList;
}
@@ -535,13 +568,14 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
LambdaUpdateChainWrapper<PqDevSub> w = pqDevSubService.lambdaUpdate()
.set(PqDevSub::getCheckState, checkState)
.set(PqDevSub::getCheckResult, checkResult)
.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
.set(PqDevSub::getCheckTime, LocalDateTime.now())
.eq(PqDevSub::getDevId, devId);
if(ObjectUtil.isNotNull(user)){
if (ObjectUtil.isNotNull(user)) {
w.set(PqDevSub::getCheckBy, user.getName());
}
if(checkState.equals(CheckStateEnum.CHECKED.getValue())){
if (checkState.equals(CheckStateEnum.CHECKED.getValue())) {
w.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue());
}
w.update();
@@ -552,15 +586,23 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
List<PqDevVO> pqDevVOList = this.baseMapper.selectByQueryParam(param);
if (CollUtil.isNotEmpty(pqDevVOList)) {
Set<Integer> set = pqDevVOList.stream().map(PqDevVO::getCheckResult).collect(Collectors.toSet());
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.NOT_ACCORD.getValue());
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
Set<Integer> set = pqDevVOList.stream().filter(obj -> CheckStateEnum.CHECKED.getValue().equals(obj.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(obj.getCheckState())).map(PqDevVO::getCheckResult).collect(Collectors.toSet());
if (checkState == CheckStateEnum.CHECKED.getValue()) {
set.add(checkResult);
}
if (CollUtil.isEmpty(set)) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
} else {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.ACCORD.getValue());
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.NOT_ACCORD.getValue());
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
} else {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.ACCORD.getValue());
}
}
set = pqDevVOList.stream().map(PqDevVO::getCheckState).collect(Collectors.toSet());
if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKING.getValue());
@@ -643,25 +685,31 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
}
@Override
public boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
public HttpResult importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover) {
DictData dictData = dictDataService.getDictDataById(patternId);
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
return this.importContrastDev(file, patternId, planId, response);
return this.importContrastDev(file, patternId, planId, response, cover);
} else {
String currrentScene = sysTestConfigService.getCurrrentScene();
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
switch (sceneEnum) {
case PROVINCE_PLATFORM:
return this.importProvinceDev(file, patternId, planId, response);
boolean result = this.importProvinceDev(file, patternId, planId, response);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, "导入成功");
}
case LEAVE_FACTORY_TEST:
return this.importCNDev(file, patternId, planId, response);
result = this.importCNDev(file, patternId, planId, response);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, "导入成功");
}
case SELF_TEST:
break;
default:
break;
}
}
return false;
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, "导入失败");
}
@Override
@@ -788,21 +836,15 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
* @param isExcludeSelf 是否排除自己
*/
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
queryWrapper
.eq("state", DataStateEnum.ENABLE.getCode())
.eq(StrUtil.isNotBlank(param.getDevType()), "Dev_Type", param.getDevType())
.eq(StrUtil.isNotBlank(param.getPattern()), "pattern", param.getPattern())
.eq(StrUtil.isNotBlank(param.getCityName()), "City_Name", param.getCityName())
.eq(StrUtil.isNotBlank(param.getGdName()), "Gd_Name", param.getGdName())
.eq(StrUtil.isNotBlank(param.getSubName()), "Sub_Name", param.getSubName())
.and(q -> q.eq(StrUtil.isNotBlank(param.getName()), "name", param.getName()).or()
.eq(StrUtil.isNotBlank(param.getCreateId()), "Create_Id", param.getCreateId())); //设备序列号重复
// .eq("manufacturer", param.getManufacturer())
// .eq("Dev_Type", param.getDevType()).or()
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<PqDev>()
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
.eq(StrUtil.isNotBlank(param.getIp()), PqDev::getIp, param.getIp())
.eq(ObjectUtil.isNotNull(param.getPort()), PqDev::getPort, param.getPort())
.eq(StrUtil.isNotBlank(param.getPattern()), PqDev::getPattern, param.getPattern())
.eq(StrUtil.isNotBlank(param.getCreateId()), PqDev::getCreateId, param.getCreateId());
if (isExcludeSelf) {
if (param instanceof PqDevParam.UpdateParam) {
queryWrapper.ne("id", ((PqDevParam.UpdateParam) param).getId());
queryWrapper.ne(PqDev::getId, ((PqDevParam.UpdateParam) param).getId());
}
}
int count = this.count(queryWrapper);
@@ -1181,7 +1223,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
}
@Override
public boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
public HttpResult importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover) {
ImportParams params = new ImportParams();
params.setStartSheetIndex(0);
params.setSheetNum(1);
@@ -1201,20 +1243,22 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} catch (Exception e) {
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
}
return this.importContrastDev(contrastDevExcelList, patternId, planId);
return this.importContrastDev(contrastDevExcelList, patternId, planId, cover);
}
@Override
@Transactional
public boolean importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId) {
public HttpResult importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId, Integer cover) {
if (CollUtil.isNotEmpty(contrastDevExcelList)) {
// 根据设备名称分组
Map<String, List<ContrastDevExcel>> listMap = contrastDevExcelList.stream()
.collect(Collectors.groupingBy(ContrastDevExcel::getName, LinkedHashMap::new, Collectors.toList()));
List<PqDev> oldDevList = new ArrayList<>(listMap.size());
List<PqMonitor> finalMonitorList = new ArrayList<>();
List<PqDev> newDevList = new ArrayList<>(listMap.size());
List<PqDev> updateDevList = new ArrayList<>();
List<PqDev> finalUpdateDevList = new ArrayList<>();
for (Map.Entry<String, List<ContrastDevExcel>> entry : listMap.entrySet()) {
String name = entry.getKey();
List<ContrastDevExcel> devExcelList = entry.getValue();
// 监测点数据
List<PqMonitorExcel> pqMonitorExcelList = devExcelList.stream()
@@ -1224,24 +1268,24 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
.collect(Collectors.toList());
// 取第一条为设备基本信息
ContrastDevExcel devExcel = devExcelList.get(0);
PqDev pqDev = BeanUtil.copyProperties(devExcel, PqDev.class);
if (pqDev.getEncryptionFlag() == 1) {
if (StrUtil.isNotBlank(pqDev.getSeries()) && StrUtil.isNotBlank(pqDev.getDevKey())) {
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
PqDev importPqDev = BeanUtil.copyProperties(devExcel, PqDev.class);
if (importPqDev.getEncryptionFlag() == 1) {
if (StrUtil.isNotBlank(importPqDev.getSeries()) && StrUtil.isNotBlank(importPqDev.getDevKey())) {
importPqDev.setSeries(EncryptionUtil.encodeString(1, importPqDev.getSeries()));
importPqDev.setDevKey(EncryptionUtil.encodeString(1, importPqDev.getDevKey()));
} else {
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
}
}
DevType devType = devTypeService.getByName(pqDev.getDevType());
DevType devType = devTypeService.getByName(importPqDev.getDevType());
if (ObjectUtil.isNull(devType)) {
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NOT_EXIST);
}
// 校验监测点数量
int devChns = devType.getDevChns();
if (pqMonitorExcelList.size() != devChns) {
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL, "" + name + "】的设备类型必须具备" + devChns + "个监测点信息!");
}
// if (pqMonitorExcelList.size() != devChns) {
// throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL, "【" + name + "】的设备类型必须具备" + devChns + "个监测点信息!");
// }
List<Integer> numList = pqMonitorExcelList.stream().map(PqMonitorExcel::getNum).collect(Collectors.toList());
// 判断是否有重复的num
Set<Integer> uniqueNumSet = new HashSet<>(numList);
@@ -1254,18 +1298,16 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_OUT_OF_RANGE);
}
pqDev.setDevType(devType.getId());
pqDev.setImportFlag(1);
pqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
pqDev.setCreateId(pqDev.getName()); //导入时设备序列号默认与设备名称相同
List<PqMonitor> monitorList = new ArrayList<>();
importPqDev.setDevType(devType.getId());
importPqDev.setImportFlag(1);
importPqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
if (StrUtil.isEmpty(importPqDev.getCreateId())) {
// 与设备名称相同
importPqDev.setCreateId(importPqDev.getName());
}
// 根据num排序
pqMonitorExcelList.sort(Comparator.comparingInt(PqMonitorExcel::getNum));
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(pqDev.getId());
monitorList.add(monitor);
}
StringBuilder inspectChannelBuilder = new StringBuilder();
for (int i = 1; i <= devChns; i++) {
inspectChannelBuilder.append(i);
@@ -1273,71 +1315,121 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
inspectChannelBuilder.append(",");
}
}
pqDev.setInspectChannel(inspectChannelBuilder.toString());
oldDevList.add(pqDev);
finalMonitorList.addAll(monitorList);
}
//逆向可视化
this.reverseVisualizeProvinceDev(oldDevList, patternId);
List<PqDev> newDevList = new ArrayList<>();
oldDevList.forEach(pqDev -> {
PqDevParam param = BeanUtil.copyProperties(pqDev, PqDevParam.class);
this.checkRepeat(param, false);
long count = newDevList.stream().filter(dev ->
dev.getDevType().equals(pqDev.getDevType())
&& dev.getCityName().equals(pqDev.getCityName())
&& dev.getGdName().equals(pqDev.getGdName())
&& dev.getSubName().equals(pqDev.getSubName())
&& (dev.getName().equals(pqDev.getName()) || dev.getCreateId().equals(pqDev.getCreateId())))
.count();
if (count == 0) {
pqDev.setPlanId(planId);
newDevList.add(pqDev);
}
});
QueryWrapper<PqDev> wrapper1 = new QueryWrapper<PqDev>()
.eq("pq_dev.State", DataStateEnum.ENABLE.getCode())
.in("pq_dev.Harm_Sys_Id", newDevList.stream().map(PqDev::getHarmSysId).collect(Collectors.toList()));
List<PqDev> oldDevList1 = this.list(wrapper1);
if (CollUtil.isNotEmpty(oldDevList1)) {
oldDevList1.stream().forEach(oldDev -> {
PqDev newDev = newDevList.stream().filter(dev -> dev.getHarmSysId().equals(oldDev.getHarmSysId())).findFirst().orElse(null);
if (ObjectUtil.isNotNull(newDev)) {
newDevList.remove(newDev);
finalMonitorList.stream()
.filter(monitor -> monitor.getDevId().equals(newDev.getId()))
.forEach(monitor -> monitor.setDevId(oldDev.getId()));
BeanUtil.copyProperties(newDev, oldDev, "id");
importPqDev.setInspectChannel(inspectChannelBuilder.toString());
List<PqMonitor> monitorList = new ArrayList<>();
// 1、先判断是否有谐波系统ID
boolean hasHarmSys = false;
if (StrUtil.isNotBlank(importPqDev.getHarmSysId())) {
// 1.1、如果有则判断是否已存在
List<PqDev> hasList = this.lambdaQuery()
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
.eq(PqDev::getPattern, patternId)
.eq(PqDev::getHarmSysId, importPqDev.getHarmSysId())
.isNull(PqDev::getPlanId)
.orderByDesc(PqDev::getCreateTime).list();
// 1.2、 存在则放入强制更新list
if (CollUtil.isNotEmpty(hasList)) {
importPqDev.setId(hasList.get(0).getId());
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor pqMonitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
pqMonitor.setDevId(importPqDev.getId());
monitorList.add(pqMonitor);
}
importPqDev.setMonitorList(monitorList);
finalUpdateDevList.add(importPqDev);
hasHarmSys = true;
}
});
this.updateBatchById(oldDevList1);
}
this.saveBatch(newDevList);
List<PqDevSub> pqDevSubList = new ArrayList<>();
for (PqDev dev : newDevList) {
PqDevSub pqDevSub = new PqDevSub();
pqDevSub.setDevId(dev.getId());
pqDevSub.setCheckState(CheckStateEnum.UNCHECKED.getValue());
pqDevSub.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
pqDevSub.setReportState(DevReportStateEnum.UNCHECKED.getValue());
pqDevSub.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
pqDevSub.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
pqDevSubList.add(pqDevSub);
}
pqDevSubService.saveBatch(pqDevSubList);
List<String> devIdList = oldDevList1.stream().map(PqDev::getId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(devIdList)) {
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<PqMonitor>()
.in("pq_monitor.Dev_Id", devIdList);
pqMonitorService.remove(wrapper);
}
if (!hasHarmSys) {
// 2、查询 ip + 端口 + 序列号 + patternId + Plan_Id为空 是否存在
List<PqDev> hasList = this.lambdaQuery()
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
.eq(PqDev::getIp, devExcel.getIp())
.eq(PqDev::getPort, devExcel.getPort())
.eq(PqDev::getPattern, patternId)
.eq(PqDev::getCreateId, devExcel.getCreateId())
.isNull(PqDev::getPlanId)
.orderByDesc(PqDev::getCreateTime).list();
// 2.1、存在则放入更新list
if (CollUtil.isNotEmpty(hasList)) {
importPqDev.setId(hasList.get(0).getId());
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(importPqDev.getId());
monitorList.add(monitor);
}
importPqDev.setMonitorList(monitorList);
updateDevList.add(importPqDev);
} else {
//2.2、不存在则放入新增list
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
monitor.setDevId(importPqDev.getId());
monitorList.add(monitor);
}
importPqDev.setMonitorList(monitorList);
newDevList.add(importPqDev);
}
}
}
pqMonitorService.reverseVisualizeMonitor(finalMonitorList);
pqMonitorService.saveBatch(finalMonitorList);
return true;
// 3、是否有重复的设备
if (CollUtil.isNotEmpty(updateDevList)) {
// 3.1、有则让用户确认是否覆盖
if (cover == 0) {
List<String> existDevList = new ArrayList<>();
updateDevList.forEach(pqDev -> {
existDevList.add(pqDev.getName() + "(" + pqDev.getIp() + ":" + pqDev.getPort() + ")");
});
return HttpResultUtil.assembleResult(DetectionResponseEnum.DEV_IP_PORT_EXIST.getCode(), existDevList, "请确认是否覆盖");
} else {
// 3.2、确认覆盖则放入强制更新list
finalUpdateDevList.addAll(updateDevList);
}
}
// 4、新增list
if (CollUtil.isNotEmpty(newDevList)) {
//逆向可视化
this.reverseVisualizeProvinceDev(newDevList, patternId);
this.saveBatch(newDevList);
List<PqDevSub> pqDevSubList = new ArrayList<>();
List<PqMonitor> newMonitorList = new ArrayList<>();
for (PqDev dev : newDevList) {
PqDevSub pqDevSub = new PqDevSub();
pqDevSub.setDevId(dev.getId());
pqDevSub.setCheckState(CheckStateEnum.UNCHECKED.getValue());
pqDevSub.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
pqDevSub.setReportState(DevReportStateEnum.UNCHECKED.getValue());
pqDevSub.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
pqDevSub.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
pqDevSubList.add(pqDevSub);
newMonitorList.addAll(dev.getMonitorList());
}
pqMonitorService.reverseVisualizeMonitor(newMonitorList);
pqMonitorService.saveBatch(newMonitorList);
pqDevSubService.saveBatch(pqDevSubList);
}
// 5、更新list
if (CollUtil.isNotEmpty(finalUpdateDevList)) {
//逆向可视化
this.reverseVisualizeProvinceDev(finalUpdateDevList, patternId);
this.updateBatchById(finalUpdateDevList);
List<PqMonitor> updateMonitorList = new ArrayList<>();
for (PqDev dev : finalUpdateDevList) {
updateMonitorList.addAll(dev.getMonitorList());
}
pqMonitorService.reverseVisualizeMonitor(updateMonitorList);
for (PqMonitor monitor : updateMonitorList) {
pqMonitorService.update(monitor, new LambdaUpdateWrapper<PqMonitor>().eq(PqMonitor::getDevId, monitor.getDevId()));
}
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "导入成功");
}
return false;
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, "导入失败");
}
@Override

View File

@@ -8,7 +8,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -18,17 +17,12 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.poi.PullDown;
import com.njcn.common.utils.EncryptionUtil;
import com.njcn.gather.device.mapper.PqStandardDevMapper;
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
import com.njcn.gather.device.pojo.enums.CommonEnum;
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
import com.njcn.gather.device.pojo.po.PqStandardDev;
import com.njcn.gather.device.pojo.vo.PqStandardDevExcel;
import com.njcn.gather.device.pojo.vo.PreDetection;
import com.njcn.gather.device.service.IPqStandardDevService;
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.plan.service.IAdPlanStandardDevService;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
@@ -73,7 +67,8 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
.eq("state", DataStateEnum.ENABLE.getCode());
.eq("state", DataStateEnum.ENABLE.getCode())
.orderByDesc("create_time");
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
}
@@ -311,7 +306,7 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
@Override
public List<PqStandardDev> canBindingList() {
List<String> excludeStandardDevIds = new ArrayList<>();
/*List<String> excludeStandardDevIds = new ArrayList<>();
// 获取所有已绑定的标准设备
List<AdPlanStandardDev> boundList = adPlanStandardDevService.list();
if (CollectionUtil.isNotEmpty(boundList)) {
@@ -350,13 +345,13 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
.collect(Collectors.toList());
excludeStandardDevIds = excludeBoundList.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
}
}
}*/
List<PqStandardDev> list = this.lambdaQuery()
.eq(PqStandardDev::getState, DataStateEnum.ENABLE.getCode())
.list();
for (PqStandardDev pqStandardDev : list) {
/*for (PqStandardDev pqStandardDev : list) {
pqStandardDev.setDisabled(excludeStandardDevIds.contains(pqStandardDev.getId()));
}
}*/
return list;
}
}

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.err.mapper.PqErrSysMapper;
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
import com.njcn.gather.err.pojo.param.PqErrSysParam;
@@ -18,6 +19,7 @@ import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
import com.njcn.gather.err.service.IPqErrSysDtlsService;
import com.njcn.gather.err.service.IPqErrSysService;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.report.pojo.enums.PowerIndexEnum;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictDataService;
@@ -219,7 +221,9 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
List<DictTree> parentDictTreeList = dictTreeService.listByIds(pids);
Map<String, String> map = new HashMap<>();
parentDictTreeList.forEach(dictTree -> {
map.put(dictTree.getId(), dictTree.getName());
if(!dictTree.getCode().equals(PowerIndexEnum.VOLTAGE.getKey())&&!dictTree.getCode().equals(PowerIndexEnum.P.getKey())){
map.put(dictTree.getId(), dictTree.getName());
}
});
return map;
}

View File

@@ -52,7 +52,7 @@ public class PqMonitorParam {
private Integer statInterval;
@ApiModelProperty(value = "谐波系统监测点id")
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
// @NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
private String harmSysId;
@ApiModelProperty(value = "是否做检测")

View File

@@ -6,7 +6,6 @@ import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import java.util.List;
import java.util.Map;
/**
* @author caozehui
@@ -112,4 +111,11 @@ public interface IPqMonitorService extends IService<PqMonitor> {
*/
Integer getDevCheckResult(String devId);
/**
* 根据被检设备id删除监测点信息
*
* @param devId
* @return
*/
boolean removeByDevId(String devId);
}

View File

@@ -280,4 +280,11 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
return DetectionDataServiceImpl.isResultFlag(allResultFlags);
}
@Override
public boolean removeByDevId(String devId) {
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
wrapper.eq("pq_monitor.Dev_Id", devId);
return this.remove(wrapper);
}
}

View File

@@ -42,6 +42,8 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -452,7 +454,17 @@ public class AdPlanController extends BaseController {
fileTypeError.setMessage("请上传zip文件");
throw new BusinessException(fileTypeError);
}
asyncPlanHandler.importAndMergePlanCheckData(file, getUserId(), planId);
// 创建临时文件
File tempFile = cn.hutool.core.io.FileUtil.createTempFile();
// 将MultipartFile内容写入临时文件
try {
file.transferTo(tempFile);
} catch (IOException e) {
throw new BusinessException(CommonResponseEnum.FAIL, "文件保存失败");
}
// 获取文件路径
String filePath = tempFile.getAbsolutePath();
asyncPlanHandler.importAndMergePlanCheckData(filePath, getUserId(), planId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}

View File

@@ -37,10 +37,8 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -65,6 +63,8 @@ public class AsyncPlanHandler {
private final IAdPariService adPairService;
private final JdbcTemplate jdbcTemplate;
@Value("${report.reportDir}")
private String reportPath;
@Value("${data.homeDir}")
@@ -235,35 +235,28 @@ public class AsyncPlanHandler {
}
@Transactional
@Async
public void importAndMergePlanCheckData(MultipartFile file, String uid, String planId) {
public void importAndMergePlanCheckData(String zipFilePath, String uid, String planId) {
importAndMergePlanCheckDataLogic(zipFilePath, uid, planId);
}
@Transactional
public void importAndMergePlanCheckDataLogic(String zipFilePath, String uid, String planId) {
NonWebAutoFillValueHandler.setCurrentUserId(uid);
LocalDateTime startTime = LocalDateTime.now();
AtomicInteger progress = new AtomicInteger(0);
AtomicInteger currentProgress = new AtomicInteger(0);
AtomicInteger dataCount = new AtomicInteger(0);
try {
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "开始保存文件,请耐心等待..."));
// 创建临时目录用于解压文件
File tempDir = FileUtil.mkdir(FileUtil.getTmpDirPath() + "import_plan_check_data_" + System.currentTimeMillis() + "/");
// 将上传的zip文件保存到临时目录
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
try {
// 直接获取文件字节避免依赖Tomcat临时文件
byte[] fileBytes = file.getBytes();
FileUtil.writeBytes(fileBytes, zipFile);
} catch (IOException e) {
log.error("保存上传文件失败", e);
throw e;
}
progress.addAndGet(1);
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "开始解压文件,请耐心等待..."));
// 解压zip文件
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
ZipUtil.unzip(zipFile.getAbsolutePath(), unzipDir.getAbsolutePath());
ZipUtil.unzip(zipFilePath, unzipDir.getAbsolutePath());
// 查找解压目录中的json文件
File[] files = unzipDir.listFiles();
@@ -464,14 +457,14 @@ public class AsyncPlanHandler {
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "数据合并完成"));
} catch (Exception e) {
log.error("导入数据失败", e);
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.FAIL.getCode(), progress.get() + currentProgress.get(), "导入失败"));
} finally {
NonWebAutoFillValueHandler.clearCurrentUserId();
}
FileUtil.del(zipFilePath);
sseClient.closeSse(uid);
}
// 构建分页查询SQL

View File

@@ -207,7 +207,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
}
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
if (CollUtil.isNotEmpty(pqDevVOList)) {
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState())).count();
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(pqDev.getCheckState())).count();
adPlanVO.setProgress((float) count / pqDevVOList.size());
} else {
adPlanVO.setProgress(0.0f);
@@ -531,7 +531,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
@Override
public List<Map<String, Object>> listByPattern(String pattern) {
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).orderByDesc(AdPlan::getCreateTime).list();
Map<Integer, List<AdPlan>> map1 = adPlanList.stream().collect(Collectors.groupingBy(AdPlan::getTestState));
List<Map<String, Object>> result = new ArrayList<>();
@@ -630,7 +630,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MAX.getValue())
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MIN.getValue())) {
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()));
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()).orderByAsc("sort"));
for (DictTree dictTree : dictTreeList) {
Map<String, String> map = new HashMap<>();

View File

@@ -73,8 +73,9 @@ public enum DetectionResponseEnum {
MONITOR_NUM_REPEAT("A02094", "该被检设备下存在相同线路号的监测点"),
PLAN_HAS_CHILDREN("A02095", "该计划下存在子计划,请先删除子计划"),
PLAN_REPEATED_IN_SAME_LEVEL("A02096", "该父计划下存在同名的子计划"),
PLEASE_UNASSIGN_STANDARD_DEV("A02097","存在已分配给子计划的标准设备,请先解除分配" ),
PLEASE_UNASSIGN_DEVICE("A02098", "存在已分配给计划的被检设备,请先解除分配");
PLEASE_UNASSIGN_STANDARD_DEV("A02097", "存在已分配给子计划的标准设备,请先解除分配"),
PLEASE_UNASSIGN_DEVICE("A02098", "存在已分配给计划的被检设备,请先解除分配"),
DEV_IP_PORT_EXIST("A02099", "存在重复被检设备");
private final String code;

View File

@@ -35,14 +35,14 @@ import java.util.List;
@RestController
@RequestMapping("/report")
@RequiredArgsConstructor
public class ReportController extends BaseController {
public class ReportController extends BaseController {
private final IPqReportService pqReportService;
/**
* 此方法临时的,给楼下使用,实际需要优化
* 1、不同的设备需要不同的模板
* 2、数据页的内容暂时是固定的后期可能是动态的
* 2、数据页的内容暂时是固定的后期可能是动态 的;
*/
@OperateInfo
@PostMapping("/generateReport")

View File

@@ -31,6 +31,7 @@ public enum BaseReportKeyEnum {
DAY("day",""),
YEAR_MONTH_DAY("year-month-day","年-月-日"),
REPORT_DATE("reportDate","年-月-日"),
GD_NAME("gdName","供电部门"),
SUB_NAME("subName","变电站"),
CHECK_BY("checkBy","检测人"),
AUDIT_BY("auditBy","负责人、审核人"),

View File

@@ -67,6 +67,7 @@ import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
import com.njcn.gather.tools.report.model.constant.ReportConstant;
import com.njcn.gather.tools.report.service.IWordReportService;
import com.njcn.gather.tools.report.util.BookmarkUtil;
@@ -89,7 +90,6 @@ import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.wml.*;
import org.docx4j.wml.Color;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
@@ -109,6 +109,7 @@ import java.math.BigInteger;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
@@ -571,7 +572,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
/**
*
* 根据设备类型生成报告
* 注:该方法目前仅支持楼下出厂检测场景,属于模板占位符替换方式,后期可能会有调整
*
@@ -641,6 +641,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
}
});
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
@@ -809,13 +816,20 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
ensureDirectoryExists(dirPath);
// 构建文件名cityName_gdName_subName_name.docx
String fileName = String.format("%s_%s_%s_%s.docx",
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
Docx4jUtil.cleanBlankPagesAndRedundantPageBreaks(baseModelDocument);
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(fileName)));
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
@@ -871,6 +885,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
ensureDirectoryExists(dirPath);
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
@@ -1065,7 +1086,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
* 实时数据3秒数据150周波数据
* 录波:录波数据
* 分钟统计数据:分钟统计数据-最大值、分钟统计数据-最小值、分钟统计数据-平均值、分钟统计数据-CP95值
*
*/
private String getDataTypeFromParam(AdPlan adPlan) {
String dataSource = adPlan.getDatasourceId();
@@ -1088,11 +1108,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(adPlan.getId());
StringBuilder sampleCount = new StringBuilder();
for (String item : dataSourceArray) {
if(item.equalsIgnoreCase(DataSourceEnum.REAL_DATA.getValue())){
if (item.equalsIgnoreCase(DataSourceEnum.REAL_DATA.getValue())) {
sampleCount.append("实时数据采集").append(adPlanTestConfig.getRealTime()).append("组,");
}else if(item.equalsIgnoreCase(DataSourceEnum.WAVE_DATA.getValue())){
} else if (item.equalsIgnoreCase(DataSourceEnum.WAVE_DATA.getValue())) {
sampleCount.append("录波数据采集").append(adPlanTestConfig.getWaveRecord()).append("组,");
}else{
} else {
sampleCount.append("统计数据采集").append(adPlanTestConfig.getStatistics()).append("组,");
}
}
@@ -1805,10 +1825,10 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
if (dictDataById != null && "Contrast".equals(dictDataById.getCode())) {
// 比对模式:使用新的路径结构
String fileName = String.format("%s_%s_%s_%s.docx",
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
filePath = reportPath.concat(File.separator).concat(plan.getName()).concat(File.separator).concat(fileName);
downloadFileName = fileName;
} else {
@@ -1837,7 +1857,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
try {
// 对中文文件名进行URL编码// 将+号替换为%20空格的正确编码
String encodedFileName = URLEncoder.encode(downloadFileName, "UTF-8")
.replaceAll("\\+", "%20");
.replaceAll("\\+", "%20");
// 使用RFC 5987标准格式
response.setHeader("Content-Disposition",
@@ -1879,12 +1899,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
for (int i = 0; i < pqDevVOList.size(); i++) {
pqDevVO = pqDevVOList.get(i);
tempPqDevVO = pqDevVO;
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
}
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
devIds.add(pqDevVO.getId());
tempPqDevVO = pqDevVO;
}
}
@@ -1986,7 +2006,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
/**
*
* 比对模式下需要获取的数据
* 处理基础模版中的信息,非数据页报告
* 因为Docx4j工具包替换时会默认增加${}
@@ -2010,6 +2029,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
baseModelMap.put(BaseReportKeyEnum.SAMPLE_ID.getKey(), StrUtil.isEmpty(pqDevVO.getName()) ? StrPool.TAB : pqDevVO.getName());
// 报告日期
baseModelMap.put(BaseReportKeyEnum.REPORT_DATE.getKey(), DateUtil.format(new Date(), DatePattern.CHINESE_DATE_PATTERN));
// 供电部门
baseModelMap.put(BaseReportKeyEnum.GD_NAME.getKey(), pqDevVO.getGdName());
// 变电站名称
baseModelMap.put(BaseReportKeyEnum.SUB_NAME.getKey(), pqDevVO.getSubName());
// 检测人

View File

@@ -198,7 +198,7 @@ public class ResultController extends BaseController {
String methodDescribe = getMethodDescribe("getCheckItem");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, monitorQueryParam);
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getDevId(),monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getPlanId(), monitorQueryParam.getDevId(), monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -15,4 +15,6 @@ public class MonitorQueryParam {
private Integer num;
private Integer waveNum;
private String planId;
}

View File

@@ -119,17 +119,19 @@ public interface IResultService {
/**
* 获取检测项
*
* @param planId
* @param devId
* @param chnNum
* @param num
* @return
*/
List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num);
List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num);
/**
* 获取设备比对式结果,用于出比对检测的报告
*
* @param devReportParam 设备报告参数
* @param pqDevVO 设备信息 省去一次sql查询
* @param pqDevVO 设备信息 省去一次sql查询
* @return 该设备的比对式结果
*/
Map<Integer, List<ContrastTestResult>> getContrastResultForReport(DevReportParam devReportParam, PqDevVO pqDevVO);

View File

@@ -22,6 +22,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.gather.detection.handler.SocketContrastResponseService;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.detection.pojo.enums.ResultEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.pojo.po.AdPair;
import com.njcn.gather.detection.pojo.po.DevData;
@@ -99,6 +100,8 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.njcn.gather.plan.pojo.enums.DataSourceEnum.*;
/**
* @author caozehui
* @data 2024-12-30
@@ -111,6 +114,7 @@ public class ResultServiceImpl implements IResultService {
private final IAdPlanService adPlanService;
private final IAdPlanTestConfigService adPlanTestConfigService;
private final IPqDevService pqDevService;
private final IPqStandardDevService pqStandardDevService;
private final SimAndDigNonHarmonicService simAndDigNonHarmonicService;
private final SimAndDigHarmonicService simAndDigHarmonicService;
private final ContrastHarmonicService contrastHarmonicService;
@@ -1601,7 +1605,7 @@ public class ResultServiceImpl implements IResultService {
}
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode())));
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode())));
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
return contrastResultVO;
}
@@ -1803,9 +1807,9 @@ public class ResultServiceImpl implements IResultService {
}
@Override
public List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num) {
PqDev dev = pqDevService.getById(devId);
AdPlan plan = adPlanService.getById(dev.getPlanId());
public List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num) {
// PqDev dev = pqDevService.getById(devId);
AdPlan plan = adPlanService.getById(planId);
String code = String.valueOf(plan.getCode());
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
@@ -1982,7 +1986,7 @@ public class ResultServiceImpl implements IResultService {
// 双零情况,记录但不加入结果判定
zeroFilteredPhases.add(phase.toUpperCase() + "");
// 将结果改为特殊标记,不参与整体结论判定
singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "双零过滤");
singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "符合");
} else {
// 有非双零数据
hasNonZeroData = true;
@@ -1990,7 +1994,6 @@ public class ResultServiceImpl implements IResultService {
String resultTemp = singlePhaseData.get(ItemReportKeyEnum.RESULT.getKey());
if (StrUtil.isNotBlank(resultTemp)) {
allResult.add(resultTemp);
// 收集特殊情况
if ("无法比较".equals(resultTemp)) {
String numOfDataStr = singlePhaseData.get(ItemReportKeyEnum.NUM_OF_DATA.getKey());
@@ -2133,7 +2136,11 @@ public class ResultServiceImpl implements IResultService {
String phases = phaseEntry.getKey();
List<Integer> harmNums = phaseEntry.getValue();
specialCaseDesc.append("").append(formatHarmNumbers(harmNums, isInterHarmonic)).append("次谐波");
specialCaseDesc.append(phases).append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
// 如果是T相则不拼接相别
if (!"T相".equals(phases)) {
specialCaseDesc.append(phases);
}
specialCaseDesc.append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
}
}
}
@@ -2357,10 +2364,16 @@ public class ResultServiceImpl implements IResultService {
// 生成无法比较的描述
if (!unComparablePhases.isEmpty()) {
specialCaseDesc.append("注:");
if (unComparablePhases.size() == 1) {
specialCaseDesc.append(unComparablePhases.get(0));
// 如果只有T相则不拼接相别
if (unComparablePhases.size() == 1 && "T相".equals(unComparablePhases.get(0))) {
// T相不拼接相别
} else {
specialCaseDesc.append(String.join("", unComparablePhases));
// 其他情况拼接相别
if (unComparablePhases.size() == 1) {
specialCaseDesc.append(unComparablePhases.get(0));
} else {
specialCaseDesc.append(String.join("", unComparablePhases));
}
}
specialCaseDesc.append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
}
@@ -2437,10 +2450,13 @@ public class ResultServiceImpl implements IResultService {
}
dataMap.put(ItemReportKeyEnum.TEST.getKey(), testValue);
// 误差 - 根据参数决定是否格式化
String errorValue = String.valueOf(detectionData.getErrorData());
if (decimalPlaces != null && detectionData.getErrorData() != null) {
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
} else {
errorValue = "/";
}
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
@@ -2448,6 +2464,8 @@ public class ResultServiceImpl implements IResultService {
String errorScope = String.valueOf(detectionData.getRadius());
if (decimalPlaces != null && detectionData.getRadius() != null) {
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
} else {
errorScope = "/";
}
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
@@ -2570,6 +2588,8 @@ public class ResultServiceImpl implements IResultService {
String errorValue = String.valueOf(detectionData.getErrorData());
if (decimalPlaces != null && detectionData.getErrorData() != null) {
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
} else {
errorValue = "/";
}
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
@@ -2577,6 +2597,8 @@ public class ResultServiceImpl implements IResultService {
String errorScope = String.valueOf(detectionData.getRadius());
if (decimalPlaces != null && detectionData.getRadius() != null) {
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
} else {
errorScope = "/";
}
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
@@ -2705,7 +2727,7 @@ public class ResultServiceImpl implements IResultService {
if (CollUtil.isNotEmpty(contrastHarmonicResults)) {
ContrastHarmonicResult contrastHarmonicResult = contrastHarmonicResults.get(0);
List<Double> harmonicNum = null;
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode())) {
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode()) || DicDataEnum.HP.getCode().equals(dictTree.getCode())) {
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
}
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
@@ -2728,6 +2750,7 @@ public class ResultServiceImpl implements IResultService {
List<RawResultDataVO.DetectionData> cList = JSON.parseArray(fieldC.get(contrastHarmonicResult) + "", RawResultDataVO.DetectionData.class);
List<RawResultDataVO> rawResultDataVOList = new ArrayList<>();
List<Integer> isDataList = new ArrayList<>();
for (int j = 0; j < aList.size(); j++) {
RawResultDataVO dataVO = new RawResultDataVO();
dataVO.setHarmNum(n);
@@ -2737,9 +2760,11 @@ public class ResultServiceImpl implements IResultService {
dataVO.setDataC(cList.get(j));
dataVO.setRadius(aList.get(j).getRadius());
dataVO.setIsData(StorageUtil.setResultFlag(Arrays.asList(aList.get(j), bList.get(j), cList.get(j))));
isDataList.add(dataVO.getIsData());
rawResultDataVOList.add(dataVO);
}
resultMap.put(String.valueOf(n), rawResultDataVOList);
Integer isData = StorageUtil.getInteger(isDataList);
resultMap.put(n + (isData == ResultEnum.NOT_QUALIFIED.getValue() ? "(不符合)" : (isData == ResultEnum.NO_ERROR_SYS.getValue() ? "(/)" : "")), rawResultDataVOList);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
@@ -2750,7 +2775,7 @@ public class ResultServiceImpl implements IResultService {
return resultMap;
}
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code, List<String> keys) {
Map<String, List<AlignDataVO.RawData>> rawMap = new LinkedHashMap<>();
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList);
@@ -2789,11 +2814,14 @@ public class ResultServiceImpl implements IResultService {
if (CollUtil.isNotEmpty(devHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevHarmonicRawDataList)) {
List<Double> harmonicNum = null;
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode())) {
boolean isHarm = true;
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode()) || DicDataEnum.HP.getCode().equals(dictTree.getCode())) {
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
isHarm = true;
}
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
harmonicNum = Stream.iterate(0.5, n -> n + 1).limit(50).collect(Collectors.toList());
isHarm = false;
}
for (Double n : harmonicNum) {
List<AlignDataVO.RawData> rawDataVOList1 = new ArrayList<>();
@@ -2844,7 +2872,10 @@ public class ResultServiceImpl implements IResultService {
}
rawDataVOList1.add(rawDataVO);
}
rawMap.put(String.valueOf(n), rawDataVOList1);
int num1 = n.intValue();
num1 = isHarm ? num1 - 2 : num1;
String key = keys.get(num1);
rawMap.put(key, rawDataVOList1);
}
}
@@ -2921,6 +2952,7 @@ public class ResultServiceImpl implements IResultService {
"A_Value_0 json NULL COMMENT 'A相基波有效值',\n" +
"B_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
"C_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
"Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" +
"PRIMARY KEY (Id)\n"
:
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" +
@@ -3043,18 +3075,19 @@ public class ResultServiceImpl implements IResultService {
DataSourceEnum nonWaveDataSourceEnum = DataSourceEnum.REAL_DATA;
for (String ds : dataSourceIds) {
switch (DataSourceEnum.valueOf(ds)) {
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(ds);
switch (dataSourceEnum) {
case MINUTE_STATISTICS_MIN:
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_MIN;
nonWaveDataSourceEnum = MINUTE_STATISTICS_MIN;
break;
case MINUTE_STATISTICS_MAX:
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_MAX;
nonWaveDataSourceEnum = MINUTE_STATISTICS_MAX;
break;
case MINUTE_STATISTICS_AVG:
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_AVG;
break;
case MINUTE_STATISTICS_CP95:
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_CP95;
nonWaveDataSourceEnum = MINUTE_STATISTICS_CP95;
break;
}
}
@@ -3107,6 +3140,7 @@ public class ResultServiceImpl implements IResultService {
parsId.put(dev.getId() + CnSocketUtil.SPLIT_TAG + split1[1], standardDev.getId() + CnSocketUtil.SPLIT_TAG + split2[1]);
numMap.put(devMonitorId, num);
numMap.put(adPair.getStdDevMonitorId(), num);
devIdMapComm.put(standardDev.getIp(), standardDev.getId());
});
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
@@ -3114,16 +3148,18 @@ public class ResultServiceImpl implements IResultService {
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 1, deviceId, null);
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
if (CollUtil.isNotEmpty(devData) && CollUtil.isNotEmpty(standardDevData)) {
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
pqDevService.updateResult(split[0], null);
});
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
pqDevService.updateResult(split[0], null);
});
}
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
@@ -3132,14 +3168,14 @@ public class ResultServiceImpl implements IResultService {
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i, DataSourceEnum.WAVE_DATA);
}
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, adPlanTestConfig.getWaveRecord(), oldCode);
pqMonitorService.updateMonitorResult(devMonitorId, null, WAVE_DATA, num, adPlanTestConfig.getWaveRecord(), oldCode);
pqDevService.updateResult(split[0], null);
});
});
@@ -3230,58 +3266,79 @@ public class ResultServiceImpl implements IResultService {
return info;
}
private List<DevData> contrastToList(List<ContrastNonHarmonicResult> nonHarm, List<ContrastHarmonicResult> harm, BiMap<String, String> testItemMap) {
private List<DevData> contrastToList(List<ContrastNonHarmonicResult> nonHarm, List<ContrastHarmonicResult> harm, BiMap<String, String> testItemMap, Integer flag) {
List<DevData> info = new ArrayList<>();
if (CollUtil.isNotEmpty(nonHarm)) {
Map<String, List<ContrastNonHarmonicResult>> devMonitorIdMap = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getDevMonitorId, Collectors.toList()));
devMonitorIdMap.forEach((devMonitorId, value) -> {
Map<String, List<ContrastNonHarmonicResult>> devMonitorIdMap1 = null;
if (flag == 0) {
devMonitorIdMap1 = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getDevMonitorId, Collectors.toList()));
} else {
devMonitorIdMap1 = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getStdDevMonitorId, Collectors.toList()));
}
devMonitorIdMap1.forEach((devMonitorId, value) -> {
Map<LocalDateTime, List<ContrastNonHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getTimeId, Collectors.toList()));
timeListMap.forEach((time, value1) -> {
DevData devData = new DevData();
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
PqDev dev = pqDevService.getById(split[0]);
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
Map<LocalDateTime, List<ContrastNonHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getTimeId, Collectors.toList()));
timeListMap.forEach((time, value1) -> {
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
if (flag == 0) {
PqDev dev = pqDevService.getById(split[0]);
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
} else {
PqStandardDev standardDev = pqStandardDevService.getById(split[0]);
devData.setId(standardDev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
}
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
value1.forEach(x -> {
DevData.SqlDataDTO sqlDataDTO = new DevData.SqlDataDTO();
DevData.SqlDataDTO.ListDTO listDTO = new DevData.SqlDataDTO.ListDTO();
listDTO.setA(StrUtil.isNotBlank(x.getAValue()) ? Double.valueOf(x.getAValue()) : null);
listDTO.setB(StrUtil.isNotBlank(x.getBValue()) ? Double.valueOf(x.getBValue()) : null);
listDTO.setC(StrUtil.isNotBlank(x.getCValue()) ? Double.valueOf(x.getCValue()) : null);
listDTO.setT(StrUtil.isNotBlank(x.getTValue()) ? Double.valueOf(x.getTValue()) : null);
sqlDataDTO.setType(x.getDataType());
sqlDataDTO.setDesc(testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), ""));
sqlDataDTO.setList(listDTO);
sqlData.add(sqlDataDTO);
});
devData.setSqlData(sqlData);
value1.forEach(x -> {
DevData.SqlDataDTO sqlDataDTO = new DevData.SqlDataDTO();
DevData.SqlDataDTO.ListDTO listDTO = new DevData.SqlDataDTO.ListDTO();
listDTO.setA(StrUtil.isNotBlank(x.getAValue()) ? Double.valueOf(x.getAValue()) : null);
listDTO.setB(StrUtil.isNotBlank(x.getBValue()) ? Double.valueOf(x.getBValue()) : null);
listDTO.setC(StrUtil.isNotBlank(x.getCValue()) ? Double.valueOf(x.getCValue()) : null);
listDTO.setT(StrUtil.isNotBlank(x.getTValue()) ? Double.valueOf(x.getTValue()) : null);
sqlDataDTO.setType(x.getDataType());
sqlDataDTO.setDesc(testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), ""));
sqlDataDTO.setList(listDTO);
sqlData.add(sqlDataDTO);
});
devData.setSqlData(sqlData);
info.add(devData);
});
});
Map<String, List<ContrastHarmonicResult>> devMonitorIdMap2 = null;
if (flag == 0) {
devMonitorIdMap2 = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getDevMonitorId, Collectors.toList()));
} else {
devMonitorIdMap2 = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getStdDevMonitorId, Collectors.toList()));
}
if (CollUtil.isNotEmpty(harm)) {
Map<String, List<ContrastHarmonicResult>> devMonitorIdMap = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getDevMonitorId, Collectors.toList()));
devMonitorIdMap.forEach((devMonitorId, value) -> {
DevData devData = new DevData();
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
PqDev dev = pqDevService.getById(split[0]);
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
Map<LocalDateTime, List<ContrastHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getTimeId, Collectors.toList()));
timeListMap.forEach((time, value1) -> {
devMonitorIdMap2.forEach((devMonitorId, value) -> {
Map<LocalDateTime, List<ContrastHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getTimeId, Collectors.toList()));
timeListMap.forEach((time, value1) -> {
DevData devData = info.stream().filter(x -> x.getTime().equals(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)))).findFirst().orElse(null);
if (ObjectUtil.isNotNull(devData)) {
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
if (flag == 0) {
PqDev dev = pqDevService.getById(split[0]);
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
} else {
PqStandardDev standardDev = pqStandardDevService.getById(split[0]);
devData.setId(standardDev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
}
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
List<DevData.SqlDataDTO> sqlData = devData.getSqlData();
List<DevData.SqlDataHarmDTO> sqlDataHarm = new ArrayList<>();
value1.forEach(x -> {
DevData.SqlDataHarmDTO dataHarmDTO = new DevData.SqlDataHarmDTO();
dataHarmDTO.setType(x.getDataType());
String desc = testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), "");
dataHarmDTO.setDesc(desc);
boolean notContainBaseHarm = false;
if (DetectionCodeEnum.V2_50.getCode().equals(desc) || DetectionCodeEnum.PV2_50.getCode().equals(desc) || DetectionCodeEnum.I2_50.getCode().equals(desc)) {
if (DetectionCodeEnum.V2_50.getCode().equals(desc) || DetectionCodeEnum.PV2_50.getCode().equals(desc) || DetectionCodeEnum.I2_50.getCode().equals(desc) || DetectionCodeEnum.P2_50.getCode().equals(desc)) {
dataHarmDTO.setNum(49);
notContainBaseHarm = true;
}
@@ -3316,12 +3373,13 @@ public class ResultServiceImpl implements IResultService {
}
}
});
devData.setSqlDataHarm(sqlDataHarm);
devData.setSqlData(sqlData);
});
info.add(devData);
}
});
}
});
return info;
}

View File

@@ -40,7 +40,8 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
@Override
public List<DevType> listAll() {
LambdaQueryWrapper<DevType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode());
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode())
.orderByAsc(DevType::getName);
List<DevType> devTypes = this.baseMapper.selectList(queryWrapper);
return devTypes;
}

View File

@@ -6,10 +6,10 @@ spring:
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://192.168.1.24:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
# url: jdbc:mysql://192.168.1.24:13306/pqs91002?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
# username: root
# password: njcnpqs
url: jdbc:mysql://localhost:13306/pqs9100member?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
url: jdbc:mysql://localhost:13306/pqs9100w?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
username: root
password: njcnpqs
#初始化建立物理连接的个数、最小、最大连接数
@@ -118,3 +118,7 @@ power-quality:
harmonic-times: 50 # 谐波次数
ib-add: false # 电流基波叠加标志
uharm-add: false # 电压谐波叠加标志
# 激活配置
activate:
private-key: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCcUyYhVqczGxblL+o/xZzF/8nf+LjrfUE/dS1aRHM7uMDD0cgCArhjtfneFePrMxt+Z7W8yNBzSarub8qsfhaVNikV7Es7oaeTygfjQXTi2n4AFkir3fM07J08RpWhl5M8f8uWTCuvFUYAw00gq55typqmnbkmJa2VIUy/iQf+cMCP7abz4/jNhUzUR3qA7TV4oMRgTdIEDUp63YF8dOC+JH8XxYrCVeHXV6fLCwmesdMzl0lB2VTEKMfLbXhOmF5g7P9y/16VCcN8UBuZlbyYfn+GAxJOSbeHi5HshOKfoSuD7Jz+3WQZpNavOWjIFExKIU38/CvnJCOP7XBCqpSTAgMBAAECggEAYeWokWRE3TpvwiOZnUpR/aVMdVi75a3ROL5XIpqPV61B+t/bU3cEpl0GF9C5pUeiRi0IoStZb3mI9D1KPW/REKyUWkhabQO1gFYbTnRlkNOn6MILzKX4cwJjDaZeeo4EBPU7N+qHyOOXrU6hdH5FfxhMdV983ajm5eeuupxER1C2kAcIklTeVpTX6EKOgZb5LBp5ssOVm2P42pOauvcRozRcvZmqnErXmukv0H4l3EVNt4rHpTn9riHUC63e8JfiYzVaF6zuNUxv6nHEft0/SRMw11XSTnNfDzcKqgjz6ksFBS/6eQQYKESk+ONC53HUuYHFAknkwsPupDCT2W8FIQKBgQDLHT/xCU3nxGr4vFKBDNaO2D5oK20ECbBO4oDvLWWmQG7f+6TsMy8PgVdMnoL4RfqGlwFAKEpS6KVFHnBVqnNEhcdy9uCI7x7Xx8UnyUtxj1EDTm76uta9Ki9OrlqB6tImDM9+Ya3vGktW37ht4WOx2OsJRhG1dbf6RLwFlH7DWwKBgQDFBxvi5I1BR6hg6Tj7xd2SqOT2Y+BED3xuSYENhWbmMhLJDResaB7mjztbxlYaY2mOE0holWm2uDmVFFhMh4jYXik4hYH8nmDzq9mDpZCZ9pyjYqnAP8THoAa8EbgrUWB8A6BPH4iL3KbMnBfBKY0pIr2xrvnjQjNBAgta7KDRKQKBgCe6oe4wxrdF2TKsC2tIqpMoQxS3Icy/ZGgZr+SYuaBKTCWtoDW/UT40K3JGMxIDBhzbXphBCUCsVt9tM8Xd4EwP6tJW7dZ7B0pnve2pVwNwaAVAiz6p2yUHIle+jN+Koe5lZRSwYIg7WW81tWpwwsJfzqFyvjYDP6hJV4mz4ROvAoGAaRcdnKvjXApomShMqJ4lTPChD3q+SA8qg3jZSOj6tZXHx00gb2kp8jg7pPvpOTIFPy6x1Ha9aCRjMk0ju84fA6lVuzwa1S907wOehUVuF3Eeo1cgy9Y3k3KbpPyeixxgpkUY4JslLdSHc2NemD0dee951qhJyRmqVOZOQDUuoeECgYEAqBw2cAFk3vM97WY06TSldGA8ajVHx3BYRjj+zl62NTQthy8fw3tqxb3c5e8toOmZWKjZvDhg2TRLhsDDQWEYg3LZG87REqVIjgEPcpjNLidjygGX8n3JF2o0O5I/EMvl0s/+LVQONfduOBvhwDqr8QNisbLsyneiAq7umewMolo="
public-key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnFMmIVanMxsW5S/qP8Wcxf/J3/i4631BP3UtWkRzO7jAw9HIAgK4Y7X53hXj6zMbfme1vMjQc0mq7m/KrH4WlTYpFexLO6Gnk8oH40F04tp+ABZIq93zNOydPEaVoZeTPH/LlkwrrxVGAMNNIKuebcqapp25JiWtlSFMv4kH/nDAj+2m8+P4zYVM1Ed6gO01eKDEYE3SBA1Ket2BfHTgviR/F8WKwlXh11enywsJnrHTM5dJQdlUxCjHy214TpheYOz/cv9elQnDfFAbmZW8mH5/hgMSTkm3h4uR7ITin6Erg+yc/t1kGaTWrzloyBRMSiFN/Pwr5yQjj+1wQqqUkwIDAQAB"

View File

@@ -25,10 +25,10 @@ public class AnalysisServiceStreamTest {
private ICompareWaveService compareWaveServiceImpl;
// 测试文件路径 - 请根据实际情况修改
private static final String SOURCE_CFG_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.239\\PQ_PQLD1_000574_20250910_135244_231.cfg";
private static final String SOURCE_DAT_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.239\\PQ_PQLD1_000574_20250910_135244_231.dat";
private static final String TARGET_CFG_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.238\\PQ_PQLD2_000508_20250910_135244_197.cfg";
private static final String TARGET_DAT_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.238\\PQ_PQLD2_000508_20250910_135244_197.dat";
private static final String SOURCE_CFG_PATH = "C:\\Users\\Administrator\\Desktop\\wavedata\\192.168.1.200\\PQ_PQLD1_000020_20251017_140358_193.cfg";
private static final String SOURCE_DAT_PATH = "C:\\Users\\Administrator\\Desktop\\wavedata\\192.168.1.200\\PQ_PQLD1_000020_20251017_140358_193.dat";
private static final String TARGET_CFG_PATH = "C:\\Users\\Administrator\\Desktop\\wavedata\\192.168.1.168\\PQ_PQLD1_000018_20251017_140357_625.cfg";
private static final String TARGET_DAT_PATH = "C:\\Users\\Administrator\\Desktop\\wavedata\\192.168.1.168\\PQ_PQLD1_000018_20251017_140357_625.dat";
// private static final String SOURCE_CFG_PATH = "F:\\hatch\\wavecompare\\数据比对\\统计数据1\\B码\\217\\PQMonitor_PQM1_000006_20200430_115517_889.cfg";
@@ -105,6 +105,54 @@ public class AnalysisServiceStreamTest {
}
}
/**
* 测试段信息保留模式的波形分析(新方法)
* <p>不进行跨段的统一降采样保留每个段的原始采样率超过512才降到256</p>
* <p>跨段的窗口会被丢弃,只计算不跨段的窗口</p>
*/
@Test
public void testAnalyzeWithSegmentPreservation() throws Exception {
System.out.println("========================================");
System.out.println("开始执行电能质量分析(段信息保留模式)...");
System.out.println("========================================");
// 检查文件是否存在
checkFileExists(SOURCE_CFG_PATH, "源CFG文件");
checkFileExists(SOURCE_DAT_PATH, "源DAT文件");
checkFileExists(TARGET_CFG_PATH, "目标CFG文件");
checkFileExists(TARGET_DAT_PATH, "目标DAT文件");
long startTime = System.currentTimeMillis();
try (InputStream sourceCfgStream = new FileInputStream(SOURCE_CFG_PATH);
InputStream sourceDatStream = new FileInputStream(SOURCE_DAT_PATH);
InputStream targetCfgStream = new FileInputStream(TARGET_CFG_PATH);
InputStream targetDatStream = new FileInputStream(TARGET_DAT_PATH)) {
CompareWaveDTO result = compareWaveServiceImpl.analyzeWithSegmentPreservation(
sourceCfgStream,
sourceDatStream,
targetCfgStream,
targetDatStream,
0 // 接线方式: 0=星型接线, 1=V型接线
);
long endTime = System.currentTimeMillis();
long duration = endTime - startTime;
// 输出分析结果
System.out.println("========================================");
System.out.println("分析完成!");
System.out.println("总耗时: " + duration + " ms (" + String.format("%.2f", duration / 1000.0) + " 秒)");
System.out.println("源文件有效窗口数: " + (result.getSourceResults() != null ? result.getSourceResults().size() : 0));
System.out.println("目标文件有效窗口数: " + (result.getTargetResults() != null ? result.getTargetResults().size() : 0));
System.out.println("========================================");
System.out.println("段信息保留模式测试完成!");
System.out.println("========================================");
}
}
/**
* 检查文件是否存在
*/

View File

@@ -1,33 +0,0 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@@ -1,172 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.njcn.gather</groupId>
<artifactId>CN_Gather</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>event_smart</artifactId>
<dependencies>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>njcn-common</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-redis</artifactId>
<version>1.0.0</version>
</dependency>
<!-- <dependency>
<groupId>com.njcn</groupId>
<artifactId>rocket-mq-springboot-starter</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.7.12</version>
</dependency>
<!-- 多数据源切换当数据源为oracle时需要使用 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>spingboot2.3.12</artifactId>
<version>2.3.12</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>mybatis-plus</artifactId>
<version>0.0.1</version>
</dependency>
<!--oracle驱动-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>21.6.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>21.1.0.0</version> <!-- 版本号需要与你的ojdbc版本匹配 -->
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- JWT -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-event</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<artifactId>common-microservice</artifactId>
<groupId>com.njcn</groupId>
</exclusion>
<exclusion>
<artifactId>common-web</artifactId>
<groupId>com.njcn</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.3-jre</version> <!-- 使用最新稳定版 -->
</dependency>
</dependencies>
<build>
<finalName>event_smart</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -1,22 +0,0 @@
package com.njcn.gather.event;
import com.njcn.event.file.component.WavePicComponent;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
@Slf4j
@SpringBootApplication(scanBasePackages = "com.njcn")
//@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = WavePicComponent.class))
@MapperScan("com.njcn.**.mapper")
public class EventSmartApplication {
public static void main(String[] args) {
SpringApplication.run(EventSmartApplication.class, args);
}
}

View File

@@ -1,84 +0,0 @@
package com.njcn.gather.event.devcie.config;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
import com.njcn.gather.event.transientes.service.PqsDeptsService;
import com.njcn.redis.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2025/07/28 上午 9:32【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Component
@Slf4j
public class PqlineCache {
@Autowired
private PqLineMapper pqLineMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private PqsDeptslineService pqsDeptslineService;
@Autowired
private PqsDeptsService pqsDeptsService;
private final static String NAME_KEY = "LineCache:";
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
@PostConstruct
public void init() {
log.info("系统启动中。。。加载pqline");
List<PqLine> pqLines = pqLineMapper.selectList(null);
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
for (PqsDepts pqsDepts : list) {
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
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());
List<Integer> result = new ArrayList<>();
if(CollUtil.isNotEmpty(deptslineIds)){
if(deptslineIds.size()> 1000 ){
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
for(List<Integer> li : listList){
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
result.addAll(temList);
}
}else {
result= pqLineMapper.getRunMonitorIds(deptslineIds);
}
}
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
}
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
}
@PreDestroy
public void destroy() {
log.info("系统运行结束");
redisUtil.deleteKeysByString(NAME_KEY);
}
}

View File

@@ -1,80 +0,0 @@
package com.njcn.gather.event.devcie.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
import com.njcn.gather.event.transientes.service.PqsDeptsService;
import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2025/08/05 上午 10:17【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Component
@EnableScheduling
public class LineCacheJob {
@Autowired
private PqLineMapper pqLineMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private PqsDeptslineService pqsDeptslineService;
@Autowired
private PqsDeptsService pqsDeptsService;
@Autowired
private PqDeviceMapper pqDeviceMapper;
private final static String NAME_KEY = "LineCache:";
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
@Scheduled(cron="0 0 1 * * ?" ) // 每3钟执行一次
public void lineCache(){
redisUtil.deleteKeysByString(NAME_KEY);
List<PqLine> pqLines = pqLineMapper.selectList(null);
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
for (PqsDepts pqsDepts : list) {
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
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());
List<Integer> result = new ArrayList<>();
if(CollUtil.isNotEmpty(deptslineIds)){
if(deptslineIds.size()> 1000 ){
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
for(List<Integer> li : listList){
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
result.addAll(temList);
}
}else {
result= pqLineMapper.getRunMonitorIds(deptslineIds);
}
}
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
}
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
}
}

View File

@@ -1,13 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/12
*/
public interface PqDeviceDetailMapper extends BaseMapper<PqDeviceDetail> {
}

View File

@@ -1,29 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO;
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqDeviceMapper extends BaseMapper<PqDevice> {
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("devIndexs") List<Integer> devIndexs);
Page<DeviceDTO> queryListByLineIds(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("lineIds") List<Integer> lineIds);
List<DeviceDeptDTO> selectDeviceDept();
}

View File

@@ -1,21 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
import com.njcn.gather.event.devcie.pojo.po.PqGdCompany;
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:48【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqGdCompanyMapper extends BaseMapper<PqGdCompany> {
}

View File

@@ -1,28 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqLineMapper extends BaseMapper<PqLine> {
List<LedgerBaseInfoDTO> getBaseLineInfo(@Param("ids")List<Integer> ids);
List<LedgerBaseInfoDTO> getBaseLedger(@Param("ids")List<Integer> ids,@Param("searchValue")String searchValue);
List<Integer> getRunMonitorIds(@Param("ids")List<Integer> ids);
}

View File

@@ -1,9 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PqLinedetailMapper extends BaseMapper<PqLinedetail> {
}

View File

@@ -1,20 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:48【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqSubstationMapper extends BaseMapper<PqSubstation> {
List<SubstationDTO> queryListByIds(@Param("ids")List<Integer> ids);
}

View File

@@ -1,22 +0,0 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqsStationMap;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsStationMapMapper extends BaseMapper<PqsStationMap> {
}

View File

@@ -1,181 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqDeviceMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqDevice">
<!--@mbg.generated-->
<!--@Table PQ_DEVICE-->
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
<result column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="STATUS" jdbcType="DECIMAL" property="status" />
<result column="DEVTYPE" jdbcType="VARCHAR" property="devtype" />
<result column="LOGONTIME" jdbcType="TIMESTAMP" property="logontime" />
<result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
<result column="NODE_INDEX" jdbcType="DECIMAL" property="nodeIndex" />
<result column="PORTID" jdbcType="DECIMAL" property="portid" />
<result column="DEVFLAG" jdbcType="DECIMAL" property="devflag" />
<result column="DEV_SERIES" jdbcType="VARCHAR" property="devSeries" />
<result column="DEV_KEY" jdbcType="VARCHAR" property="devKey" />
<result column="IP" jdbcType="VARCHAR" property="ip" />
<result column="DEVMODEL" jdbcType="DECIMAL" property="devmodel" />
<result column="CALLFLAG" jdbcType="DECIMAL" property="callflag" />
<result column="DATATYPE" jdbcType="DECIMAL" property="datatype" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEV_INDEX, GD_INDEX, SUB_INDEX, "NAME", "STATUS", DEVTYPE, LOGONTIME, UPDATETIME,
NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
</sql>
<select id="queryListByIds" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
select
pq_device.dev_index devId,
pq_device.name devName,
pq_device.UpdateTime updateTime,
pq_device.DevFlag devFlag,
pq_device.IP ip,
pq_device.status status,
PQ_SUBSTATION.sub_index stationId,
PQ_SUBSTATION.name stationName,
PQ_GDINFORMATION.Name gdName
from
pq_device,
PQ_SUBSTATION,
PQ_GDINFORMATION
where
pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
and pq_device.DEV_INDEX in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
SELECT DISTINCT
pq_device.dev_index devId,
pq_device.name devName,
pq_device.UpdateTime updateTime,
pq_device.DevFlag devFlag,
pq_device.IP ip,
pq_device.status status,
PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,
PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,
pq_device.LogonTime logonTime,
PQ_DEVICEDETAIL.MANUFACTURER
FROM
pq_device
inner JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index
<where>
pq_device.DEV_INDEX in
<foreach collection="devIndexs" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
order by pq_device.updatetime
</where>
</select>
<!-- <select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">-->
<!-- WITH temp AS(-->
<!-- SELECT DISTINCT-->
<!-- PQ_LINE.DEV_INDEX,-->
<!-- PQS_DEPTS.DEPTSNAME-->
<!-- FROM-->
<!-- PQ_LINE,-->
<!-- PQS_DEPTSLINE,-->
<!-- PQS_DEPTS-->
<!-- WHERE-->
<!-- PQ_LINE.LINE_INDEX = PQS_DEPTSLINE.LINE_INDEX-->
<!-- AND PQS_DEPTS.DEPTS_INDEX = PQS_DEPTSLINE.DEPTS_INDEX-->
<!-- )-->
<!-- SELECT DISTINCT-->
<!-- pq_device.dev_index devId,-->
<!-- pq_device.name devName,-->
<!-- pq_device.UpdateTime updateTime,-->
<!-- pq_device.DevFlag devFlag,-->
<!-- pq_device.IP ip,-->
<!-- pq_device.status status,-->
<!-- PQ_SUBSTATION.sub_index stationId,-->
<!-- PQ_SUBSTATION.name stationName,-->
<!-- PQ_GDINFORMATION.Name gdName,-->
<!-- PQS_DICDATA.DIC_Name MANUFACTURER_Name,-->
<!-- PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,-->
<!-- PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,-->
<!-- pq_device.LogonTime logonTime,-->
<!-- temp.DEPTSNAME deptName-->
<!-- FROM-->
<!-- pq_device-->
<!-- LEFT JOIN PQ_SUBSTATION ON pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX-->
<!-- LEFT JOIN PQ_GDINFORMATION ON pq_device.GD_INDEX = PQ_GDINFORMATION.GD_INDEX-->
<!-- LEFT JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index-->
<!-- LEFT JOIN PQS_DICDATA on PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX-->
<!-- LEFT JOIN temp on temp.DEV_INDEX = pq_device.dev_index-->
<!-- where 1=1-->
<!-- <if test="searchValue!= null and searchValue!= ''">-->
<!-- AND (-->
<!-- pq_device.name LIKE '%' || #{searchValue} || '%'-->
<!-- OR PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'-->
<!-- OR PQ_GDINFORMATION.Name LIKE '%' || #{searchValue} || '%'-->
<!-- )-->
<!-- </if>-->
<!-- <if test="state!= null and state!= ''">-->
<!-- and pq_device.status = #{state}-->
<!-- </if>-->
<!-- and pq_device.DEV_INDEX in-->
<!-- <foreach collection="devIndexs" item="item" open="(" close=")" separator=",">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- order by pq_device.updatetime-->
<!-- </select>-->
<select id="queryListByLineIds" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
select distinct
pq_device.dev_index devId,
pq_device.name devName,
pq_device.UpdateTime updateTime,
pq_device.DevFlag devFlag,
pq_device.IP ip,
pq_device.status status,
PQ_SUBSTATION.sub_index stationId,
PQ_SUBSTATION.name stationName,
PQ_GDINFORMATION.Name gdName,
PQS_DICDATA.DIC_Name MANUFACTURER_Name
from
pq_line,
pq_device,
PQ_DEVICEDETAIL,
PQ_SUBSTATION,
PQ_GDINFORMATION,
PQS_DICDATA
where
pq_line.DEV_INDEX = pq_device.DEV_INDEX
and PQ_DEVICEDETAIL.dev_index =pq_device.dev_index
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
and PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX
and pq_line.LINE_INDEX in
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectDeviceDept" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO">
SELECT DISTINCT
PQ_LINE.DEV_INDEX devId,
PQS_DEPTS.DEPTSNAME deptName,
PQS_DEPTS.DEPTS_INDEX deptId
FROM
PQ_LINE,
PQS_DEPTSLINE,
PQS_DEPTS
WHERE
PQ_LINE.LINE_INDEX = PQS_DEPTSLINE.LINE_INDEX
AND PQS_DEPTS.DEPTS_INDEX = PQS_DEPTSLINE.DEPTS_INDEX
</select>
</mapper>

View File

@@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqLineMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqLine">
<!--@mbg.generated-->
<!--@Table PQ_LINE-->
<id column="LINE_INDEX" jdbcType="DECIMAL" property="lineIndex" />
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
<result column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
<result column="SUBV_INDEX" jdbcType="DECIMAL" property="subvIndex" />
<result column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="PT1" jdbcType="FLOAT" property="pt1" />
<result column="PT2" jdbcType="FLOAT" property="pt2" />
<result column="CT1" jdbcType="FLOAT" property="ct1" />
<result column="CT2" jdbcType="FLOAT" property="ct2" />
<result column="DEVCMP" jdbcType="FLOAT" property="devcmp" />
<result column="DLCMP" jdbcType="FLOAT" property="dlcmp" />
<result column="JZCMP" jdbcType="FLOAT" property="jzcmp" />
<result column="XYCMP" jdbcType="FLOAT" property="xycmp" />
<result column="SUBV_NO" jdbcType="DECIMAL" property="subvNo" />
<result column="SCALE" jdbcType="VARCHAR" property="scale" />
<result column="SUBV_NAME" jdbcType="VARCHAR" property="subvName" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
LINE_INDEX, GD_INDEX, SUB_INDEX, SUBV_INDEX, DEV_INDEX, "NAME", PT1, PT2, CT1, CT2,
DEVCMP, DLCMP, JZCMP, XYCMP, SUBV_NO, "SCALE", SUBV_NAME
</sql>
<select id="getBaseLineInfo" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
WITH temp AS(
select PQ_USER_LINE_ASS.LINE_INDEX LINE_INDEX,listagg(PQ_USER_LEDGER.CUSTOMER_NAME,';') within GROUP (order by PQ_USER_LEDGER.CUSTOMER_NAME) objName from PQ_USER_LINE_ASS ,PQ_USER_LEDGER where PQ_USER_LINE_ASS.USER_INDEX=PQ_USER_LEDGER.ID group by PQ_USER_LINE_ASS.LINE_INDEX
)
select
PQ_GDINFORMATION.name gdName,
pq_line.GD_INDEX gdIndex,
pq_line.line_index lineId,
pq_line.name lineName,
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
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,
temp.objName objName
from
pq_line LEFT JOIN PQ_SUBVOLTAGE on pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
LEFT JOIN
pq_device on PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
LEFT JOIN PQ_SUBSTATION on pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
LEFT JOIN PQ_GDINFORMATION on pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
LEFT JOIN temp on temp.LINE_INDEX = pq_line.LINE_INDEX
where 1=1
and pq_line.line_index in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getBaseLedger" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
select
PQ_GDINFORMATION.name gdName,
pq_line.GD_INDEX gdIndex,
pq_line.line_index lineId,
pq_line.name lineName,
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
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
pq_line inner JOIN PQ_SUBVOLTAGE on pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
inner JOIN pq_device on PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
inner JOIN PQ_SUBSTATION on pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
inner JOIN PQ_GDINFORMATION on pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
<where>
and pq_line.line_index in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="searchValue!=null and searchValue!=''">
and (
PQ_GDINFORMATION.name LIKE '%' || #{searchValue} || '%'
or PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'
or pq_line.name LIKE '%' || #{searchValue} || '%'
)
</if>
</where>
</select>
<select id="getRunMonitorIds" resultType="integer">
select DISTINCT pq_line.line_index from pq_line inner join pq_device on pq_line.DEV_INDEX = pq_device.DEV_INDEX
where pq_line.line_index in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and pq_device.DEVFLAG = 0
</select>
</mapper>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqSubstationMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqSubstation">
<!--@mbg.generated-->
<!--@Table PQ_SUBSTATION-->
<id column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="SCALE" jdbcType="VARCHAR" property="scale" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
SUB_INDEX, GD_INDEX, "NAME", "SCALE"
</sql>
<select id="queryListByIds" resultType="com.njcn.gather.event.devcie.pojo.dto.SubstationDTO">
select
PQ_SUBSTATION.sub_index stationId,
PQ_SUBSTATION.name stationName,
PQ_GDINFORMATION.Name gdName,
PQS_MAP.LATITUDE LATITUDE,
PQS_MAP.LONGITUDE LONGITUDE
from
PQ_SUBSTATION left join
PQS_MAP on PQ_SUBSTATION.SUB_INDEX =PQS_MAP.SUB_INDEX
left join
PQ_GDINFORMATION on PQ_SUBSTATION.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
where
PQS_MAP.state=1
and PQ_SUBSTATION.SUB_INDEX in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -1,45 +0,0 @@
package com.njcn.gather.event.devcie.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* Description:
* Date: 2025/06/27 下午 3:25【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class DeviceDTO {
private Integer devId;
private String devName;
private Integer stationId;
private String stationName;
private String gdName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
private String devFlag;
private String ip;
private String manufacturerName;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate thisTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate nextTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime logonTime;
private String deptName;
//通讯状态
private Integer runFlag=0;
//装置通讯状态0中断1正常
private Integer status;
private double onLineRate=0.00;
private double integrityRate = 0.00;
}

View File

@@ -1,21 +0,0 @@
package com.njcn.gather.event.devcie.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Description:
* Date: 2025/06/27 下午 3:25【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class DeviceDeptDTO {
private Integer devId;
private String deptId;
private String deptName;
}

View File

@@ -1,41 +0,0 @@
package com.njcn.gather.event.devcie.pojo.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author: cdf
* @CreateTime: 2025-06-25
* @Description:
*/
@Data
public class LedgerBaseInfoDTO {
private String gdName;
private String gdIndex;
private Integer lineId;
private String lineName;
private Integer busBarId;
private String busBarName;
private Integer devId;
private String devName;
private String objName;
private Integer stationId;
private String stationName;
//通讯状态
private Integer runFlag=0;
private Integer eventCount;
}

View File

@@ -1,73 +0,0 @@
package com.njcn.gather.event.devcie.pojo.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Description:
* Date: 2025/07/29 下午 3:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class PqsDeptDTO {
/**
* 部门表Guid
*/
private String deptsIndex;
/**
* 部门名称
*/
private String deptsname;
/**
* 排序
*/
private Integer deptsDesc;
/**
* 关联表PQS_User用户表Guid
*/
private String userIndex;
/**
* 更新时间
*/
private LocalDateTime updatetime;
/**
* 部门描述
*/
private String deptsDescription;
/**
* 角色状态0删除1正常
*/
private Integer state;
/**
* 行政区域
*/
private String area;
private String areaName;
private Integer customDept;
private String parentnodeid;
}

View File

@@ -1,22 +0,0 @@
package com.njcn.gather.event.devcie.pojo.dto;
import lombok.Data;
/**
* Description:
* Date: 2025/06/27 下午 3:37【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class SubstationDTO {
private Integer stationId;
private String stationName;
private String gdName;
private double longitude;
private double latitude;
private Integer runFlag=0;;
}

View File

@@ -1,127 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 靠靠?
*/
@Data
@NoArgsConstructor
@TableName(value = "PQ_DEVICE")
public class PqDevice {
/**
* 靠靠
*/
@TableId(value = "DEV_INDEX", type = IdType.INPUT)
private Integer devIndex;
/**
* 靠靠靠
*/
@TableField(value = "GD_INDEX")
private Integer gdIndex;
/**
* 靠靠?
*/
@TableField(value = "SUB_INDEX")
private Integer subIndex;
/**
* 靠靠
*/
@TableField(value = "\"NAME\"")
private String name;
/**
* 靠靠靠(0:靠;1:靠)
*/
@TableField(value = "\"STATUS\"")
private Integer status;
/**
* (靠縋QS_Dicdata)靠靠Guid
*/
@TableField(value = "DEVTYPE")
private String devtype;
/**
* 靠靠
*/
@TableField(value = "LOGONTIME")
private LocalDateTime logontime;
/**
* 靠靠靠
*/
@TableField(value = "UPDATETIME")
private LocalDateTime updatetime;
/**
* 靠縉odeInformation)靠靠靠,靠靠靠靠靠靠靠?
*/
@TableField(value = "NODE_INDEX")
private Integer nodeIndex;
/**
* 靠ID,靠靠靠
*/
@TableField(value = "PORTID")
private Long portid;
/**
* 靠靠(0:靠;1:靠;2:靠)
*/
@TableField(value = "DEVFLAG")
private Integer devflag;
/**
* 靠靠?靠3ds靠
*/
@TableField(value = "DEV_SERIES")
private String devSeries;
/**
* 靠靠,靠3ds靠
*/
@TableField(value = "DEV_KEY")
private String devKey;
/**
* IP靠
*/
@TableField(value = "IP")
private String ip;
/**
* 靠靠(0:靠靠;1:靠靠)
*/
@TableField(value = "DEVMODEL")
private Integer devmodel;
/**
* 靠靠?
*/
@TableField(value = "CALLFLAG")
private Integer callflag;
/**
* 靠靠(0:靠靠;1:靠靠;2:靠靠)
*/
@TableField(value = "DATATYPE")
private Integer datatype;
}

View File

@@ -1,72 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/12
*/
@TableName(value = "PQ_DEVICEDETAIL")
@Data
public class PqDeviceDetail {
@TableId
@TableField(value = "DEV_INDEX")
private Long devIndex;
@TableField(value = "Manufacturer")
private String manufacturer;
@TableField(value = "CheckFlag")
private Long checkFlag;
@TableField(value="ThisTimeCheck")
private LocalDate ThisTimeCheck;
@TableField(value="NextTimeCheck")
private LocalDate NextTimeCheck;
@TableField(value="DATAPLAN")
private Long dataplan;
@TableField(value="NEWTRAFFIC")
private Long newtraffic;
@TableField(value = "electroplate")
private Integer electroplate = 0;
@TableField(value = "ONTIME")
private Integer ontime;
@TableField(value = "contract")
private String contract;
@TableField(value = "DEV_CATENA")
private String devCatnea;
@TableField(value = "SIM")
private String sim;
@TableField(value = "DEV_NO")
private String devNo;
@TableField(value = "DEV_LOCATION")
private String devLocation;
@TableField(value = "IS_ALARM")
private Integer isAlarm;
}

View File

@@ -1,27 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/9
*/
@Data
@TableName(value = "PQ_GDINFORMATION")
public class PqGdCompany {
@TableId
@TableField(value="GD_INDEX")
private Long gdIndex;
@TableField(value="NAME")
private String name;
@TableField(value="PROVINCE_INDEX")
private Long provinceIndex;
}

View File

@@ -1,133 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Transient;
/**
*
* Description:
* Date: 2025/06/19 下午 1:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 靠靠?
*/
@Data
@NoArgsConstructor
@TableName(value = "PQ_LINE")
public class PqLine {
/**
* 靠靠
*/
@TableId(value = "LINE_INDEX", type = IdType.INPUT)
private Integer lineIndex;
/**
* 靠靠靠
*/
@TableField(value = "GD_INDEX")
private Integer gdIndex;
/**
* 靠靠?
*/
@TableField(value = "SUB_INDEX")
private Integer subIndex;
/**
* 靠靠
*/
@TableField(value = "SUBV_INDEX")
private Integer subvIndex;
/**
* 靠靠
*/
@TableField(value = "DEV_INDEX")
private Integer devIndex;
/**
* 靠靠
*/
@TableField(value = "\"NAME\"")
private String name;
/**
* PT靠靠
*/
@TableField(value = "PT1")
private Double pt1;
/**
* PT靠靠
*/
@TableField(value = "PT2")
private Double pt2;
/**
* CT靠靠
*/
@TableField(value = "CT1")
private Double ct1;
/**
* CT靠靠
*/
@TableField(value = "CT2")
private Double ct2;
/**
* 靠靠
*/
@TableField(value = "DEVCMP")
private Double devcmp;
/**
* 靠靠
*/
@TableField(value = "DLCMP")
private Double dlcmp;
/**
* 靠靠
*/
@TableField(value = "JZCMP")
private Double jzcmp;
/**
* 靠靠
*/
@TableField(value = "XYCMP")
private Double xycmp;
/**
* 靠?靠靠靠靠靠靠?
*/
@TableField(value = "SUBV_NO")
private Integer subvNo;
/**
* (靠PQS_Dictionary?靠靠Guid
*/
@TableField(value = "\"SCALE\"")
private String scale;
/**
* 靠靠
*/
@TableField(value = "SUBV_NAME")
private String subvName;
@TableField(exist = false)
private String subName;
@TableField(exist = false)
private String deptName;
}

View File

@@ -1,52 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
/**
* @Author: cdf
* @CreateTime: 2025-06-26
* @Description:
*/
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
@TableName("PQ_LINEDETAIL")
public class PqLinedetail {
@TableId(value = "LINE_INDEX", type = IdType.INPUT)
private Integer lineIndex;
private Integer gdIndex;
private Integer subIndex;
private String lineName;
private Integer pttype;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastTime;
private Integer tinterval;
private String loadtype;
private String businesstype;
private String remark;
private String monitorId;
private Integer powerid;
private String objname;
@TableField(fill = FieldFill.INSERT)
private Integer statflag;
private String lineGrade;
private String powerSubstationName;
}

View File

@@ -1,45 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* Description:
* Date: 2025/06/19 下午 1:48【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 靠靠靠
*/
@Data
@NoArgsConstructor
@TableName(value = "PQ_SUBSTATION")
public class PqSubstation {
/**
* 靠靠?
*/
@TableId(value = "SUB_INDEX", type = IdType.INPUT)
private Integer subIndex;
/**
* 靠靠靠
*/
@TableField(value = "GD_INDEX")
private Integer gdIndex;
/**
* 靠靠?
*/
@TableField(value = "\"NAME\"")
private String name;
@TableField(value = "\"SCALE\"")
private String scale;
}

View File

@@ -1,33 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* Description:
* Date: 2025/06/19 下午 3:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@NoArgsConstructor
@TableName(value = "PQS_DEPTSLINE")
public class PqsDeptsline {
/**
* 部门表Guid
*/
@TableField(value = "DEPTS_INDEX")
private String deptsIndex;
@TableField(value = "LINE_INDEX")
private Integer lineIndex;
@TableField(value = "SYSTYPE")
private String systype;
}

View File

@@ -1,58 +0,0 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/11
*/
@TableName(value="PQS_MAP")
@Data
public class PqsStationMap {
@TableId
@TableField(value = "MAP_INDEX")
private String mapIndex;
@TableField(value = "SUB_INDEX")
private Long subIndex;
@TableField(value = "GD_INDEX")
private Long gdIndex;
//经度
@TableField(value = "LONGITUDE")
private Float longItude;
//纬度
@TableField(value = "LATITUDE")
private Float latItude;
//数据状态
@TableField(value = "STATE")
private Long state;
//用户ID
@TableField(value = "USER_INDEX")
private String userIndex;
//更新时间
@TableField(value = "UPDATETIME")
private Date updateTime;
}

View File

@@ -1,26 +0,0 @@
package com.njcn.gather.event.devcie.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO;
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqDeviceService extends IService<PqDevice>{
List<DeviceDTO> queryListByIds(List<Integer> lineIds);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs);
List<DeviceDeptDTO> selectDeviceDept();
}

View File

@@ -1,25 +0,0 @@
package com.njcn.gather.event.devcie.service;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqLineService extends IService<PqLine>{
List<LedgerBaseInfoDTO> getBaseLineInfo(List<Integer> ids);
List<LedgerBaseInfoDTO> getBaseLedger(@Param("ids") List<Integer> ids, @Param("searchValue") String searchValue);
}

View File

@@ -1,21 +0,0 @@
package com.njcn.gather.event.devcie.service;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 1:48【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqSubstationService extends IService<PqSubstation>{
List<SubstationDTO> queryListByIds(List<Integer> lineIds);
}

View File

@@ -1,16 +0,0 @@
package com.njcn.gather.event.devcie.service;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
* Description:
* Date: 2025/06/19 下午 3:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsDeptslineService extends IService<PqsDeptsline>{
}

View File

@@ -1,38 +0,0 @@
package com.njcn.gather.event.devcie.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
import com.njcn.gather.event.devcie.service.PqDeviceService;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class PqDeviceServiceImpl extends ServiceImpl<PqDeviceMapper, PqDevice> implements PqDeviceService{
@Override
public List<DeviceDTO> queryListByIds(List<Integer> lineIds) {
return this.baseMapper.queryListByIds(lineIds);
}
@Override
public Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs) {
return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs);
}
@Override
public List<DeviceDeptDTO> selectDeviceDept() {
return this.baseMapper.selectDeviceDept();
}
}

View File

@@ -1,71 +0,0 @@
package com.njcn.gather.event.devcie.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.service.PqLineService;
import org.springframework.util.CollectionUtils;
/**
*
* Description:
* Date: 2025/06/19 下午 1:43【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class PqLineServiceImpl extends ServiceImpl<PqLineMapper, PqLine> implements PqLineService{
@Override
public List<LedgerBaseInfoDTO> getBaseLineInfo(List<Integer> ids){
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
if(CollectionUtils.isEmpty(ids)){
return ledgerBaseInfoDTOS;
}
if(ids.size()>1000){
List<List<Integer>> listIds = CollUtil.split(ids,1000);
for(List<Integer> itemIds : listIds){
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLineInfo(itemIds);
ledgerBaseInfoDTOS.addAll(temp);
}
}else {
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLineInfo(ids);
ledgerBaseInfoDTOS.addAll(temp);
}
return ledgerBaseInfoDTOS;
}
@Override
public List<LedgerBaseInfoDTO> getBaseLedger(List<Integer> ids,String searchValue) {
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
if(CollectionUtils.isEmpty(ids)){
return ledgerBaseInfoDTOS;
}
if(ids.size()>1000){
List<List<Integer>> listIds = CollUtil.split(ids,1000);
for(List<Integer> itemIds : listIds){
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLedger(itemIds,searchValue);
ledgerBaseInfoDTOS.addAll(temp);
}
}else {
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLedger(ids,searchValue);
ledgerBaseInfoDTOS.addAll(temp);
}
return ledgerBaseInfoDTOS;
};
}

View File

@@ -1,26 +0,0 @@
package com.njcn.gather.event.devcie.service.impl;
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
import com.njcn.gather.event.devcie.mapper.PqSubstationMapper;
import com.njcn.gather.event.devcie.service.PqSubstationService;
/**
*
* Description:
* Date: 2025/06/19 下午 1:48【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class PqSubstationServiceImpl extends ServiceImpl<PqSubstationMapper, PqSubstation> implements PqSubstationService{
@Override
public List<SubstationDTO> queryListByIds(List<Integer> lineIds) {
return this.baseMapper.queryListByIds(lineIds);
}
}

View File

@@ -1,19 +0,0 @@
package com.njcn.gather.event.devcie.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.transientes.mapper.PqsDeptslineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
/**
*
* Description:
* Date: 2025/06/19 下午 3:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class PqsDeptslineServiceImpl extends ServiceImpl<PqsDeptslineMapper, PqsDeptsline> implements PqsDeptslineService{
}

View File

@@ -1,367 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
import com.njcn.gather.event.transientes.pojo.po.*;
import com.njcn.gather.event.transientes.service.*;
import com.njcn.gather.event.transientes.service.impl.MsgEventInfoServiceImpl;
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.njcn.gather.event.transientes.pojo.constant.RedisConstant.REDIS_DEPT_INDEX;
/**
* @Author: cdf
* @CreateTime: 2025-06-23
* @Description:
*/
@Api(tags = "暂降接收")
@RequestMapping("accept")
@RestController
@RequiredArgsConstructor
@Slf4j
public class EventGateController extends BaseController {
private final MsgEventInfoServiceImpl msgEventInfoServiceImpl;
private final PqUserLineAssMapper pqUserLineAssMapper;
private final PqUserLedgerMapper pqUserLedgerMapper;
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
private final WebSocketServer webSocketServer;
private final PqsDeptslineService pqsDeptslineService;
private final PqsDeptsService pqsDeptsService;
private final PqsUserService pqsUserService;
private final PqsUsersetService pqsUsersetService;
private final PqLineMapper pqLineMapper;
private final EventGateService eventGateService;
private final MsgEventConfigService msgEventConfigService;
private final MsgEventInfoService msgEventInfoService;
private final RedisUtil redisUtil;
@OperateInfo
@GetMapping("/eventMsg")
@ApiOperation("接收远程推送的暂态事件")
@ApiImplicitParam(name = "eventMsg", value = "暂态事件json字符", required = true)
public HttpResult<Object> eventMsg(@RequestParam("msg") String msg) {
String methodDescribe = getMethodDescribe("eventMsg");
log.info("收到前置推送暂降事件:"+msg);
JSONObject jsonObject;
try {
//下面一行代码正式环境需要放开
jsonObject = new JSONObject(msg);
//下面一行代码正式环境需要放开
//jsonObject = test();
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())
&& Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()
&& (Float.parseFloat(jsonObject.get("persisttime").toString())*1000) >= msgEventConfigService.getEventDuration()) {
//过滤重要暂降事件
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getLineIndex,lineId));
String str ="/";
if(CollUtil.isNotEmpty(assList)){
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId,PqUserLedgerPO::getCustomerName).in(PqUserLedgerPO::getId,userIds));
str = poList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(StrUtil.COMMA));
}
List<PqsDepts> deptsList = (List<PqsDepts>)redisUtil.getObjectByKey(REDIS_DEPT_INDEX+ StrUtil.DASHED+"AllDept");
Map<String,PqsDepts> deptsMap = deptsList.stream().collect(Collectors.toMap(PqsDepts::getDeptsIndex,dept->dept));
List<PqsDeptsline> deptslineList = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex,lineId).list();
List<String> deptIds = deptslineList.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toList());
Set<String> set =getAllParentIdsWithChildrenBatch(deptIds,deptsMap);
jsonObject.putOpt("objName",str);
jsonObject.putOpt("dept", String.join(StrUtil.COMMA, set));
webSocketServer.sendMessageToAll(jsonObject.toString());
}
} catch (Exception e) {
e.printStackTrace();
log.error("暂降json格式异常!{}", e.getMessage());
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
public Set<String> getAllParentIdsRecursive(String deptId, Map<String, PqsDepts> deptMap, Set<String> result) {
if (deptId == null || result.contains(deptId)) {
return result;
}
result.add(deptId); // 添加当前ID
PqsDepts dept = deptMap.get(deptId);
if (dept != null && dept.getParentnodeid() != null) {
getAllParentIdsRecursive(dept.getParentnodeid(), deptMap, result); // 递归处理父节点
}
return result;
}
// 批量处理入口方法
public Set<String> getAllParentIdsWithChildrenBatch(Collection<String> deptIds, Map<String, PqsDepts> deptMap) {
Set<String> result = new HashSet<>();
for (String deptId : deptIds) {
getAllParentIdsRecursive(deptId, deptMap, result);
}
return result;
}
@OperateInfo
@GetMapping("/testEvent")
@ApiOperation("接收远程推送的暂态事件")
public HttpResult<Object> testEvent() {
String methodDescribe = getMethodDescribe("testEvent");
log.info("模拟测试发送暂降事件-------------------------");
JSONObject jsonObject;
try {
//下面一行代码正式环境需要放开
jsonObject = test();
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) &&Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
webSocketServer.sendMessageToAll(jsonObject.toString());
//开始发送短信
try {
sendMessage(jsonObject);
}catch (Exception e){
log.error("短信组装发送失败!失败原因{}",e.getMessage());
}
}
} catch (Exception e) {
log.error("暂降json格式异常!{}", e.getMessage());
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
//测试模拟,正式环境删除
private PqsEventdetail createEvent(JSONObject jsonObject, LocalDateTime now) {
PqsEventdetail pqsEventdetail = new PqsEventdetail();
pqsEventdetail.setEventdetailIndex(jsonObject.get("eventdetail_index").toString());
pqsEventdetail.setLineid(Integer.valueOf(jsonObject.get("lineid").toString()));
pqsEventdetail.setTimeid(now);
pqsEventdetail.setMs(new BigDecimal(jsonObject.get("ms").toString()));
pqsEventdetail.setWavetype(Integer.valueOf(jsonObject.get("wavetype").toString()));
pqsEventdetail.setPersisttime(Double.valueOf(jsonObject.get("persisttime").toString()));
pqsEventdetail.setEventvalue(Double.valueOf(jsonObject.get("eventvalue").toString()));
pqsEventdetail.setEventreason(jsonObject.get("eventreason").toString());
pqsEventdetail.setEventtype(jsonObject.get("eventtype").toString());
return pqsEventdetail;
}
//测试模拟,正式环境删除
private JSONObject test() {
/*----------------------------------------------------------------------------------------*/
//以下部分为测试数据后续删除
List<PqLine> pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>());
List<Integer> lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
List<LedgerBaseInfoDTO> baseInfoDTOList = pqLineMapper.getBaseLineInfo(lineList);
Map<Integer, LedgerBaseInfoDTO> map = baseInfoDTOList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
Random random = new Random();
Integer lineId = lineList.get(random.nextInt(lineList.size()));
LedgerBaseInfoDTO dto = map.get(lineId);
LocalDateTime now = LocalDateTime.now();
String timeStr = DateUtil.format(now, DatePattern.NORM_DATETIME_PATTERN);
Long ms = (long) random.nextInt(999);
Integer[] temArr = new Integer[]{1, 3};
Integer wave = random.nextInt(2);
Double per = (double)random.nextInt(5000);
double minV = 0.1;
double maxV = 0.9;
Double eventValue = minV + (maxV - minV) * Math.random();
String id = IdUtil.simpleUUID();
JSONObject tem = new JSONObject();
tem.set("eventdetail_index", id);
tem.set("lineid", lineId.toString());
tem.set("timeid", timeStr);
tem.set("ms", ms.toString());
tem.set("wavetype", temArr[wave]);
tem.set("persisttime", per.toString());
tem.set("eventvalue", eventValue);
tem.set("eventreason", "97a56e0f-b546-4c1e-b27c-52463fc1d82f");
tem.set("eventtype", "676683a0-7f80-43e6-8df8-bea8ed235d67");
tem.set("gdname", "测试供电公司");
tem.set("bdname", dto.getStationName());
tem.set("pointname", dto.getLineName());
/* PqsEventdetail pqsEventdetail = createEvent(tem, now);
if (msgEventConfigService.getEventType().contains(tem.get("wavetype").toString())) {
webSocketServer.sendMessageToAll(tem.toString());
}
pqsEventdetailService.save(pqsEventdetail);*/
/*----------------------------------------------------------------------------------------*/
return tem;
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getTransientAnalyseWave")
@ApiOperation("暂态事件波形分析")
public HttpResult<WaveDataDTO> getTransientAnalyseWave(@RequestBody MonitorTerminalParam param) {
String methodDescribe = getMethodDescribe("getTransientAnalyseWave");
WaveDataDTO wave = eventGateService.getTransientAnalyseWave(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/simulationSend")
@ApiOperation("模拟发送短信")
public HttpResult<WaveDataDTO> simulationSend(@RequestBody @Validated SimulationMsgParam param) {
String methodDescribe = getMethodDescribe("simulationSend");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
private void sendMessage(JSONObject jsonObject) throws Exception{
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
List<PqsDeptsline> pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).eq(PqsDeptsline::getSystype, sysTypeZt).list();
Set<String> deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet());
Set<String> resultIds = getAllParentDeptIds(deptIds);
List<PqsUserSet> pqsUserSetList = pqsUsersetService.lambdaQuery().eq(PqsUserSet::getIsNotice, 1).in(PqsUserSet::getDeptsIndex, resultIds).list();
if (CollUtil.isEmpty(pqsUserSetList)) {
//当前事件未找到用户信息,判断为不需要发送短信用户
return;
}
List<PqsUser> pqsUserList = pqsUserService.lambdaQuery().select(PqsUser::getUserIndex,PqsUser::getPhone,PqsUser::getName).in(PqsUser::getUserIndex, pqsUserSetList.stream().map(PqsUserSet::getUserIndex).collect(Collectors.toList())).list();
List<String> userIds = pqsUserList.stream().map(PqsUser::getUserIndex).collect(Collectors.toList());
List<PqsUserSet> poList = pqsUserSetList.stream().filter(it -> userIds.contains(it.getUserIndex())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(poList)) {
StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString());
List<LedgerBaseInfoDTO> list = pqLineMapper.getBaseLineInfo(Stream.of(lineId).collect(Collectors.toList()));
LedgerBaseInfoDTO ledgerBaseInfoDTO = list.get(0);
BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(", ").append(ledgerBaseInfoDTO.getStationName()).append(ledgerBaseInfoDTO.getLineName())
.append("发生暂降事件,事件特征幅值").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S");
//TODO 发送短信
// System.out.println(stringBuilder);
List<MsgEventInfo> resultList = new ArrayList<>();
for (PqsUser user : pqsUserList) {
MsgEventInfo msgEventInfo = new MsgEventInfo();
msgEventInfo.setEventIndex(jsonObject.get("eventdetail_index").toString());
msgEventInfo.setMsgContent(stringBuilder.toString());
msgEventInfo.setMsgIndex(IdUtil.simpleUUID());
msgEventInfo.setPhone(user.getPhone());
msgEventInfo.setSendResult(0);
msgEventInfo.setUserId(user.getUserIndex());
msgEventInfo.setUserName(user.getName());
msgEventInfo.setIsHandle(0);
msgEventInfo.setSendTime(LocalDateTime.now());
resultList.add(msgEventInfo);
}
msgEventInfoService.saveBatch(resultList);
}
}
/**
* 获取远程短信平台token
*/
private String apiToken() {
return "token";
}
private boolean apiSend(){
return false;
}
public Set<String> getAllParentDeptIds(Set<String> deptIds) {
// 首次获取直接父级
List<PqsDepts> allDeptList = pqsDeptsService.lambdaQuery().list();
// 递归获取所有父级
Set<String> result = recursivelyGetParentIds(deptIds, allDeptList);
return result;
}
/**
* 递归获取所有父级ID
*
* @param currentParentIds 当前层级的父级ID集合
* @return 所有层级的父级ID集合
*/
private Set<String> recursivelyGetParentIds(Set<String> currentParentIds, List<PqsDepts> allDeptList) {
Set<String> result = new HashSet<>(currentParentIds);
Set<String> nextLevelParentIds = new HashSet<>();
List<PqsDepts> parentDeptList = allDeptList.stream().filter(it -> currentParentIds.contains(it.getDeptsIndex())).collect(Collectors.toList());
for (PqsDepts pqsDepts : parentDeptList) {
if (!pqsDepts.getParentnodeid().equals("0")) {
nextLevelParentIds.add(pqsDepts.getParentnodeid());
}
}
// 如果有更高层级的父级,继续递归
if (!nextLevelParentIds.isEmpty()) {
Set<String> deeperParentIds = recursivelyGetParentIds(nextLevelParentIds, allDeptList);
result.addAll(deeperParentIds);
}
return result;
}
}

View File

@@ -1,156 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqGdCompany;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
import com.njcn.gather.event.transientes.pojo.po.*;
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
import com.njcn.gather.event.transientes.service.*;
import com.njcn.gather.event.transientes.service.impl.MsgEventInfoServiceImpl;
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author: cdf
* @CreateTime: 2025-06-23
* @Description:
*/
@Api(tags = "暂降接收")
@RequestMapping("right")
@RestController
@RequiredArgsConstructor
@Slf4j
public class EventRightController extends BaseController {
private final EventRightService eventRightService;
@OperateInfo
@PostMapping("/rightEvent")
@ApiOperation("右侧表头")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightEvent");
UserLedgerStatisticVO userLedgerStatisticVO = eventRightService.userLedgerStatisticClone(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userLedgerStatisticVO, methodDescribe);
}
@OperateInfo
@PostMapping("/rightImportUser")
@ApiOperation("右侧重要用户")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightImportUser(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightImportUser");
List<UserLedgerStatisticVO.Inner> result = eventRightService.rightImportUser(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/rightEventOpen")
@ApiOperation("右侧表头点击事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightEventOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightEventOpen");
Page<PqUserLedgerPO> page = eventRightService.rightEventOpenClone(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo
@PostMapping("/rightEventOpenClone")
@ApiOperation("右侧表头点击事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightEventOpenClone(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightEventOpenClone");
Page<EventDetailVO> page = eventRightService.rightEventOpen(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo
@PostMapping("/rightEventOpenForDetail")
@ApiOperation("右侧表头点击事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightEventOpenForDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightEventOpenForDetail");
Page<EventDetailVO> page = eventRightService.rightEventOpenForDetail(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo
@PostMapping("/rightEventDevOpen")
@ApiOperation("右侧表头终端点击事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightEventDevOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightEventDevOpen");
Page<PqUserLedgerPO> page = eventRightService.rightEventDevOpen(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo
@PostMapping("/rightImportOpenDetail")
@ApiOperation("右侧表头终端点击事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
public HttpResult<Object> rightImportOpenDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightImportOpenDetail");
PqUserLedgerPO po = eventRightService.rightImportOpenDetail(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}
@GetMapping("gdSelect")
public HttpResult<List<PqGdCompany>> gdSelect() {
String methodDescribe = getMethodDescribe("gdSelect");
List<PqGdCompany> list = eventRightService.gdSelect();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@GetMapping("bdSelect")
public HttpResult<List<PqSubstation>> bdSelect() {
String methodDescribe = getMethodDescribe("bdSelect");
List<PqSubstation> list = eventRightService.bdSelect();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -1,265 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.gather.event.transientes.pojo.param.MessageEventFeedbackParam;
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
import com.njcn.gather.event.transientes.pojo.vo.*;
import com.njcn.gather.event.transientes.service.LargeScreenCountService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Description:
* Date: 2025/06/19 下午 3:00【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@Api(tags = "大屏统计")
@RestController
@RequestMapping("/largescreen")
@RequiredArgsConstructor
public class LargeScreenCountController extends BaseController {
private final LargeScreenCountService largeScreenCountService;
@OperateInfo
@PostMapping("/initLedger")
@ApiOperation("台账规模统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Object> initLedger(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("initLedger");
largeScreenCountService.initLedger(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo
@PostMapping("/ledgercount")
@ApiOperation("台账规模统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<LedgerCountVO> scaleStatistics(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("scaleStatistics");
LedgerCountVO result = largeScreenCountService.scaleStatistics(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/alarmAnalysis")
@ApiOperation("告警统计分析")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<AlarmAnalysisVO> alarmAnalysis(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("alarmAnalysis");
AlarmAnalysisVO result = largeScreenCountService.alarmAnalysis(largeScreenCountParam);
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("/eventTablePage")
@ApiOperation("告警统计分析详情")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Page<EventDetailVO>> eventTablePage(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("alarmAnalysisDetail");
Page<EventDetailVO> result = largeScreenCountService.eventTablePage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/eventTrend")
@ApiOperation("暂降事件趋势")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<EventTrendVO>> eventTrend(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("eventTrend");
List<EventTrendVO> result = largeScreenCountService.eventTrend(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/eventList")
@ApiOperation("暂降事件列表")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Page<EventDetailVO>> eventList(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("eventList");
Page<EventDetailVO> result = largeScreenCountService.eventList(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/noDealEventList")
@ApiOperation("未处理暂降事件列表")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<EventDetailVO>> noDealEventList(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("noDealEventList");
List<EventDetailVO> result = largeScreenCountService.noDealEventList(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/mapCount")
@ApiOperation("地图统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<MapCountVO>> mapCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("mapCount");
List<MapCountVO> result = largeScreenCountService.mapCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(operateType= OperateType.UPDATE)
@PostMapping("/lookEvent")
@ApiOperation("处理暂降事件")
@ApiImplicitParam(name = "eventIds", value = "暂降事件id", required = true)
public HttpResult<Boolean> lookEvent(@RequestBody List<String> eventIds) {
String methodDescribe = getMethodDescribe("lookEvent");
boolean result = largeScreenCountService.lookEvent(eventIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@GetMapping("/eventMsgDetail")
@ApiOperation("暂降事件列表详情按钮")
@ApiImplicitParam(name = "eventId", value = "暂降事件id", required = true)
public HttpResult<EventMsgDetailVO> eventMsgDetail(@RequestParam("eventId")String eventId) {
String methodDescribe = getMethodDescribe("eventMsgDetail");
EventMsgDetailVO result = largeScreenCountService.eventMsgDetail(eventId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/msgSendList")
@ApiOperation("远程通知列表")
@ApiImplicitParam(name = "largeScreenCountParam", value = "参数", required = true)
public HttpResult<List<MsgEventInfo>> msgSendList(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("msgSendList");
List<MsgEventInfo> result = largeScreenCountService.msgSendList(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/hasSendMsgPage")
@ApiOperation("已发送短信列表")
@ApiImplicitParam(name = "largeScreenCountParam", value = "参数", required = true)
public HttpResult<Page<MsgEventInfo>> hasSendMsgPage(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("hasSendMsgPage");
Page<MsgEventInfo> result = largeScreenCountService.hasSendMsgPage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(operateType = OperateType.ADD)
@PostMapping("/msgHandle")
@ApiOperation("短信处理")
@ApiImplicitParam(name = "eventId", value = "暂降事件id", required = true)
public HttpResult<Boolean> msgHandle(@RequestBody @Validated MessageEventFeedbackParam messageEventFeedbackParam) {
String methodDescribe = getMethodDescribe("msgHandle");
largeScreenCountService.msgHandle(messageEventFeedbackParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@OperateInfo
@PostMapping("/devFlagCount")
@ApiOperation("终端运行统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<DeviceCountVO> devFlagCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devFlagCount");
DeviceCountVO deviceCountVO = largeScreenCountService.devFlagCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceCountVO, methodDescribe);
}
@OperateInfo
@PostMapping("/devDetail")
@ApiOperation("终端运行统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<DeviceDTO>> devDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devDetail");
List<DeviceDTO> deviceDTOList = largeScreenCountService.devDetail(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceDTOList, methodDescribe);
}
@OperateInfo
@PostMapping("/areaDevCount")
@ApiOperation("区域终端统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<RegionDevCountVO>> areaDevCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("areaDevCount");
List<RegionDevCountVO> result = largeScreenCountService.regionDevCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/substationCount")
@ApiOperation("变电站统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<SubStationCountVO>> substationCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("substationCount");
List<SubStationCountVO> result = largeScreenCountService.substationCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/regionDevCount")
@ApiOperation("区域终端统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<RegionDevCountVO>> rightUserStatistic(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("rightUserStatistic");
List<RegionDevCountVO> result = largeScreenCountService.regionDevCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/eventPage")
@ApiOperation("分页查询暂降事件")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Page<EventDetailVO>> eventPage(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("eventPage");
Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo
@PostMapping("/devicePage")
@ApiOperation("终端分页查询")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Page<DeviceDTO>> devicePage(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devicePage");
Page<DeviceDTO> result = largeScreenCountService.devicePage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(operateType= OperateType.UPDATE)
@PostMapping("/userEventList")
@ApiOperation("查询暂降事件")
@ApiImplicitParam(name = "eventIds", value = "暂降事件id", required = true)
public HttpResult<Page<EventDetailVO>> userEventList(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("userEventList");
Page<EventDetailVO> result = largeScreenCountService.userEventList(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -1,62 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
import com.njcn.gather.event.transientes.service.MsgEventConfigService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: cdf
* @CreateTime: 2025-06-27
* @Description:
*/
@Api(tags = "暂降平台配置")
@RequestMapping("config")
@RestController
@RequiredArgsConstructor
@Slf4j
public class MsgEventConfigController extends BaseController {
private final MsgEventConfigService msgEventConfigService;
@OperateInfo(operateType = OperateType.ADD)
@PostMapping("/eventConfig")
@ApiOperation("暂降平台配置")
@ApiImplicitParam(name = "msgEventConfig", value = "实体", required = true)
@Transactional(rollbackFor = Exception.class)
public HttpResult<Object> eventConfig(@RequestBody @Validated MsgEventConfig msgEventConfig) {
String methodDescribe = getMethodDescribe("eventConfig");
msgEventConfigService.eventConfig(msgEventConfig);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@OperateInfo
@GetMapping("/queryConfig")
@ApiOperation("接收远程推送的暂态事件")
public HttpResult<MsgEventConfig> queryConfig() {
String methodDescribe = getMethodDescribe("queryConfig");
MsgEventConfig msgEventConfig = msgEventConfigService.queryConfig();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, msgEventConfig, methodDescribe);
}
}

View File

@@ -1,54 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.transientes.pojo.param.PqUserLedgerParam;
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
import com.njcn.gather.event.transientes.service.PqUserLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author: cdf
* @CreateTime: 2025-07-28
* @Description:
*/
@RestController
@RequestMapping("/pqUser/ledger")
public class PqUserLedgerController {
@Autowired
private PqUserLedgerService pqUserLedgerService;
// 添加记录
@PostMapping("addLedger")
public boolean addLedger(@RequestBody PqUserLedgerParam ledgerParam) {
return pqUserLedgerService.addLedger(ledgerParam);
}
// 更新记录
@PostMapping("updateLedger")
public boolean updateLedger(@RequestBody PqUserLedgerParam ledgerParam) {
return pqUserLedgerService.updateLedger(ledgerParam);
}
// 删除记录
@PostMapping("deleteLedger")
public boolean deleteLedger(@RequestBody List<String> ids) {
return pqUserLedgerService.deleteLedger(ids);
}
// 查询单条记录
@GetMapping("/getLedgerById")
public PqUserLedgerPO getLedgerById(@PathVariable String id) {
return pqUserLedgerService.getLedgerById(id);
}
// 查询所有记录
@GetMapping
public Page<PqUserLedgerPO> pageList(@RequestBody PqUserLedgerParam ledgerParam) {
return pqUserLedgerService.pageList(ledgerParam);
}
}

View File

@@ -1,48 +0,0 @@
package com.njcn.gather.event.transientes.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
import com.njcn.gather.event.transientes.pojo.vo.PqsDicTreeVO;
import com.njcn.gather.event.transientes.service.PqsDicTreeService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: cdf
* @CreateTime: 2025-08-01
* @Description:
*/
@Api(tags = "字典树")
@RequestMapping("dicTree")
@RestController
@RequiredArgsConstructor
@Slf4j
public class PqsDicTreeController extends BaseController {
private final PqsDicTreeService pqsDicTreeService;
@OperateInfo
@GetMapping("/getDicTree")
@ApiOperation("获取树结构")
public HttpResult<List<PqsDicTreePO>> getDicTree(@RequestParam("code") String code){
String methodDescribe = getMethodDescribe("getDicTree");
List<PqsDicTreePO> pqsDicTreePOList = pqsDicTreeService.getDicTree(code);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDicTreePOList, methodDescribe);
}
}

View File

@@ -1,81 +0,0 @@
package com.njcn.gather.event.transientes.filter;
import cn.hutool.json.JSONObject;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.event.transientes.utils.JwtUtil;
import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
@Slf4j
public class JwtRequestFilter extends OncePerRequestFilter {
private final UserDetailsService userDetailsService;
private final JwtUtil jwtUtil;
public JwtRequestFilter(UserDetailsService userDetailsService, JwtUtil jwtUtil) {
this.userDetailsService = userDetailsService;
this.jwtUtil = jwtUtil;
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
final String authorizationHeader = request.getHeader("Authorization");
String username = null;
String jwt = null;
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
jwt = authorizationHeader.substring(7);
try {
username = jwtUtil.extractUsername(jwt);
} catch (ExpiredJwtException e) {
log.error(e.getMessage());
sendErrorResponse(response,CommonResponseEnum.TOKEN_EXPIRE_JWT);
return;
} catch (Exception e) {
log.error(e.getMessage());
sendErrorResponse(response,CommonResponseEnum.PARSE_TOKEN_ERROR);
return;
}
}
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
if (jwtUtil.validateToken(jwt, userDetails)) {
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =
new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
}
}
chain.doFilter(request, response);
}
private void sendErrorResponse(HttpServletResponse response, CommonResponseEnum error) throws IOException {
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("application/json;charset=UTF-8");
HttpResult<String> httpResult = new HttpResult<>();
httpResult.setCode(error.getCode());
httpResult.setMessage(error.getMessage());
response.getWriter().write(new JSONObject(httpResult, false).toString());
}
}

View File

@@ -1,37 +0,0 @@
package com.njcn.gather.event.transientes.handler;
import com.njcn.common.pojo.constant.LogInfo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import java.lang.reflect.Method;
import java.util.Objects;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年06月22日 10:25
*/
@Slf4j
public class ControllerUtil {
/**
* 针对methodArgumentNotValidException 异常的处理
* @author cdf
*/
public static String getMethodArgumentNotValidException(MethodArgumentNotValidException methodArgumentNotValidException) {
String operate = LogInfo.UNKNOWN_OPERATE;
Method method = null;
try {
method = methodArgumentNotValidException.getParameter().getMethod();
if (!Objects.isNull(method) && method.isAnnotationPresent(ApiOperation.class)) {
ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
operate = apiOperation.value();
}
}catch (Exception e){
log.error("根据方法参数非法异常获取@ApiOperation注解值失败参数非法异常信息{},方法名:{},异常信息:{}",methodArgumentNotValidException.getMessage(),method,e.getMessage());
}
return operate;
}
}

View File

@@ -1,255 +0,0 @@
package com.njcn.gather.event.transientes.handler;
import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil;
import com.njcn.web.utils.HttpResultUtil;
import com.njcn.web.utils.HttpServletUtil;
import com.njcn.web.utils.ReflectCommonUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONException;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.util.NestedServletException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 全局通用业务异常处理器
*
* @author hongawen
* @version 1.0.0
* @date 2021年04月20日 18:04
*/
@Slf4j
@AllArgsConstructor
@RestControllerAdvice
public class GlobalBusinessExceptionHandler {
private final ThreadPoolExecutor executor = new ThreadPoolExecutor(
4, 8, 30, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(100),
// 队列满时由主线程执行
new ThreadPoolExecutor.CallerRunsPolicy()
);
/**
* 捕获业务功能异常,通常为业务数据抛出的异常
*
* @param businessException 业务异常
*/
@ExceptionHandler(BusinessException.class)
public HttpResult<String> handleBusinessException(BusinessException businessException) {
String operate = ReflectCommonUtil.getMethodDescribeByException(businessException);
// recodeBusinessExceptionLog(businessException, businessException.getMessage());
return HttpResultUtil.assembleBusinessExceptionResult(businessException, null, operate);
}
/**
* 空指针异常捕捉
*
* @param nullPointerException 空指针异常
*/
@ExceptionHandler(NullPointerException.class)
public HttpResult<String> handleNullPointerException(NullPointerException nullPointerException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage(), nullPointerException);
//recodeBusinessExceptionLog(nullPointerException, CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NULL_POINTER_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(nullPointerException));
}
/**
* 算数运算异常
*
* @param arithmeticException 算数运算异常由于除数为0引起的异常
*/
@ExceptionHandler(ArithmeticException.class)
public HttpResult<String> handleArithmeticException(ArithmeticException arithmeticException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage(), arithmeticException);
// recodeBusinessExceptionLog(arithmeticException, CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ARITHMETIC_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(arithmeticException));
}
/**
* 类型转换异常捕捉
*
* @param classCastException 类型转换异常
*/
@ExceptionHandler(ClassCastException.class)
public HttpResult<String> handleClassCastException(ClassCastException classCastException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage(), classCastException);
// recodeBusinessExceptionLog(classCastException, CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.CLASS_CAST_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(classCastException));
}
/**
* 索引下标越界异常捕捉
*
* @param indexOutOfBoundsException 索引下标越界异常
*/
@ExceptionHandler(IndexOutOfBoundsException.class)
public HttpResult<String> handleIndexOutOfBoundsException(IndexOutOfBoundsException indexOutOfBoundsException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage(), indexOutOfBoundsException);
// recodeBusinessExceptionLog(indexOutOfBoundsException, CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(indexOutOfBoundsException));
}
/**
* 前端请求后端,请求中参数的媒体方式不支持异常
*
* @param httpMediaTypeNotSupportedException 请求中参数的媒体方式不支持异常
*/
@ExceptionHandler(HttpMediaTypeNotSupportedException.class)
public HttpResult<String> httpMediaTypeNotSupportedExceptionHandler(HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage(), httpMediaTypeNotSupportedException);
// 然后提取错误提示信息进行返回
// recodeBusinessExceptionLog(httpMediaTypeNotSupportedException, CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(httpMediaTypeNotSupportedException));
}
/**
* 前端请求后端,参数校验异常捕捉
* RequestBody注解参数异常
*
* @param methodArgumentNotValidException 参数校验异常
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public HttpResult<String> methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException methodArgumentNotValidException) {
// 从异常对象中拿到allErrors数据
String messages = methodArgumentNotValidException.getBindingResult().getAllErrors()
.stream().map(ObjectError::getDefaultMessage).collect(Collectors.joining(""));
// 然后提取错误提示信息进行返回
LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages);
// recodeBusinessExceptionLog(methodArgumentNotValidException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages, ControllerUtil.getMethodArgumentNotValidException(methodArgumentNotValidException));
}
/**
* 前端请求后端,参数校验异常捕捉
* PathVariable注解、RequestParam注解参数异常
*
* @param constraintViolationException 参数校验异常
*/
@ExceptionHandler(ConstraintViolationException.class)
public HttpResult<String> constraintViolationExceptionExceptionHandler(ConstraintViolationException constraintViolationException) {
String exceptionMessage = constraintViolationException.getMessage();
StringBuilder messages = new StringBuilder();
if (exceptionMessage.indexOf(StrUtil.COMMA) > 0) {
String[] tempMessage = exceptionMessage.split(StrUtil.COMMA);
Stream.of(tempMessage).forEach(message -> {
messages.append(message.substring(message.indexOf(StrUtil.COLON) + 2)).append(';');
});
} else {
messages.append(exceptionMessage.substring(exceptionMessage.indexOf(StrUtil.COLON) + 2));
}
// 然后提取错误提示信息进行返回
LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages);
// recodeBusinessExceptionLog(constraintViolationException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage());
List<ConstraintViolation<?>> constraintViolationList = new ArrayList<>(constraintViolationException.getConstraintViolations());
ConstraintViolation<?> constraintViolation = constraintViolationList.get(0);
Class<?> rootBeanClass = constraintViolation.getRootBeanClass();
//判断校验参数异常捕获的根源是controller还是service处
if (rootBeanClass.getName().endsWith("Controller")) {
String methodName = constraintViolation.getPropertyPath().toString().substring(0, constraintViolation.getPropertyPath().toString().indexOf(StrUtil.DOT));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByClassAndMethodName(rootBeanClass, methodName));
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByException(constraintViolationException));
}
}
/**
* 索引下标越界异常捕捉
*
* @param illegalArgumentException 参数校验异常
*/
@ExceptionHandler(IllegalArgumentException.class)
public HttpResult<String> handleIndexOutOfBoundsException(IllegalArgumentException illegalArgumentException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage(), illegalArgumentException);
// recodeBusinessExceptionLog(illegalArgumentException, CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION, illegalArgumentException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(illegalArgumentException));
}
/**
* 未声明异常捕捉
*
* @param exception 未声明异常
*/
@ExceptionHandler(Exception.class)
public HttpResult<String> handleException(Exception exception) {
//针对fallbackFactory降级异常特殊处理
Exception tempException = exception;
String exceptionCause = CommonResponseEnum.UN_DECLARE.getMessage();
String code = CommonResponseEnum.UN_DECLARE.getCode();
if (exception instanceof NestedServletException) {
Throwable cause = exception.getCause();
if (cause instanceof AssertionError) {
if (cause.getCause() instanceof BusinessException) {
tempException = (BusinessException) cause.getCause();
BusinessException tempBusinessException = (BusinessException) cause.getCause();
exceptionCause = tempBusinessException.getMessage();
code = tempBusinessException.getCode();
}
}
}
LogUtil.logExceptionStackInfo(exceptionCause, tempException);
// recodeBusinessExceptionLog(exception, exceptionCause);
//判断方法上是否有自定义注解,做特殊处理
// Method method = ReflectCommonUtil.getMethod(exception);
// if (!Objects.isNull(method)){
// if(method.isAnnotationPresent(ReturnMsg.class)){
// return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}",exceptionCause));
// }
// }
return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}{}{}", ReflectCommonUtil.getMethodDescribeByException(tempException), StrUtil.C_COMMA, exceptionCause));
}
/**
* json解析异常
*
* @param jsonException json参数
*/
@ExceptionHandler(JSONException.class)
public HttpResult<String> handleIndexOutOfBoundsException(JSONException jsonException) {
LogUtil.logExceptionStackInfo(CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage(), jsonException);
// recodeBusinessExceptionLog(jsonException, CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.JSON_CONVERT_EXCEPTION, jsonException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(jsonException));
}
/*
private void recodeBusinessExceptionLog(Exception businessException, String methodDescribe) {
HttpServletRequest httpServletRequest = HttpServletUtil.getRequest();
Future<?> future = executor.submit(() -> {
HttpServletUtil.setRequest(httpServletRequest);
sysLogAuditService.recodeBusinessExceptionLog(businessException, methodDescribe);
});
try {
// 抛出 ExecutionException
future.get();
} catch (ExecutionException | InterruptedException e) {
log.error("保存审计日志异常,异常为:" + e.getMessage());
}
}*/
}

View File

@@ -1,57 +0,0 @@
//package com.njcn.gather.event.transientes.handler;
//
//import org.apache.ibatis.executor.statement.StatementHandler;
//import org.apache.ibatis.plugin.*;
//import org.apache.ibatis.session.ResultHandler;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//
//import java.sql.Statement;
//import java.util.Properties;
//
///**
// * @Author: cdf
// * @CreateTime: 2025-07-14
// * @Description:
// */
//@Intercepts({
// @Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}),
// @Signature(type = StatementHandler.class, method = "update", args = {Statement.class}),
// @Signature(type = StatementHandler.class, method = "batch", args = {Statement.class})
//})
//@Component
//public class SqlExecuteTimeInterceptor implements Interceptor {
// private static final Logger logger = LoggerFactory.getLogger(SqlExecuteTimeInterceptor.class);
//
// @Override
// public Object intercept(Invocation invocation) throws Throwable {
// long startTime = System.currentTimeMillis();
// try {
// return invocation.proceed();
// } finally {
// long endTime = System.currentTimeMillis();
// long executeTime = endTime - startTime;
//
// // 获取 SQL 语句
// StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
// String sql = statementHandler.getBoundSql().getSql();
//
// // 打印执行时间和 SQL
// logger.info("SQL 执行时间: {}ms, SQL: {}", executeTime, sql);
// }
// }
//
// @Override
// public Object plugin(Object target) {
// if (target instanceof StatementHandler) {
// return Plugin.wrap(target, this);
// }
// return target;
// }
//
// @Override
// public void setProperties(Properties properties) {
// // 可配置参数
// }
//}

View File

@@ -1,13 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.MessageEventFeedback;
/**
* @Author: cdf
* @CreateTime: 2025-06-26
* @Description:
*/
public interface MessageEventFeedbackMapper extends BaseMapper<MessageEventFeedback> {
}

View File

@@ -1,12 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
import org.apache.ibatis.annotations.Mapper;
/**
* MSG_EVENT_CONFIG表Mapper接口
*/
@Mapper
public interface MsgEventConfigMapper extends BaseMapper<MsgEventConfig> {
}

View File

@@ -1,9 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MsgEventInfoMapper extends BaseMapper<MsgEventInfo> {
}

View File

@@ -1,15 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqDevicedetailMapper extends BaseMapper<PqDeviceDetail> {
}

View File

@@ -1,14 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PqUserLedgerMapper extends BaseMapper<PqUserLedgerPO> {
List<PqUserLineAssPO> getUserByParam(@Param("lineIds") List<Integer> lineIds, @Param("searchValue")String searchValue);
}

View File

@@ -1,9 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
public interface PqUserLineAssMapper extends BaseMapper<PqUserLineAssPO> {
}

View File

@@ -1,22 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 3:57【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsDeptsMapper extends BaseMapper<PqsDepts> {
List<String> findDeptAndChildren(@Param("deptId") String deptId);
List<PqsDeptDTO> getDeptList(@Param("deptIds") List<String> deptIds);
}

View File

@@ -1,21 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
import com.njcn.gather.event.transientes.pojo.po.PqsUserSet;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/19 下午 3:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsDeptslineMapper extends BaseMapper<PqsDeptsline> {
List<PqsDeptsline> getPhoneUser(@Param("lineId")String lineId);
}

View File

@@ -1,14 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsDicData;
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PqsDicDataMapper extends BaseMapper<PqsDicData> {
}

View File

@@ -1,16 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PqsDicTreeMapper extends BaseMapper<PqsDicTreePO> {
@Select("SELECT ID,NAME,CODE,PARENT_ID as parentId,level FROM PQS_DICTREE " +
"START WITH CODE = #{code} " +
"CONNECT BY PRIOR ID = PARENT_ID")
List<PqsDicTreePO> selectChildrenByCode(@Param("code") String code);
}

View File

@@ -1,21 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.gather.event.transientes.pojo.po.PqsEventdetail;
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
/**
*
* Description:
* Date: 2025/06/20 上午 10:06【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsEventdetailMapper extends BaseMapper<PqsEventdetail> {
}

View File

@@ -1,16 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsIntegrity;
import com.njcn.gather.event.transientes.pojo.po.PqsOnlinerate;
/**
*
* Description:
* Date: 2025/07/29 下午 6:40【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsIntegrityMapper extends BaseMapper<PqsIntegrity> {
}

View File

@@ -1,15 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsOnlinerate;
/**
*
* Description:
* Date: 2025/07/29 下午 6:40【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqsOnlinerateMapper extends BaseMapper<PqsOnlinerate> {
}

View File

@@ -1,9 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PqsUserMapper extends BaseMapper<PqsUser> {
}

View File

@@ -1,13 +0,0 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsUserSet;
/**
* @Author: cdf
* @CreateTime: 2025-06-24
* @Description:
*/
public interface PqsUserSetMapper extends BaseMapper<PqsUserSet> {
}

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqDevicedetailMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail">
<!--@mbg.generated-->
<!--@Table PQ_DEVICEDETAIL-->
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
<result column="MANUFACTURER" jdbcType="VARCHAR" property="manufacturer" />
<result column="CHECKFLAG" jdbcType="DECIMAL" property="checkflag" />
<result column="THISTIMECHECK" jdbcType="TIMESTAMP" property="thistimecheck" />
<result column="NEXTTIMECHECK" jdbcType="TIMESTAMP" property="nexttimecheck" />
<result column="ONLINERATETJ" jdbcType="DECIMAL" property="onlineratetj" />
<result column="DATAPLAN" jdbcType="DECIMAL" property="dataplan" />
<result column="NEWTRAFFIC" jdbcType="DECIMAL" property="newtraffic" />
<result column="ELECTROPLATE" jdbcType="DECIMAL" property="electroplate" />
<result column="ONTIME" jdbcType="DECIMAL" property="ontime" />
<result column="CONTRACT" jdbcType="VARCHAR" property="contract" />
<result column="SIM" jdbcType="VARCHAR" property="sim" />
<result column="DEV_CATENA" jdbcType="VARCHAR" property="devCatena" />
<result column="DEV_LOCATION" jdbcType="VARCHAR" property="devLocation" />
<result column="DEV_NO" jdbcType="VARCHAR" property="devNo" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEV_INDEX, MANUFACTURER, CHECKFLAG, THISTIMECHECK, NEXTTIMECHECK, ONLINERATETJ, DATAPLAN,
NEWTRAFFIC, ELECTROPLATE, ONTIME, CONTRACT, SIM, DEV_CATENA, DEV_LOCATION, DEV_NO
</sql>
</mapper>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper">
<select id="getUserByParam" resultType="PqUserLineAssPO">
select distinct b.line_index,a.CUSTOMER_NAME userName
from pq_user_ledger a inner join PQ_USER_LINE_ASS b on a.id = b.user_index
where b.line_index in
<foreach collection="lineIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
<if test="searchValue!=null and searchValue!=''">
and a.CUSTOMER_NAME LIKE '%' || #{searchValue} || '%'
</if>
</select>
</mapper>

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqsDeptsMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.transientes.pojo.po.PqsDepts">
<!--@mbg.generated-->
<!--@Table PQS_DEPTS-->
<id column="DEPTS_INDEX" jdbcType="VARCHAR" property="deptsIndex" />
<result column="DEPTSNAME" jdbcType="VARCHAR" property="deptsname" />
<result column="DEPTS_DESC" jdbcType="DECIMAL" property="deptsDesc" />
<result column="USER_INDEX" jdbcType="VARCHAR" property="userIndex" />
<result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
<result column="DEPTS_DESCRIPTION" jdbcType="VARCHAR" property="deptsDescription" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="AREA" jdbcType="VARCHAR" property="area" />
<result column="CUSTOM_DEPT" jdbcType="DECIMAL" property="customDept" />
<result column="PARENTNODEID" jdbcType="VARCHAR" property="parentnodeid" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEPTS_INDEX, DEPTSNAME, DEPTS_DESC, USER_INDEX, UPDATETIME, DEPTS_DESCRIPTION, "STATE",
AREA, CUSTOM_DEPT, PARENTNODEID
</sql>
<select id="findDeptAndChildren" resultType="java.lang.String">
SELECT DEPTS_INDEX
FROM PQS_DEPTS
START WITH DEPTS_INDEX = #{deptId}
CONNECT BY PRIOR DEPTS_INDEX = PARENTNODEID
and state = 1
</select>
<select id="getDeptList" resultType="com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO">
SELECT
a.DEPTS_INDEX ,
a.DEPTSNAME ,
a.DEPTS_DESC ,
a.USER_INDEX ,
a.UPDATETIME ,
a.DEPTS_DESCRIPTION ,
a."STATE",
a.AREA,
a.CUSTOM_DEPT,
a.PARENTNODEID,
b.dic_name areaName
FROM
PQS_DEPTS a
LEFT JOIN PQS_DICDATA b ON a.AREA = b.DIC_INDEX
where a.STATE= 1
<if test="deptIds!= null and deptIds.size!=0">
and a.DEPTS_INDEX in
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if >
</select>
</mapper>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqsDeptslineMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqsDeptsline">
<!--@mbg.generated-->
<!--@Table PQS_DEPTSLINE-->
<result column="DEPTS_INDEX" jdbcType="VARCHAR" property="deptsIndex" />
<result column="LINE_INDEX" jdbcType="DECIMAL" property="lineIndex" />
<result column="SYSTYPE" jdbcType="VARCHAR" property="systype" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEPTS_INDEX, LINE_INDEX, SYSTYPE
</sql>
<select id="getPhoneUser">
select *
from
PQS_DEPTSLINE deptLine
inner join PQS_DEPTS dept on deptLine.DEPTS_INDEX = DEPTS_INDEX
</select>
</mapper>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqsEventdetailMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.transientes.pojo.po.PqsEventdetail">
<!--@mbg.generated-->
<!--@Table PQS_EVENTDETAIL-->
<id column="EVENTDETAIL_INDEX" jdbcType="VARCHAR" property="eventdetailIndex" />
<result column="LINEID" jdbcType="DECIMAL" property="lineid" />
<result column="TIMEID" jdbcType="TIMESTAMP" property="timeid" />
<result column="MS" jdbcType="DECIMAL" property="ms" />
<result column="DESCRIBE" jdbcType="VARCHAR" property="describe" />
<result column="WAVETYPE" jdbcType="DECIMAL" property="wavetype" />
<result column="PERSISTTIME" jdbcType="FLOAT" property="persisttime" />
<result column="EVENTVALUE" jdbcType="FLOAT" property="eventvalue" />
<result column="EVENTREASON" jdbcType="VARCHAR" property="eventreason" />
<result column="EVENTTYPE" jdbcType="VARCHAR" property="eventtype" />
<result column="EVENTASS_INDEX" jdbcType="VARCHAR" property="eventassIndex" />
<result column="DQTIME" jdbcType="FLOAT" property="dqtime" />
<result column="DEALTIME" jdbcType="TIMESTAMP" property="dealtime" />
<result column="DEALFLAG" jdbcType="DECIMAL" property="dealflag" />
<result column="NUM" jdbcType="DECIMAL" property="num" />
<result column="FILEFLAG" jdbcType="DECIMAL" property="fileflag" />
<result column="FIRSTTIME" jdbcType="TIMESTAMP" property="firsttime" />
<result column="FIRSTTYPE" jdbcType="VARCHAR" property="firsttype" />
<result column="FIRSTMS" jdbcType="DECIMAL" property="firstms" />
<result column="WAVENAME" jdbcType="VARCHAR" property="wavename" />
<result column="ENERGY" jdbcType="FLOAT" property="energy" />
<result column="SEVERITY" jdbcType="FLOAT" property="severity" />
<result column="LOOK_FLAG" jdbcType="DECIMAL" property="lookFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
EVENTDETAIL_INDEX, LINEID, TIMEID, MS, "DESCRIBE", WAVETYPE, PERSISTTIME, EVENTVALUE,
EVENTREASON, EVENTTYPE, EVENTASS_INDEX, DQTIME, DEALTIME, DEALFLAG, NUM, FILEFLAG,
FIRSTTIME, FIRSTTYPE, FIRSTMS, WAVENAME, ENERGY, SEVERITY, LOOK_FLAG
</sql>
<!-- <select id="queryByCondition" resultType="com.njcn.gather.event.transientes.pojo.vo.EventDetailVO">-->
<!--&lt;!&ndash; SELECT * from( &ndash;&gt;-->
<!-- select * from PQS_EVENTDETAIL eve where eve.LINEID in-->
<!-- <foreach collection="deptslineIds" item="item" open="(" close=")" separator=",">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- and eve.TIMEID between TO_DATE( #{startTime},'YYYY-MM-DD HH24:MI:SS') and TO_DATE( #{endTime},'YYYY-MM-DD HH24:MI:SS')-->
<!-- <if test="eventtype != null and eventtype ==1">-->
<!-- and eve.NOTICE_FLAG =1-->
<!-- </if>-->
<!-- <if test="eventtype == null or eventtype ==0">-->
<!-- and (eve.NOTICE_FLAG =0 or eve.NOTICE_FLAG is null)-->
<!-- </if>-->
<!-- order by eve.NOTICE_FLAG asc NULLS FIRST , eve.TIMEID desc-->
<!--&lt;!&ndash; )&ndash;&gt;-->
<!--&lt;!&ndash; WHERE ROWNUM &lt;= 10;&ndash;&gt;-->
<!-- </select>-->
</mapper>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqsOnlinerateMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.transientes.pojo.po.PqsOnlinerate">
<!--@mbg.generated-->
<!--@Table PQS_ONLINERATE-->
<id column="TIMEID" jdbcType="TIMESTAMP" property="timeid" />
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
<result column="ONLINEMIN" jdbcType="DECIMAL" property="onlinemin" />
<result column="OFFLINEMIN" jdbcType="DECIMAL" property="offlinemin" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
TIMEID, DEV_INDEX, ONLINEMIN, OFFLINEMIN
</sql>
</mapper>

View File

@@ -1,24 +0,0 @@
package com.njcn.gather.event.transientes.pojo;
import lombok.Getter;
@Getter
public enum DicTreeEnum {
BJ_USER("BJ_USER","半导体及精密加工"),
OI_USER("OI_USER","其他敏感用户"),
OT_USER("OT_USER","其他干扰源用户"),
;
private final String code;
private final String dicName;
DicTreeEnum(String code, String dicName) {
this.code = code;
this.dicName = dicName;
}
}

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