代码调整
This commit is contained in:
@@ -15,10 +15,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,7 +44,7 @@ public class CommLineController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getLineDetailBatch")
|
||||
@PostMapping("/getLineDetailBatch")
|
||||
@ApiOperation("批量获取监测点信息")
|
||||
public HttpResult<List<LineDTO>> getLineDetailBatch(@RequestParam("ids") List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getLineDetailBatch");
|
||||
|
||||
@@ -12,10 +12,7 @@ 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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,7 +42,7 @@ public class CommLineController extends BaseController {
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getLineDetailBatch")
|
||||
@PostMapping("/getLineDetailBatch")
|
||||
@ApiOperation("批量获取监测点信息")
|
||||
public HttpResult<List<LineDTO>> getLineDetailBatch(@RequestParam("ids") List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getLineDetailBatch");
|
||||
|
||||
@@ -476,12 +476,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
public LineDTO getLineDetail(String id) {
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
List<DictData> connect = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String, String> connectMap = connect.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
LineDTO lineDTO = this.baseMapper.selectLineDetail(id);
|
||||
if(dicMap.containsKey(lineDTO.getVoltageLevel())&&connectMap.containsKey(lineDTO.getPtType())){
|
||||
if(dicMap.containsKey(lineDTO.getVoltageLevel())){
|
||||
lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel()));
|
||||
lineDTO.setPtType(connectMap.get(lineDTO.getPtType()));
|
||||
return lineDTO;
|
||||
}
|
||||
return null;
|
||||
@@ -498,20 +495,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<LineDTO> lineDTOS = this.baseMapper.selectLineDetailBatch(ids);
|
||||
//电压等级
|
||||
Map<String, List<LineDTO>> lineVoltageMap = lineDTOS.stream().collect(Collectors.groupingBy(LineDTO::getVoltageLevel));
|
||||
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
lineVoltageMap.forEach((key,lineData) -> {
|
||||
String voltage= voltageMap.get(key);
|
||||
lineData = lineData.stream().peek(line -> line.setVoltageLevel(voltage)).collect(Collectors.toList());
|
||||
});
|
||||
//接线方式
|
||||
Map<String, List<LineDTO>> linePtTypeMap = lineDTOS.stream().collect(Collectors.groupingBy(LineDTO::getPtType));
|
||||
List<DictData> connect = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String, String> connectMap = connect.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
linePtTypeMap.forEach((key,lineData)->{
|
||||
String ptType= connectMap.get(key);
|
||||
lineData = lineData.stream().peek(line -> line.setPtType(ptType)).collect(Collectors.toList());
|
||||
});
|
||||
return lineDTOS;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,19 +81,19 @@ public class AutonomeWaveServiceImpl implements AutonomeWaveService {
|
||||
/**
|
||||
* 计算pt值和ct值
|
||||
*/
|
||||
private WaveDataDTO countPtCt(WaveDataDTO waveDataDTO){
|
||||
private WaveDataDTO countPtCt(WaveDataDTO waveDataDTO) {
|
||||
//取出集合
|
||||
List<AnalogDTO> lstAnalogDTO = waveDataDTO.getComtradeCfgDTO().getLstAnalogDTO();
|
||||
AnalogDTO ptParam = null;
|
||||
for (AnalogDTO analogDTO : lstAnalogDTO) {
|
||||
if (StringUtils.isNotBlank(analogDTO.getSzUnitName())&& analogDTO.getSzUnitName().contains("V")){
|
||||
if (StringUtils.isNotBlank(analogDTO.getSzUnitName()) && analogDTO.getSzUnitName().contains("V")) {
|
||||
ptParam = analogDTO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AnalogDTO ctParam = null;
|
||||
for (AnalogDTO analogDTO : lstAnalogDTO) {
|
||||
if (StringUtils.isNotBlank(analogDTO.getSzUnitName())&& analogDTO.getSzUnitName().contains("A")){
|
||||
if (StringUtils.isNotBlank(analogDTO.getSzUnitName()) && analogDTO.getSzUnitName().contains("A")) {
|
||||
ctParam = analogDTO;
|
||||
break;
|
||||
}
|
||||
@@ -106,4 +106,5 @@ public class AutonomeWaveServiceImpl implements AutonomeWaveService {
|
||||
waveDataDTO.setCt(ct1 / ct2);
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ public class RMpEventDetailDPO {
|
||||
* 时间
|
||||
*/
|
||||
@MppMultiId(value = "data_date")
|
||||
private Date dataDate;
|
||||
private LocalDate dataDate;
|
||||
|
||||
/**
|
||||
* 电压暂升发生次数
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ public class RMpEventDetailMPO {
|
||||
* 时间
|
||||
*/
|
||||
@MppMultiId(value = "data_date")
|
||||
private Date dataDate;
|
||||
private LocalDate dataDate;
|
||||
|
||||
/**
|
||||
* 电压暂升发生次数
|
||||
|
||||
@@ -10,7 +10,12 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum PrepareResponseEnum {
|
||||
|
||||
PREPARE_INNER_ERROR("A0801", "业务功能内部错误")
|
||||
PREPARE_INNER_ERROR("A0801", "业务功能内部错误"),
|
||||
|
||||
NO_EXECUTOR_NODE("A0802", "无可执行节点"),
|
||||
|
||||
NO_REPAIR_DATE("A0803", "未指定补招日期"),
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -32,7 +32,6 @@ public class LineParam {
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期,存的是起始时间的日期类型,去除时分秒")
|
||||
@Deprecated
|
||||
private String dataDate;
|
||||
|
||||
/**
|
||||
@@ -45,13 +44,13 @@ public class LineParam {
|
||||
/**
|
||||
* 调度任务开始时间
|
||||
*/
|
||||
@NotBlank(message = "调度任务开始时间不可为空 yyyy-MM-dd hh:mm:ss")
|
||||
@Deprecated
|
||||
private String beginTime;
|
||||
|
||||
/**
|
||||
* 调度任务结束时间
|
||||
*/
|
||||
@NotBlank(message = "调度任务结束时间不可为空 yyyy-MM-dd hh:mm:ss")
|
||||
@Deprecated
|
||||
private String endTime;
|
||||
|
||||
|
||||
|
||||
@@ -99,8 +99,6 @@
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@@ -108,19 +106,17 @@
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.yomahub</groupId>-->
|
||||
<!-- <artifactId>liteflow-rule-nacos</artifactId>-->
|
||||
<!-- <version>2.11.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-rule-nacos</artifactId>
|
||||
<version>2.11.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.njcn.prepare;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.bo.BaseParam;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.enums.PrepareResponseEnum;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
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.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月01日 10:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "监测点算法执行链")
|
||||
@RestController
|
||||
@RequestMapping("/executor")
|
||||
@RequiredArgsConstructor
|
||||
public class ExecutionCenter extends BaseController {
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("监测点算法执行链")
|
||||
@PostMapping("/measurementPointExecutor")
|
||||
public void measurementPointExecutor(@RequestBody BaseParam baseParam) {
|
||||
//手动判断参数是否合法,
|
||||
CalculatedParam calculatedParam = judgeExecuteParam(baseParam);
|
||||
// 测点索引
|
||||
if (CollectionUtils.isEmpty(calculatedParam.getIdList())) {
|
||||
calculatedParam.setIdList(commTerminalGeneralClient.getRunMonitorIds().getData());
|
||||
}
|
||||
LiteflowResponse liteflowResponse;
|
||||
if (baseParam.isRepair()) {
|
||||
//补招时,起始日期、截止日期必填
|
||||
DateTime startDate = DateUtil.parse(baseParam.getBeginTime(), DatePattern.NORM_DATE_FORMAT);
|
||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||
//递增日期执行算法链
|
||||
for (int i = 0; i < betweenDay; i++) {
|
||||
if (i != 0) {
|
||||
startDate = DateUtil.offsetDay(startDate, 1);
|
||||
}
|
||||
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
|
||||
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
|
||||
log.info("执行结果:{}", liteflowResponse.isSuccess());
|
||||
}
|
||||
} else {
|
||||
//非补招
|
||||
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
|
||||
log.info("执行结果:{}", liteflowResponse.isSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 1、校验非全链执行时,tagNames节点标签集合必须为非空,否则提示---无可执行节点
|
||||
* 2、补招标识为true时,起始日期&截止日期不可为空
|
||||
* 3、算法需要的索引集合
|
||||
* @author hongawen
|
||||
* @date 2023/11/3 11:36
|
||||
* @param baseParam 执行的基础参数
|
||||
*/
|
||||
private CalculatedParam judgeExecuteParam(BaseParam baseParam) {
|
||||
CalculatedParam calculatedParam = new CalculatedParam();
|
||||
|
||||
if (!baseParam.isFullChain() && CollectionUtil.isEmpty(baseParam.getTagNames())) {
|
||||
throw new BusinessException(PrepareResponseEnum.NO_EXECUTOR_NODE);
|
||||
}
|
||||
|
||||
if (baseParam.isRepair() && StrUtil.isAllNotEmpty(baseParam.getBeginTime(), baseParam.getEndTime())) {
|
||||
throw new BusinessException(PrepareResponseEnum.NO_REPAIR_DATE);
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(baseParam, calculatedParam);
|
||||
return calculatedParam;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.prepare.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* ** 当补招表示为true时,起始时间和截止时间是必填的 **
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月01日 16:17
|
||||
*/
|
||||
@Data
|
||||
public class BaseParam implements Serializable {
|
||||
|
||||
/***
|
||||
* 是否全链路执行算法
|
||||
* 非全链路执行时,tag集合必须非空
|
||||
*/
|
||||
@ApiModelProperty(name = "fullChain",value = "是否全链执行")
|
||||
private boolean fullChain;
|
||||
|
||||
/**
|
||||
* 目前仅监测点日统计存在补招功能 by yxb
|
||||
* 是否补招标识,默认不补招
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否补招")
|
||||
private boolean repair;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "beginTime",value = "补招起始日期_yyyy-MM-dd")
|
||||
private String beginTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "endTime",value = "补招截止日期_yyyy-MM-dd")
|
||||
private String endTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
|
||||
private String dataDate;
|
||||
|
||||
|
||||
/***
|
||||
* 需要执行的组件
|
||||
* 当不需要全链路执行时,通过tag名称动态指定执行某个算法组件
|
||||
*/
|
||||
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
|
||||
private Set<String> tagNames;
|
||||
|
||||
|
||||
/**
|
||||
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位等等
|
||||
*/
|
||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||
private List<String> idList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.prepare.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 算法编排的计算参数
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月03日 09:21
|
||||
*/
|
||||
@Data
|
||||
public class CalculatedParam implements Serializable {
|
||||
|
||||
/***
|
||||
* 是否全链路执行算法
|
||||
* 非全链路执行时,tag集合必须非空
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否全链执行")
|
||||
private boolean fullChain;
|
||||
|
||||
/**
|
||||
* 目前仅监测点日统计存在补招功能 by yxb
|
||||
* 是否补招标识,默认不补招
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否补招")
|
||||
private boolean repair;
|
||||
|
||||
/***
|
||||
* 需要执行的组件
|
||||
* 当不需要全链路执行时,通过tag名称动态指定执行某个算法组件
|
||||
*/
|
||||
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
|
||||
private Set<String> tagNames;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
|
||||
private String dataDate;
|
||||
|
||||
/**
|
||||
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位等等
|
||||
*/
|
||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||
private List<String> idList;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.prepare.executor;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月07日 09:02
|
||||
*/
|
||||
public class BaseExecutor {
|
||||
|
||||
|
||||
/***
|
||||
* 判断当前节点是否执行
|
||||
* @author hongawen
|
||||
* @date 2023/11/6 16:17
|
||||
* @param bindCmp 执行链绑定的上下文
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isAccess(NodeComponent bindCmp) {
|
||||
String tag = bindCmp.getTag();
|
||||
if (StrUtil.isBlank(tag)) {
|
||||
//没有指定tag的,使用node自己的名称判断
|
||||
tag = bindCmp.getNodeId();
|
||||
}
|
||||
CalculatedParam requestData = bindCmp.getRequestData();
|
||||
Set<String> tagNames = requestData.getTagNames();
|
||||
if (requestData.isFullChain() || (CollectionUtil.isNotEmpty(tagNames) && tagNames.contains(tag))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.njcn.prepare.executor;
|
||||
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpMonitorEvaluateDService;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月06日 15:59
|
||||
*/
|
||||
@LiteflowComponent
|
||||
@RequiredArgsConstructor
|
||||
public class MeasurementExecutor extends BaseExecutor {
|
||||
|
||||
private final RMpMonitorEvaluateDService rMpMonitorEvaluateDService;
|
||||
|
||||
private final RMpEventDetailService rMpEventDetailService;
|
||||
|
||||
private final RMpEventDetailDService rMpEventDetailDService;
|
||||
|
||||
|
||||
/**
|
||||
* 算法名: 3.4.1.1-----监测点报表
|
||||
*
|
||||
* @author hongawen
|
||||
* @date 2023年11月01日 11:08
|
||||
*/
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpMonitorEvaluate", nodeType = NodeTypeEnum.COMMON)
|
||||
public void processRMpMonitorEvaluate(NodeComponent bindCmp) {
|
||||
isAccess(bindCmp);
|
||||
rMpMonitorEvaluateDService.handleDay(bindCmp.getRequestData());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 算法名: 3.4.1.8-----监测点暂态指标明细
|
||||
*
|
||||
* @author hongawen
|
||||
* @date 2023年11月01日 11:08
|
||||
*/
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpEventDetail", nodeType = NodeTypeEnum.COMMON)
|
||||
public void processRMpEventDetail(NodeComponent bindCmp) {
|
||||
String tag = bindCmp.getTag();
|
||||
CalculatedParam calculatedParam = bindCmp.getRequestData();
|
||||
if (tag.equalsIgnoreCase("r_mp_event_detail_d")) {
|
||||
isAccess(bindCmp);
|
||||
//日表
|
||||
rMpEventDetailService.handleDay(calculatedParam);
|
||||
} else if (tag.equalsIgnoreCase("r_mp_event_detail_m")) {
|
||||
isAccess(bindCmp);
|
||||
//数据补招不执行非日表算法
|
||||
if (!calculatedParam.isRepair()) {
|
||||
//月表
|
||||
rMpEventDetailDService.handleMonth(calculatedParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -22,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -42,6 +46,7 @@ import java.util.List;
|
||||
public class RMpEventdetailController extends BaseController {
|
||||
|
||||
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final RMpEventDetailService rMpEventDetailService;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.njcn.prepare.harmonic.mapper.mysql.line;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -27,4 +29,16 @@ public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailDPO>
|
||||
|
||||
Map<String, Object> getSumAndCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lineIds") List<String> lineIds);
|
||||
|
||||
|
||||
/***
|
||||
* 处理在暂态指标明细——月报表数据获取
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 10:54
|
||||
* @param lineIds 监测点集合
|
||||
* @param dataDate 统计日期
|
||||
* @param beginMonth 起始时间
|
||||
* @param endMonth 截止时间
|
||||
* @return List<RMpEventDetailDPO>
|
||||
*/
|
||||
List<RMpEventDetailMPO> handleMonth(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginMonth") DateTime beginMonth, @Param("endMonth") DateTime endMonth);
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.njcn.prepare.harmonic.mapper.mysql.line;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/23 13:50【需求编号】
|
||||
@@ -13,4 +17,20 @@ import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface RMpEventDetailMapper extends BaseMapper<RMpEventDetailPO> {
|
||||
|
||||
|
||||
/***
|
||||
* 处理在暂态指标明细——日报表数据获取
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 10:54
|
||||
* @param lineIds 监测点集合
|
||||
* @param dataDate 统计日期
|
||||
* @param beginDay 起始时间
|
||||
* @param endDay 截止时间
|
||||
* @param voltageDip 电压暂降
|
||||
* @param voltageRise 电压暂升
|
||||
* @param shortInterruptions 短时中断
|
||||
* @return List<RMpEventDetailDPO>
|
||||
*/
|
||||
List<RMpEventDetailDPO> handleDay(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginDay") LocalDateTime beginDay, @Param("endDay") LocalDateTime endDay, @Param("voltageDip") String voltageDip, @Param("voltageRise") String voltageRise, @Param("shortInterruptions") String shortInterruptions);
|
||||
}
|
||||
@@ -36,4 +36,27 @@
|
||||
</foreach>
|
||||
AND data_date between #{startTime} and #{endTime}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="handleMonth" resultType="com.njcn.harmonic.pojo.po.RMpEventDetailMPO">
|
||||
SELECT
|
||||
#{dataDate} dataDate,
|
||||
measurement_point_id measurement_point_id,
|
||||
sum(sag_times) AS sagTimes,
|
||||
sum(swell_times) AS swellTimes,
|
||||
sum(interrupt_times) AS interruptTimes
|
||||
FROM
|
||||
r_mp_event_detail_d r_mp_event_detail_d
|
||||
where
|
||||
r_mp_event_detail_d.data_date between #{beginMonth} and #{endMonth}
|
||||
AND
|
||||
r_mp_event_detail_d.measurement_point_id IN
|
||||
<foreach collection="lineIds" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
measurement_point_id
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -37,4 +37,27 @@
|
||||
energy, severity, sagsource, start_time, duration, feature_amplitude, phase, event_describe,
|
||||
wave_path, create_time, transient_value
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="handleDay" resultType="com.njcn.harmonic.pojo.po.RMpEventDetailDPO">
|
||||
SELECT
|
||||
#{dataDate} dataDate,
|
||||
measurement_point_id measurement_point_id,
|
||||
sum( event_type = #{voltageDip} ) AS sagTimes,
|
||||
sum( event_type = #{voltageRise} ) AS swellTimes,
|
||||
sum( event_type = #{shortInterruptions} ) AS interruptTimes
|
||||
FROM
|
||||
r_mp_event_detail r_mp_event_detail
|
||||
where r_mp_event_detail.start_time between #{beginDay} and #{endDay}
|
||||
AND r_mp_event_detail.measurement_point_id
|
||||
IN
|
||||
<foreach collection="lineIds" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
measurement_point_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,17 +1,29 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailMService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 14:58【需求编号】
|
||||
@@ -21,11 +33,13 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailDPO> implements RMpEventDetailDService{
|
||||
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailDPO> implements RMpEventDetailDService {
|
||||
|
||||
|
||||
private final RMpEventDetailDMapper rMpEventDetailDMapper;
|
||||
|
||||
private final RMpEventDetailMService rMpEventDetailMService;
|
||||
|
||||
/**
|
||||
* @param lineId
|
||||
* @param dataDate
|
||||
@@ -38,10 +52,27 @@ public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMa
|
||||
@Override
|
||||
public List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate) {
|
||||
|
||||
QueryWrapper<RMpEventDetailDPO> queryWrapper = new QueryWrapper<> ();
|
||||
queryWrapper.eq ("measurement_point_id", lineId).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring (0, 7));
|
||||
List<RMpEventDetailDPO> list = rMpEventDetailDMapper.selectList (queryWrapper);
|
||||
QueryWrapper<RMpEventDetailDPO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("measurement_point_id", lineId).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
|
||||
List<RMpEventDetailDPO> list = rMpEventDetailDMapper.selectList(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*监测点暂态指标明细--月表算法
|
||||
*/
|
||||
@Override
|
||||
public void handleMonth(CalculatedParam calculatedParam) {
|
||||
List<String> lineIds = calculatedParam.getIdList();
|
||||
//以尺寸1000分片
|
||||
List<List<String>> pendingIds = ListUtils.partition(lineIds, 1000);
|
||||
DateTime beginMonth = DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
DateTime endMonth = DateUtil.endOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
for (List<String> pendingId : pendingIds) {
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOList = this.baseMapper.handleMonth(pendingId, DateUtil.format(beginMonth, DatePattern.NORM_DATE_PATTERN), beginMonth, endMonth);
|
||||
rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMPOList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
@@ -16,11 +19,13 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -46,9 +51,36 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
/***
|
||||
*监测点暂态指标明细--日表算法
|
||||
*/
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
List<String> lineIds = calculatedParam.getIdList();
|
||||
//以尺寸1000分片
|
||||
List<List<String>> pendingIds = ListUtils.partition(lineIds,1000);
|
||||
LocalDateTime beginDay = LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
LocalDateTime endDay = LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
for (List<String> pendingId : pendingIds) {
|
||||
//查询
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOList = this.baseMapper.handleDay(
|
||||
pendingId
|
||||
,LocalDateTimeUtil.format(beginDay,DatePattern.NORM_DATE_PATTERN)
|
||||
,beginDay
|
||||
,endDay
|
||||
,getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode())
|
||||
,getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode())
|
||||
,getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode()));
|
||||
//入库
|
||||
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDPOList);
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================================================================
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
public void eventdetailHandler(LineParam lineParam) {
|
||||
this.hanlderData(lineParam);
|
||||
}
|
||||
@@ -86,9 +118,8 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
|
||||
List<String> lineIds = lineParam.getLineIds();
|
||||
String dataDate = lineParam.getDataDate();
|
||||
final Date tempDate = new SimpleDateFormat("yyyy-MM-dd").parse(dataDate);
|
||||
LocalDate tempDate = LocalDateTimeUtil.parseDate(dataDate,DatePattern.NORM_DATE_PATTERN);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOList = new ArrayList<>();
|
||||
|
||||
lineIds.forEach(measurementPointId -> {
|
||||
/*查询day表数据生成月表数据*/
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOList = rMpEventDetailDService.queryOneMothData(measurementPointId, dataDate);
|
||||
@@ -112,13 +143,10 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
|
||||
@SneakyThrows
|
||||
private void hanlderDay(LineParam lineParam) {
|
||||
|
||||
List<String> lineIds = lineParam.getLineIds();
|
||||
String dataDate = lineParam.getDataDate();
|
||||
final Date tempDate = new SimpleDateFormat("yyyy-MM-dd").parse(dataDate);
|
||||
LocalDate tempDate = LocalDateTimeUtil.parseDate(dataDate,DatePattern.NORM_DATE_PATTERN);
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOList = new ArrayList<>();
|
||||
|
||||
|
||||
lineIds.forEach(measurementPointId -> {
|
||||
Integer sagCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode()));
|
||||
Integer riseCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode()));
|
||||
@@ -129,10 +157,8 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
rMpEventDetailDPO.setSagTimes(sagCount);
|
||||
rMpEventDetailDPO.setSwellTimes(riseCount);
|
||||
rMpEventDetailDPO.setInterruptTimes(interruptCount);
|
||||
|
||||
rMpEventDetailDPOList.add(rMpEventDetailDPO);
|
||||
});
|
||||
|
||||
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDPOList, 500);
|
||||
}
|
||||
|
||||
@@ -142,12 +168,10 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
eq("measurement_point_id", measurementPointId).
|
||||
eq("event_type", eventType).
|
||||
eq("DATE_FORMAT( start_time ,'%Y-%m-%d')", dataDate);
|
||||
|
||||
return this.getBaseMapper().selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
public String getEventTypeId(String code) {
|
||||
|
||||
String eventType = redisUtil.getStringByKey(code);
|
||||
eventType = Optional.ofNullable(eventType).orElseGet(() -> {
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(code).getData();
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.pojo.po.PmsAbnormalRules;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.influx.pojo.po.DataFlicker;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsAbnormalRulesMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.DataVFiveItemDTO;
|
||||
@@ -17,13 +19,16 @@ import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
|
||||
import com.njcn.prepare.harmonic.service.influxdb.DataIntegrityRateInfluxService;
|
||||
import com.njcn.prepare.harmonic.service.influxdb.DataVInfluxdbService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpMonitorEvaluateDService;
|
||||
import com.yomahub.liteflow.exception.LiteFlowException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -64,7 +69,7 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
|
||||
/*电压等级*/
|
||||
Double voltage = Double.parseDouble(data.getVoltageLevel());
|
||||
|
||||
List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(temp, beginTime,endTime, statisticalInterval);
|
||||
List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(temp, beginTime, endTime, statisticalInterval);
|
||||
RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
|
||||
|
||||
|
||||
@@ -93,6 +98,57 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
* @author hongawen
|
||||
* @date 2023/11/3 14:48
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
// System.out.println(1/0);
|
||||
//1、取出规则
|
||||
List<PmsAbnormalRules> pmsAbnormalRules = pmsAbnormalRulesMapper.selectList(null);
|
||||
String beginDay =LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
//以尺寸1000分片
|
||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(), 1000);
|
||||
for (List<String> pendingId : pendingIds) {
|
||||
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(pendingId).getData();
|
||||
List<RMpMonitorEvaluateDPO> rMpMonitorEvaluateDPOS = new ArrayList<>();
|
||||
for (LineDTO lineDTO : lineDTOList) {
|
||||
if (ObjectUtil.isNotNull(lineDTO)) {
|
||||
/*todo 统计间隔,电压等级取值方式后期提供融合版本接口获取不然pms,pqs系统取值方式不一样*/
|
||||
/*统计间隔*/
|
||||
Integer statisticalInterval = lineDTO.getTimeInterval();
|
||||
/*电压等级*/
|
||||
Double voltage = Double.parseDouble(lineDTO.getVoltageLevel());
|
||||
List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(lineDTO.getLineId(), beginDay, endDay, statisticalInterval);
|
||||
RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
|
||||
rMpMonitorEvaluateDPO = calculateRMpMonitorEvaluateDPO(rMpMonitorEvaluateDPO, fiveItems, pmsAbnormalRules, voltage, lineDTO);
|
||||
Date date = DateUtil.parse(beginDay);
|
||||
DataFlicker twoFlickerData = dataIntegrityRateInfluxService.getTwoFlickerData(lineDTO.getLineId(), date, 5);
|
||||
|
||||
if (Objects.isNull(twoFlickerData)) {
|
||||
rMpMonitorEvaluateDPO.setPltCount(0);
|
||||
rMpMonitorEvaluateDPO.setPstCount(0);
|
||||
} else {
|
||||
rMpMonitorEvaluateDPO.setPltCount(twoFlickerData.getPltCount());
|
||||
rMpMonitorEvaluateDPO.setPstCount(twoFlickerData.getPstCount());
|
||||
}
|
||||
rMpMonitorEvaluateDPO.setAllMinuteCount(fiveItems.size());
|
||||
rMpMonitorEvaluateDPO.setDeviceId(lineDTO.getDevId());
|
||||
rMpMonitorEvaluateDPO.setDataDate(date);
|
||||
rMpMonitorEvaluateDPO.setMeasurementPointId(lineDTO.getLineId());
|
||||
rMpMonitorEvaluateDPOS.add(rMpMonitorEvaluateDPO);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(rMpMonitorEvaluateDPOS)) {
|
||||
this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDPOS, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 3、频率在【45,55】之间;
|
||||
|
||||
@@ -2,11 +2,12 @@ package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 14:58【需求编号】
|
||||
@@ -16,12 +17,20 @@ import java.util.List;
|
||||
*/
|
||||
public interface RMpEventDetailDService extends IMppService<RMpEventDetailDPO> {
|
||||
|
||||
/**
|
||||
* @Description: queryOneMothData
|
||||
* @Param: [lineId, dataDate]
|
||||
* @return: java.util.List<com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpEventDetailDPO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/12/28
|
||||
*/
|
||||
List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate);
|
||||
}
|
||||
/**
|
||||
* @Description: queryOneMothData
|
||||
* @Param: [lineId, dataDate]
|
||||
* @return: java.util.List<com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpEventDetailDPO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/12/28
|
||||
*/
|
||||
List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate);
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--月表算法
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 11:19
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleMonth(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/23 13:50【需求编号】
|
||||
@@ -13,15 +13,22 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface RMpEventDetailService extends IService<RMpEventDetailPO>{
|
||||
public interface RMpEventDetailService extends IService<RMpEventDetailPO> {
|
||||
|
||||
/**
|
||||
* @Description: eventdetailHandler
|
||||
* @Param: [lineParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/23
|
||||
*/
|
||||
void eventdetailHandler(LineParam lineParam);
|
||||
/**
|
||||
* @Description: eventdetailHandler
|
||||
* @Param: [lineParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/23
|
||||
*/
|
||||
void eventdetailHandler(LineParam lineParam);
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--日表算法
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 11:19
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,4 +24,12 @@ public interface RMpMonitorEvaluateDService extends IMppService<RMpMonitorEvalua
|
||||
* @Date: 2023/4/19
|
||||
*/
|
||||
void dayDataJobHandler(List<String> indexLists, String beginTime, String endTime);
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
* @author hongawen
|
||||
* @date 2023/11/3 14:48
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.prepare.liteflow;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.prepare.bo.CalculatedParam;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月03日 14:42
|
||||
*/
|
||||
public abstract class NjcnNodeComponent extends NodeComponent {
|
||||
|
||||
/***
|
||||
* 判断是否进入该节点
|
||||
* 1、全链路执行时
|
||||
* 2、非全链路执行,但是需要执行的tag集合中包含了当前tag
|
||||
*/
|
||||
@Override
|
||||
public boolean isAccess() {
|
||||
String tag = this.getTag();
|
||||
if (StrUtil.isBlank(tag)) {
|
||||
//没有指定tag的,使用node自己的名称判断
|
||||
tag = this.getNodeId();
|
||||
}
|
||||
CalculatedParam requestData = this.getRequestData();
|
||||
Set<String> tagNames = requestData.getTagNames();
|
||||
if (requestData.isFullChain() || (CollectionUtil.isNotEmpty(tagNames) && tagNames.contains(tag))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -42,8 +42,6 @@ liteflow:
|
||||
dataId: prepare_liteflow
|
||||
group: DEFAULT_GROUP
|
||||
namespace: @nacos.namespace@
|
||||
username: nacos
|
||||
password: nacos
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
|
||||
Reference in New Issue
Block a user