海南初始版本提交
This commit is contained in:
@@ -30,7 +30,9 @@ public enum AdvanceResponseEnum {
|
||||
|
||||
RESPONSIBILITY_PARAMETER_ERROR("A0101","调用接口程序计算失败,参数非法"),
|
||||
|
||||
EVENT_EMPTY("A0102","没有查询到未分析事件")
|
||||
EVENT_EMPTY("A0102","没有查询到未分析事件"),
|
||||
USER_NAME_EXIST("A0103","用户名已存在"),
|
||||
DATA_NOT_FOUND("A0104","数据缺失,请根据模版上传近两周数据"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.njcn.advance.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Description: 承载能力评估相关枚举
|
||||
* @Param:
|
||||
* @return:
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/31
|
||||
*/
|
||||
@Getter
|
||||
|
||||
public enum CarryingCapacityEnum {
|
||||
|
||||
K("K","0.8","海南日照修正系数"),
|
||||
/**
|
||||
* h 3 ,5 ,7 ,9 ,11 ,13或者偶次
|
||||
* k_h 1.62, ,1.28 ,0.72 ,0.18 ,0.08 ,0
|
||||
*/
|
||||
K_H_2("K_H_2","0.00","2次谐波电流K_2系数"),
|
||||
K_H_3("K_H_3","1.62","3次谐波电流K_3系数"),
|
||||
K_H_4("K_H_4","0.00","4次谐波电流K_4系数"),
|
||||
K_H_5("K_H_5","1.28","5次谐波电流K_5系数"),
|
||||
K_H_6("K_H_6","0.00","6次谐波电流K_6系数"),
|
||||
K_H_7("K_H_7","0.72","7次谐波电流K_7系数"),
|
||||
K_H_8("K_H_8","0.00","8次谐波电流K_8系数"),
|
||||
K_H_9("K_H_9","0.18","9次谐波电流K_9系数"),
|
||||
K_H_10("K_H_10","0.00","10次谐波电流K_10系数"),
|
||||
K_H_11("K_H_11","0.08","11次谐波电流K_11系数"),
|
||||
K_H_12("K_H_12","0.00","12次谐波电流K_12系数"),
|
||||
K_H_13("K_H_13","0.00","13次谐波电流K_13系数"),
|
||||
K_H_14("K_H_14","0.00","14次谐波电流K_14系数"),
|
||||
K_H_15("K_H_15","0.00","15次谐波电流K_15系数"),
|
||||
K_H_16("K_H_16","0.00","16次谐波电流K_16系数"),
|
||||
K_H_17("K_H_17","0.00","17次谐波电流K_17系数"),
|
||||
K_H_18("K_H_18","0.00","18次谐波电流K_18系数"),
|
||||
K_H_19("K_H_19","0.00","19次谐波电流K_19系数"),
|
||||
K_H_20("K_H_20","0.00","20次谐波电流K_20系数"),
|
||||
K_H_21("K_H_21","0.00","21次谐波电流K_21系数"),
|
||||
K_H_22("K_H_22","0.00","22次谐波电流K_22系数"),
|
||||
K_H_23("K_H_23","0.00","23次谐波电流K_23系数"),
|
||||
K_H_24("K_H_24","0.00","24次谐波电流K_24系数"),
|
||||
K_H_25("K_H_25","0.00","25次谐波电流K_25系数"),
|
||||
|
||||
//光伏逆变器第h次的典型谐波电流含有率:I_INV_H
|
||||
I_INV_2("I_INV_2","0.254","2次典型谐波电流含有率"),
|
||||
I_INV_3("I_INV_3","0.121","3次典型谐波电流含有率"),
|
||||
I_INV_4("I_INV_4","0.087","4次典型谐波电流含有率"),
|
||||
I_INV_5("I_INV_5","2.446","5次典型谐波电流含有率"),
|
||||
I_INV_6("I_INV_6","0.024","6次典型谐波电流含有率"),
|
||||
I_INV_7("I_INV_7","1.629","7次典型谐波电流含有率"),
|
||||
I_INV_8("I_INV_8","0.042","8次典型谐波电流含有率"),
|
||||
I_INV_9("I_INV_9","0.039","9次典型谐波电流含有率"),
|
||||
I_INV_10("I_INV_10","0.037","10次典型谐波电流含有率"),
|
||||
I_INV_11("I_INV_11","0.439","11次典型谐波电流含有率"),
|
||||
I_INV_12("I_INV_12","0.021","12次典型谐波电流含有率"),
|
||||
I_INV_13("I_INV_13","0.379","13次典型谐波电流含有率"),
|
||||
I_INV_14("I_INV_14","0.042","14次典型谐波电流含有率"),
|
||||
I_INV_15("I_INV_15","0.037","15次典型谐波电流含有率"),
|
||||
I_INV_16("I_INV_16","0.043","16次典型谐波电流含有率"),
|
||||
I_INV_17("I_INV_17","0.263","17次典型谐波电流含有率"),
|
||||
I_INV_18("I_INV_18","0.017","18次典型谐波电流含有率"),
|
||||
I_INV_19("I_INV_19","0.197","19次典型谐波电流含有率"),
|
||||
I_INV_20("I_INV_20","0.062","20次典型谐波电流含有率"),
|
||||
I_INV_21("I_INV_21","0.024","21次典型谐波电流含有率"),
|
||||
I_INV_22("I_INV_22","0.032","22次典型谐波电流含有率"),
|
||||
I_INV_23("I_INV_23","0.304","23次典型谐波电流含有率"),
|
||||
I_INV_24("I_INV_24","0.03","24次典型谐波电流含有率"),
|
||||
I_INV_25("I_INV_25","0.176","25次典型谐波电流含有率"),
|
||||
I_INV_26("I_INV_26","0.032","26次典型谐波电流含有率"),
|
||||
I_INV_27("I_INV_27","0.038","27次典型谐波电流含有率"),
|
||||
I_INV_28("I_INV_28","0.031","28次典型谐波电流含有率"),
|
||||
I_INV_29("I_INV_29","0.158","29次典型谐波电流含有率"),
|
||||
I_INV_30("I_INV_30","0.024","30次典型谐波电流含有率"),
|
||||
I_INV_31("I_INV_31","0.028","31次典型谐波电流含有率"),
|
||||
I_INV_32("I_INV_32","0.026","32次典型谐波电流含有率"),
|
||||
I_INV_33("I_INV_33","0.033","33次典型谐波电流含有率"),
|
||||
I_INV_34("I_INV_34","0.018","34次典型谐波电流含有率"),
|
||||
I_INV_35("I_INV_35","0.072","35次典型谐波电流含有率");
|
||||
/**
|
||||
* 字段code
|
||||
*/
|
||||
private final String Code;
|
||||
|
||||
/**
|
||||
* 字段值
|
||||
*/
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
|
||||
CarryingCapacityEnum(String code, String value, String description) {
|
||||
Code = code;
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public static String getValueByCode(String code) {
|
||||
for (CarryingCapacityEnum item : CarryingCapacityEnum.values()) {
|
||||
if (item.Code.equals(code)) {
|
||||
return item.value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/5/12 9:13
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapcityDataIEexcel {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
@Excel(name = "时间",width = 30)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Excel(name = "监测点id",width = 30)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Excel(name = "项别",width = 30)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Excel(name = "数据类型",width = 30)
|
||||
private String valueType;
|
||||
|
||||
|
||||
@Column(name = "i_2")
|
||||
@Excel(name = "2次谐波幅值)",width = 30)
|
||||
private Double i2;
|
||||
|
||||
@Column(name = "i_3")
|
||||
@Excel(name = "3次谐波幅值)",width = 30)
|
||||
private Double i3;
|
||||
|
||||
@Column(name = "i_4")
|
||||
@Excel(name = "4次谐波幅值)",width = 30)
|
||||
private Double i4;
|
||||
|
||||
@Column(name = "i_5")
|
||||
@Excel(name = "5次谐波幅值)",width = 30)
|
||||
private Double i5;
|
||||
|
||||
@Column(name = "i_6")
|
||||
@Excel(name = "6次谐波幅值)",width = 30)
|
||||
private Double i6;
|
||||
|
||||
@Column(name = "i_7")
|
||||
@Excel(name = "7次谐波幅值)",width = 30)
|
||||
private Double i7;
|
||||
|
||||
@Column(name = "i_8")
|
||||
@Excel(name = "8次谐波幅值)",width = 30)
|
||||
private Double i8;
|
||||
|
||||
@Column(name = "i_9")
|
||||
@Excel(name = "9次谐波幅值)",width = 30)
|
||||
private Double i9;
|
||||
|
||||
@Column(name = "i_10")
|
||||
@Excel(name = "10次谐波幅值)",width = 30)
|
||||
private Double i10;
|
||||
|
||||
@Column(name = "i_11")
|
||||
@Excel(name = "11次谐波幅值)",width = 30)
|
||||
private Double i11;
|
||||
|
||||
@Column(name = "i_12")
|
||||
@Excel(name = "12次谐波幅值)",width = 30)
|
||||
private Double i12;
|
||||
|
||||
@Column(name = "i_13")
|
||||
@Excel(name = "13次谐波幅值)",width = 30)
|
||||
private Double i13;
|
||||
|
||||
@Column(name = "i_14")
|
||||
@Excel(name = "14次谐波幅值)",width = 30)
|
||||
private Double i14;
|
||||
|
||||
@Column(name = "i_15")
|
||||
@Excel(name = "15次谐波幅值)",width = 30)
|
||||
private Double i15;
|
||||
|
||||
@Column(name = "i_16")
|
||||
@Excel(name = "16次谐波幅值)",width = 30)
|
||||
private Double i16;
|
||||
|
||||
@Column(name = "i_17")
|
||||
@Excel(name = "17次谐波幅值)",width = 30)
|
||||
private Double i17;
|
||||
|
||||
@Column(name = "i_18")
|
||||
@Excel(name = "18次谐波幅值)",width = 30)
|
||||
private Double i18;
|
||||
|
||||
@Column(name = "i_19")
|
||||
@Excel(name = "19次谐波幅值)",width = 30)
|
||||
private Double i19;
|
||||
|
||||
@Column(name = "i_20")
|
||||
@Excel(name = "20次谐波幅值)",width = 30)
|
||||
private Double i20;
|
||||
|
||||
@Column(name = "i_21")
|
||||
@Excel(name = "21次谐波幅值)",width = 30)
|
||||
private Double i21;
|
||||
|
||||
@Column(name = "i_22")
|
||||
@Excel(name = "22次谐波幅值)",width = 30)
|
||||
private Double i22;
|
||||
|
||||
@Column(name = "i_23")
|
||||
@Excel(name = "23次谐波幅值)",width = 30)
|
||||
private Double i23;
|
||||
|
||||
@Column(name = "i_24")
|
||||
@Excel(name = "24次谐波幅值)",width = 30)
|
||||
private Double i24;
|
||||
@Column(name = "i_25")
|
||||
@Excel(name = "25次谐波幅值)",width = 30)
|
||||
private Double i25;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/5/12 9:13
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapcityDataPEexcel {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
@Excel(name = "时间",width = 30)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Excel(name = "监测点id",width = 30)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Excel(name = "项别",width = 30)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Excel(name = "数据类型",width = 30)
|
||||
private String valueType;
|
||||
|
||||
@Excel(name = "数据(有功功率)",width = 30)
|
||||
private Double value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/5/12 9:13
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapcityDataQEexcel {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
@Excel(name = "时间",width = 30)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Excel(name = "监测点id",width = 30)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Excel(name = "项别",width = 30)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Excel(name = "数据类型",width = 30)
|
||||
private String valueType;
|
||||
|
||||
@Excel(name = "数据(无功功率)",width = 30)
|
||||
private Double value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/5/12 9:13
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapcityDataVEexcel {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
@Excel(name = "时间",width = 30)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Excel(name = "监测点id",width = 30)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Excel(name = "项别",width = 30)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Excel(name = "数据类型",width = 30)
|
||||
private String valueType;
|
||||
|
||||
@Excel(name = "数据(电压)",width = 30)
|
||||
private Double value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CarryCapacityCalParam {
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@ApiModelProperty("监测点索引")
|
||||
private String lineId;
|
||||
@ApiModelProperty("用户Id")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "scale",value = "电压等级")
|
||||
private String scale;
|
||||
@ApiModelProperty(name = "S_T",value = "S_T为配变额定容量(监测点基准容量)")
|
||||
private Double S_T;
|
||||
@ApiModelProperty(name = "S_pv",value = "S_pv为拟接入光伏容量")
|
||||
private Double S_pv;
|
||||
@ApiModelProperty(name = "stringMap",value = "首端电流模型参数A,B,C三项")
|
||||
private Map<String, Double[]> stringMap;
|
||||
|
||||
@ApiModelProperty(name = "P_βminMap",value = "有功功率最小CP95值A,B,C三项")
|
||||
private Map<String, Double> P_βminMap;
|
||||
|
||||
@ApiModelProperty(name = "Q_βminMap",value = "无功功率最小CP95值A,B,C三项")
|
||||
private Map<String, Double> Q_βminMap;
|
||||
|
||||
@ApiModelProperty(name = "I_βmax",value = "2-25次谐波幅值最大95概率值A,B,C三项中的最大值")
|
||||
private List<Double> I_βmax;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CarryCapacityQueryDataParam {
|
||||
|
||||
|
||||
@NotBlank(message = "监测点索引为空")
|
||||
@ApiModelProperty("监测点索引")
|
||||
private String lineId;
|
||||
@ApiModelProperty("用户Id")
|
||||
@NotBlank(message = "用户ID为空")
|
||||
private String userId;
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
|
||||
private LocalDate startTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
|
||||
private LocalDate endTime;
|
||||
|
||||
@Min(2)
|
||||
@Max(25)
|
||||
@ApiModelProperty("谐波次数")
|
||||
private Integer time=2;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarryCapacityStrategyParam {
|
||||
/**
|
||||
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@ApiModelProperty(value = "总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)")
|
||||
@NotNull(message = "总承载能力评估结果不能为空")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 指标评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@ApiModelProperty(value = "指标评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)")
|
||||
@NotNull(message = "指标评估结果不能为空")
|
||||
private Integer indexResult;
|
||||
|
||||
/**
|
||||
* 比较符
|
||||
*/
|
||||
@ApiModelProperty(value = "比较符")
|
||||
@NotBlank(message = "比较符不能为空")
|
||||
private String comparisonOperators;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "数量")
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer count;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CarryCapacityUserParam {
|
||||
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 电压等级(V)
|
||||
*/
|
||||
private String voltage;
|
||||
|
||||
/**
|
||||
* 用户协议容量(MVA)
|
||||
*/
|
||||
private Double protocolCapacity;
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* 所属区域
|
||||
*/
|
||||
private String area;
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CarryCapacityUserUpdateParam extends CarryCapacityUserParam {
|
||||
@ApiModelProperty("用户Id")
|
||||
@NotBlank(message = "用户Id不能为空")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String userId;
|
||||
}
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CarryCapacityUserPageParam extends CarryCapacityUserParam {
|
||||
|
||||
private String userId;
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "pageNum",dataType ="Integer",required = true)
|
||||
private Integer pageNum;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value="起始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/6 14:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "carry_capacity_data")
|
||||
public class CarryCapacityDataPO extends BaseEntity{
|
||||
/**
|
||||
* 台区id
|
||||
*/
|
||||
@MppMultiId(value = "line_id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@MppMultiId(value = "start_time")
|
||||
private LocalDate startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@MppMultiId(value = "end_time")
|
||||
private LocalDate endTime;
|
||||
|
||||
/**
|
||||
* 上传数据集地址
|
||||
*/
|
||||
@TableField(value = "date_list")
|
||||
private String dateList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/1 15:38【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "carry_capacity_result")
|
||||
public class CarryCapacityResultPO {
|
||||
/**
|
||||
* 承载能力评估id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 配变首端电压等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "u_t_level")
|
||||
private Integer uTLevel;
|
||||
|
||||
/**
|
||||
* 配变的功率因等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "pf_t_level")
|
||||
private Integer pfTLevel;
|
||||
|
||||
/**
|
||||
* 等效负载率最小值等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "b_t_level")
|
||||
private Integer bTLevel;
|
||||
|
||||
/**
|
||||
* 各次谐波电流幅值等级 (1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "i_level")
|
||||
private Integer iLevel;
|
||||
|
||||
/**
|
||||
* 总结果等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "reslut_level")
|
||||
private Integer reslutLevel;
|
||||
|
||||
/**
|
||||
* 评估日期
|
||||
*/
|
||||
@TableField(value = "evaluate_date")
|
||||
private LocalDate evaluateDate;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:54【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "carry_capacity_strategy")
|
||||
public class CarryCapacityStrategyPO {
|
||||
/**
|
||||
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "`result`")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 指标评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "index_result")
|
||||
private Integer indexResult;
|
||||
|
||||
/**
|
||||
* 比较符
|
||||
*/
|
||||
@TableField(value = "comparison_operators")
|
||||
private String comparisonOperators;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@TableField(value = "`count`")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 初始配置1,客户配置2
|
||||
*/
|
||||
@TableField(value = "proto_flag")
|
||||
private Integer protoFlag;
|
||||
|
||||
/**
|
||||
* 启用配置1,不启用配置2
|
||||
*/
|
||||
@TableField(value = "user_flag")
|
||||
private Integer userFlag;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "carry_capacity_user")
|
||||
public class CarryCapacityUserPO extends BaseEntity {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "user_id", type = IdType.ASSIGN_UUID)
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@TableField(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
@TableField(value = "user_type")
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 电压等级(V)
|
||||
*/
|
||||
@TableField(value = "voltage")
|
||||
private String voltage;
|
||||
|
||||
/**
|
||||
* 用户协议容量(MVA)
|
||||
*/
|
||||
@TableField(value = "protocol_capacity")
|
||||
private Double protocolCapacity;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
@TableField(value = "province")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@TableField(value = "city")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@TableField(value = "region")
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* 所属区域
|
||||
*/
|
||||
@TableField(value = "area")
|
||||
private String area;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/2/27 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CarryCapacityDResultVO {
|
||||
|
||||
private Integer uTLevel;
|
||||
|
||||
/**
|
||||
* 配变的功率因等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
private Integer pfTLevel;
|
||||
|
||||
/**
|
||||
* 等效负载率最小值等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
private Integer bTLevel;
|
||||
|
||||
/**
|
||||
* 各次谐波电流幅值等级 (1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
private Integer iLevel;
|
||||
|
||||
/**
|
||||
* 总结果等级(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
private Integer reslutLevel;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/2/27 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CarryCapacityDataIVO {
|
||||
@ApiModelProperty(name = "data",value = "谐波幅值数据")
|
||||
private List<CarryCapcityData> data;
|
||||
|
||||
@ApiModelProperty(name = "I_βmax",value = "2-25次谐波幅值最大95概率值A,B,C三项中的最大值")
|
||||
private List<Double> I_βmax;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/2/27 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CarryCapacityDataQVO {
|
||||
@ApiModelProperty(name = "data",value = "有功功率数据")
|
||||
private List<CarryCapcityData> data;
|
||||
|
||||
@ApiModelProperty(name = "Q_βminMap",value = "无功功率最小CP95值A,B,C三项")
|
||||
private Map<String, Double> Q_βminMap;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/2/27 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CarryCapacityDataVO {
|
||||
@ApiModelProperty(name = "data",value = "有功功率数据")
|
||||
private List<CarryCapcityData> data;
|
||||
@ApiModelProperty(name = "stringMap",value = "首端电流模型参数A,B,C三项")
|
||||
private Map<String, Double[]> stringMap;
|
||||
|
||||
@ApiModelProperty(name = "P_βminMap",value = "有功功率最小CP95值A,B,C三项")
|
||||
private Map<String, Double> P_βminMap;
|
||||
@ApiModelProperty(name = "scale",value = "电压等级")
|
||||
private String scale;
|
||||
@ApiModelProperty(name = "devCapacity",value = "基准容量/额定容量(MVA)")
|
||||
private Double standardCapacity;
|
||||
|
||||
/**
|
||||
* 用户协议容量(MVA)
|
||||
*/
|
||||
@ApiModelProperty(name = "dealCapacity",value = "用户协议容量(MVA)")
|
||||
private Double protocolCapacity;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapacityStrategyVO {
|
||||
/**
|
||||
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@ApiModelProperty(value = "总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 指标评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@ApiModelProperty(value = "指标评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)")
|
||||
private Integer indexResult;
|
||||
|
||||
/**
|
||||
* 比较符
|
||||
*/
|
||||
@ApiModelProperty(value = "比较符")
|
||||
private String comparisonOperators;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer count;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.vo;
|
||||
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarryCapacityUserVO extends BaseEntity {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 电压等级(V)
|
||||
*/
|
||||
private String voltage;
|
||||
|
||||
/**
|
||||
* 用户协议容量(MVA)
|
||||
*/
|
||||
private Double protocolCapacity;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 所属区域
|
||||
*/
|
||||
private String area;
|
||||
|
||||
|
||||
}
|
||||
@@ -57,7 +57,11 @@
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.njcn.advance.controller.carrycapacity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataIEexcel;
|
||||
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataPEexcel;
|
||||
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataQEexcel;
|
||||
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataVEexcel;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityCalParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataIVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapcityService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月21日 10:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carrycapacity")
|
||||
@Api(tags = "承载能力评估")
|
||||
@RequiredArgsConstructor
|
||||
public class CarryCapacityController extends BaseController {
|
||||
|
||||
|
||||
private final CarryCapcityService carryCapcityService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryCarryCapacityData")
|
||||
@ApiOperation("承载能力评估数据查询-主页面")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataVO> queryCarryCapacityData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryCarryCapacityData");
|
||||
CarryCapacityDataVO carryCapacityDataVO = carryCapcityService.queryCarryCapacityData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryCarryCapacityQData")
|
||||
@ApiOperation("承载能力评估数据查询-无功功率")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataQVO> queryCarryCapacityQData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryCarryCapacityQData");
|
||||
CarryCapacityDataQVO carryCapacityDataQVO = carryCapcityService.queryCarryCapacityQData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataQVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryCarryCapacityIData")
|
||||
@ApiOperation("承载能力评估数据查询-谐波电流幅值")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataIVO> queryCarryCapacityIData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryCarryCapacityIData");
|
||||
CarryCapacityDataIVO carryCapacityDataIVO = carryCapcityService.queryCarryCapacityIData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataIVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/carryCapacityCal")
|
||||
@ApiOperation("承载能力评估")
|
||||
@ApiImplicitParam(name = "calParam", value = "计算参数", required = true)
|
||||
public HttpResult<CarryCapacityDResultVO> carryCapacityCal(@RequestBody @Validated CarryCapacityCalParam calParam) {
|
||||
String methodDescribe = getMethodDescribe("carryCapacityCal");
|
||||
CarryCapacityDResultVO carryCapacityDResultVO = carryCapcityService.carryCapacityCal(calParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDResultVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/carryCapacityTree")
|
||||
@ApiOperation("承载能力评估-台账树")
|
||||
public HttpResult<List<TerminalTree>> carryCapacityTree() {
|
||||
String methodDescribe = getMethodDescribe("carryCapacityTree");
|
||||
List<TerminalTree> terminalTree = carryCapcityService.carryCapacityTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, terminalTree, methodDescribe);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation("导出设备模板")
|
||||
@GetMapping(value = "getExcelTemplate")
|
||||
public HttpResult<String> getExcelTemplate(HttpServletResponse response) {
|
||||
final List<Map<String, Object>> sheetsList = Lists.newArrayList();
|
||||
Map<String, Object> exportMap = Maps.newHashMap();
|
||||
final ExportParams exportParams = new ExportParams(null, "电流幅值", ExcelType.HSSF);
|
||||
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
|
||||
exportMap.put("title", exportParams);
|
||||
exportMap.put("entity", CarryCapcityDataIEexcel.class);
|
||||
exportMap.put("data", new ArrayList<>());
|
||||
// 加入多sheet配置列表
|
||||
sheetsList.add(exportMap);
|
||||
|
||||
Map<String, Object> exportMap2 = Maps.newHashMap();
|
||||
final ExportParams exportParams2 = new ExportParams(null, "电压", ExcelType.HSSF);
|
||||
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
|
||||
exportMap2.put("title", exportParams2);
|
||||
exportMap2.put("entity", CarryCapcityDataVEexcel.class);
|
||||
exportMap2.put("data", new ArrayList<>());
|
||||
// 加入多sheet配置列表
|
||||
sheetsList.add(exportMap2);
|
||||
|
||||
Map<String, Object> exportMap3 = Maps.newHashMap();
|
||||
final ExportParams exportParams3 = new ExportParams(null, "有功功率", ExcelType.HSSF);
|
||||
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
|
||||
exportMap3.put("title", exportParams3);
|
||||
exportMap3.put("entity", CarryCapcityDataPEexcel.class);
|
||||
exportMap3.put("data", new ArrayList<>());
|
||||
// 加入多sheet配置列表
|
||||
sheetsList.add(exportMap3);
|
||||
|
||||
Map<String, Object> exportMap4 = Maps.newHashMap();
|
||||
final ExportParams exportParams4 = new ExportParams(null, "无功功率", ExcelType.HSSF);
|
||||
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
|
||||
exportMap4.put("title", exportParams4);
|
||||
exportMap4.put("entity", CarryCapcityDataQEexcel.class);
|
||||
exportMap4.put("data", new ArrayList<>());
|
||||
// 加入多sheet配置列表
|
||||
sheetsList.add(exportMap4);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.HSSF);
|
||||
|
||||
|
||||
String fileName = "数据集.xls";
|
||||
ExportParams exportExcel = new ExportParams("数据集", "数据集");
|
||||
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.njcn.advance.controller.carrycapacity;
|
||||
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityStrategyParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyPOService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:35【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carrycapacity")
|
||||
@Api(tags = "承载能力评估策略配置")
|
||||
@RequiredArgsConstructor
|
||||
public class CarryCapacityStrategyController extends BaseController {
|
||||
|
||||
|
||||
private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("用户新增承载能力评估策略")
|
||||
@ApiImplicitParam(name = "carryCapacityStrategyParam", value = "新增参数", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CarryCapacityStrategyParam carryCapacityStrategyParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
Boolean flag = carryCapacityStrategyPOService.add(carryCapacityStrategyParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queyDetail")
|
||||
@ApiOperation("承载能力评估策略初始化查询")
|
||||
public HttpResult<List<CarryCapacityStrategyVO>> queyDetail() {
|
||||
String methodDescribe = getMethodDescribe("queyDetail");
|
||||
List<CarryCapacityStrategyVO> carryCapacityStrategyVOList = carryCapacityStrategyPOService.queyDetail();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityStrategyVOList, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/restore")
|
||||
@ApiOperation("承载能力评估策略一键还原")
|
||||
public HttpResult<Boolean> restore() {
|
||||
String methodDescribe = getMethodDescribe("restore");
|
||||
Boolean flag = carryCapacityStrategyPOService.restore();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.advance.controller.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月21日 10:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carrycapacityuser")
|
||||
@Api(tags = "承载能力评估用户")
|
||||
@RequiredArgsConstructor
|
||||
public class CarryCapacityUserController extends BaseController {
|
||||
|
||||
|
||||
private final CarryCapacityUserPOService carryCapacityUserPOService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("承载能力评估用户新增")
|
||||
@ApiImplicitParam(name = "carryCapacityUserParam", value = "新增参数", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CarryCapacityUserParam carryCapacityUserParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
Boolean flag = carryCapacityUserPOService.add(carryCapacityUserParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/remove")
|
||||
@ApiOperation("承载能力评估用户批量删除")
|
||||
@ApiImplicitParam(name = "userIds", value = "用户id集合", required = true)
|
||||
public HttpResult<Boolean> remove(@RequestParam("userIds") List<String> userIds) {
|
||||
String methodDescribe = getMethodDescribe("remove");
|
||||
Boolean flag = carryCapacityUserPOService.removeByIds(userIds);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("承载能力评估用户编辑")
|
||||
@ApiImplicitParam(name = "userUpdateParam", value = "编辑参数", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated CarryCapacityUserParam.CarryCapacityUserUpdateParam userUpdateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
Boolean flag = carryCapacityUserPOService.updateUser(userUpdateParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queyDetailUser")
|
||||
@ApiOperation("承载能力评估用户查询")
|
||||
@ApiImplicitParam(name = "pageParam", value = "编辑参数", required = true)
|
||||
public HttpResult<IPage<CarryCapacityUserPO>> queyDetailUser(@RequestBody @Validated CarryCapacityUserParam.CarryCapacityUserPageParam pageParam) {
|
||||
String methodDescribe = getMethodDescribe("queyDetailUser");
|
||||
IPage<CarryCapacityUserPO> page = carryCapacityUserPOService.queyDetailUser(pageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.advance.mapper.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/6 14:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityDataPOMapper extends BaseMapper<CarryCapacityDataPO> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.advance.mapper.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/1 15:38【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityResultPOMapper extends BaseMapper<CarryCapacityResultPO> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.advance.mapper.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:54【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityStrategyPOMapper extends BaseMapper<CarryCapacityStrategyPO> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.advance.mapper.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityUserPOMapper extends BaseMapper<CarryCapacityUserPO> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityDataPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_data-->
|
||||
<id column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||
<id column="start_time" jdbcType="DATE" property="startTime" />
|
||||
<id column="end_time" jdbcType="DATE" property="endTime" />
|
||||
<result column="date_list" jdbcType="VARCHAR" property="dateList" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
line_id, start_time, end_time, date_list, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityResultPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_result-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="u_t_level" jdbcType="INTEGER" property="uTLevel" />
|
||||
<result column="pf_t_level" jdbcType="INTEGER" property="pfTLevel" />
|
||||
<result column="b_t_level" jdbcType="INTEGER" property="bTLevel" />
|
||||
<result column="i_level" jdbcType="INTEGER" property="iLevel" />
|
||||
<result column="reslut_level" jdbcType="INTEGER" property="reslutLevel" />
|
||||
<result column="evaluate_date" jdbcType="DATE" property="evaluateDate" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, u_t_level, pf_t_level, b_t_level, i_level, reslut_level, evaluate_date, create_by,
|
||||
create_time, update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityStrategyPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_strategy-->
|
||||
<result column="result" jdbcType="INTEGER" property="result" />
|
||||
<result column="index_result" jdbcType="INTEGER" property="indexResult" />
|
||||
<result column="comparison_operators" jdbcType="VARCHAR" property="comparisonOperators" />
|
||||
<result column="count" jdbcType="INTEGER" property="count" />
|
||||
<result column="proto_flag" jdbcType="INTEGER" property="protoFlag" />
|
||||
<result column="user_flag" jdbcType="INTEGER" property="userFlag" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
`result`, index_result, comparison_operators, `count`, proto_flag, user_flag, create_by,
|
||||
create_time, update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_user-->
|
||||
<id column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="user_type" jdbcType="VARCHAR" property="userType" />
|
||||
<result column="voltage" jdbcType="VARCHAR" property="voltage" />
|
||||
<result column="protocol_capacity" jdbcType="DOUBLE" property="protocolCapacity" />
|
||||
<result column="area" jdbcType="VARCHAR" property="area" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
user_id, user_name, user_type, voltage, protocol_capacity, area, create_by, create_time,
|
||||
update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.advance.service.carrycapacity;
|
||||
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/6 14:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityDataPOService extends IService<CarryCapacityDataPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.advance.service.carrycapacity;
|
||||
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/1 15:38【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityResultPOService extends IService<CarryCapacityResultPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.advance.service.carrycapacity;
|
||||
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityStrategyParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:33【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityStrategyPOService extends IService<CarryCapacityStrategyPO>{
|
||||
|
||||
|
||||
Boolean add(CarryCapacityStrategyParam carryCapacityStrategyParam);
|
||||
|
||||
List<CarryCapacityStrategyVO> queyDetail();
|
||||
|
||||
Boolean restore();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.advance.service.carrycapacity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapacityUserPOService extends IService<CarryCapacityUserPO>{
|
||||
|
||||
|
||||
Boolean add(CarryCapacityUserParam carryCapacityUserParam);
|
||||
|
||||
Boolean updateUser(CarryCapacityUserParam.CarryCapacityUserUpdateParam userUpdateParam);
|
||||
|
||||
IPage<CarryCapacityUserPO> queyDetailUser(CarryCapacityUserParam.CarryCapacityUserPageParam pageParm);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn.advance.service.carrycapacity;
|
||||
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityCalParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataIVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/1/31 14:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapcityService {
|
||||
|
||||
|
||||
CarryCapacityDataVO queryCarryCapacityData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDataQVO queryCarryCapacityQData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDataIVO queryCarryCapacityIData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDResultVO carryCapacityCal(CarryCapacityCalParam calParam);
|
||||
|
||||
List<TerminalTree> carryCapacityTree();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
|
||||
import com.njcn.advance.mapper.carrycapacity.CarryCapacityDataPOMapper;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityDataPOService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/6 14:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CarryCapacityDataPOServiceImpl extends ServiceImpl<CarryCapacityDataPOMapper, CarryCapacityDataPO> implements CarryCapacityDataPOService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.carrycapacity.CarryCapacityResultPOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityResultPOService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/1 15:38【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CarryCapacityResultPOServiceImpl extends ServiceImpl<CarryCapacityResultPOMapper, CarryCapacityResultPO> implements CarryCapacityResultPOService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.carrycapacity.CarryCapacityStrategyPOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityStrategyParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyPOService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/3/5 10:33【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacityStrategyPOMapper, CarryCapacityStrategyPO> implements CarryCapacityStrategyPOService{
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean add(CarryCapacityStrategyParam carryCapacityStrategyParam) {
|
||||
CarryCapacityStrategyPO carryCapacityStrategyPO = new CarryCapacityStrategyPO();
|
||||
BeanUtils.copyProperties(carryCapacityStrategyParam, carryCapacityStrategyPO);
|
||||
//将原始策略处理为不启用
|
||||
this.lambdaUpdate().eq(CarryCapacityStrategyPO::getResult, carryCapacityStrategyParam.getResult())
|
||||
.eq(CarryCapacityStrategyPO::getIndexResult, carryCapacityStrategyParam.getIndexResult())
|
||||
.eq(CarryCapacityStrategyPO::getProtoFlag, 1)
|
||||
.set(CarryCapacityStrategyPO::getUserFlag,2)
|
||||
.update();
|
||||
QueryWrapper<CarryCapacityStrategyPO> lambdaQuery = new QueryWrapper<>();
|
||||
lambdaQuery.lambda()
|
||||
.eq(CarryCapacityStrategyPO::getResult, carryCapacityStrategyParam.getResult())
|
||||
.eq(CarryCapacityStrategyPO::getIndexResult, carryCapacityStrategyParam.getIndexResult())
|
||||
.eq(CarryCapacityStrategyPO::getProtoFlag, 2);
|
||||
//将客户对应策略删除
|
||||
this.remove(lambdaQuery);
|
||||
//新增客户策略;
|
||||
carryCapacityStrategyPO.setProtoFlag(2);
|
||||
carryCapacityStrategyPO.setUserFlag(1);
|
||||
boolean save = this.save(carryCapacityStrategyPO);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarryCapacityStrategyVO> queyDetail() {
|
||||
List<CarryCapacityStrategyPO> list = this.lambdaQuery().eq(CarryCapacityStrategyPO::getUserFlag, 1).list();
|
||||
List<CarryCapacityStrategyVO> collect = list.stream().map(temp -> {
|
||||
CarryCapacityStrategyVO vo = new CarryCapacityStrategyVO();
|
||||
BeanUtils.copyProperties(temp, vo);
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean restore() {
|
||||
//将客户对应策略删除
|
||||
QueryWrapper<CarryCapacityStrategyPO> lambdaQuery = new QueryWrapper<>();
|
||||
lambdaQuery.lambda()
|
||||
.eq(CarryCapacityStrategyPO::getProtoFlag, 2);
|
||||
this.remove(lambdaQuery
|
||||
);
|
||||
//将原始策略处理为启用
|
||||
boolean update = this.lambdaUpdate().eq(CarryCapacityStrategyPO::getProtoFlag, 1)
|
||||
.set(CarryCapacityStrategyPO::getUserFlag, 1)
|
||||
.update();
|
||||
return update;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/2/20 11:15【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUserPOMapper, CarryCapacityUserPO> implements CarryCapacityUserPOService{
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(CarryCapacityUserParam carryCapacityUserParam) {
|
||||
CarryCapacityUserPO carryCapacityUserPO = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(carryCapacityUserParam, carryCapacityUserPO);
|
||||
CarryCapacityUserPO one = this.lambdaQuery().eq(CarryCapacityUserPO::getUserName, carryCapacityUserParam.getUserName()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
throw new BusinessException(AdvanceResponseEnum.USER_NAME_EXIST);
|
||||
}
|
||||
boolean save = this.save(carryCapacityUserPO);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateUser(CarryCapacityUserParam.CarryCapacityUserUpdateParam userUpdateParam) {
|
||||
CarryCapacityUserPO carryCapacityUserPO = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(userUpdateParam, carryCapacityUserPO);
|
||||
CarryCapacityUserPO one = this.lambdaQuery().eq(CarryCapacityUserPO::getUserName, userUpdateParam.getUserName()).ne(CarryCapacityUserPO::getUserId,userUpdateParam.getUserId()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
throw new BusinessException(AdvanceResponseEnum.USER_NAME_EXIST);
|
||||
}
|
||||
|
||||
boolean save = this.updateById(carryCapacityUserPO);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CarryCapacityUserPO> queyDetailUser(CarryCapacityUserParam.CarryCapacityUserPageParam pageParm) {
|
||||
Page<CarryCapacityUserPO> returnpage = new Page<> (pageParm.getPageNum ( ), pageParm.getPageSize ( ));
|
||||
QueryWrapper<CarryCapacityUserPO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(StringUtils.isNotBlank(pageParm.getUserId()) ,CarryCapacityUserPO::getUserId,pageParm.getUserId())
|
||||
.eq(StringUtils.isNotBlank(pageParm.getUserType()) ,CarryCapacityUserPO::getUserType,pageParm.getUserType())
|
||||
.between(StringUtils.isNotBlank(pageParm.getStartTime()) && StringUtils.isNotBlank(pageParm.getEndTime()) ,CarryCapacityUserPO::getCreateTime,pageParm.getStartTime(),pageParm.getEndTime());
|
||||
|
||||
IPage<CarryCapacityUserPO> page = this.page (returnpage, queryWrapper);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,699 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.enums.CarryingCapacityEnum;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityCalParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.*;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyPOService;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapcityService;
|
||||
import com.njcn.advance.utils.CZNLPG;
|
||||
import com.njcn.advance.utils.Utils;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.api.DeviceTreeClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
||||
import com.njcn.influx.imapper.DataHarmPowerPMapper;
|
||||
import com.njcn.influx.imapper.DataHarmPowerQMapper;
|
||||
import com.njcn.influx.imapper.DataVMapper;
|
||||
import com.njcn.influx.imapper.IDataIMapper;
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerP;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerQ;
|
||||
import com.njcn.influx.pojo.po.DataI;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/1/31 14:42【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CarryCapcityServiceImpl implements CarryCapcityService {
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final DeviceTreeClient deviceTreeClient;
|
||||
private final DataHarmPowerQMapper dataHarmPowerQMapper;
|
||||
private final DataHarmPowerPMapper dataHarmPowerPMapper;
|
||||
private final DataVMapper dataVMapper;
|
||||
private final IDataIMapper dataIMapper;
|
||||
|
||||
private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private static final double DEFAULTVALUE=3.1415926;
|
||||
//光伏评估
|
||||
void photovoltaicEvaluate(double S_T, double S_pv) {
|
||||
//电压等级
|
||||
|
||||
List<DataHarmPowerP> dataHarmPowerPList = null;
|
||||
List<DataHarmPowerQ> dataHarmPowerQList = null;
|
||||
|
||||
Integer voltage = null;
|
||||
//数据清洗取近一周的配变每日9时~15时段的负载率数据中概率95%小值所对应时刻的有功功率和无功功率值
|
||||
List<Double> listP = dataHarmPowerPList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.map(DataHarmPowerP::getP)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listQ = dataHarmPowerQList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.map(DataHarmPowerQ::getQ)
|
||||
.collect(Collectors.toList());
|
||||
//todo 检查数据是否缺失校验数据完整性
|
||||
double P_βmin = CZNLPG.calculatePercentile(listP, 1);
|
||||
double Q_βmin = CZNLPG.calculatePercentile(listQ, 1);
|
||||
|
||||
|
||||
double P_pv = S_pv * Integer.valueOf(CarryingCapacityEnum.K.getValue());
|
||||
double Bt = CZNLPG.calculateB(P_βmin, Q_βmin, Double.valueOf(CarryingCapacityEnum.K.getValue()), S_T, S_pv, P_pv);
|
||||
|
||||
CZNLPG.calculatePF_T(P_βmin, Q_βmin,Double.valueOf(CarryingCapacityEnum.K.getValue()),S_pv);
|
||||
//前2周的数据
|
||||
List<DataHarmPowerP> dataHarmPowerPList2 = null;
|
||||
List<DataHarmPowerQ> dataHarmPowerQList2 = null;
|
||||
List<DataV> DataVList2 = null;
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
//存储UA, UB,UC;
|
||||
List<Double> uList = new ArrayList<>();
|
||||
|
||||
phaseType.stream().forEach(phase -> {
|
||||
List<Double> listP2 = dataHarmPowerPList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(DataHarmPowerP::getP)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listQ2 = dataHarmPowerQList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(DataHarmPowerQ::getQ)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listV2 = DataVList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhasicType().equals(phase))
|
||||
.map(DataV::getRms)
|
||||
.collect(Collectors.toList());
|
||||
//todo 抽取5000条数据(抽取方式待确定)
|
||||
Double[] res = new Double[3];
|
||||
CZNLPG.cznlpgDataTrain(listV2, listP2, listQ2, listV2.size(), res);
|
||||
//前一周数据计算p_min,q_min
|
||||
List<Double> listPPhase = dataHarmPowerPList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(DataHarmPowerP::getP)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listQPhase = dataHarmPowerQList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(DataHarmPowerQ::getQ)
|
||||
.collect(Collectors.toList());
|
||||
//todo 检查数据是否缺失校验数据完整性
|
||||
double p_min = CZNLPG.calculatePercentile(listPPhase, 1);
|
||||
double q_min = CZNLPG.calculatePercentile(listQPhase, 1);
|
||||
|
||||
double U = CZNLPG.calculateU(res[0], res[1], res[2], p_min, Double.valueOf(CarryingCapacityEnum.K.getValue()), q_min, S_pv, voltage);
|
||||
uList.add(U);
|
||||
});
|
||||
//取uList最大值
|
||||
double U_T = uList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
|
||||
|
||||
List<Double> i_Th_List = new ArrayList<>();
|
||||
|
||||
List<DataI> dataIList = null;
|
||||
List<Integer> integerList = Stream.of(2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25).collect(Collectors.toList());
|
||||
|
||||
integerList.stream().forEach(temp->{
|
||||
List<Double> iList = new ArrayList<>();
|
||||
phaseType.stream().forEach(phase -> {
|
||||
|
||||
List<DataI> tempDataIList = dataIList.stream().filter(temp1 -> Utils.isTimeInRange(temp1.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp1 -> temp1.getPhaseType().equals(phase))
|
||||
.collect(Collectors.toList());
|
||||
//todo 检查数据是否缺失校验数据完整性
|
||||
|
||||
List<Double> attributeValueByPropertyName = Utils.getAttributeValueByPropertyName(tempDataIList, "i" + temp);
|
||||
double I_cp95 = CZNLPG.calculatePercentile(attributeValueByPropertyName, 0);
|
||||
double I_phase = CZNLPG.calculateITm(I_cp95, Double.valueOf(CarryingCapacityEnum.K.getValue()),
|
||||
voltage, S_pv, Double.valueOf(CarryingCapacityEnum.getValueByCode("K_H_" + temp)),
|
||||
Double.valueOf(CarryingCapacityEnum.getValueByCode("I_INV_" + temp)));
|
||||
iList.add(I_phase);
|
||||
});
|
||||
double I_th = iList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
i_Th_List.add(I_th);
|
||||
|
||||
});
|
||||
//todo 根据监测点查找限值
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarryCapacityDataVO queryCarryCapacityData(CarryCapacityQueryDataParam queryParam) {
|
||||
CarryCapacityDataVO carryCapacityDataVO = new CarryCapacityDataVO();
|
||||
String lineId = queryParam.getLineId();
|
||||
// LineDetailDataVO data = lineFeignClient.getLineDetailData(lineId).getData();
|
||||
// //时间间隔
|
||||
// Integer timeInterval = data.getTimeInterval();
|
||||
Integer timeInterval =1;
|
||||
//根据时间间隔算出最低数据量 7天*6小时*60分钟*3项*90%/时间间隔
|
||||
int minDataNum = 7*6*60*3*90/(100*timeInterval);
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
||||
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
||||
/* 近一周的数据包括电流,电压,有功功率,无功功率,数据完整性校验就取有功功率一组数据校验,因为,要有都有要没有都没有,数据查询按时间间隔和tag分组,
|
||||
缺失布置3.1415926,后边更具3.1415926个数来判断数据完整性,及进行数据补充*/
|
||||
//有功功率
|
||||
String SqlP1 = "select mean(p) as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
|
||||
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
||||
List<CarryCapcityData> dataHarmPowerPList = dataHarmPowerPMapper.getSqlResult(SqlP1);
|
||||
|
||||
|
||||
//数据校验
|
||||
if(CollectionUtil.isEmpty(dataHarmPowerPList)){
|
||||
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||
}else {
|
||||
//数据清洗取近一周的配变每日9时~15时段的负载率数据中概率95%小值所对应时刻的有功功率和无功功率值
|
||||
List<Double> listP = dataHarmPowerPList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getValue()!=DEFAULTVALUE)
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
if (listP.size()<minDataNum){
|
||||
|
||||
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
//数据缺失填补
|
||||
linearInterpolation(dataHarmPowerPList);
|
||||
carryCapacityDataVO.setData(dataHarmPowerPList);
|
||||
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
|
||||
Map<String,Double> results = new HashMap<>(4);
|
||||
//计算最小Cp95值用于评估
|
||||
phaseType.stream().forEach(phase -> {
|
||||
List<Double> listP = dataHarmPowerPList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getValue()!=DEFAULTVALUE)
|
||||
.filter(temp -> Objects.equals(temp.getPhaseType(),phase))
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
double P_βmin = CZNLPG.calculatePercentile(listP, 1);
|
||||
results.put(phase, P_βmin);
|
||||
});
|
||||
|
||||
carryCapacityDataVO.setP_βminMap(results);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//前2周的数据用于计算首端电流模型参数
|
||||
String forwardStartTime = LocalDateTimeUtil.format(queryParam.getStartTime()
|
||||
// .plusWeeks(-1)
|
||||
, formatter) + " 00:00:00";
|
||||
String forwardEndTime = LocalDateTimeUtil.format(queryParam.getEndTime()
|
||||
// .plusWeeks(-1)
|
||||
, formatter) + " 23:59:00";
|
||||
|
||||
String SqlP2 = "select mean(p) as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
|
||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
||||
List<CarryCapcityData> dataHarmPowerPList2 = dataHarmPowerPMapper.getSqlResult(SqlP2);
|
||||
//数据校验
|
||||
// if(CollectionUtil.isEmpty(dataHarmPowerPList2)){
|
||||
// throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||
// }else {
|
||||
// //数据清洗取近一周的配变每日9时~15时段的负载率数据中概率95%小值所对应时刻的有功功率和无功功率值
|
||||
// List<Double> listP = dataHarmPowerPList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
// .filter(temp -> temp.getValue()!=DEFAULTVALUE)
|
||||
// .map(CarryCapcityData::getValue)
|
||||
// .collect(Collectors.toList());
|
||||
// if (listP.size()<minDataNum){
|
||||
// throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||
// }
|
||||
// }
|
||||
//数据缺失填补
|
||||
linearInterpolation(dataHarmPowerPList2);
|
||||
|
||||
//有功功率
|
||||
String SqlQ2 = "select mean(q) as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
|
||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
||||
List<CarryCapcityData> dataHarmPowerQList2 = dataHarmPowerQMapper.getSqlResult(SqlQ2);
|
||||
//数据缺失填补
|
||||
linearInterpolation(dataHarmPowerQList2);
|
||||
|
||||
|
||||
|
||||
//电压
|
||||
String SqlU2 = "select mean(rms) as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
|
||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
||||
List<CarryCapcityData> dataVList2 = dataVMapper.getSqlResult(SqlU2);
|
||||
//数据缺失填补
|
||||
linearInterpolation(dataVList2);
|
||||
|
||||
//用前2周的数据计算C,a,b
|
||||
Map<String, Double[]> stringMap = calUParam(dataHarmPowerPList2, dataHarmPowerQList2, dataVList2);
|
||||
carryCapacityDataVO.setStringMap(stringMap);
|
||||
|
||||
return carryCapacityDataVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarryCapacityDataQVO queryCarryCapacityQData(CarryCapacityQueryDataParam queryParam) {
|
||||
|
||||
CarryCapacityDataQVO carryCapacityDataQVO = new CarryCapacityDataQVO();
|
||||
String lineId = queryParam.getLineId();
|
||||
// LineDetailDataVO data = lineFeignClient.getLineDetailData(lineId).getData();
|
||||
// //时间间隔
|
||||
// Integer timeInterval = data.getTimeInterval();
|
||||
Integer timeInterval =1;
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
||||
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
||||
//无功功率
|
||||
String SqlQ1 = "select mean(q) as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
|
||||
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
||||
List<CarryCapcityData> dataHarmPowerList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
|
||||
//数据缺失填补
|
||||
linearInterpolation(dataHarmPowerList);
|
||||
carryCapacityDataQVO.setData(dataHarmPowerList);
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
|
||||
Map<String,Double> results = new HashMap<>(4);
|
||||
//计算最小Cp95值用于评估
|
||||
phaseType.stream().forEach(phase -> {
|
||||
List<Double> listQ = dataHarmPowerList.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getValue()!=DEFAULTVALUE)
|
||||
.filter(temp -> Objects.equals(temp.getPhaseType(),phase))
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
double Q_βmin = CZNLPG.calculatePercentile(listQ, 1);
|
||||
results.put(phase, Q_βmin);
|
||||
});
|
||||
|
||||
carryCapacityDataQVO.setQ_βminMap(results);
|
||||
return carryCapacityDataQVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarryCapacityDataIVO queryCarryCapacityIData(CarryCapacityQueryDataParam queryParam) {
|
||||
CarryCapacityDataIVO carryCapacityDataIVO = new CarryCapacityDataIVO();
|
||||
String lineId = queryParam.getLineId();
|
||||
// LineDetailDataVO data = lineFeignClient.getLineDetailData(lineId).getData();
|
||||
// //时间间隔
|
||||
// Integer timeInterval = data.getTimeInterval();
|
||||
Integer timeInterval =1;
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
||||
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
||||
|
||||
//电流
|
||||
StringBuilder stringBuilder1 = new StringBuilder();
|
||||
StringBuilder stringBuilder2 = new StringBuilder();
|
||||
for (int i = 2; i <=25 ; i++) {
|
||||
if (i==25){
|
||||
stringBuilder1.append("mean(i_").append(i).append(") AS i_").append(i);
|
||||
} else {
|
||||
stringBuilder1.append("mean(i_").append(i).append(") AS i_").append(i).append(",");
|
||||
}
|
||||
}
|
||||
stringBuilder2.append ("line_id='").append (lineId).append ("' and ").append(InfluxDBPublicParam.TIME + " >= '").append(startTime).append("' and ").append(InfluxDBPublicParam.TIME).append(" <= '").append(endTime).append("' group by time(").append(timeInterval).append("m),* fill(3.1415926) ").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sqlI1 = "select "+stringBuilder1+" from "+ InfluxDBPublicParam.DATA_I+" where value_type='CP95' and phasic_type!='T' and "+stringBuilder2;
|
||||
List<DataI> dataI = dataIMapper.getSqlResult(sqlI1);
|
||||
//数据缺失填补
|
||||
linearInterpolationI(dataI);
|
||||
List<CarryCapcityData> i_list = dataI.stream().map(temp -> {
|
||||
CarryCapcityData carryCapcityData = new CarryCapcityData();
|
||||
BeanUtils.copyProperties(temp, carryCapcityData);
|
||||
carryCapcityData.setValue(Utils.getAttributeValueByPropertyName(temp, "i" + queryParam.getTime()));
|
||||
return carryCapcityData;
|
||||
}).collect(Collectors.toList());
|
||||
carryCapacityDataIVO.setData(i_list);
|
||||
|
||||
List<Double> I_βmax =new ArrayList<>();
|
||||
List<Integer> integerList = Stream.of(2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25).collect(Collectors.toList());
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
integerList.stream().forEach(temp->{
|
||||
List<Double> iList = new ArrayList<>();
|
||||
phaseType.stream().forEach(phase -> {
|
||||
|
||||
List<DataI> tempDataIList = dataI.stream().filter(temp1 -> Utils.isTimeInRange(temp1.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp1 -> temp1.getPhaseType().equals(phase))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> attributeValueByPropertyName = Utils.getAttributeValueByPropertyName(tempDataIList, "i" + temp);
|
||||
double I_cp95 = CZNLPG.calculatePercentile(attributeValueByPropertyName, 0);
|
||||
iList.add(I_cp95);
|
||||
});
|
||||
//取uList最大值
|
||||
double i_Max = iList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
I_βmax.add(i_Max);
|
||||
});
|
||||
carryCapacityDataIVO.setI_βmax(I_βmax);
|
||||
|
||||
return carryCapacityDataIVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarryCapacityDResultVO carryCapacityCal(CarryCapacityCalParam calParam) {
|
||||
CarryCapacityDResultVO carryCapacityDResultVO = new CarryCapacityDResultVO();
|
||||
Double S_T = calParam.getS_T();
|
||||
Double S_pv = calParam.getS_pv();
|
||||
Double P_pv = calParam.getS_pv()*Double.valueOf(CarryingCapacityEnum.K.getValue());
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
List<Double> uList = new ArrayList<>();
|
||||
List<Double> BtList = new ArrayList<>();
|
||||
List<Double> PF_TList = new ArrayList<>();
|
||||
for (String phase : phaseType) {
|
||||
Double P_βmin = calParam.getP_βminMap().get(phase);
|
||||
Double Q_βmin = calParam.getQ_βminMap().get(phase);
|
||||
Double[] res = calParam.getStringMap().get(phase);
|
||||
double Bt = CZNLPG.calculateB(P_βmin, Q_βmin, Double.valueOf(CarryingCapacityEnum.K.getValue()), S_T, S_pv, P_pv);
|
||||
BtList.add(Bt);
|
||||
double PF_T = CZNLPG.calculatePF_T(P_βmin, Q_βmin, Double.valueOf(CarryingCapacityEnum.K.getValue()), S_pv);
|
||||
PF_TList.add(PF_T);
|
||||
double U = CZNLPG.calculateU(res[0], res[1], res[2], P_βmin, Double.valueOf(CarryingCapacityEnum.K.getValue()), Q_βmin, S_pv, Double.valueOf(calParam.getScale()));
|
||||
uList.add(U);
|
||||
}
|
||||
//取uList最大值
|
||||
double U_T_Max = uList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
double Bt_Max = BtList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
double PF_T_Max = PF_TList.stream().mapToDouble(Double::doubleValue)
|
||||
.max()
|
||||
.getAsDouble();
|
||||
Integer uTLevel = CZNLPG.evaluateVoltageLevel(U_T_Max);
|
||||
carryCapacityDResultVO.setUTLevel(uTLevel);
|
||||
|
||||
Integer pfTLevel = CZNLPG.evaluatePowerFactorLevel(PF_T_Max);
|
||||
carryCapacityDResultVO.setPfTLevel(pfTLevel);
|
||||
|
||||
Integer bTLevel = CZNLPG.evaluateEquivalentLoadRateLevel(PF_T_Max);
|
||||
carryCapacityDResultVO.setPfTLevel(bTLevel);
|
||||
//谐波电流幅值判断
|
||||
//获取限值
|
||||
Overlimit overlimit = lineFeignClient.getOverLimitData(calParam.getLineId()).getData();
|
||||
|
||||
//各次谐波电流 均小于国标限值 返回1 存在某次谐波电流幅值 超出限值,但在1.25倍限值内 返回2 存在某次谐波电流幅值超出限值1.25倍以上 返回3 存在多次谐波电流幅值均超出限值1.25倍以上 返回4
|
||||
//i_count1小于国标限值的个数,i_count2>=国标限值<=1.25倍的国标限值,i_count3>1.25倍的国标限值
|
||||
int i_count1=0,i_count2=0,i_count3=0;
|
||||
for (int i = 0; i < calParam.getI_βmax().size(); i++) {
|
||||
double I_TM = CZNLPG.calculateITm(calParam.getI_βmax().get(i), Double.valueOf(CarryingCapacityEnum.K.getValue()),
|
||||
Double.valueOf(calParam.getScale()), S_pv, Double.valueOf(CarryingCapacityEnum.getValueByCode("K_H_" + (i + 2))),
|
||||
Double.valueOf(CarryingCapacityEnum.getValueByCode("I_INV_" + (i + 2))));
|
||||
double getUharm = PubUtils.getValueByMethod(overlimit, "getIharm", i + 2);
|
||||
if (I_TM<getUharm) {
|
||||
i_count1++;
|
||||
} else if (I_TM >= getUharm && I_TM <= 1.25 * getUharm) {
|
||||
i_count2++;
|
||||
} else if (I_TM > 1.25 * getUharm) {
|
||||
i_count3++;
|
||||
}
|
||||
|
||||
}
|
||||
Integer iLevel = 1;
|
||||
if (i_count3>1) {
|
||||
iLevel=4;
|
||||
} else if (i_count3==1) {
|
||||
iLevel=3;
|
||||
} else if (i_count2==1) {
|
||||
iLevel=2;
|
||||
}else {
|
||||
iLevel=1;
|
||||
}
|
||||
carryCapacityDResultVO.setILevel(iLevel);
|
||||
//统计安全,3级预警,2级预警1级预警个数
|
||||
List<Integer> list = Stream.of(uTLevel, pfTLevel, bTLevel, iLevel).collect(Collectors.toList());
|
||||
int safe_count=0,warn_count3=0,warn_count2=0,warn_count1=0;
|
||||
safe_count =(int) list.stream()
|
||||
.filter(temp ->temp==1)
|
||||
.count();
|
||||
warn_count3 =(int) list.stream()
|
||||
.filter(temp ->temp==2)
|
||||
.count();
|
||||
warn_count2 =(int) list.stream()
|
||||
.filter(temp ->temp==3)
|
||||
.count();
|
||||
warn_count1 =(int) list.stream()
|
||||
.filter(temp ->temp==1)
|
||||
.count();
|
||||
|
||||
|
||||
|
||||
List<CarryCapacityStrategyVO> carryCapacityStrategyVOList = carryCapacityStrategyPOService.queyDetail();
|
||||
//1-安全,2-III级预警,3-II级预警,4-I 级预警,依次执行策略看是否符合
|
||||
for (int i = 1; i < 5; i++) {
|
||||
int finalI = i;
|
||||
boolean b = StrategyReslut(carryCapacityStrategyVOList, i, 1, safe_count);
|
||||
boolean b1 = StrategyReslut(carryCapacityStrategyVOList, i, 2, warn_count3);
|
||||
boolean b2 = StrategyReslut(carryCapacityStrategyVOList, i, 3, warn_count2);
|
||||
boolean b3 = StrategyReslut(carryCapacityStrategyVOList, i, 4, warn_count1);
|
||||
if(b&&b1&&b2&&b3){
|
||||
carryCapacityDResultVO.setReslutLevel(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return carryCapacityDResultVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalTree> carryCapacityTree() {
|
||||
List<TerminalTree> data = deviceTreeClient.getTerminalTree().getData();
|
||||
data.forEach(temp->{
|
||||
temp.getChildren().forEach(temp1->{
|
||||
temp1.getChildren().forEach(temp2->{
|
||||
temp2.getChildren().forEach(temp3->{
|
||||
temp3.getChildren().forEach(temp4->{
|
||||
List<TerminalTree> collect = temp4.getChildren().stream()
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
temp4.setChildren(collect);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 首先,找到缺失值的前一个和后一个非缺失值。
|
||||
* 计算两个非缺失值之间的差值。
|
||||
* 将差值除以两个非缺失值之间的距离,得到斜率。
|
||||
* 使用斜率和前一个非缺失值计算缺失值的近似值。
|
||||
* @Param:
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/28
|
||||
*/
|
||||
public static void linearInterpolation(List<CarryCapcityData> data) {
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (data.get(i).getValue() == DEFAULTVALUE ) {
|
||||
int prevIndex = i - 1;
|
||||
int nextIndex = i + 1;
|
||||
while (prevIndex >= 0 && data.get(prevIndex).getValue() == DEFAULTVALUE) {
|
||||
prevIndex--;
|
||||
}
|
||||
while (nextIndex < data.size() && data.get(nextIndex).getValue() == DEFAULTVALUE) {
|
||||
nextIndex++;
|
||||
}
|
||||
if (prevIndex >= 0 && nextIndex < data.size()) {
|
||||
double slope = (data.get(nextIndex).getValue() - data.get(prevIndex).getValue()) / (nextIndex - prevIndex);
|
||||
data.get(i).setValue(data.get(prevIndex).getValue() + slope * (i - prevIndex));
|
||||
} else {
|
||||
data.get(i).setValue(DEFAULTVALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @Description: linearInterpolationI 电流数据缺失填补
|
||||
* @Param:
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/28
|
||||
*/
|
||||
public static void linearInterpolationI(List<DataI> data) {
|
||||
for (int k= 2; k <=25 ; k++) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (data.get(i).getI2() == DEFAULTVALUE) {
|
||||
int prevIndex = i - 1;
|
||||
int nextIndex = i + 1;
|
||||
while (prevIndex >= 0 && data.get(prevIndex).getI2() == DEFAULTVALUE) {
|
||||
prevIndex--;
|
||||
}
|
||||
while (nextIndex < data.size() && data.get(nextIndex).getI2() == DEFAULTVALUE) {
|
||||
nextIndex++;
|
||||
}
|
||||
if (prevIndex >= 0 && nextIndex < data.size()) {
|
||||
double slope = (data.get(nextIndex).getI2() - data.get(prevIndex).getI2()) / (nextIndex - prevIndex);
|
||||
data.get(i).setI2(data.get(prevIndex).getI2() + slope * (i - prevIndex));
|
||||
data.get(i).setI3(data.get(prevIndex).getI3() + slope * (i - prevIndex));
|
||||
data.get(i).setI4(data.get(prevIndex).getI4() + slope * (i - prevIndex));
|
||||
data.get(i).setI5(data.get(prevIndex).getI5() + slope * (i - prevIndex));
|
||||
data.get(i).setI6(data.get(prevIndex).getI6() + slope * (i - prevIndex));
|
||||
data.get(i).setI7(data.get(prevIndex).getI7() + slope * (i - prevIndex));
|
||||
data.get(i).setI8(data.get(prevIndex).getI8() + slope * (i - prevIndex));
|
||||
data.get(i).setI9(data.get(prevIndex).getI9() + slope * (i - prevIndex));
|
||||
data.get(i).setI10(data.get(prevIndex).getI10() + slope * (i - prevIndex));
|
||||
data.get(i).setI11(data.get(prevIndex).getI11() + slope * (i - prevIndex));
|
||||
data.get(i).setI12(data.get(prevIndex).getI12() + slope * (i - prevIndex));
|
||||
data.get(i).setI13(data.get(prevIndex).getI13() + slope * (i - prevIndex));
|
||||
data.get(i).setI14(data.get(prevIndex).getI14() + slope * (i - prevIndex));
|
||||
data.get(i).setI15(data.get(prevIndex).getI15() + slope * (i - prevIndex));
|
||||
data.get(i).setI16(data.get(prevIndex).getI16() + slope * (i - prevIndex));
|
||||
data.get(i).setI17(data.get(prevIndex).getI17() + slope * (i - prevIndex));
|
||||
data.get(i).setI18(data.get(prevIndex).getI18() + slope * (i - prevIndex));
|
||||
data.get(i).setI19(data.get(prevIndex).getI19() + slope * (i - prevIndex));
|
||||
data.get(i).setI20(data.get(prevIndex).getI20() + slope * (i - prevIndex));
|
||||
data.get(i).setI21(data.get(prevIndex).getI21() + slope * (i - prevIndex));
|
||||
data.get(i).setI22(data.get(prevIndex).getI22() + slope * (i - prevIndex));
|
||||
data.get(i).setI23(data.get(prevIndex).getI23() + slope * (i - prevIndex));
|
||||
data.get(i).setI24(data.get(prevIndex).getI24() + slope * (i - prevIndex));
|
||||
data.get(i).setI25(data.get(prevIndex).getI25() + slope * (i - prevIndex));
|
||||
|
||||
} else {
|
||||
data.get(i).setI2(DEFAULTVALUE);
|
||||
data.get(i).setI3(DEFAULTVALUE);
|
||||
data.get(i).setI4(DEFAULTVALUE);
|
||||
data.get(i).setI5(DEFAULTVALUE);
|
||||
data.get(i).setI6(DEFAULTVALUE);
|
||||
data.get(i).setI7(DEFAULTVALUE);
|
||||
data.get(i).setI8(DEFAULTVALUE);
|
||||
data.get(i).setI9(DEFAULTVALUE);
|
||||
data.get(i).setI10(DEFAULTVALUE);
|
||||
data.get(i).setI11(DEFAULTVALUE);
|
||||
data.get(i).setI12(DEFAULTVALUE);
|
||||
data.get(i).setI13(DEFAULTVALUE);
|
||||
data.get(i).setI14(DEFAULTVALUE);
|
||||
data.get(i).setI15(DEFAULTVALUE);
|
||||
data.get(i).setI16(DEFAULTVALUE);
|
||||
data.get(i).setI17(DEFAULTVALUE);
|
||||
data.get(i).setI18(DEFAULTVALUE);
|
||||
data.get(i).setI19(DEFAULTVALUE);
|
||||
data.get(i).setI20(DEFAULTVALUE);
|
||||
data.get(i).setI21(DEFAULTVALUE);
|
||||
data.get(i).setI22(DEFAULTVALUE);
|
||||
data.get(i).setI23(DEFAULTVALUE);
|
||||
data.get(i).setI24(DEFAULTVALUE);
|
||||
data.get(i).setI25(DEFAULTVALUE);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Description: calUParam 首端电压模型训练获取A,B,C三项C,a,b参数
|
||||
* @Param:
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Double[]>
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/29
|
||||
*/
|
||||
public static Map<String,Double[]> calUParam(List<CarryCapcityData> dataHarmPowerPList2,List<CarryCapcityData> dataHarmPowerQList2,List<CarryCapcityData> DataVList2){
|
||||
Map<String,Double[]> results = new HashMap<>(4);
|
||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||
//存储UA, UB,UC;
|
||||
List<Double> uList = new ArrayList<>();
|
||||
|
||||
phaseType.stream().forEach(phase -> {
|
||||
List<Double> listP2 = dataHarmPowerPList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listQ2 = dataHarmPowerQList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> listV2 = DataVList2.stream().filter(temp -> Utils.isTimeInRange(temp.getTime(), LocalTime.of(9, 0), LocalTime.of(15, 0)))
|
||||
.filter(temp -> temp.getPhaseType().equals(phase))
|
||||
.map(CarryCapcityData::getValue)
|
||||
.collect(Collectors.toList());
|
||||
//todo 抽取5000条数据(抽取方式待确定)
|
||||
Double[] res = new Double[3];
|
||||
CZNLPG.cznlpgDataTrain(listV2, listP2, listQ2, listV2.size(), res);
|
||||
results.put(phase, res);
|
||||
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private static boolean compareNumbers(int num1, int num2, String operator) {
|
||||
if (operator.equals("/")) {
|
||||
return true;
|
||||
}
|
||||
else if (operator.equals("<") ) {
|
||||
return num1 < num2;
|
||||
} else if (operator.equals(">")) {
|
||||
return num1 > num2;
|
||||
} else if (operator.equals("<=")) {
|
||||
return num1 <= num2;
|
||||
} else if (operator.equals(">=")) {
|
||||
return num1 >= num2;
|
||||
} else if (operator.equals("==")) {
|
||||
return num1 == num2;
|
||||
} else if (operator.equals("!=")) {
|
||||
return num1 != num2;
|
||||
} else {
|
||||
throw new IllegalArgumentException("无效的操作符");
|
||||
}
|
||||
}
|
||||
private static boolean StrategyReslut(List<CarryCapacityStrategyVO> carryCapacityStrategyVOList, int result_level, int index_result_level,int result_count) {
|
||||
CarryCapacityStrategyVO carryCapacityStrategyVO = carryCapacityStrategyVOList.stream()
|
||||
.filter(temp -> temp.getResult() == result_level)
|
||||
.filter(temp -> temp.getIndexResult() == index_result_level)
|
||||
.collect(Collectors.toList()).get(0);
|
||||
boolean b1 = compareNumbers(result_count, carryCapacityStrategyVO.getCount(), carryCapacityStrategyVO.getComparisonOperators());
|
||||
return b1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import org.apache.commons.math3.linear.DecompositionSolver;
|
||||
import org.apache.commons.math3.linear.LUDecomposition;
|
||||
import org.apache.commons.math3.linear.MatrixUtils;
|
||||
import org.apache.commons.math3.linear.RealMatrix;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CZNLPG {
|
||||
|
||||
private static final String DATA_CSV = "C:\\njcn\\pqs\\pqs-advance\\advance-boot\\src\\main\\resources\\test.csv";
|
||||
private static final int MAX_PRO_DATA_NUM = 5000;
|
||||
private static final int MAX_DATA_COL_NUM = 9;
|
||||
private static double[][] arr = new double[MAX_PRO_DATA_NUM][MAX_DATA_COL_NUM];
|
||||
|
||||
public static void main(String[] args) {
|
||||
double[] data_u = new double[MAX_PRO_DATA_NUM];
|
||||
double[] data_p = new double[MAX_PRO_DATA_NUM];
|
||||
double[] data_q = new double[MAX_PRO_DATA_NUM];
|
||||
|
||||
int data_num = parseCSV(DATA_CSV, data_u, data_p, data_q);
|
||||
System.out.println("data_num: " + data_num);
|
||||
|
||||
double[] res = new double[3];
|
||||
// cznlpgDataTrain(data_u, data_p, data_q, data_num, res);
|
||||
System.out.println("C = " + res[0] + " a = " + res[1] + " b = " + res[2]);
|
||||
}
|
||||
|
||||
private static int parseCSV(String path, double[] data_u, double[] data_p, double[] data_q) {
|
||||
int line = 0;
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(path))) {
|
||||
String lines;
|
||||
while ((lines = br.readLine()) != null) {
|
||||
String[] tokens = lines.split(",");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
arr[line][i] = Double.parseDouble(tokens[i]);
|
||||
}
|
||||
|
||||
System.out.println("line " + line + ": ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
System.out.println("arr[" + line + "][" + i + "]=" + arr[line][i]);
|
||||
}
|
||||
|
||||
data_u[line] = arr[line][0];
|
||||
data_p[line] = arr[line][1];
|
||||
data_q[line] = arr[line][2];
|
||||
|
||||
line++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return line;
|
||||
}
|
||||
/*
|
||||
* 模型训练
|
||||
* */
|
||||
public static void cznlpgDataTrain(List<Double> u, List<Double> p, List<Double> q, int num, Double[] outRes) {
|
||||
if (num > MAX_PRO_DATA_NUM) {
|
||||
return;
|
||||
}
|
||||
|
||||
RealMatrix matPQ = MatrixUtils.createRealMatrix(num, 3);
|
||||
RealMatrix matU = MatrixUtils.createRealMatrix(num, 1);
|
||||
RealMatrix matW = MatrixUtils.createRealMatrix(3, 1);
|
||||
|
||||
// Matrix assignment
|
||||
for (int i = 0; i < num; i++) {
|
||||
matPQ.setEntry(i, 0, 1);
|
||||
matPQ.setEntry(i, 1, p.get(i));
|
||||
matPQ.setEntry(i, 2, q.get(i));
|
||||
|
||||
matU.setEntry(i, 0, u.get(i));
|
||||
}
|
||||
|
||||
System.out.println("matPQ=");
|
||||
printMatrix(matPQ);
|
||||
System.out.println("matPQ transpose=");
|
||||
printMatrix(matPQ.transpose());
|
||||
|
||||
// w = inv(PQ1'*PQ1)*PQ1'*U
|
||||
// U = 224.5133 - 2.3041e-5 * P - 1.1900e-4 * Q
|
||||
RealMatrix matPQT = matPQ.transpose();
|
||||
RealMatrix matInverse = inverseMatrix(matPQT.multiply(matPQ));
|
||||
matW = matInverse.multiply(matPQT).multiply(matU);
|
||||
|
||||
outRes[0] = matW.getEntry(0, 0);
|
||||
outRes[1] = matW.getEntry(1, 0);
|
||||
outRes[2] = matW.getEntry(2, 0);
|
||||
}
|
||||
|
||||
private static void printMatrix(RealMatrix matrix) {
|
||||
System.out.println(matrix);
|
||||
}
|
||||
|
||||
|
||||
//矩阵求逆
|
||||
|
||||
public static RealMatrix inverseMatrix(RealMatrix matrix) {
|
||||
LUDecomposition LUDe = new LUDecomposition(matrix);
|
||||
DecompositionSolver solver = LUDe.getSolver();
|
||||
RealMatrix result = solver.getInverse();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 负载率约束指标计算P_βmin和Q_βmin分别为近一周的配变每日9时~15时段的负载率数据中概率95%小值所对应时刻的有功功率和无功功率值;
|
||||
* S_T为配变额定容量;S_pv为拟接入光伏容量;k为修正系数 ,取值可参照如下。
|
||||
* 台区日照条件 k
|
||||
* 光照强度大于1250kWh/m^2 0.8~0.9
|
||||
* 光照强度小于1250kWh/m^2 0.75~0.8
|
||||
* 海南 0.8
|
||||
* @Param:
|
||||
* @return: double Loadrate
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/26
|
||||
*/
|
||||
public static double calculateB(double P_βmin, double Q_βmin, double k, double S_T, double S_pv, double P_pv) {
|
||||
double term1 = Math.pow(P_βmin - k * S_T, 2);
|
||||
double term2 = Math.pow(Q_βmin, 2);
|
||||
double numerator = Math.sqrt(term1 + term2);
|
||||
if (P_βmin > P_pv) {
|
||||
return numerator / S_pv;
|
||||
} else {
|
||||
return -numerator / S_pv;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @Description: calculatePF_T 功率因数指标计算
|
||||
* @Param:
|
||||
* @return: double
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/20
|
||||
*/
|
||||
public static double calculatePF_T(double P_βmin, double Q_βmin, double k, double S_pv) {
|
||||
double term1 = Math.pow(P_βmin - k * S_pv, 2);
|
||||
double term2 = Math.pow(Q_βmin, 2);
|
||||
double v = P_βmin - k * S_pv;
|
||||
double numerator = Math.sqrt(term1 + term2);
|
||||
|
||||
return v/numerator;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 总结:
|
||||
* p_min和 q_min能够根据测点数据获取得到;
|
||||
* S_pv为拟接入光伏容量,此部分需要现场选取好台区后获取。
|
||||
* k为修正系数,徐工提供海南k系数,是否需要考虑不同季节台区日照系数。
|
||||
* C、a、b需要用模型计算,是此算法中难点。
|
||||
* 结论:【拟接入光伏容量】为入参;【A/B/C相有功功率】和【A/B/C相无功功率值】95%小值从A/B/C相历史数据中计算得出; 为枚举参数;能够计算三相配变首端电压 、 、 ,从而得出U 。
|
||||
* 380v -U=C-a(p_min -k*S_pv/3)-b*q_min
|
||||
* 220v -U=C-a(p_min -k*S_pv)-b*q_min
|
||||
*
|
||||
* @Param:
|
||||
* @return: double
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/2
|
||||
*/
|
||||
public static double calculateU(double C, double a, double b, double p_min, double K, double q_min,double S_pv, double voltage) {
|
||||
|
||||
if (voltage == 220) {
|
||||
return C-a*(p_min-K*S_pv)-b*q_min;
|
||||
} else if (voltage == 380) {
|
||||
return C-a*(p_min-K*S_pv/3)-b*q_min;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* I_(stock,h)为台区一周内的h次谐波电流95%概率大值,I_"inv" ^h%为光伏逆变器第h次的典型谐波电流含有率;
|
||||
* S_pv为拟接入光伏容量,此部分需要现场选取好台区后获取。
|
||||
* k为修正系数,徐工提供海南k系数,是否需要考虑不同季节台区日照系数。
|
||||
* 结论:【电压等级】为入参;I_(stock,h)为台区一周内的h次谐波电流95%概率大值,I_"inv" ^h%为光伏逆变器第h次的典型谐波电流含有率,
|
||||
* 为枚举参数;k为枚举参数;能够计算各次的谐波电流幅值 、 、 ,从而得出 。
|
||||
*/
|
||||
public static double calculateITm(double I_cp95, double k, double voltage, double S_pv, double K, double I_inv) {
|
||||
double term1 = Math.pow(I_cp95, 2);
|
||||
double term2 = 0, term3 = 0;
|
||||
if (voltage == 220) {
|
||||
term2 = Math.pow(k * S_pv * I_inv / 220, 2);
|
||||
term3 = K * I_cp95 * (k * S_pv * I_inv / 220);
|
||||
} else if (voltage == 380) {
|
||||
term2 = Math.pow(k * S_pv * I_inv / 3 * 220, 2);
|
||||
term3 = K * I_cp95 * (k * S_pv * I_inv / 3 * 220);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double sumOfTerms = term1 + term2 + term3;
|
||||
|
||||
return Math.sqrt(sumOfTerms);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: evaluateVoltageLevel 根据规则评估配变首端电压等级
|
||||
* @Param:
|
||||
* @return: int
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/30
|
||||
*/
|
||||
public static int evaluateVoltageLevel(double voltage) {
|
||||
if (voltage <= 235.4) {
|
||||
return 1; // 安全
|
||||
} else if (voltage > 235.4 && voltage <= 253.0) {
|
||||
return 2; // Ⅲ级预警
|
||||
} else if (voltage > 253.0 && voltage < 260.0) {
|
||||
return 3; // Ⅱ级预警
|
||||
} else {
|
||||
return 4; // Ⅰ级预警
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: evaluatePowerFactorLevel // 根据规则评估功率因数等级
|
||||
* @Param:
|
||||
* @return: int
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/30
|
||||
*/
|
||||
public static int evaluatePowerFactorLevel(double powerFactor) {
|
||||
if (powerFactor >= 0.9) {
|
||||
return 1; // 安全
|
||||
} else if (powerFactor >= 0.85 && powerFactor < 0.9) {
|
||||
return 2; // Ⅲ级预警
|
||||
} else if (powerFactor >= 0.8 && powerFactor < 0.85) {
|
||||
return 3; // Ⅱ级预警
|
||||
} else {
|
||||
return 4; // Ⅰ级预警
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: / 根据规则评估等效负载率等级
|
||||
* @Param:
|
||||
* @return: int
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/30
|
||||
*/
|
||||
public static int evaluateEquivalentLoadRateLevel(double equivalentLoadRate) {
|
||||
if (equivalentLoadRate >= 0.0) {
|
||||
return 1; // 安全
|
||||
} else if (equivalentLoadRate >= -40.0 && equivalentLoadRate < 0.0) {
|
||||
return 2; // Ⅲ级预警
|
||||
} else if (equivalentLoadRate >= -80.0 && equivalentLoadRate < -40.0) {
|
||||
return 3; // Ⅱ级预警
|
||||
} else {
|
||||
return 4; // Ⅰ级预警
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 判断O:各项指标是否均为“安全” 安全接入
|
||||
* 判断2: 至多2项指标达到“III级预警”,其余指标均为“安全” 3接入预警
|
||||
* @: 超过2项指标达到“III级预警”且无“II级预警”及以上的指标:或至多1项指标达到“I 级预警且其余指标均为“安全” 2接入预警
|
||||
* 判断@: 至多2项指标达到“II 级预警”且其余指标均为“安全”: 或至多1项指标达到“II级预警”且其余指标存在“III级预警” 1级接入预警
|
||||
* 否则 限制接入
|
||||
* @Param:
|
||||
* @return:
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/30
|
||||
*/
|
||||
public static int evaluateG(List<Integer> indicators) {
|
||||
long count1 = indicators.stream().filter(i -> i == 1).count();
|
||||
long count2 = indicators.stream().filter(i -> i == 2).count();
|
||||
long count3 = indicators.stream().filter(i -> i == 3).count();
|
||||
if (count1 == 4) {
|
||||
return 1;
|
||||
} else if (count2 <= 2 && count2 + count1 == 4) {
|
||||
return 2;
|
||||
} else if ((count2 >= 2 && count2 + count1 == 4) || (count3 == 1 && count1 == 3)) {
|
||||
return 3;
|
||||
} else if ((count3 <= 2 && count1 + count3 == 4) || (count3 == 1 && count2 >= 1 && count1 + count2 == 3)) {
|
||||
return 4;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算一组数据的最大95概率值,最小95概率值 入参一组double集合,一个flag表示计算类型 返回double
|
||||
*
|
||||
* @param data
|
||||
* @param type 0 最大95概率值 1 最小95概率值
|
||||
* @return
|
||||
*/
|
||||
public static double calculatePercentile(List<Double> data, Integer type) {
|
||||
// 对数组进行排序
|
||||
// 正序排序
|
||||
Collections.sort(data);
|
||||
int index =0;
|
||||
if (type == 0) {
|
||||
// 计算最大95%概率值的索引
|
||||
index =(int) Math.ceil(0.95 * data.size()) ;
|
||||
} else if (type == 1) {
|
||||
// 计算最小95%概率值的索引
|
||||
index = (int) Math.ceil(0.05 * data.size()) - 1;
|
||||
}
|
||||
|
||||
// 根据计算类型返回相应的值
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ package com.njcn.advance.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -99,4 +102,34 @@ public class Utils {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// 辅助方法:检查时间是否在指定范围内
|
||||
public static boolean isTimeInRange(Instant instant, LocalTime startTime, LocalTime endTime) {
|
||||
LocalTime localTime = instant.atZone(Instant.now().atZone(java.time.ZoneId.systemDefault()).getZone()).toLocalTime();
|
||||
return !localTime.isBefore(startTime) && !localTime.isAfter(endTime);
|
||||
}
|
||||
|
||||
public static <T> List<Double> getAttributeValueByPropertyName(List<T> list, String propertyName) {
|
||||
List<Double> resultList = new ArrayList<>();
|
||||
for (T item : list) {
|
||||
try {
|
||||
Field field = item.getClass().getDeclaredField(propertyName);
|
||||
field.setAccessible(true);
|
||||
resultList.add((Double) field.get(item));
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
public static <T> Double getAttributeValueByPropertyName(T item, String propertyName) {
|
||||
Double result = null;
|
||||
try {
|
||||
Field field = item.getClass().getDeclaredField(propertyName);
|
||||
field.setAccessible(true);
|
||||
result=(Double) field.get(item);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
2524
pqs-advance/advance-boot/src/main/java/com/njcn/advance/utils/sql
Normal file
2524
pqs-advance/advance-boot/src/main/java/com/njcn/advance/utils/sql
Normal file
File diff suppressed because it is too large
Load Diff
2021
pqs-advance/advance-boot/src/main/resources/test.csv
Normal file
2021
pqs-advance/advance-boot/src/main/resources/test.csv
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,7 @@ package com.njcn.device.biz.utils;
|
||||
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Dic;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@@ -211,7 +208,13 @@ public class COverlimitUtil {
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: iHarmCalculate
|
||||
* @Param: protocolCapacity 协议容量 devCapacity设备容量 calCap 短路容量
|
||||
* @return: float
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/4
|
||||
*/
|
||||
private static float iHarmCalculate(int nHarm, Float voltageLevel,float protocolCapacity, float devCapacity,float calCap) {
|
||||
double tag = calCap*getHarmTag(nHarm,voltageLevel);
|
||||
Double limit = getHarmonicLimit(nHarm,tag,new BigDecimal(String.valueOf(devCapacity)).doubleValue(),new BigDecimal(String.valueOf(protocolCapacity)).doubleValue());
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -21,4 +23,8 @@ public interface DeviceTreeClient {
|
||||
*/
|
||||
@GetMapping("/getTerminalTreeForFive")
|
||||
HttpResult<TerminalTree> getTerminalTreeForFive();
|
||||
|
||||
|
||||
@GetMapping("getTerminalTree")
|
||||
HttpResult<List<TerminalTree>> getTerminalTree();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -36,6 +38,12 @@ public class DeviceTreeClientFallbackFactory implements FallbackFactory<DeviceTr
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<TerminalTree>> getTerminalTree() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取终端树",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.influx.imapper;
|
||||
|
||||
import com.njcn.influx.ano.Param;
|
||||
import com.njcn.influx.ano.Select;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerP;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,4 +17,7 @@ import java.util.List;
|
||||
public interface DataHarmPowerPMapper extends InfluxDbBaseMapper<DataHarmPowerP> {
|
||||
|
||||
List<DataHarmPowerP> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
@Select(value = "#{sql}",resultType = CarryCapcityData.class)
|
||||
List<CarryCapcityData> getSqlResult(@Param("sql")String sql);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.njcn.influx.imapper;
|
||||
|
||||
import com.njcn.influx.ano.Param;
|
||||
import com.njcn.influx.ano.Select;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerQ;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
|
||||
@@ -14,5 +17,6 @@ import java.util.List;
|
||||
public interface DataHarmPowerQMapper extends InfluxDbBaseMapper<DataHarmPowerQ> {
|
||||
|
||||
List<DataHarmPowerQ> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
@Select(value = "#{sql}",resultType = CarryCapcityData.class)
|
||||
List<CarryCapcityData> getSqlResult(@Param("sql")String sql);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.njcn.influx.imapper;
|
||||
|
||||
import com.njcn.influx.ano.Param;
|
||||
import com.njcn.influx.ano.Select;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||
import com.njcn.influx.pojo.bo.MeasurementCount;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
@@ -19,5 +22,6 @@ public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
|
||||
|
||||
List<DataV> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
|
||||
List<MeasurementCount> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
@Select(value = "#{sql}",resultType = CarryCapcityData.class)
|
||||
List<CarryCapcityData> getSqlResult(@Param("sql")String sql);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.njcn.influx.imapper;
|
||||
|
||||
import com.njcn.influx.ano.Param;
|
||||
import com.njcn.influx.ano.Select;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.pojo.dto.HarmData;
|
||||
import com.njcn.influx.pojo.po.DataI;
|
||||
@@ -19,4 +21,7 @@ public interface IDataIMapper extends InfluxDbBaseMapper<DataI> {
|
||||
List<HarmData> getIHistoryData(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
List<DataI> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
@Select(value = "#{sql}",resultType = DataI.class)
|
||||
List<DataI> getSqlResult(@Param("sql")String sql);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.influx.pojo.bo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/5/12 9:13
|
||||
*/
|
||||
@Data
|
||||
public class CarryCapcityData {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
private String valueType;
|
||||
|
||||
private Double value;
|
||||
|
||||
}
|
||||
@@ -28,16 +28,16 @@ public class DataFluc {
|
||||
@Column(name = "fluccf")
|
||||
private Double fluccf;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ public class DataHarmPhasicI {
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "i_1")
|
||||
|
||||
@@ -23,16 +23,16 @@ public class DataHarmPowerP {
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "df")
|
||||
|
||||
@@ -23,18 +23,19 @@ public class DataHarmPowerQ {
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id", tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type", tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag", tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type", tag = true)
|
||||
private String valueType;
|
||||
|
||||
|
||||
@Column(name = "q")
|
||||
private Double q;
|
||||
|
||||
|
||||
@@ -23,16 +23,16 @@ public class DataHarmPowerS {
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "s")
|
||||
|
||||
@@ -20,16 +20,16 @@ public class DataInHarmRateI {
|
||||
@Column(name = "time")
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "i_1")
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.influx.service;
|
||||
|
||||
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerQ;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年05月05日 09:51
|
||||
*/
|
||||
public interface DataHarmPowerQService {
|
||||
List<DataHarmPowerQ> getHarmonicPowerQ(String lineIndex, String startTime, String endTime);
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.njcn.influx.service;
|
||||
import com.njcn.influx.pojo.po.DataI;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
@@ -11,4 +13,12 @@ import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
public interface IDataIService {
|
||||
|
||||
DataI getMeanAllTimesData(InfluxQueryWrapper influxQueryWrapper);
|
||||
/**
|
||||
* @Description: getWeekDataI 承载能力评估获取一周数据
|
||||
* @Param:
|
||||
* @return: java.util.List<com.njcn.influx.pojo.po.DataI>
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/27
|
||||
*/
|
||||
List<DataI> getWeekDataI(String lineIndex, String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,5 @@ public interface IDataVService {
|
||||
|
||||
List<DataV> getDataV(String lineIndex, String startTime, String endTime);
|
||||
List<DataV> getHarmonicDataV(String lineIndex, String startTime, String endTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.influx.service.impl;
|
||||
|
||||
import com.njcn.influx.imapper.DataHarmPowerQMapper;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerP;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerQ;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.influx.service.DataHarmPowerQService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/2/27 14:50【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class DataHarmPowerQServiceImpl implements DataHarmPowerQService {
|
||||
@Resource
|
||||
private DataHarmPowerQMapper dataHarmPowerQMapper;
|
||||
@Override
|
||||
public List<DataHarmPowerQ> getHarmonicPowerQ(String lineIndex, String startTime, String endTime) {
|
||||
List<DataHarmPowerQ> result1 ;
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerP.class);
|
||||
influxQueryWrapper.eq(DataHarmPowerQ::getLineId, lineIndex)
|
||||
.eq(DataHarmPowerQ::getValueType, "AVG")
|
||||
.eq(DataHarmPowerQ::getPhaseType, "T")
|
||||
.between(DataHarmPowerQ::getTime, startTime, endTime);
|
||||
result1 = dataHarmPowerQMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
return result1;
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ public class DataVServiceImpl implements IDataVService {
|
||||
return result1;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 自定义需要查询的谐波次数
|
||||
* @author xuyang
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.njcn.influx.service.IDataIService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
@@ -22,4 +24,17 @@ public class IDataIServiceImpl implements IDataIService {
|
||||
public DataI getMeanAllTimesData(InfluxQueryWrapper influxQueryWrapper) {
|
||||
return dataIMapper.getMeanAllTimesData(influxQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataI> getWeekDataI(String lineIndex, String startTime, String endTime) {
|
||||
List<DataI> result1 ;
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||
influxQueryWrapper
|
||||
.eq(DataI::getLineId, lineIndex)
|
||||
.eq(DataI::getValueType, "CP95")
|
||||
.ne(DataI::getPhaseType, "T")
|
||||
.between(DataI::getTime, startTime, endTime);;
|
||||
result1 = dataIMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
return result1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user