微调
This commit is contained in:
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
public class EvaluationVo {
|
public class EvaluationVo {
|
||||||
|
|
||||||
@ApiModelProperty("监测点越限占比")
|
@ApiModelProperty("监测点越限占比")
|
||||||
private Double lineRatio;
|
private Double lineRatio = 3.14159;
|
||||||
|
|
||||||
@ApiModelProperty("子集")
|
@ApiModelProperty("子集")
|
||||||
private List<Children> childrenList;
|
private List<Children> childrenList;
|
||||||
@@ -31,7 +31,7 @@ public class EvaluationVo {
|
|||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
@ApiModelProperty("越限占比")
|
@ApiModelProperty("越限占比")
|
||||||
private Double ratio;
|
private Double ratio = 3.14159;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,11 +105,34 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="selectBySubstationPage" resultType="com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO">
|
<select id="selectBySubstationPage" resultType="com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO">
|
||||||
SELECT
|
<!-- SELECT-->
|
||||||
|
<!-- substation_id as id,-->
|
||||||
|
<!-- IF(`pollution_type`=#{typeMapId.I,javaType=string},value,3.14159) as `data`,-->
|
||||||
|
<!-- IF(`pollution_type`=#{typeMapId.V,javaType=string},value,3.14159) as `dataV`-->
|
||||||
|
<!-- FROM-->
|
||||||
|
<!-- r_stat_pollution_substation_m-->
|
||||||
|
<!-- <where>-->
|
||||||
|
<!-- <if test="ids != null and ids.size > 0">-->
|
||||||
|
<!-- AND substation_id IN-->
|
||||||
|
<!-- <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>-->
|
||||||
|
<!-- #{item}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="startTime != null and startTime !=''">-->
|
||||||
|
<!-- AND data_date >= #{startTime}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="endTime != null and endTime != ''">-->
|
||||||
|
<!-- AND data_date <= #{endTime}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- </where>-->
|
||||||
|
<!-- GROUP BY-->
|
||||||
|
<!-- substation_id-->
|
||||||
|
<!-- ORDER BY `data` DESC,dataV DESC-->
|
||||||
|
select
|
||||||
substation_id as id,
|
substation_id as id,
|
||||||
IF(`pollution_type`=#{typeMapId.I,javaType=string},value,3.14159) as `data`,
|
SUM(case when pollution_type = #{typeMapId.I,javaType=string} then value else null end) as data ,
|
||||||
IF(`pollution_type`=#{typeMapId.V,javaType=string},value,3.14159) as `dataV`
|
SUM(case when pollution_type = #{typeMapId.V,javaType=string} then value else null end) as dataV
|
||||||
FROM
|
from
|
||||||
r_stat_pollution_substation_m
|
r_stat_pollution_substation_m
|
||||||
<where>
|
<where>
|
||||||
<if test="ids != null and ids.size > 0">
|
<if test="ids != null and ids.size > 0">
|
||||||
@@ -125,10 +148,7 @@
|
|||||||
AND data_date <= #{endTime}
|
AND data_date <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY
|
group by
|
||||||
substation_id
|
substation_id
|
||||||
ORDER BY `data` DESC,dataV DESC
|
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -181,11 +181,13 @@ public class GridServiceImpl implements IGridService {
|
|||||||
result.setChildrenList(childrenList);
|
result.setChildrenList(childrenList);
|
||||||
if (CollUtil.isNotEmpty(childrenList)) {
|
if (CollUtil.isNotEmpty(childrenList)) {
|
||||||
List<EvaluationVo.Children> newList = childrenList.stream()
|
List<EvaluationVo.Children> newList = childrenList.stream()
|
||||||
.filter(child -> !Objects.isNull(child.getRatio()))
|
.filter(child -> !Objects.isNull(child.getRatio()) && !Objects.equals(child.getRatio(), 3.14159))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(newList)) {
|
||||||
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
|
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
|
||||||
result.setLineRatio(PubUtils.doubleRound(2,avg));
|
result.setLineRatio(PubUtils.doubleRound(2,avg));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,58 +213,53 @@ public class GridServiceImpl implements IGridService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取数据
|
//获取数据
|
||||||
|
EvaluationLevelVo vo1 = new EvaluationLevelVo();
|
||||||
|
vo1.setTargetName("频率偏差");
|
||||||
|
EvaluationLevelVo vo2 = new EvaluationLevelVo();
|
||||||
|
vo2.setTargetName("电压偏差");
|
||||||
|
EvaluationLevelVo vo3 = new EvaluationLevelVo();
|
||||||
|
vo3.setTargetName("电压总谐波畸变率");
|
||||||
|
EvaluationLevelVo vo4 = new EvaluationLevelVo();
|
||||||
|
vo4.setTargetName("三相电压不平衡度");
|
||||||
|
EvaluationLevelVo vo5 = new EvaluationLevelVo();
|
||||||
|
vo5.setTargetName("闪变");
|
||||||
if (CollUtil.isNotEmpty(line)) {
|
if (CollUtil.isNotEmpty(line)) {
|
||||||
List<RStatDataVD> list1 = getList1(line,param.getStartTime(),param.getEndTime());
|
List<RStatDataVD> list1 = getList1(line,param.getStartTime(),param.getEndTime());
|
||||||
List<RStatDataVD> list2 = getList2(line,param.getStartTime(),param.getEndTime());
|
List<RStatDataVD> list2 = getList2(line,param.getStartTime(),param.getEndTime());
|
||||||
List<RStatDataVD> list3 = getList3(line,param.getStartTime(),param.getEndTime());
|
List<RStatDataVD> list3 = getList3(line,param.getStartTime(),param.getEndTime());
|
||||||
List<RStatDataPltDPO> list4 = getList4(line,param.getStartTime(),param.getEndTime());
|
List<RStatDataPltDPO> list4 = getList4(line,param.getStartTime(),param.getEndTime());
|
||||||
|
|
||||||
EvaluationLevelVo vo1 = new EvaluationLevelVo();
|
|
||||||
vo1.setTargetName("频率偏差");
|
|
||||||
if (CollUtil.isNotEmpty(list1)) {
|
if (CollUtil.isNotEmpty(list1)) {
|
||||||
List<Double> d = list1.stream().map(o->o.getFreqDev().doubleValue()).collect(Collectors.toList());
|
List<Double> d = list1.stream().map(o->o.getFreqDev().doubleValue()).collect(Collectors.toList());
|
||||||
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
vo1.setAvg(PubUtils.doubleRound(2,avg));
|
vo1.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
vo1.setSd(targetSd(d,avg));
|
vo1.setSd(targetSd(d,avg));
|
||||||
}
|
}
|
||||||
|
|
||||||
EvaluationLevelVo vo2 = new EvaluationLevelVo();
|
|
||||||
vo2.setTargetName("电压偏差");
|
|
||||||
if (CollUtil.isNotEmpty(list2)) {
|
if (CollUtil.isNotEmpty(list2)) {
|
||||||
List<Double> d = list2.stream().map(o->o.getVlDev().doubleValue()).collect(Collectors.toList());
|
List<Double> d = list2.stream().map(o->o.getVlDev().doubleValue()).collect(Collectors.toList());
|
||||||
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
vo2.setAvg(PubUtils.doubleRound(2,avg));
|
vo2.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
vo2.setSd(targetSd(d,avg));
|
vo2.setSd(targetSd(d,avg));
|
||||||
}
|
}
|
||||||
|
|
||||||
EvaluationLevelVo vo3 = new EvaluationLevelVo();
|
|
||||||
vo3.setTargetName("电压总谐波畸变率");
|
|
||||||
if (CollUtil.isNotEmpty(list3)){
|
if (CollUtil.isNotEmpty(list3)){
|
||||||
List<Double> d = list3.stream().map(o->o.getVThd().doubleValue()).collect(Collectors.toList());
|
List<Double> d = list3.stream().map(o->o.getVThd().doubleValue()).collect(Collectors.toList());
|
||||||
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
|
||||||
vo3.setAvg(PubUtils.doubleRound(2,avg));
|
vo3.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
vo3.setSd(targetSd(d,avg));
|
vo3.setSd(targetSd(d,avg));
|
||||||
}
|
}
|
||||||
|
|
||||||
EvaluationLevelVo vo4 = new EvaluationLevelVo();
|
|
||||||
vo4.setTargetName("三相电压不平衡度");
|
|
||||||
if (CollUtil.isNotEmpty(list1)) {
|
if (CollUtil.isNotEmpty(list1)) {
|
||||||
List<Double> d = list1.stream().map(o -> o.getVUnbalance().doubleValue()).collect(Collectors.toList());
|
List<Double> d = list1.stream().map(o -> o.getVUnbalance().doubleValue()).collect(Collectors.toList());
|
||||||
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
||||||
vo4.setAvg(PubUtils.doubleRound(2,avg));
|
vo4.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
vo4.setSd(targetSd(d,avg));
|
vo4.setSd(targetSd(d,avg));
|
||||||
}
|
}
|
||||||
|
|
||||||
EvaluationLevelVo vo5 = new EvaluationLevelVo();
|
|
||||||
vo5.setTargetName("闪变");
|
|
||||||
if (CollUtil.isNotEmpty(list4)) {
|
if (CollUtil.isNotEmpty(list4)) {
|
||||||
List<Double> d = list4.stream().map(RStatDataPltDPO::getPlt).collect(Collectors.toList());
|
List<Double> d = list4.stream().map(RStatDataPltDPO::getPlt).collect(Collectors.toList());
|
||||||
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
double avg = d.stream().collect(Collectors.averagingDouble(x -> x));
|
||||||
vo5.setAvg(PubUtils.doubleRound(2,avg));
|
vo5.setAvg(PubUtils.doubleRound(2,avg));
|
||||||
vo5.setSd(targetSd(d,avg));
|
vo5.setSd(targetSd(d,avg));
|
||||||
}
|
}
|
||||||
Stream.of(vo1, vo2, vo3, vo4, vo5).forEach(result::add);
|
|
||||||
}
|
}
|
||||||
|
Stream.of(vo1, vo2, vo3, vo4, vo5).forEach(result::add);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user