冀北电网一张图相关接口
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
device.com_flag comFlag,
|
device.com_flag comFlag,
|
||||||
1 as lineType,
|
1 as lineType,
|
||||||
0 as type,
|
0 as type,
|
||||||
lineDetail.Monitor_Flag as isUpToGrid
|
lineDetail.monitor_flag as isUpToGrid
|
||||||
</if>
|
</if>
|
||||||
<!--母线-->
|
<!--母线-->
|
||||||
<if test="type == 2">
|
<if test="type == 2">
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
DeptGetBase deptGetBase = new DeptGetBase();
|
DeptGetBase deptGetBase = new DeptGetBase();
|
||||||
deptGetBase.setUnitId(it.getId());
|
deptGetBase.setUnitId(it.getId());
|
||||||
deptGetBase.setUnitName(it.getName());
|
deptGetBase.setUnitName(it.getName());
|
||||||
|
deptGetBase.setDeptLevel(getDeptLevel(it.getPids()));
|
||||||
List<String> deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList());
|
List<String> deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList());
|
||||||
deptChildren.add(it.getId());
|
deptChildren.add(it.getId());
|
||||||
deptGetBase.setUnitChildrenList(deptChildren);
|
deptGetBase.setUnitChildrenList(deptChildren);
|
||||||
@@ -379,4 +380,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer getDeptLevel(String pids) {
|
||||||
|
List<String> list = Arrays.stream(pids.split(",")).map(String::trim).collect(Collectors.toList());
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.njcn.harmonic.pojo.param.hebeinorth;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:冀北全景一张图 综合评估请求参数
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/22 15:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AssessParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
@NotBlank(message = "部门索引不可为空")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("起始时间")
|
||||||
|
@NotBlank(message = "起始时间不可为空")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
@NotBlank(message = "结束时间不可为空")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点类型- 0:冀北 1:国网上报")
|
||||||
|
@NotNull(message = "监测点类型不可为空")
|
||||||
|
private Integer lineType;
|
||||||
|
|
||||||
|
@ApiModelProperty("稳态类型-全指标、电压偏差、频率偏差、电压总谐波畸变率、电压闪变、三相电压不平衡度")
|
||||||
|
private Integer harmonicType;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂态类型-暂降、暂升、中断")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
@ApiModelProperty("搜索值")
|
||||||
|
private String searchValue;
|
||||||
|
|
||||||
|
@ApiModelProperty("电压等级")
|
||||||
|
private String voltageLevel;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.njcn.harmonic.pojo.vo.hebeinorth;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:冀北全景一张图综合评估返回实体
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/22 14:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AssessDetailVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Float assessData = 3.14159f;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String assessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double qualifyData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端个数")
|
||||||
|
private Integer devNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压偏差
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Double vDevAssessData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String vDevAssessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double vDevQualifyData = 3.14159;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 频率偏差
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Double freqAssessData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String freqAssessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double freqQualifyData = 3.14159;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波含量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Double harmAssessData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String harmAssessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double harmQualifyData = 3.14159;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压闪变
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Double flickerAssessData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String flickerAssessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double flickerQualifyData = 3.14159;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三相电压不平衡度
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("评估分值")
|
||||||
|
private Double unbalanceAssessData = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String unbalanceAssessLevel = "暂无数据";
|
||||||
|
|
||||||
|
@ApiModelProperty("指标合格率")
|
||||||
|
private Double unbalanceQualifyData = 3.14159;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.harmonic.pojo.vo.hebeinorth;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:冀北全景一张图-综合评估主界面返回实体
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/22 14:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AssessVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估分数")
|
||||||
|
private Float score = 3.14159f;
|
||||||
|
|
||||||
|
@ApiModelProperty("评估等级")
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.njcn.harmonic.pojo.vo.hebeinorth;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/24 14:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EvaluationLevelVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String targetName;
|
||||||
|
|
||||||
|
@ApiModelProperty("平均值")
|
||||||
|
private Double avg = 3.14159;
|
||||||
|
|
||||||
|
@ApiModelProperty("标准差")
|
||||||
|
private Double sd = 3.14159;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class EvaluationRatio {
|
||||||
|
|
||||||
|
@ApiModelProperty("时间")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称集合")
|
||||||
|
private List<String> targetList;
|
||||||
|
|
||||||
|
@ApiModelProperty("超标占比集合")
|
||||||
|
private List<Double> ratioList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class EvaluationDetail {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门ID")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty("在线监测点数")
|
||||||
|
private Integer onlineNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("超标监测点数")
|
||||||
|
private Integer overNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("超标监测点占比")
|
||||||
|
private Double overRatio;
|
||||||
|
|
||||||
|
@ApiModelProperty("各指标详情")
|
||||||
|
List<TargetDetail> list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class TargetDetail {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String targetName;
|
||||||
|
|
||||||
|
@ApiModelProperty("超标监测点数")
|
||||||
|
private Integer overNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("超标天数")
|
||||||
|
private Integer overDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.harmonic.pojo.vo.hebeinorth;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/23 22:12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EvaluationVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点越限占比")
|
||||||
|
private Double lineRatio;
|
||||||
|
|
||||||
|
@ApiModelProperty("子集")
|
||||||
|
private List<Children> childrenList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Children {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty("越限占比")
|
||||||
|
private Double ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.njcn.harmonic.controller.hebeinorth;
|
||||||
|
|
||||||
|
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.harmonic.pojo.param.hebeinorth.AssessParam;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessDetailVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationLevelVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationVo;
|
||||||
|
import com.njcn.harmonic.service.hebeinorth.IGridService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/24 17:19
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/grid")
|
||||||
|
@Api(tags = "冀北全景一张图")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GridController extends BaseController {
|
||||||
|
|
||||||
|
private final IGridService gridService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAssessOverview")
|
||||||
|
@ApiOperation("综合评估概览数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<AssessVo>> getAssessOverview(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getAssessOverview");
|
||||||
|
List<AssessVo> result = gridService.getAssessOverview(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAssessDetail")
|
||||||
|
@ApiOperation("综合评估详细数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<AssessDetailVo>> getAssessDetail(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getAssessDetail");
|
||||||
|
List<AssessDetailVo> result = gridService.getData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getEvaluationOverview")
|
||||||
|
@ApiOperation("稳态电能质量水平评价概览数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<EvaluationVo> getEvaluationOverview(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getEvaluationOverview");
|
||||||
|
EvaluationVo result = gridService.getEvaluationOverview(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getEvaluationData")
|
||||||
|
@ApiOperation("稳态电能质量水平平均值、标准差")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<EvaluationLevelVo>> getEvaluationData(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getEvaluationData");
|
||||||
|
List<EvaluationLevelVo> result = gridService.getEvaluationData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/evaluationRatio")
|
||||||
|
@ApiOperation("各稳态指标的环比")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<EvaluationLevelVo.EvaluationRatio>> evaluationRatio(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("evaluationRatio");
|
||||||
|
List<EvaluationLevelVo.EvaluationRatio> result = gridService.evaluationRatio(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/evaluationDetail")
|
||||||
|
@ApiOperation("稳态指标超标详情")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<EvaluationLevelVo.EvaluationDetail>> evaluationDetail(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("evaluationDetail");
|
||||||
|
List<EvaluationLevelVo.EvaluationDetail> result = gridService.getEvaluationDetail(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.harmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatAssesDPO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RStatAssesDMapper extends BaseMapper<RStatAssesDPO> {
|
||||||
|
|
||||||
|
List<RStatAssesDPO> getData(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("list") List<String> lineIds);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.harmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatDataPltDPO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-04-17
|
||||||
|
*/
|
||||||
|
public interface RStatDataPltDMapper extends BaseMapper<RStatDataPltDPO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取闪变
|
||||||
|
*/
|
||||||
|
List<RStatDataPltDPO> getPlt(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,9 @@ package com.njcn.harmonic.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +16,19 @@ import com.njcn.harmonic.pojo.po.RStatDataVD;
|
|||||||
*/
|
*/
|
||||||
public interface RStatDataVDMapper extends BaseMapper<RStatDataVD> {
|
public interface RStatDataVDMapper extends BaseMapper<RStatDataVD> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取频率偏差、三相电压不平衡度
|
||||||
|
*/
|
||||||
|
List<RStatDataVD> getFreqDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电压偏差
|
||||||
|
*/
|
||||||
|
List<RStatDataVD> getVuDev(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电压总谐波畸变率
|
||||||
|
*/
|
||||||
|
List<RStatDataVD> getVthd(@Param("list") List<String> lineList, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package com.njcn.harmonic.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.harmonic.pojo.po.LimitRate;
|
|
||||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||||
import com.njcn.harmonic.pojo.vo.MonitorOverLimitVO;
|
import com.njcn.harmonic.pojo.vo.MonitorOverLimitVO;
|
||||||
import com.njcn.harmonic.pojo.vo.RStatLimitRateDVO;
|
import com.njcn.harmonic.pojo.vo.RStatLimitRateDVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -53,4 +51,15 @@ public interface RStatLimitRateDMapper extends BaseMapper<RStatLimitRateDPO> {
|
|||||||
List<RStatLimitRateDPO> getSumPassRateList( @Param("ids") List<String> list,
|
List<RStatLimitRateDPO> getSumPassRateList( @Param("ids") List<String> list,
|
||||||
@Param("statTime") String startTime,
|
@Param("statTime") String startTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取综合评估下的指标完整率
|
||||||
|
* @param list
|
||||||
|
* @param startTime
|
||||||
|
* @param endTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RStatLimitRateDPO> getAssessTargetRate( @Param("ids") List<String> list,
|
||||||
|
@Param("statTime") String startTime,
|
||||||
|
@Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,4 +56,7 @@ public interface RStatLimitTargetDMapper extends BaseMapper<RStatLimitTargetDPO>
|
|||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
|
List<RStatLimitTargetDPO> getSumTarget(@Param("ids") List<String> ids,
|
||||||
|
@Param("startTime") String startTime,
|
||||||
|
@Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.harmonic.mapper.RStatAssesDMapper">
|
||||||
|
|
||||||
|
<select id="getData" resultType="com.njcn.harmonic.pojo.po.day.RStatAssesDPO">
|
||||||
|
SELECT
|
||||||
|
line_id lineId,
|
||||||
|
AVG(vu_dev) vuDev ,
|
||||||
|
AVG(freq_dev) freqDev ,
|
||||||
|
AVG(data_plt) dataPlt ,
|
||||||
|
AVG(v_unbalance_cp95) vUnbalanceCp95 ,
|
||||||
|
AVG(v_thd_cp95) vThdCp95
|
||||||
|
FROM
|
||||||
|
r_stat_asses_d
|
||||||
|
WHERE
|
||||||
|
time_id BETWEEN #{startTime} AND #{endTime}
|
||||||
|
AND line_id IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by
|
||||||
|
line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</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.harmonic.mapper.RStatDataPltDMapper">
|
||||||
|
|
||||||
|
<select id="getPlt" resultType="com.njcn.harmonic.pojo.po.day.RStatDataPltDPO">
|
||||||
|
select
|
||||||
|
`time` time,
|
||||||
|
line_id lineId,
|
||||||
|
avg(plt) plt
|
||||||
|
from
|
||||||
|
r_stat_data_plt_d
|
||||||
|
where
|
||||||
|
`time` between #{startTime} and #{endTime}
|
||||||
|
and phasic_type in ('A','B','C')
|
||||||
|
and value_type = 'MAX'
|
||||||
|
and line_id IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by
|
||||||
|
`time`,line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -2,4 +2,62 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.harmonic.mapper.RStatDataVDMapper">
|
<mapper namespace="com.njcn.harmonic.mapper.RStatDataVDMapper">
|
||||||
|
|
||||||
|
<select id="getFreqDev" resultType="com.njcn.harmonic.pojo.po.RStatDataVD">
|
||||||
|
select
|
||||||
|
`time` time,
|
||||||
|
line_id lineId,
|
||||||
|
avg(abs(freq_dev)) freqDev,
|
||||||
|
avg(v_unbalance) vUnbalance
|
||||||
|
from
|
||||||
|
r_stat_data_v_d
|
||||||
|
where
|
||||||
|
`time` between #{startTime} and #{endTime}
|
||||||
|
and phasic_type = 'T'
|
||||||
|
and value_type = 'MAX'
|
||||||
|
AND line_id IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by
|
||||||
|
`time`,line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getVuDev" resultType="com.njcn.harmonic.pojo.po.RStatDataVD">
|
||||||
|
select
|
||||||
|
`time` time,
|
||||||
|
line_id lineId,
|
||||||
|
avg(vl_dev) vlDev
|
||||||
|
from
|
||||||
|
r_stat_data_v_d
|
||||||
|
where
|
||||||
|
`time` between #{startTime} and #{endTime}
|
||||||
|
and phasic_type in ('A','B','C')
|
||||||
|
and value_type = 'MAX'
|
||||||
|
and line_id IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by
|
||||||
|
`time`,line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getVthd" resultType="com.njcn.harmonic.pojo.po.RStatDataVD">
|
||||||
|
select
|
||||||
|
`time` time,
|
||||||
|
line_id lineId,
|
||||||
|
avg(v_thd) vThd
|
||||||
|
from
|
||||||
|
r_stat_data_v_d
|
||||||
|
where
|
||||||
|
`time` between #{startTime} and #{endTime}
|
||||||
|
and phasic_type in ('A','B','C')
|
||||||
|
and value_type = 'CP95'
|
||||||
|
and line_id IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by
|
||||||
|
`time`,line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -305,4 +305,27 @@
|
|||||||
GROUP BY
|
GROUP BY
|
||||||
`my_index`
|
`my_index`
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAssessTargetRate" resultType="com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO">
|
||||||
|
select
|
||||||
|
my_index as lineId,
|
||||||
|
SUM(all_time) as allTime,
|
||||||
|
SUM(freq_dev_overtime) as freqDevOvertime,
|
||||||
|
SUM(voltage_dev_overtime) as voltageDevOvertime,
|
||||||
|
SUM(flicker_overtime) as flickerOvertime,
|
||||||
|
SUM(ubalance_overtime) as ubalanceOvertime,
|
||||||
|
SUM(uaberrance_overtime) as uaberranceOvertime
|
||||||
|
from
|
||||||
|
r_stat_limit_rate_d
|
||||||
|
where
|
||||||
|
time_id between #{statTime} and #{endTime}
|
||||||
|
<if test=" ids != null and ids.size > 0">
|
||||||
|
AND my_index IN
|
||||||
|
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by
|
||||||
|
my_index
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -259,4 +259,27 @@
|
|||||||
HAVING
|
HAVING
|
||||||
allCount >0) a
|
allCount >0) a
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getSumTarget" resultType="com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO">
|
||||||
|
select
|
||||||
|
my_index as lineId,
|
||||||
|
SUM(all_time) as allTime,
|
||||||
|
SUM(freq_dev_overtime) as freqDevOvertime,
|
||||||
|
SUM(voltage_dev_overtime) as voltageDevOvertime,
|
||||||
|
SUM(flicker_overtime) as flickerOvertime,
|
||||||
|
SUM(ubalance_overtime) as ubalanceOvertime,
|
||||||
|
SUM(uaberrance_overtime) as uaberranceOvertime
|
||||||
|
from
|
||||||
|
r_stat_limit_target_d
|
||||||
|
where
|
||||||
|
time_id between #{startTime} and #{endTime}
|
||||||
|
<if test=" ids != null and ids.size > 0">
|
||||||
|
AND my_index IN
|
||||||
|
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by
|
||||||
|
my_index
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.njcn.harmonic.service.hebeinorth;
|
||||||
|
|
||||||
|
import com.njcn.harmonic.pojo.param.hebeinorth.AssessParam;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessDetailVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationLevelVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/24 17:20
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IGridService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合评估概览界面
|
||||||
|
* 业务逻辑:1.根据当前传入的部门,省级部门获取市级综合指标;市级部门获取各指标指标评估
|
||||||
|
* 2.注意监测点类型,区分所有监测点和上报国网监测点
|
||||||
|
* 涉及指标:电压偏差、频率偏差、谐波含量(只有电压总谐波畸变率)、电压闪变、三相电压不平衡度
|
||||||
|
* @author xuyang
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AssessVo> getAssessOverview(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合评估详细界面
|
||||||
|
* 业务逻辑:根据当前传入的部门,获取子部门所包含的监测点,根据监测点查询综合评估(r_stat_asses_d、r_stat_comasses_d)、指标合格率(r_stat_limit_rate_d)
|
||||||
|
* 涉及指标:电压偏差、频率偏差、谐波含量(只有电压总谐波畸变率)、电压闪变、三相电压不平衡度
|
||||||
|
* @author xuyang
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AssessDetailVo> getData(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询稳态电能质量水平评价
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EvaluationVo getEvaluationOverview(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按电压等级展示各稳态指标的平均值、标准差
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EvaluationLevelVo> getEvaluationData(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 各稳态指标的环比
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EvaluationLevelVo.EvaluationRatio> evaluationRatio(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态指标超标占比详情
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EvaluationLevelVo.EvaluationDetail> getEvaluationDetail(AssessParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,648 @@
|
|||||||
|
package com.njcn.harmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||||
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||||
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
|
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||||
|
import com.njcn.harmonic.mapper.*;
|
||||||
|
import com.njcn.harmonic.pojo.param.hebeinorth.AssessParam;
|
||||||
|
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||||
|
import com.njcn.harmonic.pojo.po.PqsComasses;
|
||||||
|
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatAssesDPO;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatDataPltDPO;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||||
|
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessDetailVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationLevelVo;
|
||||||
|
import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationVo;
|
||||||
|
import com.njcn.harmonic.service.hebeinorth.IGridService;
|
||||||
|
import com.njcn.harmonic.util.ComAssesUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2024/4/24 17:21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GridServiceImpl implements IGridService {
|
||||||
|
|
||||||
|
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
|
private final RStatAssesDMapper rStatAssesDMapper;
|
||||||
|
private final RStatComassesDMapper rStatComassesDMapper;
|
||||||
|
private final RStatLimitRateDMapper rStatLimitRateDMapper;
|
||||||
|
private final ComAssesUtil comAssesUtil;
|
||||||
|
private final LineFeignClient lineFeignClient;
|
||||||
|
private final RStatDataVDMapper statDataVDMapper;
|
||||||
|
private final RStatDataPltDMapper statDataPltDMapper;
|
||||||
|
private final RStatLimitTargetDMapper rStatLimitTargetDMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AssessVo> getAssessOverview(AssessParam param) {
|
||||||
|
List<AssessVo> result = new ArrayList<>();
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.map(LineDevGetDTO::getPointId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//上报国网监测点
|
||||||
|
if (Objects.equals(param.getLineType(), 1)){
|
||||||
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
||||||
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
//获取综合评估
|
||||||
|
List<PQSComAssesPO> list2 = rStatComassesDMapper.getAvgCount(lineList,param.getStartTime(),param.getEndTime());
|
||||||
|
list.forEach(item->{
|
||||||
|
if (!Objects.equals(item.getDeptLevel(), 2)) {
|
||||||
|
AssessVo assessVo = new AssessVo();
|
||||||
|
assessVo.setName(item.getUnitName());
|
||||||
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
||||||
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(list2)) {
|
||||||
|
List<PQSComAssesPO> list22 = list2.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
List<PqsComasses> communicateList = BeanUtil.copyToList(list22,PqsComasses.class);
|
||||||
|
if (CollUtil.isNotEmpty(communicateList)){
|
||||||
|
float synData = comAssesUtil.getAllComAss(communicateList);
|
||||||
|
assessVo.setScore(PubUtils.floatRound(2,synData));
|
||||||
|
assessVo.setLevel(getLevel(synData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.add(assessVo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AssessDetailVo> getData(AssessParam param) {
|
||||||
|
List<AssessDetailVo> result = new ArrayList<>();
|
||||||
|
//查询部门监测点关系
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.map(LineDevGetDTO::getPointId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//上报国网监测点
|
||||||
|
if (Objects.equals(param.getLineType(), 1)){
|
||||||
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
||||||
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(lineList)){
|
||||||
|
//获取所有监测点r_stat_asses_d数据
|
||||||
|
List<RStatAssesDPO> list1 = rStatAssesDMapper.getData(param.getStartTime(),param.getEndTime(),lineList);
|
||||||
|
//获取所有监测点r_stat_comasses_d数据
|
||||||
|
List<PQSComAssesPO> list2 = rStatComassesDMapper.getAvgCount(lineList,param.getStartTime(),param.getEndTime());
|
||||||
|
//获取所有监测点r_stat_limit_rate_d数据
|
||||||
|
List<RStatLimitRateDPO> list3 = rStatLimitRateDMapper.getAssessTargetRate(lineList,param.getStartTime(),param.getEndTime());
|
||||||
|
//数据处理
|
||||||
|
list.forEach(item->{
|
||||||
|
if (!Objects.equals(item.getDeptLevel(), 2)) {
|
||||||
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
AssessDetailVo comAssess = getAssessData(item.getUnitId(),item.getUnitName(), ll, list1, list2, list3);
|
||||||
|
result.add(comAssess);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationVo getEvaluationOverview(AssessParam param) {
|
||||||
|
EvaluationVo result = new EvaluationVo();
|
||||||
|
List<EvaluationVo.Children> childrenList = new ArrayList<>();
|
||||||
|
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.map(LineDevGetDTO::getPointId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//上报国网监测点
|
||||||
|
if (Objects.equals(param.getLineType(), 1)){
|
||||||
|
//获取国网监测点
|
||||||
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
||||||
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
//获取监测点所有指标数据
|
||||||
|
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAssessTargetRate(lineList,param.getStartTime(),param.getEndTime());
|
||||||
|
list.forEach(item->{
|
||||||
|
if (!Objects.equals(item.getDeptLevel(), 2)) {
|
||||||
|
EvaluationVo.Children children = new EvaluationVo.Children();
|
||||||
|
children.setDeptId(item.getUnitId());
|
||||||
|
children.setDeptName(item.getUnitName());
|
||||||
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
||||||
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(limitRateList)) {
|
||||||
|
List<RStatLimitRateDPO> l1 = limitRateList.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(l1)){
|
||||||
|
this.getDataByTarget(param.getHarmonicType(),l1,children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
childrenList.add(children);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result.setChildrenList(childrenList);
|
||||||
|
if (CollUtil.isNotEmpty(childrenList)) {
|
||||||
|
List<EvaluationVo.Children> newList = childrenList.stream()
|
||||||
|
.filter(child -> !Objects.isNull(child.getRatio()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
|
||||||
|
result.setLineRatio(PubUtils.doubleRound(2,avg));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EvaluationLevelVo> getEvaluationData(AssessParam param) {
|
||||||
|
List<EvaluationLevelVo> result = new ArrayList<>();
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取符合电压等级的监测点
|
||||||
|
Set<LineDevGetDTO> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.filter(line -> Objects.equals(line.getVoltageLevel(), param.getVoltageLevel()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
//监测点处理
|
||||||
|
List<String> line = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(lineList)) {
|
||||||
|
if (Objects.equals(param.getLineType(), 1)) {
|
||||||
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取数据
|
||||||
|
if (CollUtil.isNotEmpty(line)) {
|
||||||
|
List<RStatDataVD> list1 = getList1(line,param.getStartTime(),param.getEndTime());
|
||||||
|
List<RStatDataVD> list2 = getList2(line,param.getStartTime(),param.getEndTime());
|
||||||
|
List<RStatDataVD> list3 = getList3(line,param.getStartTime(),param.getEndTime());
|
||||||
|
List<RStatDataPltDPO> list4 = getList4(line,param.getStartTime(),param.getEndTime());
|
||||||
|
|
||||||
|
EvaluationLevelVo vo1 = new EvaluationLevelVo();
|
||||||
|
vo1.setTargetName("频率偏差");
|
||||||
|
if (CollUtil.isNotEmpty(list1)) {
|
||||||
|
List<Double> d = list1.stream().map(o->o.getFreqDev().doubleValue()).collect(Collectors.toList());
|
||||||
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
|
vo1.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
|
vo1.setSd(targetSd(d,avg));
|
||||||
|
}
|
||||||
|
|
||||||
|
EvaluationLevelVo vo2 = new EvaluationLevelVo();
|
||||||
|
vo2.setTargetName("电压偏差");
|
||||||
|
if (CollUtil.isNotEmpty(list2)) {
|
||||||
|
List<Double> d = list2.stream().map(o->o.getVlDev().doubleValue()).collect(Collectors.toList());
|
||||||
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
|
vo2.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
|
vo2.setSd(targetSd(d,avg));
|
||||||
|
}
|
||||||
|
|
||||||
|
EvaluationLevelVo vo3 = new EvaluationLevelVo();
|
||||||
|
vo3.setTargetName("电压总谐波畸变率");
|
||||||
|
if (CollUtil.isNotEmpty(list3)){
|
||||||
|
List<Double> d = list3.stream().map(o->o.getVThd().doubleValue()).collect(Collectors.toList());
|
||||||
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
|
vo3.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
|
vo3.setSd(targetSd(d,avg));
|
||||||
|
}
|
||||||
|
|
||||||
|
EvaluationLevelVo vo4 = new EvaluationLevelVo();
|
||||||
|
vo4.setTargetName("三相电压不平衡度");
|
||||||
|
if (CollUtil.isNotEmpty(list1)) {
|
||||||
|
List<Double> d = list1.stream().map(o -> o.getVUnbalance().doubleValue()).collect(Collectors.toList());
|
||||||
|
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
||||||
|
vo4.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
|
vo4.setSd(targetSd(d,avg));
|
||||||
|
}
|
||||||
|
|
||||||
|
EvaluationLevelVo vo5 = new EvaluationLevelVo();
|
||||||
|
vo5.setTargetName("闪变");
|
||||||
|
if (CollUtil.isNotEmpty(list4)) {
|
||||||
|
List<Double> d = list4.stream().map(RStatDataPltDPO::getPlt).collect(Collectors.toList());
|
||||||
|
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
||||||
|
vo5.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
|
vo5.setSd(targetSd(d,avg));
|
||||||
|
}
|
||||||
|
Stream.of(vo1, vo2, vo3, vo4, vo5).forEach(result::add);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EvaluationLevelVo.EvaluationRatio> evaluationRatio(AssessParam param) {
|
||||||
|
List<EvaluationLevelVo.EvaluationRatio> result = new ArrayList<>();
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点数据
|
||||||
|
Set<LineDevGetDTO> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
//筛选监测点
|
||||||
|
List<String> line = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(lineList)) {
|
||||||
|
if (Objects.equals(param.getLineType(), 1)) {
|
||||||
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//按月获取时间集合
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
int currentYear = currentDate.getYear(); // 获取当前年份
|
||||||
|
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
||||||
|
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
||||||
|
for (YearMonth month : monthList) {
|
||||||
|
String firstDayOfMonth = month.atDay(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
String lastDayOfMonth = month.atEndOfMonth().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
EvaluationLevelVo.EvaluationRatio vo = new EvaluationLevelVo.EvaluationRatio();
|
||||||
|
vo.setTime(month.toString());
|
||||||
|
vo.setTargetList(Arrays.asList("频率偏差","电压偏差","电压总谐波畸变率","三相电压不平衡度","闪变"));
|
||||||
|
//获取监测点越限集合
|
||||||
|
List<RStatLimitRateDPO> overLimitList = rStatLimitRateDMapper.getAssessTargetRate(line,firstDayOfMonth,lastDayOfMonth);
|
||||||
|
if (CollUtil.isNotEmpty(overLimitList)) {
|
||||||
|
long freqDev = overLimitList.stream().filter(obj -> obj.getFreqDevOvertime() > 0).count();
|
||||||
|
long vDev = overLimitList.stream().filter(obj -> obj.getVoltageDevOvertime() > 0).count();
|
||||||
|
long vThd = overLimitList.stream().filter(obj -> obj.getUaberranceOvertime() > 0).count();
|
||||||
|
long ubalance = overLimitList.stream().filter(obj -> obj.getUbalanceOvertime() > 0).count();
|
||||||
|
long plt = overLimitList.stream().filter(obj -> obj.getFlickerOvertime() > 0).count();
|
||||||
|
vo.setRatioList(Arrays.asList(PubUtils.doubleRound(2,freqDev*100.0/overLimitList.size())
|
||||||
|
,PubUtils.doubleRound(2,vDev*100.0/overLimitList.size())
|
||||||
|
,PubUtils.doubleRound(2,vThd*100.0/overLimitList.size())
|
||||||
|
,PubUtils.doubleRound(2,ubalance*100.0/overLimitList.size())
|
||||||
|
,PubUtils.doubleRound(2,plt*100.0/overLimitList.size())));
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EvaluationLevelVo.EvaluationDetail> getEvaluationDetail(AssessParam param) {
|
||||||
|
List<EvaluationLevelVo.EvaluationDetail> result = new ArrayList<>();
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptId());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点数据
|
||||||
|
Set<LineDevGetDTO> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
//筛选监测点
|
||||||
|
List<String> line = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(lineList)) {
|
||||||
|
if (Objects.equals(param.getLineType(), 1)) {
|
||||||
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取监测点越限集合
|
||||||
|
List<RStatLimitTargetDPO> overLimitList = rStatLimitTargetDMapper.getSumTarget(line,param.getStartTime(),param.getEndTime());
|
||||||
|
list.forEach(item->{
|
||||||
|
if (!Objects.equals(item.getDeptLevel(), 2)) {
|
||||||
|
EvaluationLevelVo.EvaluationDetail detail = new EvaluationLevelVo.EvaluationDetail();
|
||||||
|
detail.setDeptId(item.getUnitId());
|
||||||
|
detail.setDeptName(item.getUnitName());
|
||||||
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
||||||
|
//获取当前部门下监测点
|
||||||
|
List<String> list1 = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
detail.setOnlineNum(list1.size());
|
||||||
|
//筛选当前部门下监测点的超标数据
|
||||||
|
List<RStatLimitTargetDPO> list2 = overLimitList.stream().filter(it->list1.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(list2)) {
|
||||||
|
|
||||||
|
//筛选出五项指标(电压偏差、频率偏差、电压总谐波畸变率、电压闪变、三相电压不平衡度)超标监测点
|
||||||
|
long allNum = list2.stream().filter(o->o.getFreqDevOvertime() > 0
|
||||||
|
|| o.getVoltageDevOvertime() > 0
|
||||||
|
|| o.getFlickerOvertime() > 0
|
||||||
|
|| o.getUaberranceOvertime() > 0
|
||||||
|
|| o.getUbalanceOvertime() > 0).count();
|
||||||
|
detail.setOverNum((int) allNum);
|
||||||
|
detail.setOverRatio(PubUtils.doubleRound(2,detail.getOverNum()*100.0/detail.getOnlineNum()));
|
||||||
|
|
||||||
|
//筛选出电压偏差超标监测点
|
||||||
|
long num1 = list2.stream().filter(o->o.getFreqDevOvertime() > 0).count();
|
||||||
|
Integer day1 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetDPO::getFreqDevOvertime)).get().getFreqDevOvertime();
|
||||||
|
EvaluationLevelVo.TargetDetail detail1 = new EvaluationLevelVo.TargetDetail();
|
||||||
|
detail1.setTargetName("电压偏差");
|
||||||
|
detail1.setOverNum((int) num1);
|
||||||
|
detail1.setOverDay(day1);
|
||||||
|
|
||||||
|
//筛选出频率偏差超标监测点
|
||||||
|
long num2 = list2.stream().filter(o->o.getVoltageDevOvertime() > 0).count();
|
||||||
|
Integer day2 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetDPO::getVoltageDevOvertime)).get().getVoltageDevOvertime();
|
||||||
|
EvaluationLevelVo.TargetDetail detail2 = new EvaluationLevelVo.TargetDetail();
|
||||||
|
detail2.setTargetName("频率偏差");
|
||||||
|
detail2.setOverNum((int) num2);
|
||||||
|
detail2.setOverDay(day2);
|
||||||
|
|
||||||
|
//筛选出电压总谐波畸变率超标监测点
|
||||||
|
long num3 = list2.stream().filter(o->o.getUaberranceOvertime() > 0).count();
|
||||||
|
Integer day3 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetDPO::getUaberranceOvertime)).get().getUaberranceOvertime();
|
||||||
|
EvaluationLevelVo.TargetDetail detail3 = new EvaluationLevelVo.TargetDetail();
|
||||||
|
detail3.setTargetName("电压总谐波畸变率");
|
||||||
|
detail3.setOverNum((int) num3);
|
||||||
|
detail3.setOverDay(day3);
|
||||||
|
|
||||||
|
//筛选出电压闪变超标监测点
|
||||||
|
long num4 = list2.stream().filter(o->o.getFlickerOvertime() > 0).count();
|
||||||
|
Integer day4 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetDPO::getFlickerOvertime)).get().getFlickerOvertime();
|
||||||
|
EvaluationLevelVo.TargetDetail detail4 = new EvaluationLevelVo.TargetDetail();
|
||||||
|
detail4.setTargetName("闪变");
|
||||||
|
detail4.setOverNum((int) num4);
|
||||||
|
detail4.setOverDay(day4);
|
||||||
|
|
||||||
|
//筛选出三相电压不平衡度超标监测点
|
||||||
|
long num5 = list2.stream().filter(o->o.getUbalanceOvertime() > 0).count();
|
||||||
|
Integer day5 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetDPO::getUbalanceOvertime)).get().getUbalanceOvertime();
|
||||||
|
EvaluationLevelVo.TargetDetail detail5 = new EvaluationLevelVo.TargetDetail();
|
||||||
|
detail5.setTargetName("三相电压不平衡度");
|
||||||
|
detail5.setOverNum((int) num5);
|
||||||
|
detail5.setOverDay(day5);
|
||||||
|
List<EvaluationLevelVo.TargetDetail> details = Arrays.asList(detail1, detail2, detail3, detail4, detail5);
|
||||||
|
detail.setList(details);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.add(detail);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点频率偏差 T相最大值\获取监测点三相电压不平衡度 T相最大值
|
||||||
|
*/
|
||||||
|
public List<RStatDataVD> getList1(List<String> lineList, String startTime, String endTime) {
|
||||||
|
return statDataVDMapper.getFreqDev(lineList,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点电压偏差 使用电压上偏差A、B、C三相最大值的平均值
|
||||||
|
*/
|
||||||
|
public List<RStatDataVD> getList2(List<String> lineList, String startTime, String endTime) {
|
||||||
|
return statDataVDMapper.getVuDev(lineList,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点电压总谐波畸变率 A、B、C三相Cp95的平均值
|
||||||
|
*/
|
||||||
|
public List<RStatDataVD> getList3(List<String> lineList, String startTime, String endTime) {
|
||||||
|
return statDataVDMapper.getVthd(lineList,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点闪变 A、B、C三相最大值的平均值
|
||||||
|
*/
|
||||||
|
public List<RStatDataPltDPO> getList4(List<String> lineList, String startTime, String endTime) {
|
||||||
|
return statDataPltDMapper.getPlt(lineList,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算标准差
|
||||||
|
*/
|
||||||
|
public Double targetSd(List<Double> list, Double avg) {
|
||||||
|
double sum = list.stream().mapToDouble(number -> Math.pow(number - avg, 2)).sum();
|
||||||
|
double variance = sum / list.size();
|
||||||
|
return PubUtils.doubleRound(2,Math.sqrt(variance));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据指标类型计算数据
|
||||||
|
*/
|
||||||
|
public void getDataByTarget(Integer type, List<RStatLimitRateDPO> limitRateList, EvaluationVo.Children children) {
|
||||||
|
switch (type) {
|
||||||
|
//全指标
|
||||||
|
case 0:
|
||||||
|
List<RStatLimitRateDPO> filteredList0 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getFreqDevOvertime() + data.getVoltageDevOvertime() + data.getFlickerOvertime() + data.getUaberranceOvertime() + data.getUbalanceOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList0.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
//电压偏差
|
||||||
|
case 1:
|
||||||
|
List<RStatLimitRateDPO> filteredList1 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getVoltageDevOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList1.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
//频率偏差
|
||||||
|
case 2:
|
||||||
|
List<RStatLimitRateDPO> filteredList2 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getFreqDevOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList2.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
//电压总谐波畸变率
|
||||||
|
case 3:
|
||||||
|
List<RStatLimitRateDPO> filteredList3 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getUaberranceOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList3.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
//电压闪变
|
||||||
|
case 4:
|
||||||
|
List<RStatLimitRateDPO> filteredList4 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getFlickerOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList4.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
//三相电压不平衡度
|
||||||
|
case 5:
|
||||||
|
List<RStatLimitRateDPO> filteredList5 = limitRateList.stream()
|
||||||
|
.filter(data -> data.getUbalanceOvertime() > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
children.setRatio(PubUtils.doubleRound(2,filteredList5.size()*100.0/limitRateList.size()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AssessDetailVo getAssessData(String deptId, String deptName, List<String> lineList, List<RStatAssesDPO> list1, List<PQSComAssesPO> list2, List<RStatLimitRateDPO> list3) {
|
||||||
|
AssessDetailVo comAssess = new AssessDetailVo();
|
||||||
|
comAssess.setDeptId(deptId);
|
||||||
|
comAssess.setDeptName(deptName);
|
||||||
|
//处理区域各个指标的稳态评估
|
||||||
|
if (CollUtil.isNotEmpty(list1)){
|
||||||
|
List<RStatAssesDPO> list11 = list1.stream().filter(it->lineList.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(list11)) {
|
||||||
|
double vuDev = list11.stream()
|
||||||
|
.mapToDouble(RStatAssesDPO::getVuDev)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
comAssess.setVDevAssessData(PubUtils.doubleRound(2,vuDev));
|
||||||
|
comAssess.setVDevAssessLevel(getLevel(vuDev,0f,2.5f,5f,7.5f,10f,12.5f,15f,17.5f));
|
||||||
|
double freqDev = list11.stream()
|
||||||
|
.mapToDouble(RStatAssesDPO::getFreqDev)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
comAssess.setFreqAssessData(PubUtils.doubleRound(2,freqDev));
|
||||||
|
comAssess.setFreqAssessLevel(getLevel(freqDev,0f,0.05f,0.1f,0.15f,0.2f,0.25f,0.30f,0.35f));
|
||||||
|
double dataPlt = list11.stream()
|
||||||
|
.mapToDouble(RStatAssesDPO::getDataPlt)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
comAssess.setFlickerAssessData(PubUtils.doubleRound(2,dataPlt));
|
||||||
|
comAssess.setFlickerAssessLevel(getLevel(dataPlt,0f,0.05f,0.1f,0.15f,0.2f,0.25f,0.30f,0.35f));
|
||||||
|
double vUnbalanceCp95 = list11.stream()
|
||||||
|
.mapToDouble(RStatAssesDPO::getVUnbalanceCp95)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
comAssess.setUnbalanceAssessData(PubUtils.doubleRound(2,vUnbalanceCp95));
|
||||||
|
comAssess.setUnbalanceAssessLevel(getLevel(vUnbalanceCp95,0f,0.5f,1f,1.5f,2f,2.5f,3f,3.5f));
|
||||||
|
double vThdCp95 = list11.stream()
|
||||||
|
.mapToDouble(RStatAssesDPO::getVThdCp95)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
comAssess.setHarmAssessData(PubUtils.doubleRound(2,vThdCp95));
|
||||||
|
comAssess.setHarmAssessLevel(getLevel(vThdCp95,0f,0.5f,1f,1.5f,2f,2.5f,3f,3.5f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理区域综合稳态评估
|
||||||
|
if (CollUtil.isNotEmpty(list2)){
|
||||||
|
List<PQSComAssesPO> list22 = list2.stream().filter(it->lineList.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(list22)){
|
||||||
|
List<PqsComasses> communicateList = BeanUtil.copyToList(list22,PqsComasses.class);
|
||||||
|
float synData = comAssesUtil.getAllComAss(communicateList);
|
||||||
|
comAssess.setAssessData(PubUtils.floatRound(2,synData));
|
||||||
|
comAssess.setAssessLevel(getLevel(synData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理区域总指标合格率、各个指标合格率
|
||||||
|
if (CollUtil.isNotEmpty(list3)){
|
||||||
|
List<RStatLimitRateDPO> list33 = list3.stream().filter(it->lineList.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(list33)) {
|
||||||
|
//总指标次数
|
||||||
|
int allTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getAllTime)
|
||||||
|
.sum();
|
||||||
|
//电压偏差
|
||||||
|
int devTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getVoltageDevOvertime)
|
||||||
|
.sum();
|
||||||
|
//频率偏差
|
||||||
|
int freqTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getFreqDevOvertime)
|
||||||
|
.sum();
|
||||||
|
//谐波含量
|
||||||
|
int thdTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getUaberranceOvertime)
|
||||||
|
.sum();
|
||||||
|
//电压闪变
|
||||||
|
int pltTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getFlickerOvertime)
|
||||||
|
.sum();
|
||||||
|
//三相电压不平衡度
|
||||||
|
int ubalanceTime = list33.stream()
|
||||||
|
.mapToInt(RStatLimitRateDPO::getUbalanceOvertime)
|
||||||
|
.sum();
|
||||||
|
comAssess.setQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-(devTime+freqTime+thdTime+pltTime+ubalanceTime)/(allTime*500.0)));
|
||||||
|
comAssess.setVDevQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-devTime*100.0/allTime));
|
||||||
|
comAssess.setFreqQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-freqTime*100.0/allTime));
|
||||||
|
comAssess.setHarmQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-thdTime*100.0/allTime));
|
||||||
|
comAssess.setFlickerQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-pltTime*100.0/allTime));
|
||||||
|
comAssess.setUnbalanceQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-ubalanceTime*100.0/allTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return comAssess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取综合评估等级
|
||||||
|
*/
|
||||||
|
private String getLevel(float synDatas) {
|
||||||
|
if(synDatas==3.14159f){
|
||||||
|
return "(暂无数据)";
|
||||||
|
}
|
||||||
|
if(synDatas==3.1415f){
|
||||||
|
return "/";
|
||||||
|
}
|
||||||
|
if(0<=synDatas&&synDatas<2){
|
||||||
|
return "极差";
|
||||||
|
}else if(2<=synDatas&&synDatas<3){
|
||||||
|
return "较差";
|
||||||
|
}else if(3<=synDatas&&synDatas<4){
|
||||||
|
return "合格";
|
||||||
|
}else if(4<=synDatas&&synDatas<4.5){
|
||||||
|
return "良好";
|
||||||
|
}else{
|
||||||
|
return "优质";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取各个指标对应的等级
|
||||||
|
*/
|
||||||
|
private String getLevel(double value,float f1,float f2,float f3,float f4,float f5,float f6,float f7,float f8) {
|
||||||
|
String level;
|
||||||
|
if(f1<=value&&value<=f2){
|
||||||
|
level="特质";
|
||||||
|
}else if(f2<value&&value<=f3){
|
||||||
|
level="优质";
|
||||||
|
}else if(f3<value&&value<=f4){
|
||||||
|
level="优良";
|
||||||
|
}else if(f4<value&&value<=f5){
|
||||||
|
level="良好";
|
||||||
|
}else if(f5<value&&value<=f6){
|
||||||
|
level="轻度污染";
|
||||||
|
}else if(f6<value&&value<=f7){
|
||||||
|
level="中度污染";
|
||||||
|
}else if(f7<value&&value<=f8){
|
||||||
|
level="重度污染";
|
||||||
|
}else{
|
||||||
|
level="极度污染";
|
||||||
|
}
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<YearMonth> getMonthsBetween(LocalDate startDate, LocalDate endDate) {
|
||||||
|
List<YearMonth> months = new ArrayList<>();
|
||||||
|
YearMonth currentMonth = YearMonth.from(startDate);
|
||||||
|
YearMonth endMonth = YearMonth.from(endDate);
|
||||||
|
while (!currentMonth.isAfter(endMonth)) {
|
||||||
|
months.add(currentMonth);
|
||||||
|
currentMonth = currentMonth.plusMonths(1);
|
||||||
|
}
|
||||||
|
return months;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user