算法模块删除不必要的代码,有备份,如果存疑就联系我

This commit is contained in:
2024-11-22 09:30:56 +08:00
parent 04ce3eb97d
commit a904650751
89 changed files with 1492 additions and 660 deletions

View File

@@ -22,7 +22,7 @@
<module>pqs-process</module>
<module>pqs-bpm</module>
<module>pqs-supervision</module>
<module>pqs-algorithm</module>
</modules>
<packaging>pom</packaging>
<name>灿能微服务生态系统</name>
@@ -54,8 +54,8 @@
<nacos.password>nacos</nacos.password>
<!--服务器发布内容为空-->
<!-- <nacos.namespace></nacos.namespace>-->
<nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
<!-- sentinel:port-->
<sentinel.url>${middle.server.url}:8080</sentinel.url>

View File

@@ -182,6 +182,7 @@ public class RadarUtil {
* @param governYearLoss 治理后损失
*/
public static Double getRadarResult(Double yearLoss, Double governYearLoss) {
// 年治理效果
double loss = yearLoss - governYearLoss;
if (loss == 0D || yearLoss == 0) {
return 0D;

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>pqs-algorithm</artifactId>
<groupId>com.njcn</groupId>
<version>1.0.0</version>
</parent>
<artifactId>algorithm-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,52 @@
package com.njcn.algorithm.pojo.param;
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<T> implements Serializable {
/***
* 是否全链路执行算法
* 非全链路执行时tag集合必须非空
*/
@ApiModelProperty(name = "fullChain",value = "是否全链执行")
private boolean fullChain;
/**
* 目前仅监测点日统计存在补招功能 by yxb
* 是否补招标识,默认不补招
*/
@ApiModelProperty(name = "repair",value = "是否补招")
private boolean repair;
/**
* 日期_yyyy-MM-dd
*/
@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<T> idList;
}

View File

@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>pqs-algorithm</artifactId>
<groupId>com.njcn</groupId>
<version>1.0.0</version>
</parent>
<artifactId>algorithm-boot</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-swagger</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-microservice</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-redis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>algorithm-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-spring-boot-starter</artifactId>
<version>2.12.4.1</version>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-rule-nacos</artifactId>
<version>2.12.4.1</version>
</dependency>
<!--暂态模块-->
<dependency>
<groupId>com.njcn</groupId>
<artifactId>event-api</artifactId>
<version>${project.version}</version>
</dependency>
<!--稳态模块-->
<dependency>
<groupId>com.njcn</groupId>
<artifactId>harmonic-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>algorithmboot</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<id>build-image</id>
<phase>${docker.operate}</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<!--<serverId>36dockerHarbor</serverId>-->
<registryUrl>http://${docker.repostory}</registryUrl>
<!-- 镜像名称 -->
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
<imageTags>
<imageTag>latest</imageTag>
</imageTags>
<dockerHost>${docker.url}</dockerHost>
<dockerDirectory>${basedir}/</dockerDirectory>
<resources>
<resource>
<targetPath>/ROOT</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,20 @@
package com.njcn.algorithm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/4 14:05
*/
@Slf4j
@EnableFeignClients(basePackages = "com.njcn")
@SpringBootApplication(scanBasePackages = "com.njcn")
public class AlgorithmApplication {
public static void main(String[] args) {
SpringApplication.run(AlgorithmApplication.class,args);
}
}

View File

@@ -0,0 +1,30 @@
package com.njcn.algorithm.event.mapper;
import cn.hutool.core.date.DateTime;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 15:55
*/
public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailD> {
/***
* 处理在暂态指标明细——月报表数据获取
* @author hongawen
* @date 2023/11/2 10:54
* @param lineIds 监测点集合
* @param dataDate 统计日期
* @param beginMonth 起始时间
* @param endMonth 截止时间
* @return List<RMpEventDetailDPO>
*/
List<RMpEventDetailM> handleMonth(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginMonth") DateTime beginMonth, @Param("endMonth") DateTime endMonth);
}

View File

@@ -0,0 +1,18 @@
package com.njcn.algorithm.event.mapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.event.pojo.po.RMpEventDetailM;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/12/28 14:58【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Mapper
public interface RMpEventDetailMMapper extends MppBaseMapper<RMpEventDetailM> {
}

View File

@@ -0,0 +1,33 @@
package com.njcn.algorithm.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 15:43
*/
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<RMpEventDetailD> 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);
}

View File

@@ -0,0 +1,25 @@
<?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.algorithm.event.mapper.RMpEventDetailDMapper">
<select id="handleMonth" resultType="com.njcn.event.pojo.po.RMpEventDetailM">
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>

View File

@@ -0,0 +1,5 @@
<?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.algorithm.event.mapper.RMpEventDetailMMapper">
</mapper>

View File

@@ -0,0 +1,26 @@
<?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.algorithm.event.mapper.RMpEventDetailMapper">
<select id="handleDay" resultType="com.njcn.event.pojo.po.RMpEventDetailD">
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>

View File

@@ -0,0 +1,21 @@
package com.njcn.algorithm.event.service;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.event.pojo.po.RMpEventDetailD;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 15:48
*/
public interface IRMpEventDetailDService extends IMppService<RMpEventDetailD> {
/***
* 监测点暂态指标明细--月表算法
* @author hongawen
* @date 2023/11/2 11:19
* @param calculatedParam 查询条件
*/
void handleMonth(CalculatedParam calculatedParam);
}

View File

@@ -0,0 +1,12 @@
package com.njcn.algorithm.event.service;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.event.pojo.po.RMpEventDetailM;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 16:03
*/
public interface IRMpEventDetailMService extends IMppService<RMpEventDetailM> {
}

View File

@@ -0,0 +1,22 @@
package com.njcn.algorithm.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 15:31
*/
public interface IRMpEventDetailService extends IService<RmpEventDetailPO> {
/***
* 监测点暂态指标明细--日表算法
* @author hongawen
* @date 2023/11/2 11:19
* @param calculatedParam 查询条件
*/
void handleDay(CalculatedParam calculatedParam);
}

View File

@@ -0,0 +1,50 @@
package com.njcn.algorithm.event.service.impl;
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.algorithm.event.mapper.RMpEventDetailDMapper;
import com.njcn.algorithm.event.service.IRMpEventDetailDService;
import com.njcn.algorithm.event.service.IRMpEventDetailMService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/6 15:49
*/
@Service
@AllArgsConstructor
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailD> implements IRMpEventDetailDService {
private final IRMpEventDetailMService rMpEventDetailMService;
/***
*监测点暂态指标明细--月表算法
*/
@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<RMpEventDetailM> rMpEventDetailMPOList = this.baseMapper.handleMonth(pendingId, DateUtil.format(beginMonth, DatePattern.NORM_DATE_PATTERN), beginMonth, endMonth);
rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMPOList);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.njcn.algorithm.event.service.impl;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.algorithm.event.mapper.RMpEventDetailMMapper;
import com.njcn.algorithm.event.service.IRMpEventDetailMService;
import com.njcn.event.pojo.po.RMpEventDetailM;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/12/28 14:58【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@AllArgsConstructor
public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMapper, RMpEventDetailM> implements IRMpEventDetailMService {
}

View File

@@ -0,0 +1,81 @@
package com.njcn.algorithm.event.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.event.mapper.RMpEventDetailMapper;
import com.njcn.algorithm.event.service.IRMpEventDetailDService;
import com.njcn.algorithm.event.service.IRMpEventDetailService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
/**
* Description:
* Date: 2023/4/23 13:50【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper, RmpEventDetailPO> implements IRMpEventDetailService {
private final IRMpEventDetailDService rMpEventDetailDService;
private final DicDataFeignClient dicDataFeignClient;
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<RMpEventDetailD> rMpEventDetailDList = 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(rMpEventDetailDList);
}
}
public String getEventTypeId(String code) {
String eventType = redisUtil.getStringByKey(code);
eventType = Optional.ofNullable(eventType).orElseGet(() -> {
DictData data = dicDataFeignClient.getDicDataByCode(code).getData();
redisUtil.saveByKey(data.getCode(), data.getId());
return data.getId();
});
return eventType;
}
}

View File

@@ -0,0 +1,11 @@
package com.njcn.algorithm.harmonic.line.mapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
/**
* @author clam
* @version V1.0.0
*/
public interface RMpMonitorEvaluateDMapper extends MppBaseMapper<RMpMonitorEvaluateD> {
}

View File

@@ -0,0 +1,5 @@
<?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.algorithm.harmonic.line.mapper.RMpMonitorEvaluateDMapper">
</mapper>

View File

@@ -0,0 +1,25 @@
package com.njcn.algorithm.harmonic.line.service;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
/**
* Description:
* Date: 2023/4/19 15:42【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface IRMpMonitorEvaluateDService extends IMppService<RMpMonitorEvaluateD> {
/***
* 监测点报表--日统计
* @author hongawen
* @date 2023/11/3 14:48
* @param calculatedParam 查询条件
*/
void handleDay(CalculatedParam calculatedParam);
}

View File

@@ -0,0 +1,208 @@
package com.njcn.algorithm.harmonic.line.service.impl;
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.algorithm.harmonic.line.mapper.RMpMonitorEvaluateDMapper;
import com.njcn.algorithm.harmonic.line.service.IRMpMonitorEvaluateDService;
import com.njcn.algorithm.pojo.param.CalculatedParam;
import com.njcn.algorithm.support.mapper.PmsAbnormalRulesMapper;
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.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.influx.pojo.po.DataFlicker;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEvaluateDMapper, RMpMonitorEvaluateD> implements IRMpMonitorEvaluateDService {
private final CommLineClient commLineClient;
private final DataVInfluxdbService dataVInfluxdbService;
private final PmsAbnormalRulesMapper pmsAbnormalRulesMapper;
private final DataIntegrityRateInfluxService dataIntegrityRateInfluxService;
/***
* 监测点报表--日统计
* @author hongawen
* @date 2023/11/3 14:48
* @param calculatedParam 查询条件
*/
@Override
public void handleDay(CalculatedParam calculatedParam) {
//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(), 100);
for (List<String> pendingId : pendingIds) {
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(pendingId).getData();
List<RMpMonitorEvaluateD> rMpMonitorEvaluateDS = new ArrayList<>();
for (LineDTO lineDTO : lineDTOList) {
if (ObjectUtil.isNotNull(lineDTO)) {
/*todo 统计间隔电压等级取值方式后期提供融合版本接口获取不然pmspqs系统取值方式不一样*/
/*统计间隔*/
Integer statisticalInterval = lineDTO.getTimeInterval();
/*电压等级*/
Double voltage = Double.parseDouble(lineDTO.getVoltageLevel());
List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(lineDTO.getLineId(), beginDay, endDay, statisticalInterval);
RMpMonitorEvaluateD rMpMonitorEvaluateD = new RMpMonitorEvaluateD();
rMpMonitorEvaluateD = calculateRMpMonitorEvaluateDPO(rMpMonitorEvaluateD, fiveItems, pmsAbnormalRules, voltage, lineDTO);
Date date = DateUtil.parse(beginDay);
DataFlicker twoFlickerData = dataIntegrityRateInfluxService.getTwoFlickerData(lineDTO.getLineId(), date, 5);
LocalDate localDate = LocalDateTimeUtil.parseDate(beginDay, DatePattern.NORM_DATETIME_PATTERN);
if (Objects.isNull(twoFlickerData)) {
rMpMonitorEvaluateD.setPltCount(0);
rMpMonitorEvaluateD.setPstCount(0);
} else {
rMpMonitorEvaluateD.setPltCount(twoFlickerData.getPltCount());
rMpMonitorEvaluateD.setPstCount(twoFlickerData.getPstCount());
}
rMpMonitorEvaluateD.setAllMinuteCount(fiveItems.size());
rMpMonitorEvaluateD.setDeviceId(lineDTO.getDevId());
rMpMonitorEvaluateD.setDataDate(localDate);
rMpMonitorEvaluateD.setMeasurementPointId(lineDTO.getLineId());
rMpMonitorEvaluateDS.add(rMpMonitorEvaluateD);
}
}
if (CollUtil.isNotEmpty(rMpMonitorEvaluateDS)) {
this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDS, 500);
}
}
}
/**
* @Description: 3、频率在【4555】之间
* 4、相电压有效值在【0.85p.u.1.2p.u.】之间p.u=电压等级/1.732
* 5、线电压有效值在【0.85p.u.1.2p.u.】之间p.u=电压等级
* 6、电压总谐波畸变率在【0.1%20%】之间;
* 7、负序电压不平衡度在【020%】。满足以上条件则是一条有效数据
* @Param: [fiveItems, pmsAbnormalRules, voltage]
* @return: java.lang.Integer
* @Author: clam
* @Date: 2023/2/23
*/
private RMpMonitorEvaluateD calculateRMpMonitorEvaluateDPO(RMpMonitorEvaluateD rMpMonitorEvaluateD, List<DataVFiveItemDTO> fiveItems, List<PmsAbnormalRules> pmsAbnormalRules, Double voltage, LineDTO data) {
Integer freqCount = 0;
Integer unbalanceCount = 0;
Integer phaseVoltageCount = 0;
Integer lineVoltageCount = 0;
Integer vThdCount = 0;
Integer effectiveMinuteCount = 0;
PmsAbnormalRules freqLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_FREQ)).collect(Collectors.toList()).get(0);
PmsAbnormalRules rmsLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_RMS)).collect(Collectors.toList()).get(0);
PmsAbnormalRules rms_lvrLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_RMS_LVR)).collect(Collectors.toList()).get(0);
PmsAbnormalRules v_thdLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_V_THD)).collect(Collectors.toList()).get(0);
PmsAbnormalRules v_unbalanceLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_V_UNBALANCE)).collect(Collectors.toList()).get(0);
if (!CollectionUtils.isEmpty(fiveItems)) {
for (DataVFiveItemDTO fiveItem : fiveItems) {
Double freqMax = fiveItem.getFreqMax();
Double freqMin = fiveItem.getFreqMin();
Double rmsMax = fiveItem.getRmsMax();
Double rmsMin = fiveItem.getRmsMin();
Double vThdMax = fiveItem.getVThdMax();
Double vThdMin = fiveItem.getVThdMin();
Double vUnbalanceMax = fiveItem.getVUnbalanceMax();
Double vUnbalanceMin = fiveItem.getVUnbalanceMin();
Double rmsLvrMax = fiveItem.getRmsLvrMax();
Double rmsLvrMin = fiveItem.getRmsLvrMin();
Boolean rmsflag = false;
Boolean rmsLvrflag = false;
Boolean vUnbalanceflag = false;
freqCount++;
unbalanceCount++;
phaseVoltageCount++;
lineVoltageCount++;
vThdCount++;
effectiveMinuteCount++;
// 先注释掉 校验跑出监测点
// if (freqLimit.getLowerLimit() <= freqMin && freqMax <= freqLimit.getUpperLimit()) {
// freqCount++;
// }
// /*,监测点的接线方式,如果是星形接线这个指标要判断,角形界面则不判断,默认它是正常的*/
// if (Objects.equals("0", data.getPtType())) {
// if (rmsLimit.getLowerLimit() * (voltage / 1.732) <= rmsMin && rmsMax <= rmsLimit.getUpperLimit() * (voltage / 1.732)) {
// phaseVoltageCount++;
// rmsflag = true;
// }
// } else {
// rmsflag = true;
// phaseVoltageCount++;
// }
// if (Objects.equals("1", data.getPtPhaseType())) {
// if (rms_lvrLimit.getLowerLimit() * voltage <= rmsLvrMin && rmsLvrMax <= rms_lvrLimit.getUpperLimit() * voltage) {
// lineVoltageCount++;
// rmsLvrflag = true;
// }
//
// } else {
// rmsLvrflag = true;
// lineVoltageCount++;
//
// }
// if (Objects.equals("1", data.getPtPhaseType()) && Objects.equals("0", data.getPtType())) {
// if (v_unbalanceLimit.getLowerLimit() <= vUnbalanceMin && vUnbalanceMax <= v_unbalanceLimit.getUpperLimit()
// ) {
// unbalanceCount++;
// vUnbalanceflag = true;
// }
// } else {
// unbalanceCount++;
// vUnbalanceflag = true;
// }
//
//
// if (v_thdLimit.getLowerLimit() <= vThdMin && vThdMax <= v_thdLimit.getUpperLimit()) {
// vThdCount++;
// }
//
//
// if (freqLimit.getLowerLimit() <= freqMin && freqMax <= freqLimit.getUpperLimit() &&
// rmsflag &&
// rmsLvrflag &&
// v_thdLimit.getLowerLimit() <= vThdMin && vThdMax <= v_thdLimit.getUpperLimit() &&
// vUnbalanceflag
//
// ) {
// effectiveMinuteCount++;
// }
}
}
rMpMonitorEvaluateD.setEffectiveMinuteCount(effectiveMinuteCount);
rMpMonitorEvaluateD.setFreqCount(freqCount);
rMpMonitorEvaluateD.setPhaseVoltageCount(phaseVoltageCount);
rMpMonitorEvaluateD.setLineVoltageCount(lineVoltageCount);
rMpMonitorEvaluateD.setVThdCount(vThdCount);
rMpMonitorEvaluateD.setUnbalanceCount(unbalanceCount);
return rMpMonitorEvaluateD;
}
}

View File

@@ -0,0 +1,13 @@
package com.njcn.algorithm.support.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.po.PmsAbnormalRules;
/**
* PmsAbnormalRulesMapper
*
* @author qijian
* @date 2022/10/26
*/
public interface PmsAbnormalRulesMapper extends BaseMapper<PmsAbnormalRules> {
}

View File

@@ -0,0 +1,5 @@
<?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.algorithm.support.mapper.PmsAbnormalRulesMapper">
</mapper>

View File

@@ -0,0 +1,56 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10223
#feign接口开启服务熔断降级处理
feign:
sentinel:
enabled: true
spring:
application:
name: @artifactId@
#nacos注册中心以及配置中心的指定
cloud:
nacos:
discovery:
ip: @service.server.url@
server-addr: @nacos.url@
namespace: @nacos.namespace@
config:
server-addr: @nacos.url@
namespace: @nacos.namespace@
file-extension: yaml
shared-configs:
- data-id: share-config.yaml
refresh: true
main:
allow-bean-definition-overriding: true
liteflow:
rule-source: config/liteflow.el.xml
# rule-source-ext-data-map:
# serverAddr: @nacos.url@
# dataId: prepare_liteflow
# group: DEFAULT_GROUP
# namespace: @nacos.namespace@
when-max-wait-time: 600000
print-banner: false
#项目日志的配置
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: error
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain name="measurement_point">
THEN(
rMpSurplusAbnormalD
);
</chain>
<chain name="org_point">
THEN(
WHEN(rDimBusbarHarmnic.tag("r_dim_busbar_harmnic_d")),
rOperatingIndex.tag("r_operating_index_d"),
rOperatingIndex.tag("r_operating_index_m"),
rOperatingIndex.tag("r_operating_index_q"),
rOperatingIndex.tag("r_operating_index_y"),
rStatOrg.tag("r_stat_org_d"),
rStatOrg.tag("r_stat_org_m"),
rStatOrg.tag("r_stat_org_q"),
rStatOrg.tag("r_stat_org_y"),
rStatPollutionOrg.tag("r_stat_pollution_org_d"),
rStatPollutionOrg.tag("r_stat_pollution_org_m"),
rStatPollutionOrg.tag("r_stat_pollution_org_q"),
rStatPollutionOrg.tag("r_stat_pollution_org_y"),
rStatHarmonic.tag("r_stat_harmonic_d"),
rStatHarmonic.tag("r_stat_harmonic_m"),
rStatHarmonic.tag("r_stat_harmonic_q"),
rStatHarmonic.tag("r_stat_harmonic_y"),
rStatHarmonicVoltage.tag("r_stat_harmonic_voltage_d"),
rStatHarmonicVoltage.tag("r_stat_harmonic_voltage_m"),
rStatHarmonicOrg.tag("r_stat_harmonic_org_d"),
rStatHarmonicOrg.tag("r_stat_harmonic_org_m"),
rStatHarmonicOrg.tag("r_stat_harmonic_org_q"),
rStatHarmonicOrg.tag("r_stat_harmonic_org_y"),
rStatEvent.tag("r_stat_event_d"),
rStatEvent.tag("r_stat_event_m"),
rStatEvent.tag("r_stat_event_q"),
rStatEvent.tag("r_stat_event_y"),
rStatEventVoltage.tag("r_stat_event_voltage_d"),
rStatEventVoltage.tag("r_stat_event_voltage_m"),
rStatEventOrg.tag("r_stat_event_org_d"),
rStatEventOrg.tag("r_stat_event_org_m"),
rStatEventOrg.tag("r_stat_event_org_q"),
rStatEventOrg.tag("r_stat_event_org_y"),
rStatEventLoadType.tag("r_stat_load_type_d"),
rStatEventLoadType.tag("r_stat_load_type_m"),
rStatEventLoadType.tag("r_stat_load_type_q"),
rStatEventLoadType.tag("r_stat_load_type_y"),
rStatAlarmCount.tag("r_stat_alarm_count_w"),
rStatAlarmCount.tag("r_stat_area_alarm_count_m"),
rDimBusTarget.tag("r_dim_bus_target_d"),
rDimBusTarget.tag("r_dim_bus_target_m"),
rDimBusTarget.tag("r_dim_bus_target_y"),
rDimObjTarget.tag("r_dim_obj_target_d"),
rDimObjTarget.tag("r_dim_obj_target_m"),
rDimObjTarget.tag("r_dim_obj_target_y"),
rDimObjGlobal.tag("r_dim_obj_global_d"),
rDimObjGlobal.tag("r_dim_obj_global_m"),
rDimObjGlobal.tag("r_dim_obj_global_y"),
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_d"),
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_m"),
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_y")
);
</chain>
<chain name="sub_station">
THEN(
THEN(
rUploadSubStatisticalData
),
THEN(
rStatSubstation.tag("r_stat_substation_d"),
rStatSubstation.tag("r_stat_substation_m"),
rStatSubstation.tag("r_stat_substation_q"),
rStatSubstation.tag("r_stat_substation_y")
),
THEN(
rStatPollutionSubstation.tag("r_stat_pollution_substation_d"),
rStatPollutionSubstation.tag("r_stat_pollution_substation_m"),
rStatPollutionSubstation.tag("r_stat_pollution_substation_q"),
rStatPollutionSubstation.tag("r_stat_pollution_substation_y")
)
);
</chain>
<chain name="dim_station_busbar">
THEN(
THEN(
rDimObjEvent.tag("r_dim_obj_event_d"),
rDimObjEvent.tag("r_dim_obj_event_m"),
rDimObjEvent.tag("r_dim_obj_event_y")
)
);
</chain>
<chain name="genera_trix">
THEN(
THEN(
rBusbarVoltage.tag("r_dim_voltage_d"),
rBusbarVoltage.tag("r_dim_voltage_m"),
rBusbarVoltage.tag("r_dim_voltage_y")
),
THEN(
rStatBusbarHarmonicY
),
THEN(
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_d"),
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_m"),
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_q"),
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_y")
)
);
</chain>
<chain name="upload_org">
THEN(
rUploadPointStatisticalData,
rUploadEvaluationData,
pqTypicalSourceCreatePOService
);
</chain>
<chain name="orgSub_station">
THEN(
THEN(
rStatSubstationVoltage.tag("r_stat_substation_voltage_m")
)
);
</chain>
</flow>

25
pqs-algorithm/pom.xml Normal file
View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.njcn</groupId>
<artifactId>pqs</artifactId>
<version>1.0.0</version>
</parent>
<packaging>pom</packaging>
<modules>
<module>algorithm-api</module>
<module>algorithm-boot</module>
</modules>
<artifactId>pqs-algorithm</artifactId>
<description>算法模块</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>

View File

@@ -1,4 +1,4 @@
package com.njcn.harmonic.pojo.po;
package com.njcn.event.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -6,7 +6,6 @@ import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
/**
*
@@ -23,7 +22,7 @@ import java.util.Date;
*/
@Data
@TableName(value = "r_mp_event_detail_d")
public class RMpEventDetailDPO {
public class RMpEventDetailD {
/**
* 监测点ID
*/

View File

@@ -1,4 +1,4 @@
package com.njcn.harmonic.pojo.po;
package com.njcn.event.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -6,7 +6,6 @@ import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
/**
*
@@ -23,7 +22,7 @@ import java.util.Date;
*/
@Data
@TableName(value = "r_mp_event_detail_m")
public class RMpEventDetailMPO {
public class RMpEventDetailM {
/**
* 监测点ID
*/

View File

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.Transient;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -20,9 +21,8 @@ import java.time.LocalDateTime;
* @since 2022-10-12 18:34:55
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("r_mp_event_detail")
@ApiModel(value="RmpEventDetail对象", description="")
@ApiModel(value="RmpEventDetail对象")
public class RmpEventDetailPO implements Serializable {
private static final long serialVersionUID = 1L;
@@ -120,8 +120,11 @@ public class RmpEventDetailPO implements Serializable {
private LocalDateTime createTime;
private Double transientValue;
@ApiModelProperty(value = "用于计算数量")
@TableField(exist = false)
@Transient
private Integer count;
}

View File

@@ -11,7 +11,7 @@ import com.njcn.device.pq.pojo.vo.GridDiagramVO;
import com.njcn.event.pojo.vo.EventDetailVO;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -57,9 +57,9 @@ public class GridDiagramEventController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getEventDetailByLineId")
@ApiOperation("根据监测点获取暂态短时中断和暂态赞升暂降")
public HttpResult<RMpEventDetailMPO> getEventDetailByLineId(@RequestBody StatisticsBizBaseParam param) {
public HttpResult<RMpEventDetailM> getEventDetailByLineId(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getEventDetailByLineId");
RMpEventDetailMPO eventDetailByLine = rmpEventDetailService.getEventDetailByLine(param);
RMpEventDetailM eventDetailByLine = rmpEventDetailService.getEventDetailByLine(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailByLine, methodDescribe);
}
}

View File

@@ -1,7 +1,7 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
/**
* <p>
@@ -11,6 +11,6 @@ import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
* @author wr
* @since 2024-05-04
*/
public interface RMpEventDetailMMapper extends BaseMapper<RMpEventDetailMPO> {
public interface RMpEventDetailMMapper extends BaseMapper<RMpEventDetailM> {
}

View File

@@ -38,10 +38,9 @@ import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -384,13 +383,13 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
}
@Override
public RMpEventDetailMPO getEventDetailByLine(StatisticsBizBaseParam param) {
RMpEventDetailMPO rMpEventDetailMPO = eventDetailMMapper.selectOne(new LambdaQueryWrapper<RMpEventDetailMPO>()
.eq(RMpEventDetailMPO::getMeasurementPointId, param.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RMpEventDetailMPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RMpEventDetailMPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
public RMpEventDetailM getEventDetailByLine(StatisticsBizBaseParam param) {
RMpEventDetailM rMpEventDetailM = eventDetailMMapper.selectOne(new LambdaQueryWrapper<RMpEventDetailM>()
.eq(RMpEventDetailM::getMeasurementPointId, param.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RMpEventDetailM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RMpEventDetailM::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
return rMpEventDetailMPO;
return rMpEventDetailM;
}

View File

@@ -11,7 +11,7 @@ import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
import com.njcn.event.pojo.vo.EventDetailVO;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.pojo.param.BaseParam;
@@ -72,5 +72,5 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
* @Author: wr
* @Date: 2024/5/4 17:08
*/
RMpEventDetailMPO getEventDetailByLine(StatisticsBizBaseParam param);
RMpEventDetailM getEventDetailByLine(StatisticsBizBaseParam param);
}

View File

@@ -4,6 +4,9 @@ import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.server.ServerWebExchange;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -80,7 +83,23 @@ public class IpUtils {
ipAddress = ipAddress.substring(0, index);
}
}
return ipAddress;
String clientIp = request.getHeaders().getFirst("X-Forwarded-For");
if (clientIp == null || clientIp.isEmpty() || "unknown".equalsIgnoreCase(clientIp)) {
clientIp = request.getHeaders().getFirst("X-Real-IP");
if (clientIp == null || clientIp.isEmpty() || "unknown".equalsIgnoreCase(clientIp)) {
clientIp = request.getRemoteAddress().getAddress().getHostAddress();
}
} else {
// X-Forwarded-For 头可能包含多个 IP取第一个
int index = clientIp.indexOf(',');
if (index > 0) {
clientIp = clientIp.substring(0, index).trim();
}
}
System.out.println("new------:"+clientIp);
// System.out.println("old------:"+ipAddress);
return clientIp;
}
/**

View File

@@ -1,29 +1,20 @@
package com.njcn.prepare.harmonic.pojo.mysql;
package com.njcn.harmonic.pojo.po.algorithm.line;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/4/19 15:42需求编号
*
* 监测点评价表
* @author clam
* @version V1.0.0
*/
/**
* 监测点评价表
*/
@Data
@TableName(value = "r_mp_monitor_evaluate_d")
public class RMpMonitorEvaluateDPO {
public class RMpMonitorEvaluateD {
/**
* 监测点Id

View File

@@ -30,6 +30,12 @@ public class CalculatedParam<T> implements Serializable {
@ApiModelProperty(name = "repair",value = "是否补招")
private boolean repair;
/**
* 日期_yyyy-MM-dd
*/
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
private String dataDate;
/***
* 需要执行的组件
* 当不需要全链路执行时通过tag名称动态指定执行某个算法组件
@@ -37,10 +43,6 @@ public class CalculatedParam<T> implements Serializable {
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
private Set<String> tagNames;
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
private String dataDate;
/**
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位下监测点等等
*/

View File

@@ -1,175 +0,0 @@
package com.njcn.prepare.harmonic.pojo.mysql;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/4/23 13:50【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@TableName(value = "r_mp_event_detail")
public class RMpEventDetailPO {
/**
* 暂时事件ID
*/
@TableId(value = "event_id")
private String eventId;
/**
* 监测点ID
*/
@TableField(value = "measurement_point_id")
private String measurementPointId;
/**
* 统计指标类型
*/
@TableField(value = "event_type")
private String eventType;
/**
* 暂降原因字典表PQS_Dicdata
*/
@TableField(value = "advance_reason")
private String advanceReason;
/**
* 暂降类型字典表PQS_Dicdata
*/
@TableField(value = "advance_type")
private String advanceType;
/**
* 事件关联分析表Guid
*/
@TableField(value = "eventass_index")
private String eventassIndex;
@TableField(value = "dq_time")
private Double dqTime;
/**
* 特征值计算更新时间外键PQS_Relevance的Time字段
*/
@TableField(value = "deal_time")
private Date dealTime;
/**
* 默认事件个数为0
*/
@TableField(value = "num")
private Integer num;
/**
* 波形文件是否从装置招到本地(0未招1已招)默认值为0
*/
@TableField(value = "file_flag")
private Boolean fileFlag;
/**
* 特征值计算标志0未处理1已处理; 2已处理无结果;3计算失败默认值为0
*/
@TableField(value = "deal_flag")
private Boolean dealFlag;
/**
* 处理结果第一条事件发生时间(读comtra文件获取)
*/
@TableField(value = "first_time")
private Date firstTime;
/**
* 处理结果第一条事件暂降类型字典表PQS_Dicdata
*/
@TableField(value = "first_type")
private String firstType;
/**
* 处理结果第一条事件发生时间毫秒(读comtra文件获取)
*/
@TableField(value = "first_ms")
private BigDecimal firstMs;
/**
* 暂降能量
*/
@TableField(value = "energy")
private Double energy;
/**
* 暂降严重度
*/
@TableField(value = "severity")
private Double severity;
/**
* 暂降源与监测位置关系 Upper:上游Lower :下游Unknown :未知;为空则是未计算
*/
@TableField(value = "sagsource")
private String sagsource;
/**
* 开始时间
*/
@TableField(value = "start_time")
private Date startTime;
/**
* 持续时间,单位秒
*/
@TableField(value = "duration")
private BigDecimal duration;
/**
* 特征幅值
*/
@TableField(value = "feature_amplitude")
private BigDecimal featureAmplitude;
/**
* 相别
*/
@TableField(value = "phase")
private String phase;
/**
* 事件描述
*/
@TableField(value = "event_describe")
private String eventDescribe;
@ApiModelProperty(value = "暂降核实原因")
@TableField("verify_reason")
private String verifyReason;
@ApiModelProperty(value = "暂降核实原因详情")
@TableField("verify_reason_detail")
private String verifyReasonDetail;
/**
* 波形路径
*/
@TableField(value = "wave_path")
private String wavePath;
/**
* 暂态事件上送时间
*/
@TableField(value = "create_time")
private Date createTime;
@TableField(value = "transient_value")
private Double transientValue;
}

View File

@@ -61,6 +61,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>event-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>system-api</artifactId>

View File

@@ -84,25 +84,25 @@ public class ExecutionCenter extends BaseController {
* @author hongawen
* @date 2023/11/7 14:44
*/
private void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse,String methodDescribe) {
if(liteflowResponse.isSuccess()){
log.info("日期{}{}执行{}成功",calculatedParam.getDataDate(),methodDescribe,calculatedParam.isFullChain()?"全链":"指定节点:".concat(String.join(StrPool.COMMA,calculatedParam.getTagNames())));
}else{
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
private void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse, String methodDescribe) {
if (liteflowResponse.isSuccess()) {
log.info("日期{}{}执行{}成功", calculatedParam.getDataDate(), methodDescribe, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames())));
} else {
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
CmpStep failStep = null;
for (String key : executeSteps.keySet()) {
List<CmpStep> cmpSteps = executeSteps.get(key);
cmpSteps=cmpSteps.stream().filter(cmpStep -> !cmpStep.isSuccess()).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(cmpSteps)){
cmpSteps = cmpSteps.stream().filter(cmpStep -> !cmpStep.isSuccess()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(cmpSteps)) {
failStep = cmpSteps.get(0);
}
}
log.error("日期{}{}执行{}失败,在执行{}失败,失败原因:{}"
,calculatedParam.getDataDate()
,methodDescribe
,calculatedParam.isFullChain()?"全链":"指定节点:".concat(String.join(StrPool.COMMA,calculatedParam.getTagNames()))
,failStep.getNodeId().concat(Objects.isNull(failStep.getTag()) ? "" :StrPool.DASHED.concat(failStep.getTag()))
,Objects.isNull(failStep.getException()) ? null:failStep.getException().getMessage());
, calculatedParam.getDataDate()
, methodDescribe
, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames()))
, failStep.getNodeId().concat(Objects.isNull(failStep.getTag()) ? "" : StrPool.DASHED.concat(failStep.getTag()))
, Objects.isNull(failStep.getException()) ? null : failStep.getException().getMessage());
}
}
@@ -132,12 +132,12 @@ public class ExecutionCenter extends BaseController {
}
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
dealResponse(calculatedParam,liteflowResponse,methodDescribe);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
} else {
//非补招
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
dealResponse(calculatedParam,liteflowResponse,methodDescribe);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
}
@@ -155,7 +155,7 @@ public class ExecutionCenter extends BaseController {
Dept data = deptFeignClient.getRootDept().getData();
deptGetLineParam.setDeptId(data.getId());
List<DeptGetDeviceDTO> list = commTerminalGeneralClient.deptGetDevice(deptGetLineParam).getData();
DeptGetDeviceDTO dto = list.stream().filter(po ->Objects.equals(po.getUnitId(),data.getId())).collect(Collectors.toList()).get(0);
DeptGetDeviceDTO dto = list.stream().filter(po -> Objects.equals(po.getUnitId(), data.getId())).collect(Collectors.toList()).get(0);
List<LineDevGetDTO> devList = dto.getDeviceList();
calculatedParam.setIdList(devList.stream().map(LineDevGetDTO::getDevId).distinct().collect(Collectors.toList()));
}
@@ -172,12 +172,12 @@ public class ExecutionCenter extends BaseController {
}
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
liteflowResponse = flowExecutor.execute2Resp("device", calculatedParam);
dealResponse(calculatedParam,liteflowResponse,methodDescribe);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
} else {
//非补招
liteflowResponse = flowExecutor.execute2Resp("device", calculatedParam);
dealResponse(calculatedParam,liteflowResponse,methodDescribe);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
}
@@ -309,6 +309,7 @@ public class ExecutionCenter extends BaseController {
/**
* pms dim母线电站运行情况
*
* @author cdf
* @date 2023/11/17
*/
@@ -382,7 +383,7 @@ public class ExecutionCenter extends BaseController {
}
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
liteflowResponse = flowExecutor.execute2Resp("genera_trix", calculatedParam);
dealResponse(calculatedParam,liteflowResponse,methodDescribe);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
} else {
//非补招

View File

@@ -2,13 +2,12 @@ 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 com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -21,7 +20,7 @@ import java.util.Map;
* @version V1.0.0
*/
@Mapper
public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailDPO> {
public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailD> {
int getSagTimes(@Param("lineId") String lineId, @Param("date") LocalDate date);
@@ -40,5 +39,5 @@ public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailDPO>
* @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);
List<RMpEventDetailM> handleMonth(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginMonth") DateTime beginMonth, @Param("endMonth") DateTime endMonth);
}

View File

@@ -1,7 +1,7 @@
package com.njcn.prepare.harmonic.mapper.mysql.line;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -14,5 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
* @version V1.0.0
*/
@Mapper
public interface RMpEventDetailMMapper extends MppBaseMapper<RMpEventDetailMPO> {
public interface RMpEventDetailMMapper extends MppBaseMapper<RMpEventDetailM> {
}

View File

@@ -1,8 +1,8 @@
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 com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
@@ -16,7 +16,7 @@ import java.util.List;
* @author clam
* @version V1.0.0
*/
public interface RMpEventDetailMapper extends BaseMapper<RMpEventDetailPO> {
public interface RMpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
/***
@@ -32,5 +32,5 @@ public interface RMpEventDetailMapper extends BaseMapper<RMpEventDetailPO> {
* @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);
List<RMpEventDetailD> 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);
}

View File

@@ -2,7 +2,6 @@ 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.RMpEventDetailMPO;
import com.njcn.harmonic.pojo.po.RMpEventDetailQPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@@ -1,7 +1,7 @@
package com.njcn.prepare.harmonic.mapper.mysql.line;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
/**
*
@@ -12,5 +12,5 @@ import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
* @author clam
* @version V1.0.0
*/
public interface RMpMonitorEvaluateDMapper extends MppBaseMapper<RMpMonitorEvaluateDPO> {
public interface RMpMonitorEvaluateDMapper extends MppBaseMapper<RMpMonitorEvaluateD> {
}

View File

@@ -38,7 +38,7 @@
</select>
<select id="handleMonth" resultType="com.njcn.harmonic.pojo.po.RMpEventDetailMPO">
<select id="handleMonth" resultType="com.njcn.event.pojo.po.RMpEventDetailM">
SELECT
#{dataDate} dataDate,
measurement_point_id measurement_point_id,
@@ -56,7 +56,6 @@
</foreach>
GROUP BY
measurement_point_id
</select>
</mapper>

View File

@@ -1,7 +1,7 @@
<?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.prepare.harmonic.mapper.mysql.line.RMpEventDetailMMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpEventDetailMPO">
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RMpEventDetailM">
<!--@mbg.generated-->
<!--@Table r_mp_event_detail_m-->
<id column="measurement_point_id" jdbcType="VARCHAR" property="measurementPointId" />

View File

@@ -1,45 +1,8 @@
<?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.prepare.harmonic.mapper.mysql.line.RMpEventDetailMapper">
<resultMap id="BaseResultMap" type="com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO">
<!--@mbg.generated-->
<!--@Table r_mp_event_detail-->
<id column="event_id" jdbcType="CHAR" property="eventId" />
<result column="measurement_point_id" jdbcType="VARCHAR" property="measurementPointId" />
<result column="event_type" jdbcType="CHAR" property="eventType" />
<result column="advance_reason" jdbcType="CHAR" property="advanceReason" />
<result column="advance_type" jdbcType="CHAR" property="advanceType" />
<result column="eventass_index" jdbcType="VARCHAR" property="eventassIndex" />
<result column="dq_time" jdbcType="DOUBLE" property="dqTime" />
<result column="deal_time" jdbcType="TIMESTAMP" property="dealTime" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="file_flag" jdbcType="BOOLEAN" property="fileFlag" />
<result column="deal_flag" jdbcType="BOOLEAN" property="dealFlag" />
<result column="first_time" jdbcType="TIMESTAMP" property="firstTime" />
<result column="first_type" jdbcType="VARCHAR" property="firstType" />
<result column="first_ms" jdbcType="DECIMAL" property="firstMs" />
<result column="energy" jdbcType="DOUBLE" property="energy" />
<result column="severity" jdbcType="DOUBLE" property="severity" />
<result column="sagsource" jdbcType="VARCHAR" property="sagsource" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="duration" jdbcType="DECIMAL" property="duration" />
<result column="feature_amplitude" jdbcType="DECIMAL" property="featureAmplitude" />
<result column="phase" jdbcType="VARCHAR" property="phase" />
<result column="event_describe" jdbcType="VARCHAR" property="eventDescribe" />
<result column="wave_path" jdbcType="VARCHAR" property="wavePath" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="transient_value" jdbcType="DOUBLE" property="transientValue" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
event_id, measurement_point_id, event_type, advance_reason, advance_type, eventass_index,
dq_time, deal_time, num, file_flag, deal_flag, first_time, first_type, first_ms,
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 id="handleDay" resultType="com.njcn.event.pojo.po.RMpEventDetailD">
SELECT
#{dataDate} dataDate,
measurement_point_id measurement_point_id,

View File

@@ -1,7 +1,7 @@
<?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.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper">
<resultMap id="BaseResultMap" type="com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD">
<!--@mbg.generated-->
<!--@Table r_mp_monitor_evaluate_d-->
<id column="time_id" jdbcType="TIMESTAMP" property="timeId" />

View File

@@ -64,7 +64,6 @@ public class DataVInfluxdbServiceImpl implements DataVInfluxdbService {
/**
* @param lineId
* @param date
* @Description: 获取监测点当天数据
* @Param: [lineId, date]
* @return: java.util.List<com.njcn.prepare.harmonic.pojo.vo.DataVOracleVO>

View File

@@ -16,7 +16,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.service.mysql.IRStatOrgBusbarVoltageDService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -104,13 +104,13 @@ public class RStatOrgBusbarVoltageDServiceImpl extends MppServiceImpl<RStatOrgBu
* 获取有效接入监测点个数
*/
public Integer getEffectiveNum(List<String> lineList, String time) {
LambdaQueryWrapper<RMpMonitorEvaluateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateDPO::getMeasurementPointId)
.eq(RMpMonitorEvaluateDPO::getDataDate, time)
.in(RMpMonitorEvaluateDPO::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateDPO::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateDPO> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateDPO::getMeasurementPointId).collect(Collectors.toList()).size();
LambdaQueryWrapper<RMpMonitorEvaluateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateD::getMeasurementPointId)
.eq(RMpMonitorEvaluateD::getDataDate, time)
.in(RMpMonitorEvaluateD::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateD::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateD> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateD::getMeasurementPointId).collect(Collectors.toList()).size();
}
/**

View File

@@ -19,7 +19,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.service.mysql.IRStatOrgBusbarVoltageMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -126,13 +126,13 @@ public class RStatOrgBusbarVoltageMServiceImpl extends MppServiceImpl<RStatOrgBu
* 获取有效接入监测点个数
*/
public Integer getEffectiveNum(List<String> lineList, String startTime, String endTime) {
LambdaQueryWrapper<RMpMonitorEvaluateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateDPO::getMeasurementPointId)
.between(RMpMonitorEvaluateDPO::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateDPO::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateDPO::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateDPO> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateDPO::getMeasurementPointId).collect(Collectors.toList()).size();
LambdaQueryWrapper<RMpMonitorEvaluateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateD::getMeasurementPointId)
.between(RMpMonitorEvaluateD::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateD::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateD::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateD> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateD::getMeasurementPointId).collect(Collectors.toList()).size();
}
/**

View File

@@ -19,7 +19,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.service.mysql.IRStatOrgBusbarVoltageQService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -126,13 +126,13 @@ public class RStatOrgBusbarVoltageQServiceImpl extends MppServiceImpl<RStatOrgBu
* 获取有效接入监测点个数
*/
public Integer getEffectiveNum(List<String> lineList, String startTime, String endTime) {
LambdaQueryWrapper<RMpMonitorEvaluateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateDPO::getMeasurementPointId)
.between(RMpMonitorEvaluateDPO::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateDPO::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateDPO::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateDPO> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateDPO::getMeasurementPointId).collect(Collectors.toList()).size();
LambdaQueryWrapper<RMpMonitorEvaluateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateD::getMeasurementPointId)
.between(RMpMonitorEvaluateD::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateD::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateD::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateD> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateD::getMeasurementPointId).collect(Collectors.toList()).size();
}
/**

View File

@@ -19,7 +19,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.service.mysql.IRStatOrgBusbarVoltageYService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -126,13 +126,13 @@ public class RStatOrgBusbarVoltageYServiceImpl extends MppServiceImpl<RStatOrgBu
* 获取有效接入监测点个数
*/
public Integer getEffectiveNum(List<String> lineList, String startTime, String endTime) {
LambdaQueryWrapper<RMpMonitorEvaluateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateDPO::getMeasurementPointId)
.between(RMpMonitorEvaluateDPO::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateDPO::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateDPO::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateDPO> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateDPO::getMeasurementPointId).collect(Collectors.toList()).size();
LambdaQueryWrapper<RMpMonitorEvaluateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpMonitorEvaluateD::getMeasurementPointId)
.between(RMpMonitorEvaluateD::getDataDate, startTime, endTime)
.in(RMpMonitorEvaluateD::getMeasurementPointId, lineList)
.gt(RMpMonitorEvaluateD::getEffectiveMinuteCount, 0);
List<RMpMonitorEvaluateD> list = mpMonitorEvaluateDMapper.selectList(lambdaQueryWrapper);
return CollUtil.isEmpty(list)?0: list.stream().distinct().map(RMpMonitorEvaluateD::getMeasurementPointId).collect(Collectors.toList()).size();
}
/**

View File

@@ -8,7 +8,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.harmonic.pojo.po.RMpTargetWarnDPO;
import com.njcn.harmonic.pojo.po.RStatOrgDPO;
import com.njcn.harmonic.pojo.po.RStatOrgMPO;
@@ -84,7 +84,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
QueryWrapper<ROperatingMonitorDPO> rOperatingMonitorDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpTargetWarnDPO> rmpTargetWarnDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
for (DeptGetChildrenMoreDTO deptGetChildrenMoreDTO : calculatedParam.getIdList()) {
@@ -122,14 +122,14 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
rStatOrgDPO.setEventCount(sum+sum1+sum2);
rStatOrgDPO.setEventMeasurement(rMpEventDetailDPOS.size());
rStatOrgDPO.setEventMeasurement(rMpEventDetailDS.size());
/*todo这个指标不重要后续根据配置来*/
rStatOrgDPO.setShouldCount(8);
/*7、告警监测点数*/
@@ -180,14 +180,14 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
rStatOrgDPO.setEventCount(sum+sum1+sum2);
rStatOrgDPO.setEventMeasurement(rMpEventDetailDPOS.size());
rStatOrgDPO.setEventMeasurement(rMpEventDetailDS.size());
/*todo这个指标不重要后续根据配置来*/
rStatOrgDPO.setShouldCount(8);
/*7、告警监测点数*/
@@ -235,7 +235,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
QueryWrapper<ROperatingMonitorDPO> rOperatingMonitorDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpTargetWarnDPO> rmpTargetWarnDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpPassRateMPO> rMpPassRateMPOQueryWrapper = new QueryWrapper<>();
for (DeptGetChildrenMoreDTO deptGetChildrenMoreDTO : calculatedParam.getIdList()) {
@@ -305,15 +305,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgMPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgMPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -324,7 +324,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
rStatOrgMPO.setEventCount(sum+sum1+sum2);
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgMPO.setEventFreq(0.00);
@@ -416,15 +416,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgMPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgMPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -435,7 +435,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
rStatOrgMPO.setEventCount(sum+sum1+sum2);
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgMPO.setEventFreq(0.00);
@@ -490,7 +490,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
QueryWrapper<ROperatingMonitorDPO> rOperatingMonitorDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpTargetWarnDPO> rmpTargetWarnDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpPassRateQPO> rMpPassRateQPOQueryWrapper = new QueryWrapper<>();
@@ -574,15 +574,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgQPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgQPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -593,7 +593,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
rStatOrgQPO.setEventCount(sum+sum1+sum2);
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgQPO.setEventFreq(0.00);
@@ -695,15 +695,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgQPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgQPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -714,7 +714,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
rStatOrgQPO.setEventCount(sum+sum1+sum2);
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgQPO.setEventFreq(0.00);
@@ -772,7 +772,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
QueryWrapper<ROperatingMonitorDPO> rOperatingMonitorDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpTargetWarnDPO> rmpTargetWarnDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpPassRateYPO> rMpPassRateYPOQueryWrapper = new QueryWrapper<>();
@@ -854,15 +854,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgYPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgYPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -873,7 +873,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
rStatOrgYPO.setEventCount(sum+sum1+sum2);
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgYPO.setEventFreq(0.00);
}else{
@@ -974,15 +974,15 @@ public class RStatOrgServiceImpl implements RStatOrgService {
in("measurement_point_id", collect1).
and(i-> i.gt("swell_times",0).or().gt("sag_times",0).or().gt("interrupt_times",0)).
between("data_date",begin,end);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
Integer eventCount =0;
int sum = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
int sum1 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
int sum2 = rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
String value3 = df.format((float)rMpEventDetailDPOS.size()/ days);
int sum = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum();
int sum1 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum();
int sum2 = rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum();
String value3 = df.format((float) rMpEventDetailDS.size()/ days);
rStatOrgYPO.setEventMeasurementAverage(Double.valueOf(value3));
/*12、累计监测到暂态指标的监测点数*/
long count2 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count2 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
rStatOrgYPO.setEventMeasurementAccrued(Integer.valueOf(count2+""));
/*13、日均暂态超标监测点数占比*/
@@ -994,7 +994,7 @@ public class RStatOrgServiceImpl implements RStatOrgService {
/*14、暂态指标发生频次*/
long count3 = rMpEventDetailDPOS.stream().map(RMpEventDetailDPO::getMeasurementPointId).distinct().count();
long count3 = rMpEventDetailDS.stream().map(RMpEventDetailD::getMeasurementPointId).distinct().count();
if(count3==0){
rStatOrgYPO.setEventFreq(0.00);

View File

@@ -10,7 +10,7 @@ import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.prepare.harmonic.mapper.mysql.device.RStatDevSignalDPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.pojo.po.RStatDevSignalDPO;
import com.njcn.prepare.harmonic.service.mysql.device.RStatDevSignalDPOService;
import com.njcn.system.api.DicDataFeignClient;
@@ -53,22 +53,22 @@ public class RStatDevSignalDPOServiceImpl extends MppServiceImpl<RStatDevSignalD
log.info(LocalDateTime.now()+"===>终端通信管理日统计算法开始");
List<LineDevGetDTO> lineDevGetList = new ArrayList<>();
List<RStatDevSignalDPO> rStatDevSignalList = new ArrayList<>();
List<RMpMonitorEvaluateDPO> evaluateList = new ArrayList<>();
List<RMpMonitorEvaluateD> evaluateList = new ArrayList<>();
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RUNNING.getCode()).getData();
List<String> lineIds = calculatedParam.getIdList();
//以尺寸100分片,查询数据
List<List<String>> pendingIds = ListUtils.partition(lineIds,5);
for (List<String> pendingId : pendingIds) {
//获取监测点评价详情
LambdaQueryWrapper<RMpMonitorEvaluateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(RMpMonitorEvaluateDPO::getMeasurementPointId,pendingId)
.eq(RMpMonitorEvaluateDPO::getDataDate,calculatedParam.getDataDate());
List<RMpMonitorEvaluateDPO> ls = revaluateDMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<RMpMonitorEvaluateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(RMpMonitorEvaluateD::getMeasurementPointId,pendingId)
.eq(RMpMonitorEvaluateD::getDataDate,calculatedParam.getDataDate());
List<RMpMonitorEvaluateD> ls = revaluateDMapper.selectList(lambdaQueryWrapper);
evaluateList.addAll(ls);
//监测点详情
lineDevGetList.addAll(commTerminalGeneralClient.getMonitorDetailList(pendingId).getData());
}
Map<String,List<RMpMonitorEvaluateDPO>> map1 = evaluateList.stream().collect(Collectors.groupingBy(RMpMonitorEvaluateDPO::getDeviceId));
Map<String,List<RMpMonitorEvaluateD>> map1 = evaluateList.stream().collect(Collectors.groupingBy(RMpMonitorEvaluateD::getDeviceId));
Map<String,List<LineDevGetDTO>> map2 = lineDevGetList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getDevId));
map2.forEach((k,v)->{
@@ -80,7 +80,7 @@ public class RStatDevSignalDPOServiceImpl extends MppServiceImpl<RStatDevSignalD
}
rStatDevSignal.setDataDate(LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(),DatePattern.NORM_DATE_FORMATTER));
if (CollectionUtil.isNotEmpty(map1.get(k))){
int count = map1.get(k).stream().mapToInt(RMpMonitorEvaluateDPO::getEffectiveMinuteCount).sum();
int count = map1.get(k).stream().mapToInt(RMpMonitorEvaluateD::getEffectiveMinuteCount).sum();
if (count > 0){
rStatDevSignal.setRunStatus("1");
} else {

View File

@@ -5,8 +5,8 @@ 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.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
@@ -27,7 +27,7 @@ import java.util.List;
*/
@Service
@AllArgsConstructor
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailDPO> implements RMpEventDetailDService {
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailD> implements RMpEventDetailDService {
private final RMpEventDetailDMapper rMpEventDetailDMapper;
@@ -44,12 +44,12 @@ public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMa
* @Date: 2022/12/28
*/
@Override
public List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate) {
public List<RMpEventDetailD> queryOneMothData(String lineId, String dataDate) {
QueryWrapper<RMpEventDetailDPO> queryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> 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);
List<RMpEventDetailD> list = rMpEventDetailDMapper.selectList(queryWrapper);
return list;
}
@@ -64,8 +64,8 @@ public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMa
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);
List<RMpEventDetailM> rMpEventDetailMList = this.baseMapper.handleMonth(pendingId, DateUtil.format(beginMonth, DatePattern.NORM_DATE_PATTERN), beginMonth, endMonth);
rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMList);
}
}

View File

@@ -2,7 +2,7 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMMapper;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailMService;
import com.njcn.prepare.harmonic.utils.PublicUtil;
@@ -22,7 +22,7 @@ import java.util.List;
*/
@Service
@AllArgsConstructor
public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMapper, RMpEventDetailMPO> implements RMpEventDetailMService{
public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMapper, RMpEventDetailM> implements RMpEventDetailMService{
private final RMpEventDetailMMapper rMpEventDetailMMapper;
@@ -36,12 +36,12 @@ public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMa
* @Date: 2022/12/28
*/
@Override
public List<RMpEventDetailMPO> queryOneQtrData(String lineId, String dataDate) {
public List<RMpEventDetailM> queryOneQtrData(String lineId, String dataDate) {
QueryWrapper<RMpEventDetailMPO> queryWrapper = new QueryWrapper<> ();
QueryWrapper<RMpEventDetailM> queryWrapper = new QueryWrapper<> ();
queryWrapper.eq ("measurement_point_id", lineId).
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
List<RMpEventDetailMPO> list = rMpEventDetailMMapper.selectList (queryWrapper);
List<RMpEventDetailM> list = rMpEventDetailMMapper.selectList (queryWrapper);
return list;
}
@@ -55,11 +55,11 @@ public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMa
* @Date: 2022/12/28
*/
@Override
public List<RMpEventDetailMPO> queryOneYearData(String lineId, String dataDate) {
QueryWrapper<RMpEventDetailMPO> queryWrapper = new QueryWrapper<> ();
public List<RMpEventDetailM> queryOneYearData(String lineId, String dataDate) {
QueryWrapper<RMpEventDetailM> queryWrapper = new QueryWrapper<> ();
queryWrapper.eq ("measurement_point_id", lineId).
eq("YEAR( data_date )",dataDate.substring (0, 4));
List<RMpEventDetailMPO> list = rMpEventDetailMMapper.selectList (queryWrapper);
List<RMpEventDetailM> list = rMpEventDetailMMapper.selectList (queryWrapper);
return list;
}
}

View File

@@ -4,7 +4,6 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.harmonic.pojo.po.RMpEventDetailQPO;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailQMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;

View File

@@ -3,10 +3,10 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
import com.njcn.redis.utils.RedisUtil;
@@ -30,7 +30,7 @@ import java.util.Optional;
*/
@Service
@RequiredArgsConstructor
public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper, RMpEventDetailPO> implements RMpEventDetailService {
public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper, RmpEventDetailPO> implements RMpEventDetailService {
private final RMpEventDetailDService rMpEventDetailDService;
@@ -51,7 +51,7 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
LocalDateTime endDay = LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
for (List<String> pendingId : pendingIds) {
//查询
List<RMpEventDetailDPO> rMpEventDetailDPOList = this.baseMapper.handleDay(
List<RMpEventDetailD> rMpEventDetailDList = this.baseMapper.handleDay(
pendingId
,LocalDateTimeUtil.format(beginDay,DatePattern.NORM_DATE_PATTERN)
,beginDay
@@ -60,7 +60,7 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
,getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode())
,getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode()));
//入库
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDPOList);
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDList);
}
}

View File

@@ -15,7 +15,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.line.PmsAbnormalRulesMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.dto.DataVFiveItemDTO;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
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;
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEvaluateDMapper, RMpMonitorEvaluateDPO> implements RMpMonitorEvaluateDService {
public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEvaluateDMapper, RMpMonitorEvaluateD> implements RMpMonitorEvaluateDService {
private final CommLineClient commLineClient;
private final DataVInfluxdbService dataVInfluxdbService;
@@ -64,7 +64,7 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(), 100);
for (List<String> pendingId : pendingIds) {
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(pendingId).getData();
List<RMpMonitorEvaluateDPO> rMpMonitorEvaluateDPOS = new ArrayList<>();
List<RMpMonitorEvaluateD> rMpMonitorEvaluateDS = new ArrayList<>();
for (LineDTO lineDTO : lineDTOList) {
if (ObjectUtil.isNotNull(lineDTO)) {
/*todo 统计间隔电压等级取值方式后期提供融合版本接口获取不然pmspqs系统取值方式不一样*/
@@ -73,28 +73,28 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
/*电压等级*/
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);
RMpMonitorEvaluateD rMpMonitorEvaluateD = new RMpMonitorEvaluateD();
rMpMonitorEvaluateD = calculateRMpMonitorEvaluateDPO(rMpMonitorEvaluateD, fiveItems, pmsAbnormalRules, voltage, lineDTO);
Date date = DateUtil.parse(beginDay);
DataFlicker twoFlickerData = dataIntegrityRateInfluxService.getTwoFlickerData(lineDTO.getLineId(), date, 5);
LocalDate localDate = LocalDateTimeUtil.parseDate(beginDay, DatePattern.NORM_DATETIME_PATTERN);
if (Objects.isNull(twoFlickerData)) {
rMpMonitorEvaluateDPO.setPltCount(0);
rMpMonitorEvaluateDPO.setPstCount(0);
rMpMonitorEvaluateD.setPltCount(0);
rMpMonitorEvaluateD.setPstCount(0);
} else {
rMpMonitorEvaluateDPO.setPltCount(twoFlickerData.getPltCount());
rMpMonitorEvaluateDPO.setPstCount(twoFlickerData.getPstCount());
rMpMonitorEvaluateD.setPltCount(twoFlickerData.getPltCount());
rMpMonitorEvaluateD.setPstCount(twoFlickerData.getPstCount());
}
rMpMonitorEvaluateDPO.setAllMinuteCount(fiveItems.size());
rMpMonitorEvaluateDPO.setDeviceId(lineDTO.getDevId());
rMpMonitorEvaluateDPO.setDataDate(localDate);
rMpMonitorEvaluateDPO.setMeasurementPointId(lineDTO.getLineId());
rMpMonitorEvaluateDPOS.add(rMpMonitorEvaluateDPO);
rMpMonitorEvaluateD.setAllMinuteCount(fiveItems.size());
rMpMonitorEvaluateD.setDeviceId(lineDTO.getDevId());
rMpMonitorEvaluateD.setDataDate(localDate);
rMpMonitorEvaluateD.setMeasurementPointId(lineDTO.getLineId());
rMpMonitorEvaluateDS.add(rMpMonitorEvaluateD);
}
}
if (CollUtil.isNotEmpty(rMpMonitorEvaluateDPOS)) {
this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDPOS, 500);
if (CollUtil.isNotEmpty(rMpMonitorEvaluateDS)) {
this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDS, 500);
}
}
}
@@ -111,7 +111,7 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
* @Author: clam
* @Date: 2023/2/23
*/
private RMpMonitorEvaluateDPO calculateRMpMonitorEvaluateDPO(RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO, List<DataVFiveItemDTO> fiveItems, List<PmsAbnormalRules> pmsAbnormalRules, Double voltage, LineDTO data) {
private RMpMonitorEvaluateD calculateRMpMonitorEvaluateDPO(RMpMonitorEvaluateD rMpMonitorEvaluateD, List<DataVFiveItemDTO> fiveItems, List<PmsAbnormalRules> pmsAbnormalRules, Double voltage, LineDTO data) {
Integer freqCount = 0;
Integer unbalanceCount = 0;
@@ -204,12 +204,12 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
}
}
rMpMonitorEvaluateDPO.setEffectiveMinuteCount(effectiveMinuteCount);
rMpMonitorEvaluateDPO.setFreqCount(freqCount);
rMpMonitorEvaluateDPO.setPhaseVoltageCount(phaseVoltageCount);
rMpMonitorEvaluateDPO.setLineVoltageCount(lineVoltageCount);
rMpMonitorEvaluateDPO.setVThdCount(vThdCount);
rMpMonitorEvaluateDPO.setUnbalanceCount(unbalanceCount);
return rMpMonitorEvaluateDPO;
rMpMonitorEvaluateD.setEffectiveMinuteCount(effectiveMinuteCount);
rMpMonitorEvaluateD.setFreqCount(freqCount);
rMpMonitorEvaluateD.setPhaseVoltageCount(phaseVoltageCount);
rMpMonitorEvaluateD.setLineVoltageCount(lineVoltageCount);
rMpMonitorEvaluateD.setVThdCount(vThdCount);
rMpMonitorEvaluateD.setUnbalanceCount(unbalanceCount);
return rMpMonitorEvaluateD;
}
}

View File

@@ -15,7 +15,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.line.RMpPartHarmonicDetailDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpPassRateDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpSurplusHarmonicDetailDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateDPO;
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateMPO;
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateQPO;
@@ -60,7 +60,7 @@ public class RMpPassRateDServiceImpl extends MppServiceImpl<RMpPassRateDMapper,
LocalDateTime end = LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
List<RMpPassRateDPO> rMpPassRateDPOList = new ArrayList<> ( );
QueryWrapper<RMpMonitorEvaluateDPO> rMpMonitorEvaluateDPOQueryWrapper = new QueryWrapper<>( );
QueryWrapper<RMpMonitorEvaluateD> rMpMonitorEvaluateDPOQueryWrapper = new QueryWrapper<>( );
QueryWrapper<RMpPartHarmonicDetailD> queryWrapper = new QueryWrapper<>( );
QueryWrapper<RMpSurplusHarmonicDetailD> surplusHarmonicDetailDQueryWrapper = new QueryWrapper<>( );
@@ -75,7 +75,7 @@ public class RMpPassRateDServiceImpl extends MppServiceImpl<RMpPassRateDMapper,
rMpMonitorEvaluateDPOQueryWrapper.select ("effective_minute_count").
eq ("measurement_point_id", lineDTO.getLineId()).
eq ("data_date", calculatedParam.getDataDate ( ));
RMpMonitorEvaluateDPO one = rMpMonitorEvaluateDService.getOne (rMpMonitorEvaluateDPOQueryWrapper);
RMpMonitorEvaluateD one = rMpMonitorEvaluateDService.getOne (rMpMonitorEvaluateDPOQueryWrapper);
if (Objects.isNull(one)) {
continue;

View File

@@ -9,7 +9,7 @@ import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.ROperatingMonitorDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RStatAbnormalDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
import com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO;
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorService;
@@ -66,11 +66,11 @@ public class ROperatingMonitorDServiceImpl extends MppServiceImpl<ROperatingMoni
ROperatingMonitorDPO rOperatingMonitorDPO = new ROperatingMonitorDPO();
Integer statisticalInterval = lineDTO.getTimeInterval ();
RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
rMpMonitorEvaluateDPO.setMeasurementPointId (lineDTO.getLineId());
rMpMonitorEvaluateDPO.setDataDate (localDate);
rMpMonitorEvaluateDPO = rMpMonitorEvaluateDMapper.selectByMultiId (rMpMonitorEvaluateDPO);
if (Objects.isNull(rMpMonitorEvaluateDPO)) {
RMpMonitorEvaluateD rMpMonitorEvaluateD = new RMpMonitorEvaluateD();
rMpMonitorEvaluateD.setMeasurementPointId (lineDTO.getLineId());
rMpMonitorEvaluateD.setDataDate (localDate);
rMpMonitorEvaluateD = rMpMonitorEvaluateDMapper.selectByMultiId (rMpMonitorEvaluateD);
if (Objects.isNull(rMpMonitorEvaluateD)) {
continue;
}
@@ -85,23 +85,23 @@ public class ROperatingMonitorDServiceImpl extends MppServiceImpl<ROperatingMoni
rOperatingMonitorDPO.setMeasurementPointId (lineDTO.getLineId());
rOperatingMonitorDPO.setDataDate (localDate);
rOperatingMonitorDPO.setIsUnusual (rStatAbnormalDPO.getValueAlarm ());
rOperatingMonitorDPO.setEffectiveMinuteCount (rMpMonitorEvaluateDPO.getEffectiveMinuteCount ());
rOperatingMonitorDPO.setDataIntegrityRate (BigDecimal.valueOf (Double.valueOf(rMpMonitorEvaluateDPO.getEffectiveMinuteCount ()*statisticalInterval)/1440).setScale(5, BigDecimal.ROUND_HALF_UP));
if(rMpMonitorEvaluateDPO.getEffectiveMinuteCount ()==0){
rOperatingMonitorDPO.setEffectiveMinuteCount (rMpMonitorEvaluateD.getEffectiveMinuteCount ());
rOperatingMonitorDPO.setDataIntegrityRate (BigDecimal.valueOf (Double.valueOf(rMpMonitorEvaluateD.getEffectiveMinuteCount ()*statisticalInterval)/1440).setScale(5, BigDecimal.ROUND_HALF_UP));
if(rMpMonitorEvaluateD.getEffectiveMinuteCount ()==0){
rOperatingMonitorDPO.setDataRightRate(BigDecimal.valueOf(0.00));
}else{
rOperatingMonitorDPO.setDataRightRate (BigDecimal.valueOf(
(Double.valueOf(rMpMonitorEvaluateDPO.getFreqCount ()+ rMpMonitorEvaluateDPO.getLineVoltageCount ()+
rMpMonitorEvaluateDPO.getPhaseVoltageCount ()+rMpMonitorEvaluateDPO.getUnbalanceCount ()+
rMpMonitorEvaluateDPO.getVThdCount ()))/(5*rMpMonitorEvaluateDPO.getEffectiveMinuteCount ())
(Double.valueOf(rMpMonitorEvaluateD.getFreqCount ()+ rMpMonitorEvaluateD.getLineVoltageCount ()+
rMpMonitorEvaluateD.getPhaseVoltageCount ()+ rMpMonitorEvaluateD.getUnbalanceCount ()+
rMpMonitorEvaluateD.getVThdCount ()))/(5* rMpMonitorEvaluateD.getEffectiveMinuteCount ())
).setScale(5, BigDecimal.ROUND_HALF_UP));
}
rOperatingMonitorDPO.setIndexIntegrityRate (
BigDecimal.valueOf(
(Double.valueOf(rMpMonitorEvaluateDPO.getFreqCount ()+ rMpMonitorEvaluateDPO.getLineVoltageCount ()+
rMpMonitorEvaluateDPO.getPhaseVoltageCount ()+rMpMonitorEvaluateDPO.getUnbalanceCount ()+
rMpMonitorEvaluateDPO.getVThdCount ())*statisticalInterval)/(5*1440)
(Double.valueOf(rMpMonitorEvaluateD.getFreqCount ()+ rMpMonitorEvaluateD.getLineVoltageCount ()+
rMpMonitorEvaluateD.getPhaseVoltageCount ()+ rMpMonitorEvaluateD.getUnbalanceCount ()+
rMpMonitorEvaluateD.getVThdCount ())*statisticalInterval)/(5*1440)
).setScale(5, BigDecimal.ROUND_HALF_UP)
);
rOperatingMonitorDPO.setDevId (lineDTO.getDevId());

View File

@@ -2,30 +2,14 @@ package com.njcn.prepare.harmonic.service.mysql.dim.impl;
import cn.hutool.core.collection.CollUtil;
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.pms.pojo.po.GeneratrixWire;
import com.njcn.device.pms.pojo.po.PmsCountLedger;
import com.njcn.device.pms.pojo.po.PmsMidLedger;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
import com.njcn.harmonic.pojo.po.dim.RDimBusGlobalD;
import com.njcn.harmonic.pojo.po.dim.RDimBusbarHarmnicDPO;
import com.njcn.harmonic.pojo.po.dim.RDimMonitorRateD;
import com.njcn.harmonic.pojo.po.dim.RDimStationBaseD;
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.area.ROperatingIndexDPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatIntegrityDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.dim.GeneratrixWireMapper;
@@ -34,24 +18,16 @@ import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimBusGlobalDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.ROperatingMonitorDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
import com.njcn.prepare.harmonic.service.mysql.dim.IRDimBusGlobalDService;
import com.njcn.prepare.harmonic.service.mysql.dim.IRDimStationBaseDService;
import com.njcn.prepare.harmonic.service.mysql.dim.RDimBusbarHarmnicDPOService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**

View File

@@ -2,7 +2,6 @@ package com.njcn.prepare.harmonic.service.mysql.dim.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
@@ -10,8 +9,7 @@ import com.njcn.device.pms.api.StatationStatClient;
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.po.dim.RDimStationHarmnicDPO;
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
@@ -34,7 +32,6 @@ import com.njcn.prepare.harmonic.service.mysql.dim.RDimBusbarHarmnicDPOService;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -104,7 +101,7 @@ public class RDimBusbarHarmnicDPOServiceImpl extends MppServiceImpl<RDimBusbarHa
List<String> linids = monitorList.stream().map(Monitor::getId).collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateDPOS = irStatLimitRateDService.findList(linids, beginDay, endDay);
List<RMpEventDetailDPO> rMpEventDetailDPOList = rMpEventDetailDService.lambdaQuery().in(RMpEventDetailDPO::getMeasurementPointId, linids).eq(RMpEventDetailDPO::getDataDate, localDate).list();
List<RMpEventDetailD> rMpEventDetailDList = rMpEventDetailDService.lambdaQuery().in(RMpEventDetailD::getMeasurementPointId, linids).eq(RMpEventDetailD::getDataDate, localDate).list();
monitorList.stream().forEach(busbar->{
//稳态
indicatorTypeDate.stream().forEach(temp->{
@@ -157,15 +154,15 @@ public class RDimBusbarHarmnicDPOServiceImpl extends MppServiceImpl<RDimBusbarHa
rDimBusbarHarmnicDPO.setLevel(1);
rDimBusbarHarmnicDPO.setMonitorTag(busbar.getMonitorTag());
rDimBusbarHarmnicDPO.setVoltageLevel(busbar.getVoltageLevel());
Optional<RMpEventDetailDPO> first = rMpEventDetailDPOList.stream().filter(rMpEventDetailDPO -> Objects.equals(rMpEventDetailDPO.getMeasurementPointId(), busbar.getId())).findFirst();
RMpEventDetailDPO rMpEventDetailDPO = new RMpEventDetailDPO();
Optional<RMpEventDetailD> first = rMpEventDetailDList.stream().filter(rMpEventDetailDPO -> Objects.equals(rMpEventDetailDPO.getMeasurementPointId(), busbar.getId())).findFirst();
RMpEventDetailD rMpEventDetailD = new RMpEventDetailD();
if (first.isPresent()) {
rMpEventDetailDPO = first.get();
rMpEventDetailD = first.get();
}else {
return;
}
rDimBusbarHarmnicDPO.setLimitCount(eventBusbarsCount(dictData,rMpEventDetailDPO));
rDimBusbarHarmnicDPO.setLimitCount(eventBusbarsCount(dictData, rMpEventDetailD));
rDimBusbarHarmnicDPO.setStatisCount(0);
rDimBusbarHarmnicDPOList.add(rDimBusbarHarmnicDPO);
});
@@ -213,15 +210,15 @@ public class RDimBusbarHarmnicDPOServiceImpl extends MppServiceImpl<RDimBusbarHa
}
}
private Integer eventBusbarsCount(DictData dictData, RMpEventDetailDPO rMpEventDetailDPO) {
private Integer eventBusbarsCount(DictData dictData, RMpEventDetailD rMpEventDetailD) {
Integer eventCount =0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
eventCount = rMpEventDetailDPO.getSagTimes();
eventCount = rMpEventDetailD.getSagTimes();
} else if ( Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_RISE.getCode())) {
eventCount = rMpEventDetailDPO.getSwellTimes();
eventCount = rMpEventDetailD.getSwellTimes();
} else if ( Objects.equals(dictData.getCode(), DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
eventCount = rMpEventDetailDPO.getInterruptTimes();
eventCount = rMpEventDetailD.getInterruptTimes();
}
return eventCount;

View File

@@ -7,7 +7,7 @@ import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.harmonic.pojo.po.RMpTargetWarnDPO;
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpTargetWarnDMapper;
@@ -113,13 +113,13 @@ public class RDimObjEventDServiceImpl extends MppServiceImpl<RDimObjEventDMapper
float result = 3.1415926f;
int data = 0;
int count = 0;
LambdaQueryWrapper<RMpEventDetailDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailDPO::getSwellTimes,RMpEventDetailDPO::getSagTimes,RMpEventDetailDPO::getInterruptTimes)
.in(RMpEventDetailDPO::getMeasurementPointId,lineList)
.eq(RMpEventDetailDPO::getDataDate,time);
List<RMpEventDetailDPO> eventDay = rMpEventDetailDMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<RMpEventDetailD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailD::getSwellTimes, RMpEventDetailD::getSagTimes, RMpEventDetailD::getInterruptTimes)
.in(RMpEventDetailD::getMeasurementPointId,lineList)
.eq(RMpEventDetailD::getDataDate,time);
List<RMpEventDetailD> eventDay = rMpEventDetailDMapper.selectList(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(eventDay)){
for (RMpEventDetailDPO item : eventDay) {
for (RMpEventDetailD item : eventDay) {
int times = item.getSwellTimes() + item.getSagTimes() + item.getInterruptTimes();
if (times == 0){
count++;

View File

@@ -8,7 +8,7 @@ import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimObjEventMMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMMapper;
@@ -120,13 +120,13 @@ public class RDimObjEventMServiceImpl extends MppServiceImpl<RDimObjEventMMapper
float result = 3.1415926f;
int data = 0;
int count = 0;
LambdaQueryWrapper<RMpEventDetailMPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailMPO::getSwellTimes,RMpEventDetailMPO::getSagTimes,RMpEventDetailMPO::getInterruptTimes)
.in(RMpEventDetailMPO::getMeasurementPointId,lineList)
.eq(RMpEventDetailMPO::getDataDate,time);
List<RMpEventDetailMPO> eventDay = rMpEventDetailMMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<RMpEventDetailM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailM::getSwellTimes, RMpEventDetailM::getSagTimes, RMpEventDetailM::getInterruptTimes)
.in(RMpEventDetailM::getMeasurementPointId,lineList)
.eq(RMpEventDetailM::getDataDate,time);
List<RMpEventDetailM> eventDay = rMpEventDetailMMapper.selectList(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(eventDay)){
for (RMpEventDetailMPO item : eventDay) {
for (RMpEventDetailM item : eventDay) {
int times = item.getSwellTimes() + item.getSagTimes() + item.getInterruptTimes();
if (times == 0){
count++;

View File

@@ -8,7 +8,7 @@ import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper;
import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimObjEventYMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMMapper;
@@ -122,15 +122,15 @@ public class RDimObjEventYServiceImpl extends MppServiceImpl<RDimObjEventYMapper
float result = 3.1415926f;
int data = 0;
int count = 0;
LambdaQueryWrapper<RMpEventDetailMPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailMPO::getSwellTimes,RMpEventDetailMPO::getSagTimes,RMpEventDetailMPO::getInterruptTimes)
.in(RMpEventDetailMPO::getMeasurementPointId,lineList)
.between(RMpEventDetailMPO::getDataDate,startTime,endTime);
List<RMpEventDetailMPO> eventDay = rMpEventDetailMMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<RMpEventDetailM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(RMpEventDetailM::getSwellTimes, RMpEventDetailM::getSagTimes, RMpEventDetailM::getInterruptTimes)
.in(RMpEventDetailM::getMeasurementPointId,lineList)
.between(RMpEventDetailM::getDataDate,startTime,endTime);
List<RMpEventDetailM> eventDay = rMpEventDetailMMapper.selectList(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(eventDay)){
Map<String,List<RMpEventDetailMPO>> map = eventDay.stream().collect(Collectors.groupingBy(RMpEventDetailMPO::getMeasurementPointId));
Map<String,List<RMpEventDetailM>> map = eventDay.stream().collect(Collectors.groupingBy(RMpEventDetailM::getMeasurementPointId));
for(String key : map.keySet()){
for (RMpEventDetailMPO item : map.get(key)) {
for (RMpEventDetailM item : map.get(key)) {
int times = item.getSwellTimes() + item.getSagTimes() + item.getInterruptTimes();
data = data + times;
}

View File

@@ -1,7 +1,7 @@
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.event.pojo.po.RMpEventDetailD;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import java.util.List;
@@ -14,7 +14,7 @@ import java.util.List;
* @author clam
* @version V1.0.0
*/
public interface RMpEventDetailDService extends IMppService<RMpEventDetailDPO> {
public interface RMpEventDetailDService extends IMppService<RMpEventDetailD> {
/**
* @Description: queryOneMothData
@@ -23,7 +23,7 @@ public interface RMpEventDetailDService extends IMppService<RMpEventDetailDPO> {
* @Author: clam
* @Date: 2022/12/28
*/
List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate);
List<RMpEventDetailD> queryOneMothData(String lineId, String dataDate);
/***
* 监测点暂态指标明细--月表算法

View File

@@ -1,7 +1,7 @@
package com.njcn.prepare.harmonic.service.mysql.line;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import java.util.List;
@@ -14,7 +14,7 @@ import java.util.List;
* @author clam
* @version V1.0.0
*/
public interface RMpEventDetailMService extends IMppService<RMpEventDetailMPO> {
public interface RMpEventDetailMService extends IMppService<RMpEventDetailM> {
/**
* @Description: queryOneQtrData 查询一季度Mouth表数据
@@ -23,7 +23,7 @@ public interface RMpEventDetailMService extends IMppService<RMpEventDetailMPO> {
* @Author: clam
* @Date: 2022/12/28
*/
List<RMpEventDetailMPO> queryOneQtrData(String lineId, String dataDate);
List<RMpEventDetailM> queryOneQtrData(String lineId, String dataDate);
/**
* @Description: queryOneYearData 查询一年Mouth表数据
* @Param: [lineId, dataDate]
@@ -31,5 +31,5 @@ public interface RMpEventDetailMService extends IMppService<RMpEventDetailMPO> {
* @Author: clam
* @Date: 2022/12/28
*/
List<RMpEventDetailMPO> queryOneYearData(String lineId, String dataDate);
List<RMpEventDetailM> queryOneYearData(String lineId, String dataDate);
}

View File

@@ -1,9 +1,8 @@
package com.njcn.prepare.harmonic.service.mysql.line;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
/**
* Description:
@@ -13,7 +12,7 @@ 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> {
/***

View File

@@ -2,7 +2,7 @@ package com.njcn.prepare.harmonic.service.mysql.line;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
/**
@@ -12,7 +12,7 @@ import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
* @author clam
* @version V1.0.0
*/
public interface RMpMonitorEvaluateDService extends IMppService<RMpMonitorEvaluateDPO> {
public interface RMpMonitorEvaluateDService extends IMppService<RMpMonitorEvaluateD> {
/***

View File

@@ -7,8 +7,8 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.harmonic.pojo.po.RStatOrgDPO;
import com.njcn.harmonic.pojo.po.RStatOrgMPO;
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgDMapper;
@@ -97,7 +97,7 @@ public class RStatEventServiceImpl implements RStatEventService {
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RStatOrgDPO> rStatOrgDPOQueryWrapper = new QueryWrapper<>();
calculatedParam.getIdList().forEach(deptGetChildrenMoreDTO -> {
@@ -113,7 +113,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
rStatOrgDPOQueryWrapper.clear();
rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -130,7 +130,7 @@ public class RStatEventServiceImpl implements RStatEventService {
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
return;
}
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDPOS);
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDS);
RStatEventDPO rStatEventDPO = new RStatEventDPO();
rStatEventDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
rStatEventDPO.setDataDate(localDate);
@@ -167,7 +167,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
rStatOrgDPOQueryWrapper.clear();
rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -184,7 +184,7 @@ public class RStatEventServiceImpl implements RStatEventService {
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
return;
}
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDPOS);
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDS);
RStatEventDPO rStatEventDPO = new RStatEventDPO();
rStatEventDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
rStatEventDPO.setDataDate(localDate);
@@ -236,7 +236,7 @@ public class RStatEventServiceImpl implements RStatEventService {
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
//详情表
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
//org表
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
//天表
@@ -255,7 +255,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date",begin,end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
// rStatOrgMPOQueryWrapper.clear();
// rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -299,7 +299,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisData(dictData, rMpEventDetailMS);
if(statisData>0){
System.out.println("1");
}
@@ -347,7 +347,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date",begin,end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
rStatOrgMPOQueryWrapper.clear();
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -392,7 +392,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisData(dictData, rMpEventDetailMS);
RStatEventMPO rStatEventMPO = new RStatEventMPO();
rStatEventMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -454,7 +454,7 @@ public class RStatEventServiceImpl implements RStatEventService {
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
//详情表
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
//org季表
QueryWrapper<RStatOrgQPO> rStatOrgQPOQueryWrapper = new QueryWrapper<>();
//天表
@@ -475,7 +475,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date", begin, end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
// //季表
// rStatOrgQPOQueryWrapper.clear();
@@ -534,7 +534,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisQData(dictData, rMpEventDetailMS);
RStatEventQPO rStatEventQPO = new RStatEventQPO();
rStatEventQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -579,7 +579,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date", begin, end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
//季表
rStatOrgQPOQueryWrapper.clear();
@@ -638,7 +638,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisQData(dictData, rMpEventDetailMS);
RStatEventQPO rStatEventQPO = new RStatEventQPO();
rStatEventQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -701,7 +701,7 @@ public class RStatEventServiceImpl implements RStatEventService {
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
//详情表
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
//org年表
QueryWrapper<RStatOrgYPO> rStatOrgYPOQueryWrapper = new QueryWrapper<>();
//天表
@@ -722,7 +722,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date", begin, end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
// //年表
// rStatOrgYPOQueryWrapper.clear();
@@ -781,7 +781,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisQData(dictData, rMpEventDetailMS);
RStatEventYPO rStatEventYPO = new RStatEventYPO();
rStatEventYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -827,7 +827,7 @@ public class RStatEventServiceImpl implements RStatEventService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date", begin, end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
//年表
rStatOrgYPOQueryWrapper.clear();
@@ -886,7 +886,7 @@ public class RStatEventServiceImpl implements RStatEventService {
return;
}
//累计发生暂态监测点数
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
Integer statisData = getStatisQData(dictData, rMpEventDetailMS);
RStatEventYPO rStatEventYPO = new RStatEventYPO();
rStatEventYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -948,21 +948,21 @@ public class RStatEventServiceImpl implements RStatEventService {
}
//获取暂态各个类型发生的监测点数量及发生次数
private List<Integer> getTransientStatisData(DictData dictData, List<RMpEventDetailDPO> list) {
private List<Integer> getTransientStatisData(DictData dictData, List<RMpEventDetailD> list) {
List<Integer> result = new ArrayList<>(2);
Integer value = 0;
Integer count = 0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
value = Integer.valueOf(list.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailD::getSagTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_RISE.getCode())) {
value = Integer.valueOf(list.stream().filter(temp -> temp.getSwellTimes() > 0).count() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
value = Integer.valueOf(list.stream().filter(temp -> temp.getInterruptTimes() > 0).count() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum() + "");
count = Integer.valueOf(list.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum() + "");
}
result.add(value);
result.add(count);
@@ -971,7 +971,7 @@ public class RStatEventServiceImpl implements RStatEventService {
}
//获取暂态各个类型发生的监测点数量
private Integer getStatisData(DictData dictData, List<RMpEventDetailMPO> list) {
private Integer getStatisData(DictData dictData, List<RMpEventDetailM> list) {
Integer value = 0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
value = Integer.valueOf(list.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
@@ -988,32 +988,32 @@ public class RStatEventServiceImpl implements RStatEventService {
}
//季表月表相同id去重
private Integer getStatisQData(DictData dictData, List<RMpEventDetailMPO> list) {
private Integer getStatisQData(DictData dictData, List<RMpEventDetailM> list) {
Integer value = 0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
Map<String, RMpEventDetailMPO> idToObjectMap = list.stream()
Map<String, RMpEventDetailM> idToObjectMap = list.stream()
.filter(obj -> obj.getSagTimes() > 0) // 筛选count大于0的对象
.collect(Collectors.toMap(RMpEventDetailMPO::getMeasurementPointId, Function.identity(),
.collect(Collectors.toMap(RMpEventDetailM::getMeasurementPointId, Function.identity(),
(existing, replacement) -> existing.getSagTimes() > 0 ? existing : replacement)); // 对id去重仅保留计数大于0的对象
for (RMpEventDetailMPO obj : idToObjectMap.values()) {
for (RMpEventDetailM obj : idToObjectMap.values()) {
value += (obj.getSagTimes() > 0 ? 1 : 0);
}
}
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_RISE.getCode())) {
Map<String, RMpEventDetailMPO> idToObjectMap = list.stream()
Map<String, RMpEventDetailM> idToObjectMap = list.stream()
.filter(obj -> obj.getSwellTimes() > 0) // 筛选count大于0的对象
.collect(Collectors.toMap(RMpEventDetailMPO::getMeasurementPointId, Function.identity(),
.collect(Collectors.toMap(RMpEventDetailM::getMeasurementPointId, Function.identity(),
(existing, replacement) -> existing.getSwellTimes() > 0 ? existing : replacement)); // 对id去重仅保留计数大于0的对象
for (RMpEventDetailMPO obj : idToObjectMap.values()) {
for (RMpEventDetailM obj : idToObjectMap.values()) {
value += (obj.getSwellTimes() > 0 ? 1 : 0);
}
}
if (Objects.equals(dictData.getCode(), DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
Map<String, RMpEventDetailMPO> idToObjectMap = list.stream()
Map<String, RMpEventDetailM> idToObjectMap = list.stream()
.filter(obj -> obj.getInterruptTimes() > 0) // 筛选count大于0的对象
.collect(Collectors.toMap(RMpEventDetailMPO::getMeasurementPointId, Function.identity(),
.collect(Collectors.toMap(RMpEventDetailM::getMeasurementPointId, Function.identity(),
(existing, replacement) -> existing.getInterruptTimes() > 0 ? existing : replacement)); // 对id去重仅保留计数大于0的对象
for (RMpEventDetailMPO obj : idToObjectMap.values()) {
for (RMpEventDetailM obj : idToObjectMap.values()) {
value += (obj.getInterruptTimes() > 0 ? 1 : 0);
}
}

View File

@@ -7,6 +7,8 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.harmonic.pojo.po.*;
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgDMapper;
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgMMapper;
@@ -87,7 +89,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
Map<String, DictData> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getValue, dictData -> dictData));
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RStatOrgDPO> rStatOrgDPOQueryWrapper = new QueryWrapper<>();
calculatedParam.getIdList().forEach(deptGetChildrenMoreDTO -> {
@@ -105,7 +107,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
// rStatOrgDPOQueryWrapper.clear();
// rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -123,7 +125,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
return;
}
List<Integer> transientStatisData = getTransientStatisDataNew(dictData, rMpEventDetailDPOS);
List<Integer> transientStatisData = getTransientStatisDataNew(dictData, rMpEventDetailDS);
RStatEventVoltageDPO rStatEventVoltageDPO = new RStatEventVoltageDPO();
rStatEventVoltageDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
rStatEventVoltageDPO.setDataDate(localDate);
@@ -166,7 +168,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("data_date",localDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
rStatOrgDPOQueryWrapper.clear();
rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -183,7 +185,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
return;
}
List<Integer> transientStatisData = getTransientStatisDataNew(dictData, rMpEventDetailDPOS);
List<Integer> transientStatisData = getTransientStatisDataNew(dictData, rMpEventDetailDS);
RStatEventVoltageDPO rStatEventVoltageDPO = new RStatEventVoltageDPO();
rStatEventVoltageDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
rStatEventVoltageDPO.setDataDate(localDate);
@@ -219,21 +221,21 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
}
}
private List<Integer> getTransientStatisDataNew(DictData dictData, List<RMpEventDetailDPO> rMpEventDetailDPOS) {
private List<Integer> getTransientStatisDataNew(DictData dictData, List<RMpEventDetailD> rMpEventDetailDS) {
List<Integer> result = new ArrayList<>(2);
Integer value = 0;
Integer count = 0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
value = Integer.valueOf(rMpEventDetailDPOS.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailDS.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSagTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_RISE.getCode())) {
value = Integer.valueOf(rMpEventDetailDPOS.stream().filter(temp -> temp.getSwellTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailDS.stream().filter(temp -> temp.getSwellTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getSwellTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
value = Integer.valueOf(rMpEventDetailDPOS.stream().filter(temp -> temp.getInterruptTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDPOS.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailDS.stream().filter(temp -> temp.getInterruptTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailDS.stream().mapToInt(RMpEventDetailD::getInterruptTimes).sum() + "");
}
result.add(value);
result.add(count);
@@ -266,7 +268,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
Map<String, DictData> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getValue, dictData -> dictData));
//详情表
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
//org表
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
//天表
@@ -288,7 +290,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date",begin,end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
// rStatOrgMPOQueryWrapper.clear();
// rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -320,7 +322,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
List<RStatEventVoltageDPO> rStatEventVoltageDPOS = rStatEventVoltageDPOMapper.selectList(rStatEventVoltageDPOQueryWrapper);
//累计发生暂态监测点数
List<Integer> transientStatisDataNew = getTransientStatisDataNewByM(dictData, rMpEventDetailMPOS);
List<Integer> transientStatisDataNew = getTransientStatisDataNewByM(dictData, rMpEventDetailMS);
RStatEventVoltageMPO rStatEventVoltageMPO = new RStatEventVoltageMPO();
rStatEventVoltageMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
@@ -388,7 +390,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
between("data_date",begin,end);
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
rStatOrgMPOQueryWrapper.clear();
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -423,7 +425,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rStatEventVoltageMPO.setVoltageType(k1);
rStatEventVoltageMPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
List<Integer> transientStatisDataNew = getTransientStatisDataNewByM(dictData, rMpEventDetailMPOS);
List<Integer> transientStatisDataNew = getTransientStatisDataNewByM(dictData, rMpEventDetailMS);
/*3、日均发生暂态监测点数*/
double asDouble = rStatEventVoltageDPOS.stream().mapToDouble(RStatEventVoltageDPO::getEventMeasurement).average().getAsDouble();
@@ -474,21 +476,21 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
}
}
private List<Integer> getTransientStatisDataNewByM(DictData dictData, List<RMpEventDetailMPO> rMpEventDetailMPOS) {
private List<Integer> getTransientStatisDataNewByM(DictData dictData, List<RMpEventDetailM> rMpEventDetailMS) {
List<Integer> result = new ArrayList<>(2);
Integer value = 0;
Integer count = 0;
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_DIP.getCode())) {
value = Integer.valueOf(rMpEventDetailMPOS.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMPOS.stream().mapToInt(RMpEventDetailMPO::getSagTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailMS.stream().filter(temp -> temp.getSagTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMS.stream().mapToInt(RMpEventDetailM::getSagTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.VOLTAGE_RISE.getCode())) {
value = Integer.valueOf(rMpEventDetailMPOS.stream().filter(temp -> temp.getSwellTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMPOS.stream().mapToInt(RMpEventDetailMPO::getSwellTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailMS.stream().filter(temp -> temp.getSwellTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMS.stream().mapToInt(RMpEventDetailM::getSwellTimes).sum() + "");
}
if (Objects.equals(dictData.getCode(), DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
value = Integer.valueOf(rMpEventDetailMPOS.stream().filter(temp -> temp.getInterruptTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMPOS.stream().mapToInt(RMpEventDetailMPO::getInterruptTimes).sum() + "");
value = Integer.valueOf(rMpEventDetailMS.stream().filter(temp -> temp.getInterruptTimes() > 0).count() + "");
count = Integer.valueOf(rMpEventDetailMS.stream().mapToInt(RMpEventDetailM::getInterruptTimes).sum() + "");
}
result.add(value);
result.add(count);
@@ -536,7 +538,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
Map<String, DictData> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getValue, dictData -> dictData));
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailD> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RStatOrgDPO> rStatOrgDPOQueryWrapper = new QueryWrapper<>();
data.forEach(deptGetChildrenMoreDTO -> {
@@ -552,7 +554,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
rStatOrgDPOQueryWrapper.clear();
rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -564,9 +566,9 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
//循环拷贝
List<RMpEventDetailDNewPO> poList = new ArrayList<>();
for (RMpEventDetailDPO rMpEventDetailDPO : rMpEventDetailDPOS) {
for (RMpEventDetailD rMpEventDetailD : rMpEventDetailDS) {
RMpEventDetailDNewPO po = new RMpEventDetailDNewPO();
BeanUtils.copyProperties(rMpEventDetailDPO, po);
BeanUtils.copyProperties(rMpEventDetailD, po);
poList.add(po);
}
for (RMpEventDetailDNewPO rMpEventDetailDNewPO : poList) {
@@ -626,7 +628,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailDPOQueryWrapper.
in("measurement_point_id", collect1).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
List<RMpEventDetailD> rMpEventDetailDS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
rStatOrgDPOQueryWrapper.clear();
rStatOrgDPOQueryWrapper.select("effective_measurement").
@@ -638,9 +640,9 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
//循环拷贝
List<RMpEventDetailDNewPO> poList = new ArrayList<>();
for (RMpEventDetailDPO rMpEventDetailDPO : rMpEventDetailDPOS) {
for (RMpEventDetailD rMpEventDetailD : rMpEventDetailDS) {
RMpEventDetailDNewPO po = new RMpEventDetailDNewPO();
BeanUtils.copyProperties(rMpEventDetailDPO, po);
BeanUtils.copyProperties(rMpEventDetailD, po);
poList.add(po);
}
for (RMpEventDetailDNewPO rMpEventDetailDNewPO : poList) {
@@ -719,7 +721,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
Map<String, DictData> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getValue, dictData -> dictData));
//详情表
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
//org表
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
//天表
@@ -738,7 +740,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
rStatOrgMPOQueryWrapper.clear();
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -780,9 +782,9 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
//循环拷贝
List<RMpEventDetailMNewPO> poList = new ArrayList<>();
for (RMpEventDetailMPO rMpEventDetailMPO : rMpEventDetailMPOS) {
for (RMpEventDetailM rMpEventDetailM : rMpEventDetailMS) {
RMpEventDetailMNewPO po = new RMpEventDetailMNewPO();
BeanUtils.copyProperties(rMpEventDetailMPO, po);
BeanUtils.copyProperties(rMpEventDetailM, po);
poList.add(po);
}
for (RMpEventDetailMNewPO rMpEventDetailMNewPO : poList) {
@@ -853,7 +855,7 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
rMpEventDetailMPOQueryWrapper.
in("measurement_point_id", collect1).
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
List<RMpEventDetailM> rMpEventDetailMS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
rStatOrgMPOQueryWrapper.clear();
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
@@ -895,9 +897,9 @@ public class RStatEventVoltageServiceImpl implements RStatEventVoltageService {
//循环拷贝
List<RMpEventDetailMNewPO> poList = new ArrayList<>();
for (RMpEventDetailMPO rMpEventDetailMPO : rMpEventDetailMPOS) {
for (RMpEventDetailM rMpEventDetailM : rMpEventDetailMS) {
RMpEventDetailMNewPO po = new RMpEventDetailMNewPO();
BeanUtils.copyProperties(rMpEventDetailMPO, po);
BeanUtils.copyProperties(rMpEventDetailM, po);
poList.add(po);
}
for (RMpEventDetailMNewPO rMpEventDetailMNewPO : poList) {

View File

@@ -3,33 +3,22 @@ package com.njcn.prepare.harmonic.service.mysql.newalgorithm.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetBandDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.harmonic.pojo.po.RMpPartHarmonicDetailM;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpPartHarmonicDetailMMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.po.RStatSubstationMPO;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailMService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.prepare.harmonic.mapper.mysql.newalgorithm.RStatSubstationVoltageMPOMapper;
import com.njcn.prepare.harmonic.pojo.mysql.po.RStatSubstationVoltageMPO;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatSubstationVoltageMPOService;
@@ -60,7 +49,7 @@ public class RStatSubstationVoltageMPOServiceImpl extends MppServiceImpl<RStatSu
List<RStatSubstationVoltageMPO> result=new ArrayList<>();
RStatSubstationVoltageMPO po;
QueryWrapper<RMpPartHarmonicDetailM> queryWrapper = new QueryWrapper<>();
QueryWrapper<RMpEventDetailMPO> queryWrapper2 = new QueryWrapper<>();
QueryWrapper<RMpEventDetailM> queryWrapper2 = new QueryWrapper<>();
//单位
for (DeptGetSubStationDTO.Info info : idList) {
List<SubGetBase> stationIds = info.getStationIds();
@@ -87,7 +76,7 @@ public class RStatSubstationVoltageMPOServiceImpl extends MppServiceImpl<RStatSu
queryWrapper2.clear();
queryWrapper2.in("measurement_point_id",subGetBase.getUnitChildrenList())
.between("data_date",begin,end);
List<RMpEventDetailMPO> list = rMpEventDetailMService.list(queryWrapper2);
List<RMpEventDetailM> list = rMpEventDetailMService.list(queryWrapper2);
long count1 = list.stream().filter(x -> x.getSagTimes() > 0 || x.getSwellTimes() > 0 || x.getInterruptTimes() > 0).count();
if(count1>0){
eventCount=eventCount+1;

View File

@@ -14,7 +14,7 @@ import com.njcn.device.pms.pojo.param.PmsBaseParam;
import com.njcn.device.pms.pojo.param.PmsGeneratrixParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.event.pojo.po.RMpEventDetailD;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.po.send.ConverterIndexStatisticsPO;
import com.njcn.prepare.harmonic.mapper.mysql.send.ConverterIndexStatisticsPOMapper;
@@ -164,7 +164,7 @@ public class ConverterIndexStatisticsPOServiceImpl extends ServiceImpl<Converter
List<String> abnormallines;
if (!CollectionUtils.isEmpty(tempIds)) {
List<RStatLimitRateDPO> rStatLimitRateDPOS = irStatLimitRateDService.lambdaQuery().in(RStatLimitRateDPO::getLineId,tempIds).eq(RStatLimitRateDPO::getTime,localDate).eq(RStatLimitRateDPO::getPhasicType,"T").list();
List<RMpEventDetailDPO> rMpEventDetailDPOList = rMpEventDetailDService.lambdaQuery().in(RMpEventDetailDPO::getMeasurementPointId, tempIds).eq(RMpEventDetailDPO::getDataDate, localDate).list();
List<RMpEventDetailD> rMpEventDetailDList = rMpEventDetailDService.lambdaQuery().in(RMpEventDetailD::getMeasurementPointId, tempIds).eq(RMpEventDetailD::getDataDate, localDate).list();
List<String> limitIds = rStatLimitRateDPOS.stream().filter(temp ->
(temp.getVoltageDevOvertime() +
temp.getFlickerOvertime() +
@@ -236,9 +236,9 @@ public class ConverterIndexStatisticsPOServiceImpl extends ServiceImpl<Converter
temp.getFreqDevOvertime() +
temp.getINegOvertime()) > 0
).map(RStatLimitRateDPO::getLineId).distinct().collect(Collectors.toList());
List<String> eventLineIds = rMpEventDetailDPOList.stream().filter(temp -> (temp.getInterruptTimes() +
List<String> eventLineIds = rMpEventDetailDList.stream().filter(temp -> (temp.getInterruptTimes() +
temp.getSagTimes() +
temp.getSwellTimes()) > 0).map(RMpEventDetailDPO::getMeasurementPointId).distinct().collect(Collectors.toList());
temp.getSwellTimes()) > 0).map(RMpEventDetailD::getMeasurementPointId).distinct().collect(Collectors.toList());
limitIds.retainAll(eventLineIds);
abnormallines = limitIds;

View File

@@ -43,6 +43,7 @@ liteflow:
group: DEFAULT_GROUP
namespace: @nacos.namespace@
when-max-wait-time: 600000
print-banner: false
#项目日志的配置

View File

@@ -249,6 +249,9 @@ public class QuitRunningDeviceServiceImpl extends ServiceImpl<QuitRunningDeviceM
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
QuitRunningDeviceVO quitRunningDeviceVO = this.getVOById(businessId);
if(Objects.isNull(quitRunningDeviceVO)){
return null;
}
bpmInstanceInfo.setHistoryInstanceId(quitRunningDeviceVO.getHistoryInstanceId());
String sign = quitRunningDeviceVO.getGdName()
.concat(StrPool.SLASH)

View File

@@ -245,6 +245,9 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
SupervisionDevMainReportVO supervisionDevMainReportVO = this.querySurveyDetail(businessId);
if(Objects.isNull(supervisionDevMainReportVO)){
return null;
}
bpmInstanceInfo.setHistoryInstanceId(supervisionDevMainReportVO.getHistoryInstanceId());
String sign = supervisionDevMainReportVO.getOrgName()
.concat(StrPool.SLASH)

View File

@@ -324,7 +324,7 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
.concat(supervisionTempLineDebugVO.getLineName());
bpmInstanceInfo.setInstanceSign(sign);
}
return bpmInstanceInfo;
return null;
}
@Override

View File

@@ -216,7 +216,7 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl<Supervisio
.concat(supervisionTempLineReportVO.getLineName());
bpmInstanceInfo.setInstanceSign(sign);
}
return bpmInstanceInfo;
return null;
}
@Override

View File

@@ -359,7 +359,7 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
.concat(supervisionTempLineRunTestVO.getLineName());
bpmInstanceInfo.setInstanceSign(sign);
}
return bpmInstanceInfo;
return null;
}
@Override

View File

@@ -91,14 +91,13 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
private SupervisionUserComplaintPOService supervisionUserComplaintService;
/**
* 不创建工作流,只是创建一个告警单,需要待用户反馈后才会进入流程
*/
@Override
public String createLeaflet(String name, String deptId, String code, String id, Integer problemType, Integer leaflet, String issueDetail, String reformAdvice, String filePath) {
WarningLeaflet one = this.lambdaQuery().eq(WarningLeaflet::getProblemId, id).one();
if(Objects.isNull(one)){
if (Objects.isNull(one)) {
WarningLeaflet warningLeaflet = new WarningLeaflet();
warningLeaflet.setLeafletName(name);
warningLeaflet.setDeptId(deptId);
@@ -115,7 +114,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
warningLeaflet.setFilePath(filePath);
this.baseMapper.insert(warningLeaflet);
return warningLeaflet.getId();
}else {
} else {
//新增字段整改意见
one.setReformAdvice(reformAdvice);
one.setDealState(DealStateEnum.UNSOLVED.getCode());
@@ -130,7 +129,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
@Override
public Page<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(warningLeafletQueryParam)&& StringUtils.equals(warningLeafletQueryParam.getDealState(),"1")) {
if (Objects.nonNull(warningLeafletQueryParam) && StringUtils.equals(warningLeafletQueryParam.getDealState(), "1")) {
//添加上时间范围
warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())),
@@ -143,7 +142,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
warningLeafletVOQueryWrapper.in("supervision_warning_leaflet.dept_id", deptIds);
}
warningLeafletVOQueryWrapper
.eq(StringUtils.equals(warningLeafletQueryParam.getDealState(),"0"),"supervision_temp_line_run_test_warning.deal_state",0)
.eq(StringUtils.equals(warningLeafletQueryParam.getDealState(), "0"), "supervision_temp_line_run_test_warning.deal_state", 0)
.eq("supervision_warning_leaflet.state", DataStateEnum.ENABLE.getCode())
.eq("supervision_warning_leaflet.leaflet_type", LeafletTypeEnum.WARNING.getCode())
.orderByDesc("supervision_warning_leaflet.Update_Time");
@@ -263,12 +262,12 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
this.lambdaUpdate().set(WarningLeaflet::getStatus, status).eq(WarningLeaflet::getId, businessKey).update();
WarningLeaflet one = this.lambdaQuery().eq(WarningLeaflet::getId, businessKey).one();
//如果审核通过且problem_type不是在线监测的1技术监督管理2在线监测超标问题3用户投诉4现场测试超标,将对应能质量问题改成已解决,所有的预告警单改成已解决
if(status==2&&one.getProblemType()!=2){
if (status == 2 && one.getProblemType() != 2) {
//多次的预告警单是删除
this.lambdaUpdate().set(WarningLeaflet::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(WarningLeaflet::getId, businessKey)
.eq(WarningLeaflet::getProblemId,one.getProblemId()).update();
updatePowerProblem(one.getProblemType(),one.getProblemId());
.eq(WarningLeaflet::getProblemId, one.getProblemId()).update();
updatePowerProblem(one.getProblemType(), one.getProblemId());
}
}
@@ -276,18 +275,18 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
switch (problemType) {
//技术监督计划
case 1:
surveyTestService.lambdaUpdate().set(SurveyTest::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(SurveyTest::getId,problemId).update();
surveyTestService.lambdaUpdate().set(SurveyTest::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(SurveyTest::getId, problemId).update();
break;
//用户投诉问题
case 3:
supervisionUserComplaintService.lambdaUpdate().set(SupervisionUserComplaintPO::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(SupervisionUserComplaintPO::getId,problemId).update();
.eq(SupervisionUserComplaintPO::getId, problemId).update();
break;
//试运行监测点问题
//试运行监测点问题
case 4:
lineRunTestWarningService.lambdaUpdate().set(TempLineRunTestWarning::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(TempLineRunTestWarning::getId,problemId).update();
.eq(TempLineRunTestWarning::getId, problemId).update();
break;
default:
break;
@@ -312,8 +311,9 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
.concat(warningLeafletVO.getLeafletName())
.concat(type);
bpmInstanceInfo.setInstanceSign(sign);
return bpmInstanceInfo;
}
return bpmInstanceInfo;
return null;
}
@Override

View File

@@ -73,7 +73,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
private ISurveyTestService surveyTestService;
@Resource
private DicDataFeignClient dicDataFeignClient;
private DicDataFeignClient dicDataFeignClient;
@Override
@@ -81,7 +81,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
QueryWrapper<SurveyPlanVO> surveyPlanVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(surveyPlanQueryParam)) {
//添加上时间范围
surveyPlanVOQueryWrapper.and(x->x.between("supervision_survey_plan.plan_start_time",
surveyPlanVOQueryWrapper.and(x -> x.between("supervision_survey_plan.plan_start_time",
DateUtil.beginOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchEndTime()))).or().isNull("supervision_survey_plan.plan_start_time"));
//根据工程名称模糊搜索
@@ -94,14 +94,14 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
surveyPlanVOQueryWrapper.in("supervision_survey_plan.dept_id", deptIds);
}
surveyPlanVOQueryWrapper
.and(CollUtil.isNotEmpty(InstanceUtil.filterTaskStatus()),w -> w.in("supervision_survey_plan.status", InstanceUtil.filterTaskStatus())
.and(CollUtil.isNotEmpty(InstanceUtil.filterTaskStatus()), w -> w.in("supervision_survey_plan.status", InstanceUtil.filterTaskStatus())
.or()
.eq("supervision_survey_plan.create_by", RequestUtil.getUserIndex())
);
if (Objects.nonNull(surveyPlanQueryParam.getStatus())) {
surveyPlanVOQueryWrapper.in("supervision_survey_plan.status", surveyPlanQueryParam.getStatus());
}
surveyPlanVOQueryWrapper.eq(StringUtils.isNotBlank(surveyPlanQueryParam.getSupvType()),"supervision_survey_plan.supv_type",surveyPlanQueryParam.getSupvType());
surveyPlanVOQueryWrapper.eq(StringUtils.isNotBlank(surveyPlanQueryParam.getSupvType()), "supervision_survey_plan.supv_type", surveyPlanQueryParam.getSupvType());
}
surveyPlanVOQueryWrapper.eq("supervision_survey_plan.state", DataStateEnum.ENABLE.getCode())
.orderByDesc("supervision_survey_plan.Update_Time");
@@ -119,8 +119,8 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
String substation = record.getSubstation();
//保存草稿时未选择电站判断
if(StringUtils.isNotEmpty(substation)){
String[] subIds = substation.split(StrPool.COMMA);
if (StringUtils.isNotEmpty(substation)) {
String[] subIds = substation.split(StrPool.COMMA);
for (String subId : subIds) {
String name = lineFeignClient.getSubstationInfo(subId).getData().getName();
@@ -145,10 +145,10 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
SurveyPlan surveyPlan = new SurveyPlan();
BeanUtils.copyProperties(surveyPlanParam, surveyPlan);
//设置状态
if(Objects.equals(surveyPlanParam.getSaveOrCheckflag(),"1")){
if (Objects.equals(surveyPlanParam.getSaveOrCheckflag(), "1")) {
surveyPlan.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
}else {
} else {
surveyPlan.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
}
@@ -157,7 +157,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
surveyPlan = this.baseMapper.selectById(surveyPlan.getId());
// 发起 BPM 流程
if(Objects.equals(surveyPlanParam.getSaveOrCheckflag(),"2")){
if (Objects.equals(surveyPlanParam.getSaveOrCheckflag(), "2")) {
Map<String, Object> processInstanceVariables = new HashMap<>(16);
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(SupervisionKeyEnum.SURVEY_PLAN.getKey());
@@ -228,7 +228,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
if (surveyPlan.getCustomSubstationFlag() == 0) {
String substation = surveyPlan.getSubstation();
//保存草稿时未选择电站判断
if(StringUtils.isNotEmpty(substation)){
if (StringUtils.isNotEmpty(substation)) {
String[] subIds = substation.split(StrPool.COMMA);
for (String subId : subIds) {
SurveyTest surveyTest = new SurveyTest();
@@ -262,14 +262,17 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
SurveyPlanVO surveyPlanVO = this.getVOById(businessId);
if (Objects.isNull(surveyPlanVO)) {
return null;
}
bpmInstanceInfo.setHistoryInstanceId(surveyPlanVO.getHistoryInstanceId());
DictData data = dicDataFeignClient.getDicDataById(surveyPlanVO.getSupvType()).getData();
String name = "未知监督类型";
if(Objects.nonNull(data)){
if (Objects.nonNull(data)) {
name = data.getName();
}
String sign = name.concat("->")
.concat(surveyPlanVO.getSupvObjectName());
.concat(surveyPlanVO.getSupvObjectName());
bpmInstanceInfo.setInstanceSign(sign);
return bpmInstanceInfo;
}
@@ -285,7 +288,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
.select(SurveyPlan::getProcessInstanceId);
List<SurveyPlan> surveyPlanList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = surveyPlanList.stream().map(SurveyPlan::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
if (CollectionUtil.isNotEmpty(result)) {
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
@@ -305,11 +308,11 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
//系统内变电站信息
String substation = surveyPlanVO.getSubstation();
//保存草稿时未选择电站判断
if(StringUtils.isNotEmpty(substation)) {
if (StringUtils.isNotEmpty(substation)) {
String[] subIds = substation.split(StrPool.COMMA);
for (String subId : subIds) {
PollutionSubstationDTO data = lineFeignClient.getSubstationInfo(subId).getData();
if(ObjectUtil.isNotNull(data)){
if (ObjectUtil.isNotNull(data)) {
SurveySubstation surveySubstation = new SurveySubstation();
surveySubstation.setDataSource(0);
surveySubstation.setSubstationName(data.getName());
@@ -332,7 +335,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
@Override
public Boolean deleteSurveyPlan(List<String> supervisionId) {
List<SurveyPlan> surveyPlans = this.listByIds(supervisionId);
if(CollUtil.isEmpty(surveyPlans)){
if (CollUtil.isEmpty(surveyPlans)) {
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
}
//判断是否有权限操作

View File

@@ -316,7 +316,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
SurveyTestVO surveyTestVO = this.getVOById(businessId);
if(Objects.isNull(surveyTestVO)){
return bpmInstanceInfo;
return null;
}
bpmInstanceInfo.setHistoryInstanceId(surveyTestVO.getHistoryInstanceId());
DictData data = dicDataFeignClient.getDicDataById(surveyTestVO.getSupvType()).getData();

View File

@@ -51,6 +51,7 @@ public class UserReportDeleteServiceImpl extends ServiceImpl<UserReportPOMapper,
private final SupervisionTempLineReportService lineReportService;
private final SupervisionTempLineDebugPOService lineDebugService;
private final ISupervisionTempLineRunTestService lineRunTestService;
@Override
@Transactional(rollbackFor = Exception.class)
public void updateProcessStatus(String businessId, Integer status) {
@@ -80,7 +81,7 @@ public class UserReportDeleteServiceImpl extends ServiceImpl<UserReportPOMapper,
List<SupervisionTempLineReport> lineList = lineReportService.list(new LambdaQueryWrapper<SupervisionTempLineReport>()
.eq(SupervisionTempLineReport::getState, 0)
.eq(SupervisionTempLineReport::getUserId, businessId));
if(CollUtil.isNotEmpty(lineList)){
if (CollUtil.isNotEmpty(lineList)) {
List<String> lineIds = lineList.stream().map(SupervisionTempLineReport::getId).collect(Collectors.toList());
//删除监测点绑定信息
lineReportService.update(new LambdaUpdateWrapper<SupervisionTempLineReport>()
@@ -105,11 +106,12 @@ public class UserReportDeleteServiceImpl extends ServiceImpl<UserReportPOMapper,
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
UserReportPO byId = this.getById(businessId);
if(Objects.nonNull(byId)){
if (Objects.nonNull(byId)) {
bpmInstanceInfo.setHistoryInstanceId(byId.getHistoryInstanceId());
bpmInstanceInfo.setInstanceSign(byId.getProjectName()+"信息删除");
bpmInstanceInfo.setInstanceSign(byId.getProjectName() + "信息删除");
return bpmInstanceInfo;
}
return bpmInstanceInfo;
return null;
}
/**
@@ -156,7 +158,7 @@ public class UserReportDeleteServiceImpl extends ServiceImpl<UserReportPOMapper,
UserReportPO po = this.getById(userReportParam.getId());
if (ObjUtil.isNull(po)) {
throw new BusinessException("当前信息不存在,请确认信息是否存在");
}else{
} else {
if (Objects.equals(po.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus())) {
throw new BusinessException("当前流程以完成审批,无法重新发起");
}

View File

@@ -191,8 +191,9 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
if (Objects.nonNull(userReportGoNet)) {
bpmInstanceInfo.setHistoryInstanceId(userReportGoNet.getHistoryInstanceId());
bpmInstanceInfo.setInstanceSign(userReportGoNet.getProjectName());
return bpmInstanceInfo;
}
return bpmInstanceInfo;
return null;
}

View File

@@ -413,6 +413,9 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
UserReportPO userReportPO = this.getById(businessId);
if(Objects.isNull(userReportPO)){
return null;
}
bpmInstanceInfo.setHistoryInstanceId(userReportPO.getHistoryInstanceId());
bpmInstanceInfo.setInstanceSign(userReportPO.getProjectName());
return bpmInstanceInfo;

View File

@@ -79,7 +79,7 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
bpmInstanceInfo.setInstanceSign(userReportPO.getUserReportMessageJson().getProjectName()+"信息更新");
return bpmInstanceInfo;
}
return new BpmInstanceInfo();
return null;
}
@Override