10 Commits

Author SHA1 Message Date
xy
5e93eb3691 驾驶舱功能调整 2025-10-24 16:14:54 +08:00
xy
b63fab9085 云前置改造-暂态数据补召功能新增topic 2025-10-15 20:50:47 +08:00
hzj
aba66aaf4a Merge branch 'main' of http://192.168.1.22:3000/Microservice/pqs 2025-10-15 11:46:05 +08:00
hzj
1c7c514691 报表bug修改 2025-10-15 11:42:56 +08:00
04fe9bdbbd Merge pull request 'liaoning' (#1) from liaoning into main
Reviewed-on: #1
2025-10-15 10:39:21 +08:00
hzj
b41347c596 Merge remote-tracking branch 'origin/main' into liaoning 2025-10-15 10:38:02 +08:00
hzj
4f75deac43 报表bug修改 2025-10-15 10:33:51 +08:00
2c68646fc9 本地文件bug修改 2025-10-14 20:35:36 +08:00
02599eeb81 bug修改 2025-10-14 18:06:22 +08:00
xy
0cec471ce2 云前置改造-新增mq信息 2025-10-14 11:40:44 +08:00
29 changed files with 811 additions and 92 deletions

View File

@@ -47,6 +47,36 @@ public interface BusinessTopic {
*/ */
String DEVICE_RUN_FLAG_TOPIC = "Device_Run_Flag_Topic"; String DEVICE_RUN_FLAG_TOPIC = "Device_Run_Flag_Topic";
/**
* 云前置日志主题
*/
String LOG_TOPIC = "log_Topic";
/**
* 台账更新下发
*/
String CONTROL_TOPIC = "control_Topic";
/**
* 台账更新前置端响应
*/
String REPLY_TOPIC = "Reply_Topic";
/**
* 前置进程控制
*/
String PROCESS_TOPIC = "process_Topic";
/**
* 补召下发命令
*/
String ASK_RECALL_TOPIC = "ask_recall_Topic";
/**
* 补召应答命令
*/
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
/********************************数据中心*********************************/ /********************************数据中心*********************************/
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic"; String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";

View File

@@ -28,14 +28,14 @@ public class AppFileMessage extends BaseMessage {
private Integer code; private Integer code;
private AppFileMessage.Msg msg; private Msg msg;
@Data @Data
public static class Msg{ public static class Msg{
private String type; private String type;
private AppFileMessage.FileInfo fileInfo; private FileInfo fileInfo;
private String data; private String data;

View File

@@ -0,0 +1,59 @@
package com.njcn.mq.message;
import com.njcn.middle.rocket.domain.BaseMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author xy
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class BZEventMessage extends BaseMessage {
//补召事件
@Data
public static class Event{
@ApiModelProperty("请求的guid")
private String guid;
@ApiModelProperty("终端id")
private String terminalId;
@ApiModelProperty("监测点id")
private List<String> monitorIdList;
@ApiModelProperty("数据类型 0 稳态 1 暂态事件 2 暂态波形")
private Integer dataType;
@ApiModelProperty("时间范围")
private List<String> timeInterval;
}
//补召波形
@Data
public static class File{
@ApiModelProperty("请求的guid")
private String guid;
@ApiModelProperty("终端id")
private String terminalId;
@ApiModelProperty("监测点id")
private String monitorId;
@ApiModelProperty("数据类型 0 稳态 1 暂态事件 2 暂态波形")
private Integer dataType;
@ApiModelProperty("缺失波形时标集合")
private List<String> timeList;
}
}

View File

@@ -0,0 +1,53 @@
package com.njcn.mq.message;
import com.njcn.middle.rocket.domain.BaseMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2025/9/29 15:06
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BzMessage extends BaseMessage {
@ApiModelProperty("唯一标识")
private String guid;
@ApiModelProperty("补召类型")
private String dataType;
@ApiModelProperty("响应码")
private Integer code;
@ApiModelProperty("结果")
private String result;
@ApiModelProperty("设备id")
private String terminalId;
@ApiModelProperty("监测点id")
private String monitorId;
@ApiModelProperty("补召起始时间")
private String recallStartDate;
@ApiModelProperty("补召结束时间")
private String recallEndDate;
@ApiModelProperty("前置服务器id")
private String nodeId;
@ApiModelProperty("前置进程")
private String processNo;
}

View File

@@ -0,0 +1,38 @@
package com.njcn.mq.message;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 类的介绍:日志信息
*
* @author xuyang
* @version 1.0.0
* @createTime 2025/9/18 15:06
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CldControlMessage {
@ApiModelProperty("请求的guid")
private String guid;
@ApiModelProperty("功能代号")
private String code;
@ApiModelProperty("前置服务器id")
private String nodeId;
@ApiModelProperty("指定处理的进程号")
private Integer processNo;
@ApiModelProperty("delete用于杀死进程")
private String fun;
@ApiModelProperty("进程数")
private Integer processNum;
}

View File

@@ -0,0 +1,47 @@
package com.njcn.mq.message;
import com.njcn.middle.rocket.domain.BaseMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 类的介绍:日志信息
*
* @author xuyang
* @version 1.0.0
* @createTime 2025/9/18 15:06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
public class CldLogMessage extends BaseMessage {
@ApiModelProperty("前置id")
private String nodeId;
@ApiModelProperty("进程id")
private String processNo;
@ApiModelProperty("监测点id、装置id")
private String businessId;
@ApiModelProperty("级别(process进程、terminal装置、measurepoint监测点)")
private String level;
@ApiModelProperty("日志等级")
private String grade;
@ApiModelProperty("告警码")
private String code;
@ApiModelProperty("告警时间")
private String time;
@ApiModelProperty("日志信息")
private String log;
}

View File

@@ -0,0 +1,93 @@
package com.njcn.mq.message;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* cld设备更新台账实体
* @author xy
*/
@Data
public class CldUpdateLedgerMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("消息唯一标识")
private String guid;
@ApiModelProperty("add_terminal/delete_terminal/ledger_modify")
private String code;
@ApiModelProperty("进程号")
private Integer processNo;
@ApiModelProperty("数据")
private List<CldDeviceDto> data;
@Data
public static class CldDeviceDto implements Serializable {
@ApiModelProperty("最大进程数")
private Integer maxProcessNum;
@ApiModelProperty("进程号")
private Integer node;
@ApiModelProperty("设备id")
private String id;
@ApiModelProperty("设备MAC")
private String ip;
@ApiModelProperty("设备型号")
private String devType;
@ApiModelProperty("设备名称")
private String name;
@ApiModelProperty("监测点信息集合")
private List<CldMonitorDto> monitorData;
}
@Data
public static class CldMonitorDto implements Serializable {
@ApiModelProperty("监测点id")
private String id;
@ApiModelProperty("监测点名称")
private String name;
@ApiModelProperty("监测点线路号")
private String lineNo;
@ApiModelProperty("电压等级")
private String voltageLevel;
@ApiModelProperty("status")
private Integer status;
@ApiModelProperty("接线方式")
private String ptType;
@ApiModelProperty("设备id")
private String deviceId;
@ApiModelProperty("pt一次变比")
private Double pt1;
@ApiModelProperty("pt二次变比")
private Double pt2;
@ApiModelProperty("ct一次变比")
private Double ct1;
@ApiModelProperty("ct二次变比")
private Double ct2;
}
}

View File

@@ -1,14 +1,10 @@
package com.njcn.mq.message; package com.njcn.mq.message;
import com.njcn.middle.rocket.domain.BaseMessage;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
/** /**
* 类的介绍: * 类的介绍:
* *
@@ -39,4 +35,7 @@ public class RealDataMessage {
@ApiModelProperty("限制") @ApiModelProperty("限制")
private Integer count; private Integer count;
@ApiModelProperty("idx")
private Integer idx;
} }

View File

@@ -0,0 +1,45 @@
package com.njcn.mq.message;
import com.njcn.middle.rocket.domain.BaseMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2025/9/29 15:06
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UpdateLedgerMessage extends BaseMessage {
@ApiModelProperty("唯一标识")
private String guid;
@ApiModelProperty("数据")
private List<HandleData> data;
@Data
public static class HandleData implements Serializable {
@ApiModelProperty("设备id")
private String deviceId;
@ApiModelProperty("响应码")
private Integer code;
@ApiModelProperty("结果描述")
private String result;
}
}

View File

@@ -0,0 +1,31 @@
package com.njcn.mq.template;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.njcn.middle.rocket.domain.BaseMessage;
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
import com.njcn.mq.constant.BusinessResource;
import com.njcn.mq.constant.BusinessTopic;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;
/**
* 类的介绍:补召事件
*
* @author xuyang
* @version 1.0.0
*/
@Component
public class BZEventMessageTemplate extends RocketMQEnhanceTemplate {
public BZEventMessageTemplate(RocketMQTemplate template) {
super(template);
}
public SendResult sendMember(Object message, String tag) {
BaseMessage baseMessage = new BaseMessage();
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
baseMessage.setMessageBody(new Gson().toJson(message));
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.mq.template;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.njcn.middle.rocket.domain.BaseMessage;
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
import com.njcn.mq.constant.BusinessResource;
import com.njcn.mq.constant.BusinessTopic;
import com.njcn.mq.message.CldControlMessage;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;
/**
* 类的介绍:实时数据模板
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/8/11 15:28
*/
@Component
public class CldControlMessageTemplate extends RocketMQEnhanceTemplate {
public CldControlMessageTemplate(RocketMQTemplate template) {
super(template);
}
public SendResult sendMember(CldControlMessage message, String tag) {
BaseMessage baseMessage = new BaseMessage();
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
baseMessage.setMessageBody(new Gson().toJson(message));
return send(BusinessTopic.PROCESS_TOPIC,tag,baseMessage);
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.mq.template;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.njcn.middle.rocket.domain.BaseMessage;
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
import com.njcn.mq.constant.BusinessResource;
import com.njcn.mq.constant.BusinessTopic;
import com.njcn.mq.message.CldUpdateLedgerMessage;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;
/**
* 类的介绍:实时数据模板
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/8/11 15:28
*/
@Component
public class CldUpdateLedgerMessageTemplate extends RocketMQEnhanceTemplate {
public CldUpdateLedgerMessageTemplate(RocketMQTemplate template) {
super(template);
}
public SendResult sendMember(CldUpdateLedgerMessage cldUpdateLedgerMessage, String tag) {
BaseMessage baseMessage = new BaseMessage();
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
baseMessage.setMessageBody(new Gson().toJson(cldUpdateLedgerMessage));
return send(BusinessTopic.CONTROL_TOPIC,tag,baseMessage);
}
}

View File

@@ -2,6 +2,7 @@ package com.njcn.oss.utils;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import com.njcn.common.config.GeneralInfo; import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.huawei.obs.util.OBSUtil; import com.njcn.huawei.obs.util.OBSUtil;
@@ -88,16 +89,23 @@ public class FileStorageUtil {
} }
}else { }else {
try { try {
// 确保目录存在 // 构建完整目录:基准目录 + dir子目录
Path uploadPath = Paths.get(generalInfo.getLocalStorePath()); Path basePath = Paths.get(generalInfo.getLocalStorePath());
Path uploadPath = basePath.resolve(dir); // 将dir作为子目录添加
// 确保完整目录存在包括dir子目录
if (!Files.exists(uploadPath)) { if (!Files.exists(uploadPath)) {
Files.createDirectories(uploadPath); Files.createDirectories(uploadPath);
} }
// 生成本地文件名(可以添加时间戳或UUID防止重名 // 生成本地文件名(处理扩展名,防止异常
String originalFilename = multipartFile.getOriginalFilename(); String originalFilename = multipartFile.getOriginalFilename();
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")); String fileExtension = "";
String newFilename = UUID.randomUUID().toString() + fileExtension; int extIndex = originalFilename.lastIndexOf(".");
if (extIndex > 0 && extIndex < originalFilename.length() - 1) {
fileExtension = originalFilename.substring(extIndex);
}
String newFilename = IdUtil.simpleUUID().toUpperCase() + fileExtension;
// 构建完整路径 // 构建完整路径
Path filePathPath = uploadPath.resolve(newFilename); Path filePathPath = uploadPath.resolve(newFilename);
@@ -105,7 +113,7 @@ public class FileStorageUtil {
// 保存文件 // 保存文件
multipartFile.transferTo(filePathPath.toFile()); multipartFile.transferTo(filePathPath.toFile());
// 返回相对路径或完整路径,根据需求调整 // 返回相对路径或完整路径
filePath = dir + File.separator + newFilename; filePath = dir + File.separator + newFilename;
} catch (IOException e) { } catch (IOException e) {
throw new BusinessException("本地文件上传失败: " + e.getMessage()); throw new BusinessException("本地文件上传失败: " + e.getMessage());

View File

@@ -45,7 +45,7 @@ public enum RedisKeyEnum {
/** /**
* 云前置心跳 * 云前置心跳
*/ */
CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 120L); CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 180L);
private final String key; private final String key;

View File

@@ -794,8 +794,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
@Override @Override
public List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException { public List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException {
//获取暂降字典信息 //获取暂降字典信息
DictData dataDto = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<TimeVO> list = new ArrayList<>(); List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList()); List<TimeVO> list = new ArrayList<>();
//参数 //参数
StringBuilder builder1 = new StringBuilder(); StringBuilder builder1 = new StringBuilder();
StringBuilder builder2 = new StringBuilder(); StringBuilder builder2 = new StringBuilder();
@@ -826,11 +826,11 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
// long count = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); // long count = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count();
List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.eq(StringUtils.isNotBlank(dataDto.getId()), RmpEventDetailPO::getEventType, dataDto.getId()) .in(RmpEventDetailPO::getEventType,typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
); );
long count = eventDetailList.stream().filter(x -> dataDto.getId().equals(x.getEventType())).count(); long count = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count();
if (startMonth < 10) { if (startMonth < 10) {
list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString()));
} else { } else {
@@ -852,11 +852,11 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
// long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); // long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count();
List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.eq(StringUtils.isNotBlank(dataDto.getId()), RmpEventDetailPO::getEventType, dataDto.getId()) .in(RmpEventDetailPO::getEventType, typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
); );
long count1 = eventDetailList.stream().filter(x -> dataDto.getId().equals(x.getEventType())).count(); long count1 = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count();
if (startMonth < 10) { if (startMonth < 10) {
list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString()));
} else { } else {
@@ -871,12 +871,12 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> eventDetailList = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.eq(StringUtils.isNotBlank(dataDto.getId()), RmpEventDetailPO::getEventType, dataDto.getId()) .in(RmpEventDetailPO::getEventType, typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
); );
Map<String, List<RmpEventDetailPO>> map = eventDetailList.stream().filter(x -> dataDto.getId().equals(x.getEventType())) Map<String, List<RmpEventDetailPO>> map = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType()))
.peek(t -> t.setFormatTime(t.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) .peek(t -> t.setFormatTime(t.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.groupingBy(RmpEventDetailPO::getFormatTime)); .collect(Collectors.groupingBy(RmpEventDetailPO::getFormatTime));
Set<String> keySet = map.keySet(); Set<String> keySet = map.keySet();
@@ -931,11 +931,12 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
List<ReasonsVO> reasonsVOS = new ArrayList<>(); List<ReasonsVO> reasonsVOS = new ArrayList<>();
List<TypesVO> typesVOS = new ArrayList<>(); List<TypesVO> typesVOS = new ArrayList<>();
//获取暂降字典信息 //获取暂降字典信息
DictData dataDto = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); List<DictData> dataDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<String> typeList = dataDic.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
//数据暂降查询 //数据暂降查询
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.eq(StringUtils.isNotBlank(dataDto.getId()), RmpEventDetailPO::getEventType, dataDto.getId()) .in( RmpEventDetailPO::getEventType,typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
); );
@@ -952,7 +953,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
//添加detail //添加detail
for (RmpEventDetailPO detail : info) { for (RmpEventDetailPO detail : info) {
EventDetail details = null; EventDetail details = null;
if (dataDto.getId().equals(detail.getEventType())) { if (typeList.contains(detail.getEventType())) {
for (DictData data : reasonData) { for (DictData data : reasonData) {
reasonMap.put(data.getName(), 0); reasonMap.put(data.getName(), 0);
if (detail.getAdvanceReason().equals(data.getId())) { if (detail.getAdvanceReason().equals(data.getId())) {
@@ -1326,11 +1327,12 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
// } // }
// } // }
//获取电压暂降信息 //获取电压暂降信息
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
//查询监测点未处理暂态事件 //查询监测点未处理暂态事件
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.eq(StrUtil.isNotBlank(data.getId()), RmpEventDetailPO::getEventType, data.getId()) .in(RmpEventDetailPO::getEventType,typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
); );
@@ -1353,7 +1355,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()); eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude());
//波形路径 //波形路径
eventDetailNew.setWavePath(eventDetail.getWavePath()); eventDetailNew.setWavePath(eventDetail.getWavePath());
if (data.getId().equals(eventDetail.getEventType())) { //if (data.getId().equals(eventDetail.getEventType())) {
if (reasonMap.containsKey(eventDetail.getAdvanceReason())) { if (reasonMap.containsKey(eventDetail.getAdvanceReason())) {
//暂降原因 //暂降原因
DictData dictData = reasonMap.get(eventDetail.getAdvanceReason()); DictData dictData = reasonMap.get(eventDetail.getAdvanceReason());
@@ -1364,7 +1366,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
DictData dictData = typeMap.get(eventDetail.getAdvanceType()); DictData dictData = typeMap.get(eventDetail.getAdvanceType());
eventDetailNew.setAdvanceType(dictData.getName()); eventDetailNew.setAdvanceType(dictData.getName());
} }
} // }
result.add(eventDetailNew); result.add(eventDetailNew);
} }

View File

@@ -1802,7 +1802,7 @@ public class ReportServiceImpl implements ReportService {
} else { } else {
for (int j = 0; j < reasonTypeTime.size(); j++) { for (int j = 0; j < reasonTypeTime.size(); j++) {
TimeVO timeVO = reasonTypeTime.get(j); TimeVO timeVO = reasonTypeTime.get(j);
insertRow(doc, table1, centerParagraph, false, timeVO.getDay(), timeVO.getTimes()); insertRow(doc, table1, centerParagraph, false,timeVO.getFulltime(), timeVO.getTimes());
} }
} }
two++; two++;

View File

@@ -719,25 +719,25 @@ public class ExportModelController extends BaseController {
reportmap.put("$FV0%$", judgeNull(valueOfFreValue.getCp95Value())); reportmap.put("$FV0%$", judgeNull(valueOfFreValue.getCp95Value()));
try { try {
maxValue = Math.abs(Double.parseDouble(valueOfFreValue.getFmaxValue().toString())); maxValue = Double.parseDouble(valueOfFreValue.getFmaxValue().toString());
minValue = Math.abs(Double.parseDouble(valueOfFreValue.getMinValue().toString())); minValue = Double.parseDouble(valueOfFreValue.getMinValue().toString());
aveValue = Math.abs(Double.parseDouble(valueOfFreValue.getMeanValue().toString())); aveValue = Double.parseDouble(valueOfFreValue.getMeanValue().toString());
cp95Value = Math.abs(Double.parseDouble(valueOfFreValue.getCp95Value().toString())); cp95Value = Double.parseDouble(valueOfFreValue.getCp95Value().toString());
limit = Math.abs(Double.parseDouble(valueOfFreLimit)); limit = Math.abs(Double.parseDouble(valueOfFreLimit));
} catch (Exception e) { } catch (Exception e) {
strResultFreValue += "注意:从上表中可以看出" + strLineBaseName + "频率偏差数据存在异常(不是数值类型)。"; strResultFreValue += "注意:从上表中可以看出" + strLineBaseName + "频率偏差数据存在异常(不是数值类型)。";
} }
if (maxValue > limit) { if (Math.abs(maxValue) > limit) {
tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + deviceUnit.getUnitFrequencyDev(); tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + deviceUnit.getUnitFrequencyDev();
} }
if (minValue > limit) { if (Math.abs(minValue) > limit) {
tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + deviceUnit.getUnitFrequencyDev(); tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + deviceUnit.getUnitFrequencyDev();
} }
if (aveValue > limit) { if (Math.abs(aveValue) > limit) {
tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + deviceUnit.getUnitFrequencyDev(); tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + deviceUnit.getUnitFrequencyDev();
} }
if (cp95Value > limit) { if (Math.abs(cp95Value) > limit) {
tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + deviceUnit.getUnitFrequencyDev(); tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + deviceUnit.getUnitFrequencyDev();
} }

View File

@@ -365,7 +365,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
steadyQualifyDTO.getIharm24Overtime() + steadyQualifyDTO.getIharm24Overtime() +
steadyQualifyDTO.getIharm25Overtime()))); steadyQualifyDTO.getIharm25Overtime())));
//间谐波电压含有率 //间谐波电压含有率
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime(), (steadyQualifyDTO.getInuharm1Overtime() + steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime()*16, (steadyQualifyDTO.getInuharm1Overtime() +
steadyQualifyDTO.getInuharm2Overtime() + steadyQualifyDTO.getInuharm2Overtime() +
steadyQualifyDTO.getInuharm3Overtime() + steadyQualifyDTO.getInuharm3Overtime() +
steadyQualifyDTO.getInuharm4Overtime() + steadyQualifyDTO.getInuharm4Overtime() +
@@ -497,7 +497,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
return 3.14159; return 3.14159;
} else { } else {
if (allTime >= overTime) { if (allTime >= overTime) {
return NumberUtil.round((1 - (overTime / (allTime * 16.0))) * 100, 2).doubleValue(); return NumberUtil.round((1 - ((double) overTime /allTime)) * 100, 2).doubleValue();
} }
return 0.0; return 0.0;
} }

View File

@@ -0,0 +1,24 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.PqDashboardPageFeignClientFallbackFactory;
import com.njcn.system.pojo.po.PqDashboardPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author 徐扬
*/
@FeignClient(value = ServerInfo.SYSTEM,path = "/dashboard",fallbackFactory = PqDashboardPageFeignClientFallbackFactory.class,contextId = "dashboard")
public interface PqDashboardPageFeignClient {
@PostMapping("/getDashboardPageByUserId")
@ApiOperation("根据用户id查询用户驾驶舱")
HttpResult<List<PqDashboardPage>> getDashboardPageByUserId(@RequestParam("id") String id,@RequestParam("state") boolean state);
}

View File

@@ -0,0 +1,48 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.PqDashboardPageFeignClient;
import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:08
*/
@Slf4j
@Component
public class PqDashboardPageFeignClientFallbackFactory implements FallbackFactory<PqDashboardPageFeignClient> {
/**
* 输出远程请求接口异常日志
* @param cause RPC请求异常
* @return
*/
@Override
public PqDashboardPageFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new PqDashboardPageFeignClient() {
@Override
public HttpResult<List<PqDashboardPage>> getDashboardPageByUserId(String id, boolean state) {
log.error("{}异常,降级处理,异常为:{}","根据用户id查询用户驾驶舱异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -1,11 +1,5 @@
package com.njcn.system.pojo.param; package com.njcn.system.pojo.param;
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 com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.constant.ValidMessage; import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -13,8 +7,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* Description: * Description:
@@ -61,6 +53,18 @@ public class PqDashboardPageParam {
*/ */
private Integer state; private Integer state;
@ApiModelProperty("绑定页面路由")
private String pagePath;
@ApiModelProperty("绑定页面名称")
private String pathName;
@ApiModelProperty("路由名称")
private String routeName;
@ApiModelProperty("图标")
private String icon;
/** /**
* 更新操作实体 * 更新操作实体
*/ */

View File

@@ -1,12 +1,9 @@
package com.njcn.system.pojo.po; package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
@@ -24,6 +21,18 @@ public class PqDashboardPage extends BaseEntity {
*/ */
private String id; private String id;
/**
* 用户id
*/
@TableField(value = "user_id")
private String userId;
/**
* 图标
*/
@TableField(value = "icon")
private String icon;
/** /**
* 页面名称 * 页面名称
*/ */
@@ -59,5 +68,16 @@ public class PqDashboardPage extends BaseEntity {
@TableField(value = "state") @TableField(value = "state")
private Integer state; private Integer state;
@TableField(value = "page_path")
@ApiModelProperty("绑定页面路由")
private String pagePath;
@TableField(value = "path_name")
@ApiModelProperty("绑定页面名称")
private String pathName;
@TableField(value = "route_name")
@ApiModelProperty("路由名称")
private String routeName;
} }

View File

@@ -1,12 +1,12 @@
package com.njcn.system.pojo.vo; package com.njcn.system.pojo.vo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -60,6 +60,17 @@ public class PqDashboardPageVO extends BaseEntity {
*/ */
private String createBy; private String createBy;
@ApiModelProperty("绑定页面路由")
private String pagePath;
@ApiModelProperty("绑定页面名称")
private String pathName;
@ApiModelProperty("路由名称")
private String routeName;
@ApiModelProperty("图标")
private String icon;
/** /**
* 创建时间 * 创建时间

View File

@@ -1,5 +1,6 @@
package com.njcn.system.controller; package com.njcn.system.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -11,12 +12,13 @@ import com.njcn.system.pojo.vo.PqDashboardPageVO;
import com.njcn.system.service.PqDashboardPageService; import com.njcn.system.service.PqDashboardPageService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
@@ -59,7 +61,7 @@ public class PqDashboardPageController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("删除驾驶舱页面") @ApiOperation("删除驾驶舱页面")
public HttpResult<Boolean> deleteDashboard(@RequestParam("id") String id){ public HttpResult<Boolean> deleteDashboard(@RequestParam("id") String id){
log.info("修改驾驶舱页面"); log.info("删除驾驶舱页面");
String methodDescribe = getMethodDescribe("deleteDashboard"); String methodDescribe = getMethodDescribe("deleteDashboard");
Boolean result = pqDashboardPageService.removeById(id); Boolean result = pqDashboardPageService.removeById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
@@ -69,7 +71,7 @@ public class PqDashboardPageController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询驾驶舱页面") @ApiOperation("查询驾驶舱页面")
public HttpResult<PqDashboardPageVO> queryById(@RequestParam("id") String id){ public HttpResult<PqDashboardPageVO> queryById(@RequestParam("id") String id){
log.info("新增驾驶舱页面"); log.info("查询驾驶舱页面");
String methodDescribe = getMethodDescribe("queryById"); String methodDescribe = getMethodDescribe("queryById");
PqDashboardPageVO result = pqDashboardPageService.queryById(id); PqDashboardPageVO result = pqDashboardPageService.queryById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
@@ -77,10 +79,10 @@ public class PqDashboardPageController extends BaseController {
@PostMapping("/activatePage") @PostMapping("/activatePage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("激活的驾驶舱页面") @ApiOperation("激活的驾驶舱页面")
public HttpResult<Boolean> activatePage(@RequestParam("id") String id){ public HttpResult<Boolean> activatePage(@RequestParam("id") String id,@RequestParam("state") Integer state){
log.info("激活的驾驶舱页面"); log.info("激活的驾驶舱页面");
String methodDescribe = getMethodDescribe("activatePage"); String methodDescribe = getMethodDescribe("activatePage");
Boolean result = pqDashboardPageService.activatePage(id); Boolean result = pqDashboardPageService.activatePage(id,state);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@@ -88,7 +90,7 @@ public class PqDashboardPageController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询激活的驾驶舱页面") @ApiOperation("查询激活的驾驶舱页面")
public HttpResult<PqDashboardPageVO> queryActivatePage(){ public HttpResult<PqDashboardPageVO> queryActivatePage(){
log.info("新增驾驶舱页面"); log.info("查询激活的驾驶舱页面");
String methodDescribe = getMethodDescribe("queryActivatePage"); String methodDescribe = getMethodDescribe("queryActivatePage");
PqDashboardPageVO vo = new PqDashboardPageVO(); PqDashboardPageVO vo = new PqDashboardPageVO();
PqDashboardPage result = pqDashboardPageService.lambdaQuery().eq(PqDashboardPage::getState,1).one(); PqDashboardPage result = pqDashboardPageService.lambdaQuery().eq(PqDashboardPage::getState,1).one();
@@ -100,9 +102,32 @@ public class PqDashboardPageController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("分页查询") @ApiOperation("分页查询")
public HttpResult<Page<PqDashboardPageVO>> queryPage(@RequestBody PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam){ public HttpResult<Page<PqDashboardPageVO>> queryPage(@RequestBody PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam){
log.info("新增驾驶舱页面"); log.info("分页查询");
String methodDescribe = getMethodDescribe("queryPage"); String methodDescribe = getMethodDescribe("queryPage");
Page<PqDashboardPageVO> result = pqDashboardPageService.queryPage(pqDashboardPageQueryParam); Page<PqDashboardPageVO> result = pqDashboardPageService.queryPage(pqDashboardPageQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@PostMapping("/queryByPagePath")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据页面路由查询数据")
public HttpResult<PqDashboardPageVO> queryByPagePath(@RequestParam("pagePath") String pagePath){
String methodDescribe = getMethodDescribe("queryByPagePath");
PqDashboardPageVO result = pqDashboardPageService.queryByPagePath(pagePath);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@PostMapping("/getDashboardPageByUserId")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据用户id查询用户驾驶舱")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户id", required = true),
@ApiImplicitParam(name = "state", value = "状态", required = true)
})
public HttpResult<List<PqDashboardPage>> getDashboardPageByUserId(@RequestParam("id") String id,@RequestParam("state") boolean state){
String methodDescribe = getMethodDescribe("getDashboardPageByUserId");
List<PqDashboardPage> result = pqDashboardPageService.getDashboardPageByUserId(id,state);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.system.pojo.param.PqDashboardPageParam; import com.njcn.system.pojo.param.PqDashboardPageParam;
import com.njcn.system.pojo.po.PqDashboardPage; import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.system.pojo.vo.PqDashboardPageVO; import com.njcn.system.pojo.vo.PqDashboardPageVO;
import com.njcn.user.pojo.po.HomePage;
import java.util.List;
/** /**
* *
@@ -25,5 +28,9 @@ public interface PqDashboardPageService extends IService<PqDashboardPage> {
Page<PqDashboardPageVO> queryPage(PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam); Page<PqDashboardPageVO> queryPage(PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam);
Boolean activatePage(String id); Boolean activatePage(String id,Integer state);
PqDashboardPageVO queryByPagePath(String pagePath);
List<PqDashboardPage> getDashboardPageByUserId(String id,boolean state);
} }

View File

@@ -4,28 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.common.pojo.exception.BusinessException;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.pojo.param.NodeParam;
import com.njcn.device.pq.pojo.po.Node;
import com.njcn.supervision.pojo.po.device.LineWarning;
import com.njcn.system.enums.SystemResponseEnum; import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.mapper.TemplateRelMapper; import com.njcn.system.mapper.PqDashboardPageMapper;
import com.njcn.system.pojo.param.PqDashboardPageParam; import com.njcn.system.pojo.param.PqDashboardPageParam;
import com.njcn.system.pojo.po.TemplateRel; import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.system.pojo.vo.PqDashboardPageVO; import com.njcn.system.pojo.vo.PqDashboardPageVO;
import com.njcn.system.service.PqDashboardPageService;
import com.njcn.user.pojo.constant.HomePageState;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList;
import java.util.List;
import com.njcn.system.mapper.PqDashboardPageMapper;
import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.system.service.PqDashboardPageService;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -43,19 +36,19 @@ public class PqDashboardPageServiceImpl extends ServiceImpl<PqDashboardPageMappe
@Override @Override
public Boolean addDashboard(PqDashboardPageParam pqDashboardPageParam) { public Boolean addDashboard(PqDashboardPageParam pqDashboardPageParam) {
PqDashboardPage pqDashboardPage = new PqDashboardPage(); PqDashboardPage pqDashboardPage = new PqDashboardPage();
checkName(pqDashboardPageParam,false); // checkName(pqDashboardPageParam,false);
BeanUtils.copyProperties(pqDashboardPageParam,pqDashboardPage); BeanUtils.copyProperties(pqDashboardPageParam,pqDashboardPage);
pqDashboardPage.setState(0); pqDashboardPage.setState(0);
pqDashboardPage.setUserId(RequestUtil.getUserIndex());
this.save(pqDashboardPage); this.save(pqDashboardPage);
return true; return true;
} }
@Override @Override
public Boolean updateDashboard(PqDashboardPageParam.UpdatePqDashboardPageParam updatePqDashboardPageParam) { public Boolean updateDashboard(PqDashboardPageParam.UpdatePqDashboardPageParam updatePqDashboardPageParam) {
PqDashboardPage pqDashboardPage = new PqDashboardPage(); PqDashboardPage pqDashboardPage = new PqDashboardPage();
checkName(updatePqDashboardPageParam,true); // checkName(updatePqDashboardPageParam,true);
BeanUtils.copyProperties(updatePqDashboardPageParam,pqDashboardPage); BeanUtils.copyProperties(updatePqDashboardPageParam,pqDashboardPage);
this.updateById(pqDashboardPage); this.updateById(pqDashboardPage);
@@ -83,12 +76,33 @@ public class PqDashboardPageServiceImpl extends ServiceImpl<PqDashboardPageMappe
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) public Boolean activatePage(String id,Integer state) {
public Boolean activatePage(String id) { return this.lambdaUpdate().set(PqDashboardPage::getState,state).eq(PqDashboardPage::getId,id).update();
this.lambdaUpdate().set(PqDashboardPage::getState,1).eq(PqDashboardPage::getId,id).update(); }
this.lambdaUpdate().set(PqDashboardPage::getState,0).ne(PqDashboardPage::getId,id).update();
return true; @Override
public PqDashboardPageVO queryByPagePath(String pagePath) {
LambdaQueryWrapper<PqDashboardPage> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PqDashboardPage::getPagePath,pagePath);
PqDashboardPage result = this.getOne(queryWrapper);
if (Objects.isNull(result)) {
return null;
}
PqDashboardPageVO vo = new PqDashboardPageVO();
BeanUtils.copyProperties(result,vo);
return vo;
}
@Override
public List<PqDashboardPage> getDashboardPageByUserId(String id,boolean state) {
List<String> userList = new ArrayList<>();
userList.add(id);
userList.add(HomePageState.DEFAULT_USER_ID);
if (state) {
return this.lambdaQuery().in(PqDashboardPage::getUserId,userList).eq(PqDashboardPage::getState,1).orderByAsc(PqDashboardPage::getSort).list();
} else {
return this.lambdaQuery().in(PqDashboardPage::getUserId,userList).orderByAsc(PqDashboardPage::getSort).list();
}
} }
/** /**

View File

@@ -0,0 +1,31 @@
package com.njcn.system.timer.tasks.cld;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.csdevice.api.IcdFeignClient;
import com.njcn.csdevice.param.IcdBzParam;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
* @author xy
*/
@Component
@RequiredArgsConstructor
public class BzEventFileTaskRunner implements TimerTaskRunner {
private final IcdFeignClient icdFeignClient;
@Override
public void action(String date) {
if(StrUtil.isBlank(date)){
date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
}
IcdBzParam param = new IcdBzParam();
param.setStartTime(date);
param.setEndTime(date);
icdFeignClient.bzFile(param);
}
}

View File

@@ -0,0 +1,31 @@
package com.njcn.system.timer.tasks.cld;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.csdevice.api.IcdFeignClient;
import com.njcn.csdevice.param.IcdBzParam;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
* @author xy
*/
@Component
@RequiredArgsConstructor
public class BzEventTaskRunner implements TimerTaskRunner {
private final IcdFeignClient icdFeignClient;
@Override
public void action(String date) {
if(StrUtil.isBlank(date)){
date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
}
IcdBzParam param = new IcdBzParam();
param.setStartTime(date);
param.setEndTime(date);
icdFeignClient.bzEvent(param);
}
}

View File

@@ -10,6 +10,8 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.redis.pojo.enums.RedisKeyEnum; import com.njcn.redis.pojo.enums.RedisKeyEnum;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.PqDashboardPageFeignClient;
import com.njcn.system.pojo.po.PqDashboardPage;
import com.njcn.user.enums.UserResponseEnum; import com.njcn.user.enums.UserResponseEnum;
import com.njcn.user.mapper.FunctionMapper; import com.njcn.user.mapper.FunctionMapper;
import com.njcn.user.mapper.RoleFunctionMapper; import com.njcn.user.mapper.RoleFunctionMapper;
@@ -17,7 +19,10 @@ import com.njcn.user.pojo.constant.FunctionState;
import com.njcn.user.pojo.constant.UserType; import com.njcn.user.pojo.constant.UserType;
import com.njcn.user.pojo.param.FunctionParam; import com.njcn.user.pojo.param.FunctionParam;
import com.njcn.user.pojo.param.RoleParam; import com.njcn.user.pojo.param.RoleParam;
import com.njcn.user.pojo.po.*; import com.njcn.user.pojo.po.Function;
import com.njcn.user.pojo.po.Role;
import com.njcn.user.pojo.po.RoleFunction;
import com.njcn.user.pojo.po.UserRole;
import com.njcn.user.pojo.vo.FunctionVO; import com.njcn.user.pojo.vo.FunctionVO;
import com.njcn.user.service.*; import com.njcn.user.service.*;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
@@ -57,6 +62,8 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
private final RoleFunctionMapper roleFunctionMapper; private final RoleFunctionMapper roleFunctionMapper;
private final PqDashboardPageFeignClient pqDashboardPageFeignClient;
/** /**
* 将系统中角色--资源对应数据缓存到redis * 将系统中角色--资源对应数据缓存到redis
* 先清除,再缓存 * 先清除,再缓存
@@ -270,25 +277,23 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
/** /**
* 组装驾驶舱子级 * 组装驾驶舱子级
*
* @param list 菜单集合
*/ */
private void setDriverChildren(List<FunctionVO> list) { private void setDriverChildren(List<FunctionVO> list) {
List<HomePage> homePages = homePageService.getHomePagesByUserId(RequestUtil.getUserIndex()); List<PqDashboardPage> PqDashboardPage = pqDashboardPageFeignClient.getDashboardPageByUserId(RequestUtil.getUserIndex(),true).getData();
list.forEach(item -> { list.forEach(item -> {
if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME)) { if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME) && CollectionUtil.isNotEmpty(PqDashboardPage)) {
homePages.forEach(po -> { PqDashboardPage.forEach(po -> {
FunctionVO functionVO = new FunctionVO(); FunctionVO functionVO = new FunctionVO();
functionVO.setId(po.getId()); functionVO.setId(po.getId());
functionVO.setPid(item.getId()); functionVO.setPid(item.getId());
functionVO.setTitle(po.getName()); functionVO.setTitle(po.getPageName());
functionVO.setCode(item.getCode()); functionVO.setCode(item.getCode());
functionVO.setRouteName(po.getPath().substring(po.getPath().lastIndexOf("/") + 1)); functionVO.setRouteName(po.getRouteName());
functionVO.setRoutePath(po.getPath()); functionVO.setRoutePath(po.getPagePath());
functionVO.setIcon(po.getIcon()); functionVO.setIcon(po.getIcon());
functionVO.setSort(po.getSort()); functionVO.setSort(po.getSort());
functionVO.setType(item.getType()); functionVO.setType(item.getType());
functionVO.setRemark(po.getName()); functionVO.setRemark(po.getPageName());
functionVO.setChildren(new ArrayList<>()); functionVO.setChildren(new ArrayList<>());
item.getChildren().add(functionVO); item.getChildren().add(functionVO);
}); });
@@ -296,6 +301,34 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
}); });
} }
// /**
// * 组装驾驶舱子级
// *
// * @param list 菜单集合
// */
// private void setDriverChildren(List<FunctionVO> list) {
// List<HomePage> homePages = homePageService.getHomePagesByUserId(RequestUtil.getUserIndex());
// list.forEach(item -> {
// if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME)) {
// homePages.forEach(po -> {
// FunctionVO functionVO = new FunctionVO();
// functionVO.setId(po.getId());
// functionVO.setPid(item.getId());
// functionVO.setTitle(po.getName());
// functionVO.setCode(item.getCode());
// functionVO.setRouteName("/src/views/pqs/cockpit/homePage/index.vue");
// functionVO.setRoutePath(po.getPath());
// functionVO.setIcon(po.getIcon());
// functionVO.setSort(po.getSort());
// functionVO.setType(item.getType());
// functionVO.setRemark(po.getName());
// functionVO.setChildren(new ArrayList<>());
// item.getChildren().add(functionVO);
// });
// }
// });
// }
/** /**
* 处理tab页 * 处理tab页
*/ */