This commit is contained in:
xy
2024-04-28 13:17:41 +08:00
parent b299dfd845
commit 6cb222359f
3 changed files with 47 additions and 30 deletions

View File

@@ -16,7 +16,7 @@ import java.util.List;
public class EvaluationVo {
@ApiModelProperty("监测点越限占比")
private Double lineRatio;
private Double lineRatio = 3.14159;
@ApiModelProperty("子集")
private List<Children> childrenList;
@@ -31,7 +31,7 @@ public class EvaluationVo {
private String deptName;
@ApiModelProperty("越限占比")
private Double ratio;
private Double ratio = 3.14159;
}
}

View File

@@ -105,12 +105,35 @@
</trim>
</insert>
<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 &lt;= #{endTime}-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY-->
<!-- substation_id-->
<!-- ORDER BY `data` DESC,dataV DESC-->
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
SUM(case when pollution_type = #{typeMapId.I,javaType=string} then value else null end) as data ,
SUM(case when pollution_type = #{typeMapId.V,javaType=string} then value else null end) as dataV
from
r_stat_pollution_substation_m
<where>
<if test="ids != null and ids.size > 0">
AND substation_id IN
@@ -125,10 +148,7 @@
AND data_date &lt;= #{endTime}
</if>
</where>
GROUP BY
group by
substation_id
ORDER BY `data` DESC,dataV DESC
</select>
</mapper>

View File

@@ -181,10 +181,12 @@ public class GridServiceImpl implements IGridService {
result.setChildrenList(childrenList);
if (CollUtil.isNotEmpty(childrenList)) {
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());
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
result.setLineRatio(PubUtils.doubleRound(2,avg));
if (CollUtil.isNotEmpty(newList)) {
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
result.setLineRatio(PubUtils.doubleRound(2,avg));
}
}
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)) {
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);
}
Stream.of(vo1, vo2, vo3, vo4, vo5).forEach(result::add);
return result;
}