1.谐波趋势图调整

This commit is contained in:
wr
2024-01-12 17:38:19 +08:00
parent 3496f93c86
commit 3bf4273736
6 changed files with 1822 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package com.njcn.harmonic.pojo.param;
import lombok.Data;
/**
* @author wr
* @description
* @date 2024/1/12 10:20
*/
@Data
public class HarmonicHistoryParam {
private String startTime;
private String endTime;
private String valueTypeName;
private String lineId="16461";
}

View File

@@ -0,0 +1,83 @@
package com.njcn.harmonic.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.njcn.harmonic.pojo.param.HarmonicHistoryParam;
import com.njcn.influx.pojo.bo.HarmonicHistoryData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("oracle")
public interface HistoryDataMapper{
//相电压有效值
List<HarmonicHistoryData> getDataV(@Param("param") HarmonicHistoryParam param);
//线电压有效值
List<HarmonicHistoryData> getDataV_lvr(@Param("param") HarmonicHistoryParam param);
//电压偏差
List<HarmonicHistoryData> getDataV_vu_dev(@Param("param") HarmonicHistoryParam param);
//三相电压不平衡度
List<HarmonicHistoryData> getDataV_v_unbalance(@Param("param") HarmonicHistoryParam param);
//电压不平衡
List<HarmonicHistoryData> getDataV_v_zero(@Param("param") HarmonicHistoryParam param);
//电压总谐波畸变率
List<HarmonicHistoryData> getDataV_v_thd(@Param("param") HarmonicHistoryParam param);
//电流有效值
List<HarmonicHistoryData> getDataI_rms(@Param("param") HarmonicHistoryParam param);
//电流总畸变率
List<HarmonicHistoryData> getDataI_i_thd(@Param("param") HarmonicHistoryParam param);
//负序电流
List<HarmonicHistoryData> getDataI_i_neg(@Param("param") HarmonicHistoryParam param);
//频率 V9暂时代表Freq
List<HarmonicHistoryData> getDataV_i_neg(@Param("param") HarmonicHistoryParam param);
//谐波电压含有率
List<HarmonicHistoryData> getDataHarmratV_v(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波电流含有率
List<HarmonicHistoryData> getDataHarmratI_i(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波电压幅值
List<HarmonicHistoryData> getDataV_v(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波电流幅值
List<HarmonicHistoryData> getDataI_i(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波电压相角
List<HarmonicHistoryData> getDataHarmphasic_v(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波电流相角
List<HarmonicHistoryData> getDataHarmphasic_i(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//todo 缺少间谐波电压含有率
//todo 缺少间谐波电流含有率
//间谐波电压幅值
List<HarmonicHistoryData> getDataInharmrateV_v(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//间谐波电流幅值
List<HarmonicHistoryData> getDataInharmrateI_i(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波有功功率
List<HarmonicHistoryData> getDataHarmpowerP_p(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波无功功率
List<HarmonicHistoryData> getDataHarmpowerQ_q(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//谐波视在功率
List<HarmonicHistoryData> getDataHarmpowerS_s(@Param("param") HarmonicHistoryParam param,@Param("number") Integer number);
//三相有功功率
List<HarmonicHistoryData> getDataHarmpowerP(@Param("param") HarmonicHistoryParam param);
//三相无功功率
List<HarmonicHistoryData> getDataHarmpowerQ(@Param("param") HarmonicHistoryParam param);
//三相视在功率
List<HarmonicHistoryData> getDataHarmpowerS(@Param("param") HarmonicHistoryParam param);
//三相总有功功率
List<HarmonicHistoryData> getDataHarmpowerP_t(@Param("param") HarmonicHistoryParam param);
//三相总无功功率
List<HarmonicHistoryData> getDataHarmpowerQ_t(@Param("param") HarmonicHistoryParam param);
//三相总视在功率
List<HarmonicHistoryData> getDataHarmpowerS_t(@Param("param") HarmonicHistoryParam param);
//视在功率因数
List<HarmonicHistoryData> getDataHarmpowerP_pf(@Param("param") HarmonicHistoryParam param);
//位移功率因数
List<HarmonicHistoryData> getDataHarmpowerP_df(@Param("param") HarmonicHistoryParam param);
//总视在功率因数
List<HarmonicHistoryData> getDataHarmpowerP_pf_T(@Param("param") HarmonicHistoryParam param);
//总位移功率因数
List<HarmonicHistoryData> getDataHarmpowerP_df_T(@Param("param") HarmonicHistoryParam param);
//长时闪变
List<HarmonicHistoryData> getDataPlt(@Param("param") HarmonicHistoryParam param);
//短时闪变
List<HarmonicHistoryData> getDataFlicker(@Param("param") HarmonicHistoryParam param);
//电压波动
List<HarmonicHistoryData> getDataFluc(@Param("param") HarmonicHistoryParam param);
}

View File

@@ -0,0 +1,876 @@
<?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.harmonic.mapper.HistoryDataMapper'>
<select id="getDataV" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(RMS) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(RMS_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(RMS_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(RMS_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_lvr" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(RMSAB) as aValue,
sum(RMSBC) as bValue,
sum(RMSCA) as cValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(RMSAB_MAX) as aValue,
sum(RMSBC_MAX) as bValue,
sum(RMSCA_MAX) as cValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(RMSAB_MIN) as aValue,
sum(RMSBC_MIN) as bValue,
sum(RMSCA_MIN) as cValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(RMSAB_CP95) as aValue,
sum(RMSBC_CP95) as bValue,
sum(RMSCA_CP95) as cValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_vu_dev" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(VU_Dev) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(VU_Dev_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(VU_Dev_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(VU_Dev_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_v_unbalance" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(V_Unbalance) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(V_Unbalance_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(V_Unbalance_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(V_Unbalance_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_v_zero" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_zero) as aValue,
sum(v_pos) as bValue,
sum(v_neg) as cValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_zero_MAX) as aValue,
sum(v_pos_MAX) as bValue,
sum(v_neg_MAX) as cValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_zero_MIN) as aValue,
sum(v_pos_MIN) as bValue,
sum(v_neg_MIN) as cValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_zero_CP95) as aValue,
sum(v_pos_CP95) as bValue,
sum(v_neg_CP95) as cValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_v_thd" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_thd) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_thd_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_thd_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_thd_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataI_rms" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(RMS) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(RMS_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(RMS_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(RMS_CP95) as aValue
</if>
from
data_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataI_i_thd" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(I_THD) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(I_THD_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(I_THD_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(I_THD_CP95) as aValue
</if>
from
data_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataI_i_neg" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(I_NEG) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(I_NEG_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(I_NEG_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(I_NEG_CP95) as aValue
</if>
from
data_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_i_neg" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(FREQ) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(FREQ_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(FREQ_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(FREQ_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmratV_v" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_${number}_CP95) as aValue
</if>
from
data_harmrate_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmratI_i" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(i_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(i_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(i_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(i_${number}_CP95) as aValue
</if>
from
data_harmrate_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataV_v" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_${number}_CP95) as aValue
</if>
from
data_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataI_i" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(i_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(i_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(i_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(i_${number}_CP95) as aValue
</if>
from
data_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmphasic_v" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_${number}_CP95) as aValue
</if>
from
data_harmphasic_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmphasic_i" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(i_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(i_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(i_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(i_${number}_CP95) as aValue
</if>
from
data_harmphasic_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataInharmrateV_v" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(v_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(v_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(v_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(v_${number}_CP95) as aValue
</if>
from
data_inharm_v
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataInharmrateI_i" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(i_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(i_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(i_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(i_${number}_CP95) as aValue
</if>
from
data_inharm_i
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_p" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(p_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(p_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(p_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(p_${number}_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerQ_q" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(q_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(q_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(q_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(q_${number}_CP95) as aValue
</if>
from
data_harmpower_q
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerS_s" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(s_${number}) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(s_${number}_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(s_${number}_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(s_${number}_CP95) as aValue
</if>
from
data_harmpower_s
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(p) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(p_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(p_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(p_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerQ" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(q) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(q_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(q_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(q_CP95) as aValue
</if>
from
data_harmpower_q
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerS" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(s) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(s_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(s_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(s_CP95) as aValue
</if>
from
data_harmpower_s
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_t" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(p) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(p_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(p_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(p_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerQ_t" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(q) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(q_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(q_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(q_CP95) as aValue
</if>
from
data_harmpower_q
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerS_t" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(s) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(s_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(s_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(s_CP95) as aValue
</if>
from
data_harmpower_s
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_pf" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(pf) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(pf_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(pf_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(pf_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_df" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(df) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(df_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(df_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(df_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type !='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_pf_T" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(pf) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(pf_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(pf_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(pf_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataHarmpowerP_df_T" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
<if test="param.valueTypeName == ''">
sum(df) as aValue
</if>
<if test="param.valueTypeName == 'MAX'">
sum(df_MAX) as aValue
</if>
<if test="param.valueTypeName == 'MIN'">
sum(df_MIN) as aValue
</if>
<if test="param.valueTypeName == 'CP95'">
sum(df_CP95) as aValue
</if>
from
data_harmpower_p
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type ='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataPlt" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
sum(plt) as aValue
from
data_plt
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataFlicker" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
sum(pst) as aValue
from
data_flicker
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
<select id="getDataFluc" resultType="com.njcn.influx.pojo.bo.HarmonicHistoryData">
select
TIMEID as timeId,
PHASIC_TYPE as phasicType,
sum(fluc) as aValue
from
data_fluc
<where>
timeId between to_date(#{param.startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{param.endTime},'yyyy-mm-DD hh24:mi:ss')
and phasic_type!='T'
and lineid = #{param.lineId}
group by timeid,PHASIC_TYPE
order by timeId asc
</where>
</select>
</mapper>

View File

@@ -0,0 +1,19 @@
package com.njcn.harmonic.service;
import com.njcn.harmonic.pojo.param.HistoryParam;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import java.util.List;
/**
* @author wr
* @description
* @date 2024/1/11 16:14
*/
public interface OracleResultService {
List<HistoryDataResultVO> getHistoryResult(HistoryParam historyParam);
List<HistoryDataResultVO> getHistoryResult2(HistoryParam historyParam);
}

View File

@@ -0,0 +1,815 @@
package com.njcn.harmonic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.biz.utils.COverlimitUtil;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.harmonic.mapper.HistoryDataMapper;
import com.njcn.harmonic.pojo.QueryResultLimitVO;
import com.njcn.harmonic.pojo.param.HarmonicHistoryParam;
import com.njcn.harmonic.pojo.param.HistoryParam;
import com.njcn.harmonic.pojo.vo.EventDetailVO;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import com.njcn.harmonic.service.OracleResultService;
import com.njcn.influx.pojo.bo.HarmonicHistoryData;
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.DictData;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author wr
* @description
* @date 2024/1/11 16:15
*/
@Service
@AllArgsConstructor
public class OracleResultServiceImpl implements OracleResultService {
private final EventDetailFeignClient eventDetailFeignClient;
private final CommTerminalGeneralClient commTerminalGeneralClient;
private final DicDataFeignClient dicDataFeignClient;
private final HistoryDataMapper HistoryDataMapper;
@Override
public List<HistoryDataResultVO> getHistoryResult(HistoryParam historyParam) {
List<HistoryDataResultVO> historyDataResultVOList = new ArrayList<>();
//获取监测点
String[] points = historyParam.getLineId();
Integer number = 0;
for (int i = 0; i < points.length; i++) {
HistoryDataResultVO historyDataResultVO;
List<EventDetail> eventDetailList = eventDetailFeignClient.getEventDetailData(points[i], historyParam.getSearchBeginTime(), historyParam.getSearchEndTime()).getData();
List<EventDetailVO> eventDetailVOList = new ArrayList<>();
if (!eventDetailList.isEmpty()) {
for (EventDetail eventdetail : eventDetailList) {
String timeText = eventdetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
EventDetailVO eventDetailVO = new EventDetailVO();
eventDetailVO.setId(eventdetail.getEventId());
eventDetailVO.setTime(timeText);
eventDetailVOList.add(eventDetailVO);
}
}
//获取指标
String[] contions = historyParam.getCondition();
for (int j = 0; j < contions.length; j++) {
if ("40".equals(contions[j]) || "41".equals(contions[j]) || "42".equals(contions[j]) || "43".equals(contions[j])
|| "44".equals(contions[j]) || "45".equals(contions[j]) || "50".equals(contions[j]) || "51".equals(contions[j])
|| "52".equals(contions[j])) {
number = historyParam.getHarmonic();
}
if ("46".equals(contions[j]) || "47".equals(contions[j]) || "48".equals(contions[j]) || "49".equals(contions[j])) {
number = historyParam.getInHarmonic();
}
historyDataResultVO = getCondition(historyParam.getSearchBeginTime(), historyParam.getSearchEndTime(), points[i], contions[j], number, historyParam.getValueType(), historyParam.getPtType());
historyDataResultVO.setEventDetail(eventDetailVOList);
historyDataResultVOList.add(historyDataResultVO);
}
}
return historyDataResultVOList;
}
@Override
public List<HistoryDataResultVO> getHistoryResult2(HistoryParam historyParam) {
HarmonicHistoryParam param=new HarmonicHistoryParam();
param.setStartTime("2023-12-01 00:00:00");
param.setEndTime("2023-12-01 23:59:59");
param.setValueTypeName("");
List<HarmonicHistoryData> data_v = HistoryDataMapper.getDataFluc(param);
param.setValueTypeName("MAX");
List<HarmonicHistoryData> data_v2 = HistoryDataMapper.getDataFluc(param);
param.setValueTypeName("MIN");
List<HarmonicHistoryData> data_v3 = HistoryDataMapper.getDataFluc(param);
param.setValueTypeName("CP95");
List<HarmonicHistoryData> data_v4 = HistoryDataMapper.getDataFluc(param);
return null;
}
@SneakyThrows
private HistoryDataResultVO getCondition(String startTime, String endTime, String lineId, String contion, Integer number, Integer valueType, Integer ptType) {
HistoryDataResultVO historyDataResultVO = new HistoryDataResultVO();
QueryResultLimitVO queryResultLimitVO = getQueryResult(startTime, endTime, lineId, contion, number, valueType, ptType);
List<HarmonicHistoryData> harmonicHistoryDataList = queryResultLimitVO.getHarmonicHistoryDataList();
BeanUtil.copyProperties(queryResultLimitVO, historyDataResultVO);
//时间轴
List<Date> time = new ArrayList<>();
//A相值
List<Float> aValue;
//B相值
List<Float> bValue = new ArrayList<>();
//C相值
List<Float> cValue = new ArrayList<>();
//针对统计相别为T时存放的数据
List<Float> fValue = new ArrayList<>();
List<List<Object>> objectListData = new ArrayList<>();
if (CollectionUtil.isNotEmpty(harmonicHistoryDataList)) {
//相别统计为T时业务数据处理
if (StrUtil.isBlank(harmonicHistoryDataList.get(0).getPhasicType()) || harmonicHistoryDataList.get(0).getPhasicType().equalsIgnoreCase("t")) {
for (HarmonicHistoryData harmonicHistoryData : harmonicHistoryDataList) {
time.add(PubUtils.instantToDate(harmonicHistoryData.getTime()));
fValue.add(BigDecimal.valueOf(harmonicHistoryData.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue());
//返回结果有多个值,需要额外处理下
if (Integer.parseInt(contion) == 14) {
bValue.add(BigDecimal.valueOf(harmonicHistoryData.getBValue()).setScale(4, RoundingMode.HALF_UP).floatValue());
cValue.add(BigDecimal.valueOf(harmonicHistoryData.getCValue()).setScale(4, RoundingMode.HALF_UP).floatValue());
}
}
//组装二维数组
for (int i = 0; i < time.size(); i++) {
List<Object> objects = new ArrayList<>();
objects.add(time.get(i));
objects.add(fValue.get(i));
if (Integer.parseInt(contion) == 14) {
objects.add(bValue.get(i));
objects.add(cValue.get(i));
}
objectListData.add(objects);
}
historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit());
historyDataResultVO.setLowerLimit(queryResultLimitVO.getLowerLimit());
historyDataResultVO.setMinValue(Collections.min(fValue));
historyDataResultVO.setMaxValue(Collections.max(fValue));
historyDataResultVO.setValue(objectListData);
} else {
//按时间分组
Map<Instant,List<HarmonicHistoryData>> map = harmonicHistoryDataList.stream().collect(Collectors.groupingBy(HarmonicHistoryData::getTime,TreeMap::new, Collectors.toList()));
Float maxI = null;
Float minI = null;
for (Map.Entry<Instant, List<HarmonicHistoryData>> entry : map.entrySet()) {
List<HarmonicHistoryData> val = entry.getValue();
Object[] objects = {PubUtils.instantToDate(entry.getKey()),0,0,0};
//需要保证val的长度为3
if(val.size()!=3){
for(int i =0;i<3-val.size();i++){
HarmonicHistoryData tem = new HarmonicHistoryData();
tem.setAValue(0f);
val.add(tem);
}
}
for (HarmonicHistoryData harmonicHistoryData : val) {
if (InfluxDBTableConstant.PHASE_TYPE_A.equalsIgnoreCase(harmonicHistoryData.getPhasicType())) {
BigDecimal a = BigDecimal.valueOf(harmonicHistoryData.getAValue()).setScale(4, RoundingMode.HALF_UP);
objects[1] =a;
maxI = max(maxI, a.floatValue());
minI = min(minI, a.floatValue());
} else if (InfluxDBTableConstant.PHASE_TYPE_B.equalsIgnoreCase(harmonicHistoryData.getPhasicType())) {
BigDecimal b = BigDecimal.valueOf(harmonicHistoryData.getAValue()).setScale(4, RoundingMode.HALF_UP);
objects[2] = b;
maxI = max(maxI, b.floatValue());
minI = min(minI, b.floatValue());
} else if (InfluxDBTableConstant.PHASE_TYPE_C.equalsIgnoreCase(harmonicHistoryData.getPhasicType())) {
BigDecimal c = BigDecimal.valueOf(harmonicHistoryData.getAValue()).setScale(4, RoundingMode.HALF_UP);
objects[3] = c;
maxI = max(maxI, c.floatValue());
minI = min(minI, c.floatValue());
}
}
List<Object> list = new ArrayList<>(Arrays.asList(objects));
objectListData.add(list);
};
historyDataResultVO.setMaxValue(maxI);
historyDataResultVO.setMinValue(minI);
historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit());
historyDataResultVO.setLowerLimit(queryResultLimitVO.getLowerLimit());
historyDataResultVO.setValue(objectListData);
}
} else {
return historyDataResultVO;
}
return historyDataResultVO;
}
private QueryResultLimitVO getQueryResult(String startTime, String endTime, String lineId, String contion, Integer number, Integer valueType, Integer ptType) {
PqsDeviceUnit pqsDeviceUnit = commTerminalGeneralClient.lineUnitDetail(lineId).getData();
QueryResultLimitVO queryResultLimitVO = new QueryResultLimitVO();
if (!lineId.isEmpty()) {
Float topLimit = 0f;
Float lowerLimit = 0f;
Integer type=0;
//获取监测点信息
LineDevGetDTO lineDetailDataVO = commTerminalGeneralClient.getMonitorDetail(lineId).getData();
//获取限值
Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(lineId).getData();
if(Objects.isNull(overlimit)){
//对配网没有限值的统一处理
DictData dictData = dicDataFeignClient.getDicDataById(lineDetailDataVO.getVoltageLevel()).getData();
type=1;
float voltageLevel = Float.parseFloat(dictData.getValue());
float shortVal = COverlimitUtil.getDlCapByVoltageLevel(voltageLevel);
overlimit = COverlimitUtil.globalAssemble(voltageLevel,10f,10f,shortVal,1,1);
}
String valueTypeName = "";
switch (valueType) {
case 1:
valueTypeName = "";
break;
case 2:
valueTypeName = "MIN";
break;
case 3:
valueTypeName = "MAX";
break;
case 4:
valueTypeName = "CP95";
break;
default:
break;
}
List<String> phasicType = new ArrayList<>();
List<String> unit = new ArrayList<>();
String targetName = "";
switch (Integer.parseInt(contion)) {
case 10:
//相电压有效值
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add(pqsDeviceUnit.getPhaseVoltage());
targetName = "相电压有效值";
break;
case 11:
//线电压有效值
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
unit.add(pqsDeviceUnit.getLineVoltage());
targetName = "线电压有效值";
break;
case 12:
//电压偏差
topLimit = overlimit.getVoltageDev();
lowerLimit = overlimit.getUvoltageDev();
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("%");
targetName = "电压偏差";
break;
case 13:
//三相电压不平衡度
topLimit = overlimit.getUbalance();
phasicType.add("三相电压不平衡度");
unit.add("%");
targetName = "三相电压不平衡度";
break;
case 14:
//电压不平衡
phasicType.add("零序电压");
phasicType.add("正序电压");
phasicType.add("负序电压");
unit.add(pqsDeviceUnit.getNoPositiveV());
unit.add(pqsDeviceUnit.getPositiveV());
unit.add(pqsDeviceUnit.getNoPositiveV());
targetName = "电压不平衡";
break;
case 15:
//电压总谐波畸变率
topLimit = overlimit.getUaberrance();
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("%");
targetName = "电压总谐波畸变率";
break;
case 20:
//电流有效值
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("A");
targetName = "电流有效值";
break;
case 21:
//电流总畸变率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("%");
targetName = "电流总谐波畸变率";
break;
case 22:
//负序电流
topLimit = overlimit.getINeg();
phasicType.add("负序电流");
unit.add("A");
targetName = "负序电流";
break;
case 30:
//频率 V9暂时代表Freq
topLimit = 50 + overlimit.getFreqDev();
lowerLimit = 50 - overlimit.getFreqDev();
phasicType.add("频率");
unit.add("Hz");
targetName = "频率";
break;
case 40:
//谐波电压含有率
if (number != 1) {
if (number < 26) {
topLimit = PubUtils.getValueByMethod(overlimit, "getUharm", number);
}
}
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("%");
targetName = "谐波电压含有率";
break;
case 41:
//谐波电流含有率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("%");
targetName = "谐波电流含有率";
break;
case 42:
//谐波电压幅值
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
if (number == 1) {
unit.add(pqsDeviceUnit.getVfundEffective());
} else {
unit.add("V");
}
targetName = "谐波电压幅值";
break;
case 43:
//谐波电流幅值
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("A");
targetName = "谐波电流幅值";
break;
case 44:
//谐波电压相角
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("°");
targetName = "谐波电压相角";
break;
case 45:
//谐波电流相角
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("°");
targetName = "谐波电流相角";
break;
case 46:
//间谐波电压含有率
topLimit = PubUtils.getValueByMethod(overlimit, "getInuharm", number);
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("%");
targetName = "间谐波电压含有率";
break;
case 47:
//间谐波电流含有率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("%");
targetName = "间谐波电流含有率";
break;
case 48:
//间谐波电压幅值
targetName = "间谐波电压幅值";
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add(pqsDeviceUnit.getPhaseVoltage());
break;
case 49:
//间谐波电流幅值
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("A");
targetName = "间谐波电流幅值";
break;
case 50:
//谐波有功功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
if (number == 1) {
unit.add(pqsDeviceUnit.getFundActiveP());
} else {
unit.add("W");
}
targetName = "谐波有功功率";
break;
case 51:
//谐波无功功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
if (number == 1) {
unit.add(pqsDeviceUnit.getTotalNoP());
} else {
unit.add("Var");
}
targetName = "谐波无功功率";
break;
case 52:
//谐波视在功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
if (number == 1) {
unit.add(pqsDeviceUnit.getTotalViewP());
} else {
unit.add("VA");
}
targetName = "谐波视在功率";
break;
case 53:
//三相有功功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add(pqsDeviceUnit.getTotalActiveP());
targetName = "三相有功功率";
break;
case 54:
//三相无功功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add(pqsDeviceUnit.getTotalNoP());
targetName = "三相无功功率";
break;
case 55:
//三相视在功率
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add(pqsDeviceUnit.getTotalViewP());
targetName = "三相视在功率";
break;
case 56:
//三相总有功功率
phasicType.add("三相总有功功率");
unit.add(pqsDeviceUnit.getTotalActiveP());
targetName = "三相总有功功率";
break;
case 57:
//三相总无功功率
phasicType.add("三相总无功功率");
unit.add(pqsDeviceUnit.getTotalNoP());
targetName = "三相总无功功率";
break;
case 58:
//三相总视在功率
phasicType.add("三相总视在功率");
unit.add(pqsDeviceUnit.getTotalViewP());
targetName = "三相总视在功率";
break;
case 59:
//视在功率因数
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
targetName = "视在功率因数";
break;
case 591:
//位移功率因数
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
targetName = "位移功率因数";
break;
case 592:
//总视在功率因数
phasicType.add("总视在功率因数");
targetName = "总视在功率因数";
break;
case 593:
//总位移功率因数
phasicType.add("总位移功率因数");
targetName = "总位移功率因数";
break;
case 61:
//长时闪变
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
topLimit = overlimit.getFlicker();
targetName = "长时闪变";
break;
case 60:
//短时闪变
topLimit = overlimit.getFlicker();
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
targetName = "短时闪变";
break;
case 62:
//电压波动
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
targetName = "电压波动";
break;
default:
break;
}
//大致有3种类型
//1、一次查询返回3条记录分别为A/B/C三相的结果
//2、一次查询返回一条记录以T相为条件返回某3个指标值
//3、一次查询返回一条记录以T相为条件返回某1个指标值
HarmonicHistoryParam historyParam=new HarmonicHistoryParam();
historyParam.setStartTime(startTime+InfluxDBTableConstant.START_TIME);
historyParam.setEndTime(endTime+InfluxDBTableConstant.END_TIME);
historyParam.setValueTypeName(valueTypeName);
historyParam.setLineId(lineId);
queryResultLimitVO.setHarmonicHistoryDataList(setHistoryDataList(historyParam,contion,number,type));
queryResultLimitVO.setTopLimit(topLimit);
queryResultLimitVO.setLowerLimit(lowerLimit);
queryResultLimitVO.setPhaiscType(phasicType);
queryResultLimitVO.setUnit(unit);
queryResultLimitVO.setLineName(lineDetailDataVO.getPointName());
queryResultLimitVO.setHarmNum(number);
queryResultLimitVO.setTargetName(targetName);
} else {
return queryResultLimitVO;
}
return queryResultLimitVO;
}
/**
* 数值赋值
* @param historyParam
* @param contion
* @param number
* @param type 区分主配网
* @return
*/
private List<HarmonicHistoryData> setHistoryDataList(HarmonicHistoryParam historyParam,String contion,Integer number,Integer type){
List<HarmonicHistoryData> harmonicHistoryData = new ArrayList<>();
switch (Integer.parseInt(contion)) {
case 10:
harmonicHistoryData=HistoryDataMapper.getDataFluc(historyParam);
break;
case 11:
//线电压有效值
harmonicHistoryData=HistoryDataMapper.getDataV_lvr(historyParam);
break;
case 12:
//电压偏差
harmonicHistoryData=HistoryDataMapper.getDataV_vu_dev(historyParam);
break;
case 13:
//三相电压不平衡度
harmonicHistoryData=HistoryDataMapper.getDataV_v_unbalance(historyParam);
break;
case 14:
//电压不平衡
harmonicHistoryData=HistoryDataMapper.getDataV_v_zero(historyParam);
break;
case 15:
//电压总谐波畸变率
harmonicHistoryData=HistoryDataMapper.getDataV_v_thd(historyParam);
break;
case 20:
//电流有效值
harmonicHistoryData=HistoryDataMapper.getDataI_rms(historyParam);
break;
case 21:
//电流总畸变率
harmonicHistoryData=HistoryDataMapper.getDataI_i_thd(historyParam);
break;
case 22:
//负序电流
harmonicHistoryData=HistoryDataMapper.getDataI_i_neg(historyParam);
break;
case 30:
//频率 V9暂时代表Freq
harmonicHistoryData=HistoryDataMapper.getDataV_i_neg(historyParam);
break;
case 40:
//谐波电压含有率
harmonicHistoryData=HistoryDataMapper.getDataHarmratV_v(historyParam,number);
break;
case 41:
//谐波电流含有率
harmonicHistoryData=HistoryDataMapper.getDataHarmratI_i(historyParam,number);
break;
case 42:
//谐波电压幅值
harmonicHistoryData=HistoryDataMapper.getDataV_v(historyParam,number);
break;
case 43:
//谐波电流幅值
harmonicHistoryData=HistoryDataMapper.getDataI_i(historyParam,number);
break;
case 44:
//谐波电压相角
harmonicHistoryData=HistoryDataMapper.getDataHarmphasic_v(historyParam,number);
break;
case 45:
//谐波电流相角
harmonicHistoryData=HistoryDataMapper.getDataHarmphasic_i(historyParam,number);
break;
case 46:
//间谐波电压含有率
break;
case 47:
//间谐波电流含有率
break;
case 48:
//间谐波电压幅值
harmonicHistoryData=HistoryDataMapper.getDataInharmrateV_v(historyParam,number);
break;
case 49:
//间谐波电流幅值
harmonicHistoryData=HistoryDataMapper.getDataInharmrateI_i(historyParam,number);
break;
case 50:
//谐波有功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_p(historyParam,number);
break;
case 51:
//谐波无功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerQ_q(historyParam,number);
break;
case 52:
//谐波视在功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerS_s(historyParam,number);
break;
case 53:
//三相有功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP(historyParam);
break;
case 54:
//三相无功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerQ(historyParam);
break;
case 55:
//三相视在功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerS(historyParam);
break;
case 56:
//三相总有功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_t(historyParam);
break;
case 57:
//三相总无功功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerQ_t(historyParam);
break;
case 58:
//三相总视在功率
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerS_t(historyParam);
break;
case 59:
//视在功率因数
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_pf(historyParam);
break;
case 591:
//位移功率因数
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_df(historyParam);
break;
case 592:
//总视在功率因数
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_pf_T(historyParam);
break;
case 593:
//总位移功率因数
harmonicHistoryData=HistoryDataMapper.getDataHarmpowerP_df_T(historyParam);
break;
case 61:
//长时闪变
harmonicHistoryData=HistoryDataMapper.getDataPlt(historyParam);
break;
case 60:
//短时闪变
harmonicHistoryData=HistoryDataMapper.getDataFlicker(historyParam);
break;
case 62:
//电压波动
harmonicHistoryData=HistoryDataMapper.getDataFluc(historyParam);
break;
default:
break;
}
return harmonicHistoryData;
}
private Float max(Float ding,Float a){
if(Objects.isNull(ding)){
ding = a;
}
if(a>ding){
ding = a;
}
return ding;
}
private Float min(Float ding,Float a){
if(Objects.isNull(ding)){
ding = a;
}
if(a<ding){
ding = a;
}
return ding;
}
}

View File

@@ -28,4 +28,11 @@ public class HarmonicHistoryData implements Serializable {
private Float bValue;
private Float cValue;
private Instant timeId;
public void setTimeId(Instant timeId) {
this.timeId = timeId;
this.time = timeId;
}
}