高级算法代码修改,管理员功能代码移植
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.njcn.advance.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -16,10 +18,13 @@ import java.util.Date;
|
||||
@TableName("pqs_relevancy_log")
|
||||
public class PqsRelevanceLog extends BaseEntity {
|
||||
|
||||
@TableId("id")
|
||||
private String id;
|
||||
/**
|
||||
* 归一化算法时间
|
||||
*/
|
||||
@TableId("Time_Id")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime timeId;
|
||||
|
||||
|
||||
@@ -30,4 +35,7 @@ public class PqsRelevanceLog extends BaseEntity {
|
||||
|
||||
private Integer state;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String createName;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.netflix.ribbon.proxy.annotation.Http;
|
||||
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
||||
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -11,6 +12,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
@@ -50,7 +52,7 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
@ApiOperation("启动关联分析")
|
||||
public HttpResult<Object> processEvents(@RequestParam("startTime") String startTime, @RequestParam("endTime")String endTime) {
|
||||
String methodDescribe = getMethodDescribe("processEvents");
|
||||
List<LocalDateTime> timeVal = PubUtils.checkLocalDateTime(startTime,endTime);
|
||||
List<LocalDateTime> timeVal = PubUtils.checkLocalDate(startTime,endTime);
|
||||
eventRelevantAnalysisService.processEvents(timeVal.get(0),timeVal.get(1));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
@@ -65,10 +67,66 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/querySagEventsPage")
|
||||
@ApiOperation("高级算法-暂降事件关联分析主列表")
|
||||
public HttpResult<Page<AdvanceEventDetailVO>> querySagEventsPage(BaseParam baseParam){
|
||||
public HttpResult<Page<AdvanceEventDetailVO>> querySagEventsPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("querySagEventsPage");
|
||||
Page<AdvanceEventDetailVO> list = eventRelevantAnalysisService.querySagEventsPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件查看
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEventsAssPage")
|
||||
@ApiOperation("事件波形分析主列表")
|
||||
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryEventsAssPage");
|
||||
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 事件详情
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/queryEventDetailByAssId")
|
||||
@ApiOperation("事件详情查看")
|
||||
public HttpResult<Page<AdvanceEventDetailVO>> queryEventDetailByAssId(@RequestParam("id")String id,@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize){
|
||||
String methodDescribe = getMethodDescribe("queryEventDetailByAssId");
|
||||
Page<AdvanceEventDetailVO> page = eventRelevantAnalysisService.queryEventDetailByAssId(id,pageNum,pageSize);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作记录查看
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryRelevantLogPage")
|
||||
@ApiOperation("事件分析操作记录查看")
|
||||
public HttpResult<Page<PqsRelevanceLog>> queryRelevantLogPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryRelevantLogPage");
|
||||
Page<PqsRelevanceLog> page = eventRelevantAnalysisService.queryRelevantLogPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作记录删除
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/delRelevantLog")
|
||||
@ApiOperation("操作记录删除")
|
||||
public HttpResult<Boolean> delRelevantLog(@RequestParam("id")String id){
|
||||
String methodDescribe = getMethodDescribe("delRelevantLog");
|
||||
boolean flag = eventRelevantAnalysisService.delRelevantLog(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* @author cdf
|
||||
* @date 2023/6/19
|
||||
*/
|
||||
public interface RelevantMapper extends BaseMapper<PqsRelevanceLog> {
|
||||
public interface RelevantLogMapper extends BaseMapper<PqsRelevanceLog> {
|
||||
|
||||
|
||||
|
||||
@@ -23,4 +23,7 @@ public interface RelevantMapper extends BaseMapper<PqsRelevanceLog> {
|
||||
*/
|
||||
List<EntityLogic> getLogic();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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.advance.mapper.RelevantMapper">
|
||||
<mapper namespace="com.njcn.advance.mapper.RelevantLogMapper">
|
||||
|
||||
<select id="updateCause" resultType="EntityLogic">
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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.advance.mapper.RelevantMapper">
|
||||
<mapper namespace="com.njcn.advance.mapper.RelevantLogMapper">
|
||||
|
||||
<select id="getLogic" resultType="EntityLogic">
|
||||
SELECT
|
||||
@@ -3,6 +3,8 @@ package com.njcn.advance.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
@@ -27,4 +29,33 @@ public interface EventRelevantAnalysisService extends IService<RmpEventDetailPO>
|
||||
|
||||
|
||||
Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam);
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
Page<AdvanceEventDetailVO> queryEventDetailByAssId(String assId,Integer pageNum,Integer pageSize);
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
Page<PqsRelevanceLog> queryRelevantLogPage(BaseParam baseParam);
|
||||
|
||||
/**
|
||||
* 删除关联操作记录
|
||||
* @author cdf
|
||||
* @date 2023/8/11
|
||||
*/
|
||||
boolean delRelevantLog(String id);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,15 @@ package com.njcn.advance.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.RelevantMapper;
|
||||
import com.njcn.advance.mapper.RelevantLogMapper;
|
||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||
import com.njcn.advance.mapper.RmpEventDetailAssMapper;
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
@@ -28,20 +27,24 @@ import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -66,7 +69,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RelevantMapper relevantMapper;
|
||||
private final RelevantLogMapper relevantLogMapper;
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
@@ -76,6 +79,8 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
private final RmpEventDetailAssMapper rmpEventDetailAssMapper;
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -96,7 +101,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
// 传入的处理事件根据物理隔绝进行分组
|
||||
|
||||
List<EntityLogic> strategyList = relevantMapper.getLogic();
|
||||
List<EntityLogic> strategyList = relevantLogMapper.getLogic();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(strategyList)) {
|
||||
List<SagEvent> listSagEvent = new ArrayList<>();
|
||||
@@ -120,7 +125,6 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
mapRedis.put(key, entityMtrans);
|
||||
});
|
||||
//TODO 是否要处理排序
|
||||
|
||||
strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||
int index = 1;
|
||||
@@ -211,7 +215,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
entityPqsRelevance.setContentDes(describe);
|
||||
entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||
entityPqsRelevance.setTimeId(date);
|
||||
relevantMapper.insert(entityPqsRelevance);
|
||||
relevantLogMapper.insert(entityPqsRelevance);
|
||||
|
||||
}
|
||||
|
||||
@@ -220,7 +224,147 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) {
|
||||
return null;
|
||||
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
throw new BusinessException("当前部门下不存在监测点");
|
||||
}
|
||||
|
||||
|
||||
List<LocalDateTime> vTime = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.and(i -> i.isNull(RmpEventDetailPO::getEventassIndex).or().eq(RmpEventDetailPO::getEventassIndex, ""))
|
||||
.between(RmpEventDetailPO::getStartTime, vTime.get(0), vTime.get(1)).orderByAsc(RmpEventDetailPO::getStartTime)
|
||||
;
|
||||
|
||||
|
||||
Page<RmpEventDetailPO> poPage = eventAdvanceMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
List<RmpEventDetailPO> rmpEventDetailPOList = poPage.getRecords();
|
||||
|
||||
if (CollectionUtil.isEmpty(rmpEventDetailPOList)) {
|
||||
return new Page<>();
|
||||
}
|
||||
|
||||
List<String> tempLineIds = rmpEventDetailPOList.stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
||||
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||
if (map.containsKey(item.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
||||
item.setGdName(areaLineInfoVO.getGdName());
|
||||
item.setSubName(areaLineInfoVO.getSubName());
|
||||
item.setLineName(areaLineInfoVO.getLineName());
|
||||
item.setNum(areaLineInfoVO.getNum());
|
||||
item.setVoltageId(areaLineInfoVO.getVoltageId());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
Page<AdvanceEventDetailVO> page = new Page<>(poPage.getCurrent(), poPage.getSize());
|
||||
page.setTotal(poPage.getTotal());
|
||||
page.setRecords(advanceEventDetailVOList);
|
||||
return page;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
||||
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||
LambdaQueryWrapper<RmpEventDetailAssPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
||||
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
||||
Page<RmpEventDetailAssPO> page = rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> queryEventDetailByAssId(String assId,Integer pageNum,Integer pageSize) {
|
||||
Page<AdvanceEventDetailVO> pageResult = new Page<>(pageNum,pageSize);
|
||||
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RmpEventDetailPO::getEventassIndex,assId)
|
||||
.orderByAsc(RmpEventDetailPO::getStartTime);
|
||||
Page<RmpEventDetailPO> page = eventAdvanceMapper.selectPage(new Page<>(pageNum,pageSize),lambdaQueryWrapper);
|
||||
List<RmpEventDetailPO> pos = page.getRecords();
|
||||
if(CollectionUtil.isEmpty(pos)){
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
List<String> lineIds = pos.stream().map(RmpEventDetailPO::getMeasurementPointId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> lineAres = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
Map<String, AreaLineInfoVO> map = lineAres.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
||||
|
||||
|
||||
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(pos,AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item->{
|
||||
if(map.containsKey(item.getMeasurementPointId())){
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(item.getMeasurementPointId());
|
||||
item.setGdName(areaLineInfoVO.getGdName());
|
||||
item.setSubName(areaLineInfoVO.getSubName());
|
||||
item.setLineName(areaLineInfoVO.getLineName());
|
||||
item.setVoltageId(areaLineInfoVO.getVoltageScale());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
pageResult.setRecords(advanceEventDetailVOList);
|
||||
pageResult.setTotal(page.getTotal());
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PqsRelevanceLog> queryRelevantLogPage(BaseParam baseParam) {
|
||||
LambdaQueryWrapper<PqsRelevanceLog> logLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
logLambdaQueryWrapper.orderByAsc(PqsRelevanceLog::getTimeId);
|
||||
Page<PqsRelevanceLog> page = relevantLogMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), logLambdaQueryWrapper);
|
||||
List<PqsRelevanceLog> temList = page.getRecords();
|
||||
if (CollectionUtil.isEmpty(temList)) {
|
||||
return page;
|
||||
}
|
||||
List<String> userIds = temList.stream().map(PqsRelevanceLog::getCreateBy).distinct().collect(Collectors.toList());
|
||||
List<User> userTem = userFeignClient.getUserByIdList(userIds).getData();
|
||||
Map<String, User> map = userTem.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||
temList = temList.stream().peek(item -> {
|
||||
if (map.containsKey(item.getCreateBy())) {
|
||||
item.setCreateName(map.get(item.getCreateBy()).getName());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
page.setRecords(temList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean delRelevantLog(String id) {
|
||||
PqsRelevanceLog pqsRelevanceLog = relevantLogMapper.selectById(id);
|
||||
if (Objects.nonNull(pqsRelevanceLog)) {
|
||||
|
||||
LambdaQueryWrapper<RmpEventDetailAssPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RmpEventDetailAssPO::getCreateTime, pqsRelevanceLog.getTimeId()).select(RmpEventDetailAssPO::getEventAssId);
|
||||
List<RmpEventDetailAssPO> rmpEventDetailAssPOList = rmpEventDetailAssMapper.selectList(lambdaQueryWrapper);
|
||||
List<String> temAssIds = rmpEventDetailAssPOList.stream().map(RmpEventDetailAssPO::getEventAssId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(temAssIds)) {
|
||||
|
||||
rmpEventDetailAssMapper.deleteBatchIds(temAssIds);
|
||||
|
||||
|
||||
LambdaUpdateWrapper<RmpEventDetailPO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(RmpEventDetailPO::getEventassIndex, temAssIds);
|
||||
|
||||
|
||||
RmpEventDetailPO update = new RmpEventDetailPO();
|
||||
update.setEventassIndex("");
|
||||
eventAdvanceMapper.update(update, updateWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
relevantLogMapper.deleteById(id);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -412,7 +556,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
* 获取变压器信息并生成矩阵
|
||||
*************************************************************************************/
|
||||
public void getNodeInfo(HandleEvent handleEvent) {
|
||||
List<EntityLogic> list = relevantMapper.getLogic();
|
||||
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Map<String, List<EntityLogic>> tfMap = list.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||
@@ -438,7 +582,6 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<AdvanceEventDetailVO> querySagEventsAll(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
|
||||
@@ -219,19 +219,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
}
|
||||
|
||||
log.info("高级算法波形计算" + timeInterval.interval());
|
||||
return null;
|
||||
return entityAdvancedData;
|
||||
}
|
||||
|
||||
|
||||
// 1-值调用暂降类型dll 2-两个dll都调用
|
||||
private void judgeEvt(int type, String eventIndex, WaveData waveData, Rect rect, EntityAdvancedData entityAdvancedData) {
|
||||
try {
|
||||
//getDataFromDLL(type, eventIndex, waveData, rect, entityAdvancedData);
|
||||
} catch (Exception e) {
|
||||
//eventDetailMapper.updateDealFlag(3, eventIndex); //计算失败
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
||||
@@ -224,7 +224,7 @@ public class PubUtils {
|
||||
* @author cdf
|
||||
* @date 2023/8/10
|
||||
*/
|
||||
public static List<LocalDateTime> checkLocalDateTime(String startTime,String endTime) {
|
||||
public static List<LocalDateTime> checkLocalDate(String startTime,String endTime) {
|
||||
List<LocalDateTime> resultList = new ArrayList<>();
|
||||
if(StrUtil.isBlank(startTime) || StrUtil.isBlank(endTime)){
|
||||
throw new BusinessException(CommonResponseEnum.TIME_ERROR);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.device.pq.enums;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
public enum SocketResponseEnum {
|
||||
|
||||
|
||||
/**
|
||||
* socket返回状态码
|
||||
*/
|
||||
SUCCEED("10000","成功"),
|
||||
JSON_ERROR("10003","JSON字符串解析出错")
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
SocketResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.njcn.device.pq.utils;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.socket.SocketUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/10
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SocketClientComm {
|
||||
|
||||
|
||||
/**
|
||||
* 装置版本升级
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/8/10
|
||||
*/
|
||||
private void normalSocket(String ip,Integer port,String msg) {
|
||||
|
||||
Socket socket = null;
|
||||
BufferedReader in = null;
|
||||
OutputStream out = null;
|
||||
try{
|
||||
socket = new Socket(ip,port);
|
||||
socket.setSoTimeout(3000);
|
||||
in = new BufferedReader(new InputStreamReader(socket.getInputStream(),StandardCharsets.UTF_8));
|
||||
out = socket.getOutputStream();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String expression;
|
||||
|
||||
while ((expression = in.readLine())==null){break;} {
|
||||
try {
|
||||
//System.out.println(expression);
|
||||
JSONObject res = JSONObject.fromObject(expression);
|
||||
|
||||
|
||||
if("10000".equalsIgnoreCase(res.get("resultcode").toString())){
|
||||
//成功
|
||||
|
||||
}else {
|
||||
//错误
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
}finally{
|
||||
//一些必要的清理工作
|
||||
if(in != null){
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
in = null;
|
||||
}
|
||||
if(out != null){
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
out = null;
|
||||
}
|
||||
if(socket != null){
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
socket = null;
|
||||
}
|
||||
|
||||
//System.out.println("end---");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,17 +23,19 @@ public class RmpEventDetailAssPO extends BaseEntity {
|
||||
/**
|
||||
*事件关联分析表uuid
|
||||
*/
|
||||
@TableId("Event_Ass_Id")
|
||||
private String eventAssId;
|
||||
|
||||
/**
|
||||
*发生时间(归一化中第一个时间)
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||
private LocalDateTime timeId;
|
||||
|
||||
/**
|
||||
*关联事件描述
|
||||
*/
|
||||
private String describe;
|
||||
private String contentDes;
|
||||
|
||||
/**
|
||||
*是否进行范围分析(0:分析;1:未分析)
|
||||
|
||||
@@ -96,10 +96,15 @@ public class AdvanceEventDetailVO {
|
||||
|
||||
private Double transientValue;
|
||||
|
||||
@ApiModelProperty(value = "供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(value = "变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
private String voltageId;
|
||||
|
||||
@ApiModelProperty(value = "特征值是否计算")
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MonitorPointController extends BaseController {
|
||||
* @author cdf
|
||||
* @date 2022/6/23
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
/* @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventAnalyse")
|
||||
@ApiOperation("获取监测点暂降事件分析")
|
||||
@ApiImplicitParam(name = "eventBaseParam", value = "暂降事件分析参数", required = true)
|
||||
@@ -53,7 +53,7 @@ public class MonitorPointController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("getEventAnalyse");
|
||||
Page<EventDetail> page = eventAnalysisService.getEventAnalyse(eventBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 获取电压暂态表及密度图
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface EventAnalysisService {
|
||||
* @author cdf
|
||||
* @date 2022/6/23
|
||||
*/
|
||||
Page<EventDetail> getEventAnalyse(EventBaseParam eventBaseParam);
|
||||
//Page<EventDetail> getEventAnalyse(EventBaseParam eventBaseParam);
|
||||
|
||||
/**
|
||||
* 获取坐标
|
||||
|
||||
@@ -65,7 +65,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public Page<EventDetail> getEventAnalyse(EventBaseParam eventBaseParam) {
|
||||
|
||||
//查询sql语句
|
||||
@@ -97,7 +97,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
page.setCurrent(eventBaseParam.getPageNum());
|
||||
page.setSize(eventBaseParam.getPageSize());
|
||||
return page;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 时间无ID全查询
|
||||
|
||||
Reference in New Issue
Block a user