Commit 4049bf7d authored by yangyang's avatar yangyang

风机 & 光伏 - 按时刻生成设备、子阵、场站和片区数据

parent 77aea05f
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import java.util.List;
/**
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.boot.module.jxiop.biz.service
*
* @author yangyang
* @version v1.0
* @date 2024/7/23 21:55
*/
public interface IFanHealthIndexService {
List<FanHealthIndex> getInfoListByGroupByZxtFan(String startTime, String tableName, String analysisObjectType);
/**
* 设备加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<FanHealthIndex> getInfoListByGroupBySbFan(String startTime, String tableName, String analysisObjectType);
/**
* 场站加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<FanHealthIndex> getInfoListByGroupByCzFan(String startTime, String tableName, String analysisObjectType);
/**
* 区域加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<FanHealthIndex> getInfoListByGroupByQyFan(String startTime, String tableName, String analysisObjectType);
/**
* 全域【所有 / 全国】加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<FanHealthIndex> getInfoListByGroupByQgFan(String startTime, String tableName, String analysisObjectType);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import java.util.List;
/**
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.boot.module.jxiop.biz.service.impl
*
* @author yangyang
* @version v1.0
* @date 2024/7/23 21:59
*/
public interface IPvHealthIndexService {
/**
* 设备加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List < FanHealthIndex >}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<PvHealthIndex> getInfoListByGroupBySbPv(String startTime,
String tableName,
String analysisObjectType);
/**
* 子阵加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<PvHealthIndex> getInfoListByGroupByZzPv(String startTime,
String tableName,
String analysisObjectType);
/**
* 场站加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<PvHealthIndex> getInfoListByGroupByCzPv(String startTime,
String tableName,
String analysisObjectType);
/**
* 片区加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<PvHealthIndex> getInfoListByGroupByQyPv(String startTime,
String tableName,
String analysisObjectType);
/**
* 全域【所有 / 全国】加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
* w1, w2, …, wn 是各个数据点的权重;
* x1, x2, …, xn 是各个数据点的数值;
* n 是数据点的总数。
*
* @param startTime startTime
* @param tableName tableName
* @param analysisObjectType analysisObjectType
* @return {@link List< FanHealthIndex>}
* @throws
* @author yangyang
* @date 2024/7/23 21:02
*/
List<PvHealthIndex> getInfoListByGroupByQgPv(String startTime,
String tableName,
String analysisObjectType);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWeightMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IFanHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* TODO(一句话描述该类的功能)
* 风电 - 按时刻生成子系统、设备、场站、区域 数据
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.boot.module.jxiop.biz.service.impl
......@@ -35,25 +27,12 @@ import java.util.stream.Collectors;
*/
@Component
@Slf4j
public class FanHealthIndexServiceImpl {
public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private IdxBizPvHealthIndexMapper idxFanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
@Autowired
private IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
@Autowired
private IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Autowired
private IdxBizFanWeightMapper idxBizFanWeightMapper;
/**
......@@ -71,12 +50,13 @@ public class FanHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<FanHealthIndex> getInfoListByGroupByZxtFan(String startTime, String tableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndicesZxt = fanHealthIndexMapper.getInfoList(startTime, tableName, analysisObjectType);
QueryWrapper<IdxBizFanWeight> idxBizFanWeightQueryWrapper = new QueryWrapper<>();
idxBizFanWeightQueryWrapper.ne("type", "5");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getOrgCode() + o.getPointName(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizFanWeight::getValue));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getArea() + o.getStation() + o.getEquipmentName() + o.getSubSystem() + o.getOrgCode() + o.getPointName()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -120,6 +100,7 @@ public class FanHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<FanHealthIndex> getInfoListByGroupBySbFan(String startTime, String tableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndicesZxt = fanHealthIndexMapper.getInfoList(startTime, tableName, analysisObjectType);
QueryWrapper<IdxBizFanWeight> idxBizFanWeightQueryWrapper = new QueryWrapper<>();
......@@ -167,6 +148,7 @@ public class FanHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<FanHealthIndex> getInfoListByGroupByCzFan(String startTime, String tableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndicesZxt = fanHealthIndexMapper.getInfoList(startTime, tableName, analysisObjectType);
QueryWrapper<IdxBizFanWeight> idxBizFanWeightQueryWrapper = new QueryWrapper<>();
......@@ -212,6 +194,7 @@ public class FanHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<FanHealthIndex> getInfoListByGroupByQyFan(String startTime, String tableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndicesZxt = fanHealthIndexMapper.getInfoList(startTime, tableName, analysisObjectType);
QueryWrapper<IdxBizFanWeight> idxBizFanWeightQueryWrapper = new QueryWrapper<>();
......@@ -255,6 +238,7 @@ public class FanHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<FanHealthIndex> getInfoListByGroupByQgFan(String startTime, String tableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndicesZxt = fanHealthIndexMapper.getInfoList(startTime, tableName, analysisObjectType);
QueryWrapper<IdxBizFanWeight> idxBizFanWeightQueryWrapper = new QueryWrapper<>();
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWeightMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPvHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -35,24 +28,12 @@ import java.util.stream.Collectors;
*/
@Component
@Slf4j
public class PvHealthIndexServiceImpl {
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private IdxBizPvHealthIndexMapper idxFanHealthIndexMapper;
public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
@Autowired
private IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
@Autowired
private IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Autowired
private IdxBizPvWeightMapper idxBizPvWeightMapper;
/**
......@@ -70,6 +51,7 @@ public class PvHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<PvHealthIndex> getInfoListByGroupBySbPv(String startTime,
String tableName,
String analysisObjectType) {
......@@ -119,6 +101,7 @@ public class PvHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<PvHealthIndex> getInfoListByGroupByZzPv(String startTime,
String tableName,
String analysisObjectType) {
......@@ -167,6 +150,7 @@ public class PvHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<PvHealthIndex> getInfoListByGroupByCzPv(String startTime,
String tableName,
String analysisObjectType) {
......@@ -214,6 +198,7 @@ public class PvHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<PvHealthIndex> getInfoListByGroupByQyPv(String startTime,
String tableName,
String analysisObjectType) {
......@@ -259,6 +244,7 @@ public class PvHealthIndexServiceImpl {
* @author yangyang
* @date 2024/7/23 21:02
*/
@Override
public List<PvHealthIndex> getInfoListByGroupByQgPv(String startTime,
String tableName,
String analysisObjectType) {
......
......@@ -9,6 +9,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IFanHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPvHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
......@@ -16,7 +18,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -54,6 +55,12 @@ public class TdengineTimeServiceImpl {
@Autowired
private HealthStatusIndicatorServiceImpl healthStatusIndicatorServiceImpl;
@Autowired
private IFanHealthIndexService fanHealthIndexService;
@Autowired
private IPvHealthIndexService pvHealthIndexService;
/**
* 风电 - 按时刻生成子系统、设备、场站、区域 数据
*/
......@@ -83,9 +90,6 @@ public class TdengineTimeServiceImpl {
}
@Autowired
private FanHealthIndexServiceImpl fanHealthIndexService;
public void insertMomentDataNew(String recDate) throws ParseException {
//s 489分钟 为 8小时 + 19分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -489), DateUtils.DATE_TIME_PATTERN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment