Compare commits
55 Commits
2166529b4d
...
2025-12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
184b2b8fad | ||
|
|
fe029fcb95 | ||
|
|
9143466ce7 | ||
|
|
9409d57243 | ||
| 63603dee08 | |||
|
|
e35bbd9b34 | ||
|
|
ea2173fff4 | ||
| faac7953d3 | |||
| c3cc39973e | |||
| 6d8bfacd0a | |||
|
|
ab5d28e3cb | ||
|
|
2dccb22cf8 | ||
| 6b0bad6047 | |||
| 9ffbdbdf57 | |||
|
|
778f689b3e | ||
|
|
917e3fb2d5 | ||
| e0f1e314a4 | |||
| 2f2ed06a35 | |||
| 277400670d | |||
| a1031109c4 | |||
| eeb27c519b | |||
|
|
670eaf7d38 | ||
| 2b79cefad6 | |||
| 212db18835 | |||
|
|
e9a1c34160 | ||
|
|
fb7a2b7084 | ||
|
|
4b3ec39a11 | ||
|
|
2d255a5dd3 | ||
|
|
614647d36d | ||
|
|
a899614c89 | ||
|
|
2543f87dd2 | ||
|
|
c5074df93d | ||
| 24e4c4de37 | |||
|
|
4f70566c65 | ||
|
|
dc11d34add | ||
| 9f3bb52d9a | |||
|
|
567ba2f56e | ||
|
|
371d4efb29 | ||
|
|
47b08d4797 | ||
| 65805e4f50 | |||
| 41d555121c | |||
|
|
4d48b42c98 | ||
|
|
f5e1fac55d | ||
|
|
cebda9323e | ||
| d09f1472a9 | |||
| b9696e957d | |||
| 12cfecac7e | |||
| 3a97f01383 | |||
|
|
10273dd2b0 | ||
|
|
5e8e03cbb1 | ||
|
|
b103141a54 | ||
|
|
a6d2d6ed47 | ||
| 601a78246e | |||
| 5e7b973d5f | |||
|
|
e89c6a2888 |
@@ -83,10 +83,10 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryEventsAssPage");
|
||||
String searchValue = baseParam.getSearchValue();
|
||||
Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||
if(pattern.matcher(searchValue).find()){
|
||||
throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||
}
|
||||
// Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||
// if(pattern.matcher(searchValue).find()){
|
||||
// throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||
// }
|
||||
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ public class SecondaryEvaluationServiceImpl implements SecondaryEvaluationServic
|
||||
unblance.add(evaluationResult);
|
||||
|
||||
evaluationResult = new AssessResultVO.EvaluationResult();
|
||||
evaluationResult.setData(result.getApproUnblance().multiply(BigDecimal.valueOf(200)));
|
||||
evaluationResult.setData(result.getApproUnblance());
|
||||
evaluationResult.setLimitData(overLimit.getUnblance());
|
||||
evaluationResult.setIsQualified(NumberUtil.isLess(evaluationResult.getData(), evaluationResult.getLimitData()));
|
||||
unblance.add(evaluationResult);
|
||||
|
||||
@@ -322,10 +322,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
|
||||
@Override
|
||||
public boolean deleteEventData(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(SgEvent::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(SgEvent::getId, ids)
|
||||
.update();
|
||||
return this.removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,6 +51,7 @@ import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -471,6 +472,8 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||
item.setFeatureAmplitude(roundHalfUp(item.getFeatureAmplitude()*100));
|
||||
|
||||
if (map.containsKey(item.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
||||
item.setGdName(areaLineInfoVO.getGdName());
|
||||
@@ -489,7 +492,17 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 四舍五入保留两位小数
|
||||
*/
|
||||
private Double roundHalfUp(double num) {
|
||||
if (num == 3.14159) {
|
||||
return num;
|
||||
}
|
||||
BigDecimal b = new BigDecimal(num);
|
||||
//保留2位小数
|
||||
return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
}
|
||||
@Override
|
||||
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
||||
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.springframework.context.annotation.DependsOn;
|
||||
* @date 2022/11/10
|
||||
*/
|
||||
@Slf4j
|
||||
@DependsOn("proxyMapperRegister")
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
|
||||
@@ -99,4 +99,9 @@ public class PollutionLineInfoDTO {
|
||||
* 监测点名称
|
||||
*/
|
||||
private String lineName;
|
||||
|
||||
/**
|
||||
* 实际安装位置
|
||||
*/
|
||||
private String actualArea;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,7 @@ public class DeptGetLineParam {
|
||||
@ApiModelProperty("监测点运行状态")
|
||||
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
|
||||
private Integer lineRunFlag;
|
||||
|
||||
@ApiModelProperty("搜索值")
|
||||
private String searchValue;
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
SELECT DISTINCT
|
||||
monitor.Org_Id AS orgId,
|
||||
monitor.Org_Name AS orgName,
|
||||
monitor.`Powerr_Id` AS powerId,
|
||||
monitor.`Powerr_Name` AS powerName,
|
||||
monitor.Powerr_Id AS powerId,
|
||||
monitor.Powerr_Name AS powerName,
|
||||
monitor.id AS monitorId,
|
||||
monitor.`Name` AS monitorName,
|
||||
monitor.Name AS monitorName,
|
||||
monitor.Line_Id,
|
||||
monitor.Line_Name,
|
||||
pdm.Monitor_Sort AS monitorSort,
|
||||
@@ -29,8 +29,8 @@
|
||||
(
|
||||
SELECT
|
||||
pm.id,
|
||||
pm.`Name`,
|
||||
pm.`Status`,
|
||||
pm.Name,
|
||||
pm.Status,
|
||||
pm.Org_Id,
|
||||
pm.Org_Name,
|
||||
pm.Powerr_Id,
|
||||
@@ -51,8 +51,8 @@
|
||||
) AS monitor
|
||||
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
|
||||
WHERE
|
||||
monitor.`Status` = 1
|
||||
AND pdm.`Status` = 1
|
||||
monitor.Status = 1
|
||||
AND pdm.Status = 1
|
||||
AND monitor.Org_Id IN
|
||||
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
|
||||
#{orgId}
|
||||
@@ -85,7 +85,7 @@
|
||||
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
|
||||
</if>
|
||||
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
|
||||
AND monitor.`Name` LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
||||
AND monitor.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.pq.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.dataVerifyCountFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/dataVerifyCount", fallbackFactory = dataVerifyCountFallbackFactory.class, contextId = "dataVerifyCount")
|
||||
public interface PqDataVerifyCountClient {
|
||||
|
||||
/**
|
||||
* 获取有异常数据的监测点相关信息
|
||||
*/
|
||||
@PostMapping("/getAnomalousData")
|
||||
HttpResult<List<OnlineMonitorVo>> getAnomalousData(@RequestBody LineBaseQueryParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.device.pq.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.api.PqDataVerifyCountClient;
|
||||
import com.njcn.device.pq.api.PqDevTypeClient;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class dataVerifyCountFallbackFactory implements FallbackFactory<PqDataVerifyCountClient> {
|
||||
@Override
|
||||
public PqDataVerifyCountClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqDataVerifyCountClient()
|
||||
{
|
||||
|
||||
@Override
|
||||
public HttpResult<List<OnlineMonitorVo>> getAnomalousData(LineBaseQueryParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取有异常数据的监测点相关信息异常", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,8 @@ public class PublicDTO {
|
||||
private String id;
|
||||
|
||||
private Double data;
|
||||
|
||||
private Integer onlineMin;
|
||||
|
||||
private Integer offlineMin;
|
||||
}
|
||||
@@ -218,6 +218,9 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("指标")
|
||||
private List<String> dicData;
|
||||
|
||||
@ApiModelProperty("是否展示污染值 0:否 1:是")
|
||||
private Integer isPollution;
|
||||
}
|
||||
|
||||
public Boolean isUserLedger() {
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DeviceParam {
|
||||
@NotBlank(message = "设备制造商不能为空")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "electroplate",value = "电镀功能",required = true)
|
||||
@ApiModelProperty(name = "electroplate",value = "电度功能",required = true)
|
||||
@NotNull(message = "电镀标识不能为空")
|
||||
private Integer electroplate;
|
||||
|
||||
|
||||
@@ -77,4 +77,7 @@ public class RunManageParam extends BaseParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "evaluate", value = "评价")
|
||||
private String evaluate;
|
||||
|
||||
@ApiModelProperty(name = "ids", value = "监测点id集合")
|
||||
private List<String> ids;
|
||||
}
|
||||
|
||||
@@ -38,4 +38,12 @@ public class MonitorBaseParam extends BaseParam {
|
||||
@ApiModelProperty(value = "终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "监测点运行状态")
|
||||
private Integer lineRunFlag;
|
||||
|
||||
@ApiModelProperty(value = "异常天数时间")
|
||||
private List<String> time;
|
||||
|
||||
@ApiModelProperty(value = "过滤异常时间次数")
|
||||
private Integer errorTimeCount;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -25,136 +26,306 @@ public class PqDataVerifyBak {
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value = "line_id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 异常数据时间
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value = "time_id")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private LocalDate timeId;
|
||||
|
||||
/**
|
||||
* 频率(0:正常 1:异常)
|
||||
* 监测点状态
|
||||
* 判断所有指标 0:无异常 1:异常
|
||||
*/
|
||||
private Integer freq;
|
||||
@TableField(value = "state")
|
||||
private Integer state ;
|
||||
|
||||
/**
|
||||
* 频率偏差(0:正常 1:异常)
|
||||
* 频率指标
|
||||
*/
|
||||
private Integer freqDev;
|
||||
@TableField(value = "freq")
|
||||
private Integer freq ;
|
||||
|
||||
/**
|
||||
* 相电压有效值(0:正常 1:异常)
|
||||
* 频率异常时间
|
||||
*/
|
||||
private Integer vRms;
|
||||
@TableField(value = "freq_time")
|
||||
private Integer freqTime ;
|
||||
|
||||
/**
|
||||
* 正序电压(0:正常 1:异常)
|
||||
* 频率偏差指标
|
||||
*/
|
||||
private Integer vPos;
|
||||
@TableField(value = "freq_dev")
|
||||
private Integer freqDev ;
|
||||
|
||||
/**
|
||||
* 负序电压(0:正常 1:异常)
|
||||
* 频率偏差异常时间
|
||||
*/
|
||||
private Integer vNeg;
|
||||
@TableField(value = "freq_dev_time")
|
||||
private Integer freqDevTime ;
|
||||
|
||||
/**
|
||||
* 零序电压(0:正常 1:异常)
|
||||
* 相电压有效值
|
||||
*/
|
||||
private Integer vZero;
|
||||
@TableField(value = "v_rms")
|
||||
private Integer vRms ;
|
||||
|
||||
/**
|
||||
* 电压不平衡度(0:正常 1:异常)
|
||||
* 相电压有效值异常时间
|
||||
*/
|
||||
private Integer vUnbalance;
|
||||
@TableField(value = "v_rms_time")
|
||||
private Integer vRmsTime ;
|
||||
|
||||
/**
|
||||
* 线电压有效值(0:正常 1:异常)
|
||||
* 正序电压
|
||||
*/
|
||||
private Integer rmsLvr;
|
||||
@TableField(value = "v_pos")
|
||||
private Integer vPos ;
|
||||
|
||||
/**
|
||||
* 电压正偏差(0:正常 1:异常)
|
||||
* 正序电压异常时间
|
||||
*/
|
||||
private Integer vuDev;
|
||||
@TableField(value = "v_pos_time")
|
||||
private Integer vPosTime ;
|
||||
|
||||
/**
|
||||
* 电压负偏差(0:正常 1:异常)
|
||||
* 负序电压
|
||||
*/
|
||||
private Integer vlDev;
|
||||
@TableField(value = "v_neg")
|
||||
private Integer vNeg ;
|
||||
|
||||
/**
|
||||
* 电压总谐波畸变率(0:正常 1:异常)
|
||||
* 负序电压异常时间
|
||||
*/
|
||||
private Integer vThd;
|
||||
@TableField(value = "v_neg_time")
|
||||
private Integer vNegTime ;
|
||||
|
||||
/**
|
||||
* 相电压基波有效值(0:正常 1:异常)
|
||||
* 零序电压
|
||||
*/
|
||||
private Integer v;
|
||||
@TableField(value = "v_zero")
|
||||
private Integer vZero ;
|
||||
|
||||
/**
|
||||
* 电流有效值(0:正常 1:异常)
|
||||
* 零序电压异常时间
|
||||
*/
|
||||
private Integer iRms;
|
||||
@TableField(value = "v_zero_time")
|
||||
private Integer vZeroTime ;
|
||||
|
||||
/**
|
||||
* 长时闪变(0:正常 1:异常)
|
||||
* 电压不平衡度
|
||||
*/
|
||||
private Integer plt;
|
||||
@TableField(value = "v_unbalance")
|
||||
private Integer vUnbalance ;
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率(0:正常 1:异常)
|
||||
* 电压不平衡度异常时间
|
||||
*/
|
||||
private Integer vInharm;
|
||||
@TableField(value = "v_unbalance_time")
|
||||
private Integer vUnbalanceTime ;
|
||||
|
||||
/**
|
||||
* 谐波电压含有率(0:正常 1:异常)
|
||||
* 线电压有效值
|
||||
*/
|
||||
private Integer vHarm;
|
||||
@TableField(value = "rms_lvr")
|
||||
private Integer rmsLvr ;
|
||||
|
||||
/**
|
||||
* 功率因数(0:正常 1:异常)
|
||||
* 线电压有效值异常时间
|
||||
*/
|
||||
private Integer pf;
|
||||
@TableField(value = "rms_lvr_time")
|
||||
private Integer rmsLvrTime ;
|
||||
|
||||
/**
|
||||
* 谐波电压相角(0:正常 1:异常)
|
||||
* 电压正偏差
|
||||
*/
|
||||
private Integer vPhasic;
|
||||
@TableField(value = "vu_dev")
|
||||
private Integer vuDev ;
|
||||
|
||||
/**
|
||||
* 谐波电压基波相角(0:正常 1:异常)
|
||||
* 电压正偏差异常时间
|
||||
*/
|
||||
private Integer v1Phasic;
|
||||
@TableField(value = "vu_dev_time")
|
||||
private Integer vuDevTime ;
|
||||
|
||||
/**
|
||||
* 电压波动(0:正常 1:异常)
|
||||
* 电压负偏差
|
||||
*/
|
||||
private Integer fluc;
|
||||
@TableField(value = "vl_Dev")
|
||||
private Integer vlDev ;
|
||||
|
||||
/**
|
||||
* 短时闪变(0:正常 1:异常)
|
||||
* 电压负偏差异常时间
|
||||
*/
|
||||
private Integer pst;
|
||||
@TableField(value = "vl_Dev_time")
|
||||
private Integer vlDevTime ;
|
||||
|
||||
/**
|
||||
* 电压总谐波畸变率
|
||||
*/
|
||||
@TableField(value = "v_thd")
|
||||
private Integer vThd ;
|
||||
|
||||
/**
|
||||
* 电压总谐波畸变率异常时间
|
||||
*/
|
||||
@TableField(value = "v_thd_time")
|
||||
private Integer vThdTime ;
|
||||
|
||||
/**
|
||||
* 相电压基波有效值
|
||||
*/
|
||||
@TableField(value = "v")
|
||||
private Integer v ;
|
||||
|
||||
/**
|
||||
* 相电压基波有效值异常时间
|
||||
*/
|
||||
@TableField(value = "v_time")
|
||||
private Integer vTime ;
|
||||
|
||||
/**
|
||||
* 电流有效值
|
||||
*/
|
||||
@TableField(value = "i_rms")
|
||||
private Integer iRms ;
|
||||
|
||||
/**
|
||||
* 电流有效值异常时间
|
||||
*/
|
||||
@TableField(value = "i_rms_time")
|
||||
private Integer iRmsTime ;
|
||||
|
||||
/**
|
||||
* 长时闪变
|
||||
*/
|
||||
@TableField(value = "plt")
|
||||
private Integer plt ;
|
||||
|
||||
/**
|
||||
* 长时闪变异常时间
|
||||
*/
|
||||
@TableField(value = "plt_time")
|
||||
private Integer pltTime ;
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率
|
||||
*/
|
||||
@TableField(value = "v_inharm")
|
||||
private Integer vInharm ;
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率异常时间
|
||||
*/
|
||||
@TableField(value = "v_Inharm_time")
|
||||
private Integer vInharmTime ;
|
||||
|
||||
/**
|
||||
* 谐波电压含有率
|
||||
*/
|
||||
@TableField(value = "v_harm")
|
||||
private Integer vHarm ;
|
||||
|
||||
/**
|
||||
* 谐波电压含有率异常时间
|
||||
*/
|
||||
@TableField(value = "v_harm_time")
|
||||
private Integer vHarmTime ;
|
||||
|
||||
/**
|
||||
* 功率因数
|
||||
*/
|
||||
@TableField(value = "pf")
|
||||
private Integer pf ;
|
||||
|
||||
/**
|
||||
* 功率因数异常时间
|
||||
*/
|
||||
@TableField(value = "pf_time")
|
||||
private Integer pfTime ;
|
||||
|
||||
/**
|
||||
* 谐波电压相角
|
||||
*/
|
||||
@TableField(value = "v_phasic")
|
||||
private Integer vPhasic ;
|
||||
|
||||
/**
|
||||
* 谐波电压相角异常时间
|
||||
*/
|
||||
@TableField(value = "v_phasic_time")
|
||||
private Integer vPhasicTime ;
|
||||
|
||||
/**
|
||||
* 谐波电压基波相角
|
||||
*/
|
||||
@TableField(value = "v1_phasic")
|
||||
private Integer v1Phasic ;
|
||||
|
||||
/**
|
||||
* 谐波电压基波相角异常时间
|
||||
*/
|
||||
@TableField(value = "v1_phasic_time")
|
||||
private Integer v1PhasicTime ;
|
||||
|
||||
/**
|
||||
* 电压波动
|
||||
*/
|
||||
@TableField(value = "fluc")
|
||||
private Integer fluc ;
|
||||
|
||||
/**
|
||||
* 电压波动异常时间
|
||||
*/
|
||||
@TableField(value = "fluc_time")
|
||||
private Integer flucTime ;
|
||||
|
||||
/**
|
||||
* 短时闪变
|
||||
*/
|
||||
@TableField(value = "pst")
|
||||
private Integer pst ;
|
||||
|
||||
/**
|
||||
* 短时闪变异常时间
|
||||
*/
|
||||
@TableField(value = "pst_time")
|
||||
private Integer pstTime ;
|
||||
|
||||
/**
|
||||
* 电压暂降(0:正常 1:异常)
|
||||
*/
|
||||
private Integer dip;
|
||||
@TableField(value = "dip")
|
||||
private Integer dip ;
|
||||
|
||||
/**
|
||||
* 电压暂降异常时间
|
||||
*/
|
||||
@TableField(value = "dip_time")
|
||||
private Integer dipTime ;
|
||||
|
||||
/**
|
||||
* 电压暂升(0:正常 1:异常)
|
||||
*/
|
||||
private Integer rise;
|
||||
@TableField(value = "rise")
|
||||
private Integer rise ;
|
||||
|
||||
/**
|
||||
* 判断所有指标 0:无异常 1:有异常
|
||||
* 电压暂升异常时间
|
||||
*/
|
||||
private Integer state;
|
||||
@TableField(value = "rise_time")
|
||||
private Integer riseTime ;
|
||||
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
@TableField(value = "path")
|
||||
private String path;
|
||||
|
||||
|
||||
|
||||
@@ -52,17 +52,5 @@ public class PqDataVerifyCount implements Serializable {
|
||||
@TableField(value = "total_all")
|
||||
private Integer totalAll ;
|
||||
|
||||
/**
|
||||
* 异常短时闪变数量
|
||||
*/
|
||||
@TableField(value = "flicker")
|
||||
private Integer flicker ;
|
||||
|
||||
/**
|
||||
* 短时闪变总数量
|
||||
*/
|
||||
@TableField(value = "flicker_all")
|
||||
private Integer flickerAll;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("distribution_area")
|
||||
@TableName("fbs_distribution_area")
|
||||
public class DistributionArea extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.time.LocalDate;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("power_generation_user")
|
||||
@TableName("fbs_power_generation_user")
|
||||
public class GenerationUser extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -130,11 +130,16 @@ public class AreaLineInfoVO implements Serializable {
|
||||
@ApiModelProperty(name = "smallObjType",value = "检测对象小类")
|
||||
private String smallObjType;
|
||||
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志(0-电网侧;1-非电网侧)")
|
||||
private Integer powerFlag;
|
||||
|
||||
@ApiModelProperty(name = "objId",value = "对象id")
|
||||
private String objId;
|
||||
|
||||
private Double vHarmonicValue; ;
|
||||
@ApiModelProperty(name = "vHarmonicValue",value = "污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
@ApiModelProperty(name = "userList",value = "敏感用户信息")
|
||||
private List<User> userList;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DeviceVO implements Serializable {
|
||||
@ApiModelProperty(name = "manufacturer",value = "设备制造商Guid")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "electroplate",value = "电镀功能")
|
||||
@ApiModelProperty(name = "electroplate",value = "电度功能")
|
||||
private Integer electroplate;
|
||||
|
||||
@ApiModelProperty(name = "thisTimeCheck",value = "本次定检时间")
|
||||
|
||||
@@ -36,6 +36,9 @@ public class GridDiagramProVO {
|
||||
|
||||
@ApiModelProperty(name = "integrityRate", value = "数据完整率")
|
||||
private Float integrityRate;
|
||||
|
||||
@ApiModelProperty(name = "onLineRate", value = "数据在线率")
|
||||
private Float onLineRate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,6 +136,18 @@ public class LineIntegrityDataVO implements Serializable {
|
||||
@ApiModelProperty(name = "integrityData",value = "数据完整性")
|
||||
private Double integrityData;
|
||||
|
||||
/**
|
||||
* 实际时间
|
||||
*/
|
||||
@ApiModelProperty(name = "realTime",value = "实际时间")
|
||||
private Integer realTime;
|
||||
|
||||
/**
|
||||
* 期望时间
|
||||
*/
|
||||
@ApiModelProperty(name = "dueTime",value = "期望时间")
|
||||
private Integer dueTime;
|
||||
|
||||
/**
|
||||
* 监测点合格率
|
||||
*/
|
||||
|
||||
@@ -77,6 +77,18 @@ public class TerminalOnlineRateDataVO implements Serializable {
|
||||
@ApiModelProperty(name = "onlineRate",value = "在线率")
|
||||
private Double onlineRate;
|
||||
|
||||
/**
|
||||
* 在线分钟数
|
||||
*/
|
||||
@ApiModelProperty(name = "onlineMin",value = "在线分钟数")
|
||||
private Integer onlineMin;
|
||||
|
||||
/**
|
||||
* 离线分钟数
|
||||
*/
|
||||
@ApiModelProperty(name = "offlineMin",value = "离线分钟数")
|
||||
private Integer offlineMin;
|
||||
|
||||
/**
|
||||
* 最新数据时间
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-03-31
|
||||
@@ -14,6 +17,8 @@ public class DetailAbnormalVO {
|
||||
|
||||
private String date;
|
||||
|
||||
private List<TimeAndTargetKey> dateTargetList;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private String bdName;
|
||||
@@ -24,7 +29,13 @@ public class DetailAbnormalVO {
|
||||
|
||||
private String targetKey;
|
||||
|
||||
@Data
|
||||
public static class TimeAndTargetKey {
|
||||
|
||||
private String date;
|
||||
|
||||
private List<VerifyTargetVO> targetKeys;
|
||||
}
|
||||
/**
|
||||
* 异常实体
|
||||
*/
|
||||
@@ -55,6 +66,23 @@ public class DetailAbnormalVO {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DetailAbnormalCountVO {
|
||||
|
||||
private Integer timeSum;
|
||||
private Integer errCount;
|
||||
private List<DetailAbnormalInnerVO> time;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DetailLimitCountVO {
|
||||
|
||||
private Integer timeSum;
|
||||
private Integer errCount;
|
||||
private List<DetailLimitInnerVO> time;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class DetailLimitInnerVO{
|
||||
|
||||
@@ -78,4 +106,96 @@ public class DetailAbnormalVO {
|
||||
//限值
|
||||
private float overLimitValue;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Assess {
|
||||
|
||||
/**
|
||||
* 频率偏差
|
||||
*/
|
||||
@ApiModelProperty("频率偏差")
|
||||
private Double freqData = 3.14159;
|
||||
@ApiModelProperty("频率偏差限值")
|
||||
private Float freqLimit = 3.14159F;
|
||||
|
||||
/**
|
||||
* 电压闪变
|
||||
*/
|
||||
@ApiModelProperty("电压闪变")
|
||||
private Double flickerData = 3.14159;
|
||||
@ApiModelProperty("电压闪变限值")
|
||||
private Float flickerLimit = 3.14159F;
|
||||
|
||||
|
||||
/**
|
||||
* 电压偏差上
|
||||
*/
|
||||
@ApiModelProperty("电压上偏差")
|
||||
private Double vDevData = 3.14159;
|
||||
@ApiModelProperty("电压上偏差限值")
|
||||
private Float vDevLimit = 3.14159F;
|
||||
|
||||
|
||||
/**
|
||||
* 电压偏差下
|
||||
*/
|
||||
@ApiModelProperty("电压下偏差")
|
||||
private Double uDevData = 3.14159;
|
||||
@ApiModelProperty("电压下偏差限值")
|
||||
private Float uDevLimit = 3.14159F;
|
||||
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
@ApiModelProperty("三相电压不平衡度")
|
||||
private Double unbalanceData = 3.14159;
|
||||
@ApiModelProperty("三相电压不平衡度限值")
|
||||
private Float unbalanceLimit = 3.14159F;
|
||||
|
||||
|
||||
/**
|
||||
* 总谐波畸变率
|
||||
*/
|
||||
@ApiModelProperty("总谐波畸变率")
|
||||
private Double uaberranceData = 3.14159;
|
||||
@ApiModelProperty("总谐波畸变率限值")
|
||||
private Float uaberranceLimit = 3.14159F;
|
||||
|
||||
|
||||
/**
|
||||
* 负序电流限值天数
|
||||
*/
|
||||
@ApiModelProperty("负序电流")
|
||||
private Double iNegData= 3.14159;
|
||||
@ApiModelProperty("负序电流限值")
|
||||
private Float iNegLimit= 3.14159F;
|
||||
|
||||
|
||||
/**
|
||||
* 谐波电压越限天数
|
||||
*/
|
||||
@ApiModelProperty("谐波电压")
|
||||
private Double uharmData = 3.14159;
|
||||
@ApiModelProperty("谐波电压限值")
|
||||
private Float uharmLimit= 3.14159F;
|
||||
/**
|
||||
* 谐波电流越限天数
|
||||
*/
|
||||
@ApiModelProperty("谐波电流")
|
||||
private Double iharmData = 3.14159;
|
||||
@ApiModelProperty("谐波电流限值")
|
||||
private Float iharmLimit= 3.14159F;
|
||||
/**
|
||||
* 间谐波限值天数
|
||||
*/
|
||||
@ApiModelProperty("间谐波电压")
|
||||
private Double inuharmData = 3.14159;
|
||||
@ApiModelProperty("间谐波电压限值")
|
||||
private Float inuharmLimit= 3.14159F;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ public class PowerQualityIndicatorsVO {
|
||||
|
||||
@ApiModelProperty(name = "monitorId",value = "监测点id")
|
||||
private String monitorId;
|
||||
//监测点名称
|
||||
|
||||
@ApiModelProperty(name = "monitorName",value = "监测点名称")
|
||||
private String monitorName;
|
||||
//所属终端名称
|
||||
|
||||
@ApiModelProperty(name = "devName",value = "所属终端名称")
|
||||
private String devName;
|
||||
|
||||
@@ -25,23 +25,25 @@ public class PowerQualityIndicatorsVO {
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "所属厂商")
|
||||
private String manufacturer;
|
||||
//所属电站
|
||||
|
||||
@ApiModelProperty(name = "stationName",value = "所属电站")
|
||||
private String stationName;
|
||||
//监测对象类型
|
||||
|
||||
@ApiModelProperty(name = "objType",value = "监测对象类型")
|
||||
private String objType;
|
||||
//监测对象名称
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "监测对象名称")
|
||||
private String objName;
|
||||
//电压等级
|
||||
|
||||
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
||||
private String voltageLevel;
|
||||
//异常天数
|
||||
|
||||
@ApiModelProperty(name = "abnormalDay",value = "异常天数")
|
||||
private Integer abnormalDay;
|
||||
//严重度
|
||||
|
||||
@ApiModelProperty(name = "severity",value = "严重度")
|
||||
private Integer severity;
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorAbnormalTableDetail")
|
||||
@ApiOperation("弹框-获取异常监测点列表详情")
|
||||
public HttpResult<List<DetailAbnormalVO.DetailAbnormalInnerVO>> monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<DetailAbnormalVO.DetailAbnormalCountVO> monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("monitorAbnormalTableDetail");
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam);
|
||||
DetailAbnormalVO.DetailAbnormalCountVO list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -134,12 +134,21 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorLimitTableDetail")
|
||||
@ApiOperation("弹框-获取稳态告警监测点列表详情")
|
||||
public HttpResult<List<DetailAbnormalVO.DetailLimitInnerVO>> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<DetailAbnormalVO.DetailLimitCountVO> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
String methodDescribe = getMethodDescribe("monitorLimitTableDetail");
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
|
||||
DetailAbnormalVO.DetailLimitCountVO list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/limitTableDetail")
|
||||
@ApiOperation("监测点评价")
|
||||
public HttpResult<DetailAbnormalVO.Assess> limitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("limitTableDetail");
|
||||
DetailAbnormalVO.Assess list = iDataVerifyService.limitTableDetail(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +168,10 @@ public class DeptLineController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getAllData")
|
||||
@ApiOperation("获取部门监测点表所有数据")
|
||||
@ApiOperation("获取部门监测点表数据(仅查询在运监测点)")
|
||||
public HttpResult<List<DeptLine>> getAllData() {
|
||||
String methodDescribe = getMethodDescribe("getAllData");
|
||||
List<DeptLine> list = deptLineMapper.selectList(null);
|
||||
List<DeptLine> list = deptLineMapper.getOnlineMonitor();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
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.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyCountService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 异常数据功能
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-12-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dataVerifyCount")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "异常数据数量统计")
|
||||
public class PqDataVerifyCountController extends BaseController {
|
||||
|
||||
private final IPqDataVerifyCountService pqDataVerifyCountService;
|
||||
|
||||
/**
|
||||
* 获取有异常数据的监测点相关信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAnomalousData")
|
||||
@ApiOperation("异常-获取异常数据主页面")
|
||||
public HttpResult<List<OnlineMonitorVo>> getAnomalousData(@RequestBody LineBaseQueryParam param){
|
||||
String methodDescribe = getMethodDescribe("getMonitorVerifyData");
|
||||
List<OnlineMonitorVo> list = pqDataVerifyCountService.getAnomalousData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.device.pq.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyCount;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,4 +20,6 @@ public interface PqDataVerifyCountMapper extends BaseMapper<PqDataVerifyCount> {
|
||||
|
||||
|
||||
List<PqDataVerifyCount> selectSumVerify(@Param("param") OnlineRateParam param);
|
||||
|
||||
List<OnlineMonitorVo> getAnomalousData(@Param("lineIds")List<String> lineIds, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
SELECT
|
||||
line_id AS lineId,
|
||||
SUM(total) AS total,
|
||||
SUM(total_all) AS totalAll,
|
||||
SUM(flicker) AS flicker,
|
||||
SUM(flicker_all) AS flickerAll
|
||||
SUM(total_all) AS totalAll
|
||||
FROM
|
||||
pq_data_verify_count
|
||||
<where>
|
||||
@@ -29,4 +27,44 @@
|
||||
</where>
|
||||
group by line_id ;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="getAnomalousData" resultType="OnlineMonitorVo">
|
||||
SELECT DISTINCT
|
||||
t6.Name gdName,
|
||||
t5.Name subName,
|
||||
t4.Name deviceName,
|
||||
t1.Line_Id lineId,
|
||||
t2.Name lineName,
|
||||
t8.Name monitorObjType,
|
||||
t7.Obj_Name monitorObj,
|
||||
"异常数据" as target,
|
||||
count(t1.time_id) lastDay
|
||||
FROM
|
||||
pq_data_verify_count t1
|
||||
left join pq_line t2 on t1.Line_Id = t2.Id
|
||||
left join pq_line t3 on t2.Pid = t3.Id
|
||||
left join pq_line t4 on t3.Pid = t4.Id
|
||||
left join pq_line t5 on t4.Pid = t5.Id
|
||||
left join pq_line t6 on t5.Pid = t6.Id
|
||||
left join pq_line_detail t7 on t1.Line_Id = t7.Id
|
||||
left join sys_dict_data t8 on t7.Load_Type = t8.Id
|
||||
WHERE
|
||||
t1.total > 0
|
||||
<if test="lineIds!=null and lineIds.size > 0">
|
||||
and Line_Id in
|
||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test=" startTime != null and startTime !=''">
|
||||
and time_id >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and time_id <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
Line_Id
|
||||
order by lastDay desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -176,7 +176,6 @@
|
||||
<select id="getDevOnlineByDevIds" resultType="TerminalOnlineRateData">
|
||||
select
|
||||
dev_index devId,
|
||||
avg(online_min/(online_min+offline_min))*100 onlineRate,
|
||||
sum(online_min) onlineMin,
|
||||
sum(offline_min) offlineMin
|
||||
from r_stat_onlinerate_d
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
line.LEVEL,
|
||||
line.sort,
|
||||
line.pids,
|
||||
CONCAT(voltage.name, '_', line.name, '(',device.`Name`,')') name,
|
||||
CONCAT(voltage.name, '_', line.name, '(',device.Name,')') name,
|
||||
comFlag.Com_Flag,
|
||||
detail.pt_type,
|
||||
detail.obj_id
|
||||
|
||||
@@ -41,7 +41,8 @@ public interface IDataVerifyService extends IService<DataVerify> {
|
||||
|
||||
List<DetailAbnormalVO> monitorLimitTable(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ public interface IPqDataVerifyBakService extends IService<PqDataVerifyBak> {
|
||||
List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyCount;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,8 +19,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface IPqDataVerifyCountService extends IService<PqDataVerifyCount> {
|
||||
|
||||
|
||||
|
||||
List<PqDataVerifyCount> getSumVerify( OnlineRateParam param);
|
||||
|
||||
List<OnlineMonitorVo> getAnomalousData(LineBaseQueryParam par);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -50,12 +51,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 基础获取单位信息
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@@ -77,7 +75,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptGetBase.setUnitChildrenList(deptChildren);
|
||||
result.add(deptGetBase);
|
||||
});
|
||||
redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(),result);
|
||||
redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -87,8 +85,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, String> deptMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
@@ -100,8 +98,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(x->{
|
||||
if(deptMap.containsKey(x.getUnitId())){
|
||||
map.get(i).forEach(x -> {
|
||||
if (deptMap.containsKey(x.getUnitId())) {
|
||||
x.setUnitName(deptMap.get(x.getUnitId()));
|
||||
}
|
||||
});
|
||||
@@ -127,7 +125,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, String> deptMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevAllGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1,deptGetLineParam.getLineRunFlag(),deptGetLineParam.getIsUpToGrid());
|
||||
1, deptGetLineParam.getLineRunFlag(), deptGetLineParam.getIsUpToGrid());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
@@ -139,8 +137,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(x->{
|
||||
if(deptMap.containsKey(x.getUnitId())){
|
||||
map.get(i).forEach(x -> {
|
||||
if (deptMap.containsKey(x.getUnitId())) {
|
||||
x.setUnitName(deptMap.get(x.getUnitId()));
|
||||
}
|
||||
});
|
||||
@@ -184,7 +182,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
subList.addAll(map.get(i).stream().map(TerminalGetBase::getLedgerId).distinct().collect(Collectors.toList()));
|
||||
subList.addAll(map.get(i).stream().filter(x-> StrUtil.isNotBlank(x.getObjId())).map(TerminalGetBase::getObjId).distinct().collect(Collectors.toList()));
|
||||
subList.addAll(map.get(i).stream().filter(x -> StrUtil.isNotBlank(x.getObjId())).map(TerminalGetBase::getObjId).distinct().collect(Collectors.toList()));
|
||||
lineList.addAll(map.get(i).stream().map(TerminalGetBase::getLineId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
@@ -200,7 +198,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
public List<DeptGetBusBarDTO> deptBusBar(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetBusBarDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),2,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()), 2, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetBusBarDTO deptGetBusBarDTO = new DeptGetBusBarDTO();
|
||||
deptGetBusBarDTO.setUnitId(item.getUnitId());
|
||||
@@ -225,10 +223,10 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type) {
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam, Integer type) {
|
||||
List<DeptGetDeviceDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),type,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()), type, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO();
|
||||
deptGetDeviceDTO.setUnitId(item.getUnitId());
|
||||
@@ -266,7 +264,11 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetSubStationDTO.Info> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()),deptGetLineParam.getPowerFlag(),deptGetLineParam.getLineRunFlag(),deptGetLineParam.getIsUpToGrid());
|
||||
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
deptGetLineParam.getPowerFlag(),
|
||||
deptGetLineParam.getLineRunFlag(),
|
||||
deptGetLineParam.getIsUpToGrid(),
|
||||
deptGetLineParam.getSearchValue());
|
||||
Map<String, List<TerminalGetBase.Extend>> orgSub = anExtends.stream().collect(Collectors.groupingBy(TerminalGetBase::getUnitId));
|
||||
Map<String, String> deptNameMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
temDept.forEach(item -> {
|
||||
@@ -284,15 +286,15 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
//获取部门下变电信息
|
||||
List<TerminalGetBase.Extend> sub = orgSub.get(deptId);
|
||||
Map<String, List<TerminalGetBase.Extend>> subMap = sub.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getLedgerId()+"_"+x.getSubName()+"_"+x.getVoltageLevel()));
|
||||
.collect(Collectors.groupingBy(x -> x.getLedgerId() + "_" + x.getSubName() + "_" + x.getVoltageLevel()));
|
||||
for (Map.Entry<String, List<TerminalGetBase.Extend>> stringListEntry : subMap.entrySet()) {
|
||||
String[] split = stringListEntry.getKey().split("_");
|
||||
subGetBase=new SubGetBase();
|
||||
subGetBase = new SubGetBase();
|
||||
subGetBase.setId(split[0]);
|
||||
subGetBase.setName(split[1]);
|
||||
subGetBase.setVoltageLevel(split[2]);
|
||||
subGetBase.setOrgId(deptId);
|
||||
if(deptNameMap.containsKey(deptId)){
|
||||
if (deptNameMap.containsKey(deptId)) {
|
||||
subGetBase.setOrgName(deptNameMap.get(deptId));
|
||||
}
|
||||
//国网监测点
|
||||
@@ -318,12 +320,12 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
@Override
|
||||
public List<SubGetBase> tagOrIdGetSub(SubstationParam substationParam) {
|
||||
List<SubGetBase> subStationList = deptLineService.getSubStationList(substationParam);
|
||||
if(CollUtil.isNotEmpty(subStationList)){
|
||||
if (CollUtil.isNotEmpty(subStationList)) {
|
||||
List<String> ids = subStationList.stream().map(SubGetBase::getOrgId).collect(Collectors.toList());
|
||||
List<Dept> data = deptFeignClient.getDeptInfoListByIds(ids).getData();
|
||||
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
subStationList.stream().forEach(x->{
|
||||
if(deptMap.containsKey(x.getOrgId())){
|
||||
subStationList.stream().forEach(x -> {
|
||||
if (deptMap.containsKey(x.getOrgId())) {
|
||||
x.setOrgName(deptMap.get(x.getOrgId()));
|
||||
}
|
||||
});
|
||||
@@ -334,7 +336,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
@Override
|
||||
public List<String> getRunMonitorByDept(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(monitorBaseParam.getDeptId()).getData();
|
||||
List<String> monitorIds = deptLineService.getLineByDeptIds(ids,monitorBaseParam.getManufacturer(),null,Stream.of(0,1,2).collect(Collectors.toList()),monitorBaseParam.getObjType());
|
||||
List<String> monitorIds = deptLineService.getLineByDeptIds(ids, monitorBaseParam.getManufacturer(),
|
||||
ObjectUtil.isNotNull(monitorBaseParam.getLineRunFlag())? Arrays.asList(monitorBaseParam.getLineRunFlag()):null,
|
||||
Stream.of(0, 1, 2).collect(Collectors.toList()), monitorBaseParam.getObjType());
|
||||
return monitorIds;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -17,35 +18,38 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.overlimit.service.IOverLimitService;
|
||||
import com.njcn.device.pq.mapper.DataVerifyMapper;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IDataVerifyService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -67,28 +71,19 @@ import java.util.stream.Collectors;
|
||||
public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVerify> implements IDataVerifyService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataVerifyServiceImpl.class);
|
||||
|
||||
private static final String SEPARATOR = "&";
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
|
||||
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
||||
|
||||
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||
|
||||
private final DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final PqDataVerifyBakMapper pqDataVerifyBakMapper;
|
||||
private final IOverLimitService overLimitService;
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -214,7 +209,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
List<DataLimitTargetDto> limitTarget = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> it.getAllTime() > 0).collect(Collectors.toList());
|
||||
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.toList());
|
||||
long abnormalCount = limitList.stream().map(DataLimitTargetDto::getLineId).distinct().count();
|
||||
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
|
||||
verifyMonitorVO.setRunNum(monitorIds.size());
|
||||
@@ -235,7 +230,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
List<DataLimitTargetDto> limitTarget = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> it.getAllTime() > 0).collect(Collectors.toList());
|
||||
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.toList());
|
||||
return getLimitTable(limitList, monitorBaseParam);
|
||||
}
|
||||
|
||||
@@ -244,137 +239,50 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<DetailAbnormalVO> result = new ArrayList<>();
|
||||
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
|
||||
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
|
||||
|
||||
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
|
||||
lineCountEvaluateParam.setLineId(monitorBaseParam.getMonitorIds());
|
||||
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
List<DataLimitRateDetailDto> dataLimitRateDetailDtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
Map<LocalDate, List<DataLimitRateDetailDto>> limitMap = dataLimitRateDetailDtoList.stream().collect(Collectors.groupingBy(DataLimitRateDetailDto::getTime));
|
||||
|
||||
limitMap.forEach((date, list) -> {
|
||||
Map<String, DataLimitRateDetailDto> map = list.stream().collect(Collectors.toMap(DataLimitRateDetailDto::getLineId, Function.identity()));
|
||||
map.forEach((lineId, line) -> {
|
||||
LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId);
|
||||
Integer timeInterval = lineInfoVO.getTimeInterval();
|
||||
Set<String> timeSet = new HashSet<>();
|
||||
List<String> specialTargetList = new ArrayList<>();
|
||||
String jonsStr = "";
|
||||
if (monitorBaseParam.getTargetKey().equals(DicDataEnum.VOLTAGE_DEV.getCode())) {
|
||||
//电压偏差
|
||||
jonsStr = line.getVoltageDevOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FLICKER.getCode())) {
|
||||
jonsStr = line.getFlickerOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.phase_Voltage.getCode())) {
|
||||
jonsStr = line.getUbalanceOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FREQUENCY_DEV.getCode())) {
|
||||
jonsStr = line.getFreqDevOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.NEG_CURRENT.getCode())) {
|
||||
jonsStr = line.getINegOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.THD_V.getCode())) {
|
||||
jonsStr = line.getUaberranceOvertime();
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_VOLTAGE.getCode())) {
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "uharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_CURRENT.getCode())) {
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "iharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.INTERHARMONIC_VOLTAGE.getCode())) {
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String uHarmKey = "inuharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
List<DataLimitTargetDto> dataLimitTargetDtoList = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
Map<String, List<DataLimitTargetDto>> limitMap = dataLimitTargetDtoList.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.groupingBy(DataLimitTargetDto::getLineId));
|
||||
limitMap.forEach((lineId, value) -> {
|
||||
LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId);
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setMonitorId(lineId);
|
||||
List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
|
||||
DetailAbnormalVO.TimeAndTargetKey targetKey;
|
||||
for (DataLimitTargetDto dto : value) {
|
||||
List<VerifyTargetVO> verifyS = assLimitTarget(Arrays.asList(dto)).stream().filter(x -> x.getIds().size() > 0).collect(Collectors.toList());
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
List<VerifyTargetVO> verify = verifyS.stream().filter(x -> x.getKey().equals(monitorBaseParam.getTargetKey())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(verify)) {
|
||||
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
|
||||
targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
|
||||
targetKey.setTargetKeys(verify);
|
||||
targetKeyList.add(targetKey);
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(line.getVoltageDevOvertime())) {
|
||||
specialTargetList.add(line.getVoltageDevOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getFlickerOvertime())) {
|
||||
specialTargetList.add(line.getFlickerOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getUbalanceOvertime())) {
|
||||
specialTargetList.add(line.getUbalanceOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getFreqDevOvertime())) {
|
||||
specialTargetList.add(line.getFreqDevOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getINegOvertime())) {
|
||||
specialTargetList.add(line.getINegOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getUaberranceOvertime())) {
|
||||
specialTargetList.add(line.getUaberranceOvertime());
|
||||
}
|
||||
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "uharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "iharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String uHarmKey = "inuharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
|
||||
targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
|
||||
targetKey.setTargetKeys(verifyS);
|
||||
targetKeyList.add(targetKey);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(specialTargetList)) {
|
||||
for (String str : specialTargetList) {
|
||||
JSONArray jsonArray = new JSONArray(str);
|
||||
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
|
||||
jsonBaseVOList.forEach(it -> {
|
||||
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if(StrUtil.isNotBlank(jonsStr)){
|
||||
JSONArray jsonArray = new JSONArray(jonsStr);
|
||||
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
|
||||
jsonBaseVOList.forEach(it -> {
|
||||
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(timeSet.size()>0){
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setMonitorId(lineId);
|
||||
detailAbnormalVO.setDate(date.format(DATE_FORMAT));
|
||||
detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
|
||||
detailAbnormalVO.setBdName(lineInfoVO.getBdName());
|
||||
detailAbnormalVO.setTimeSum(String.valueOf(timeInterval*timeSet.size()));
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
detailAbnormalVO.setDateTargetList(targetKeyList);
|
||||
detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
|
||||
detailAbnormalVO.setBdName(lineInfoVO.getBdName());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
public DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
|
||||
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
|
||||
DetailAbnormalVO.DetailLimitCountVO v = new DetailAbnormalVO.DetailLimitCountVO();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result = new ArrayList<>();
|
||||
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
|
||||
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
|
||||
@@ -382,7 +290,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchBeginTime());
|
||||
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
if (CollUtil.isEmpty(dtoList)) {
|
||||
return result;
|
||||
return v;
|
||||
}
|
||||
|
||||
DataLimitRateDetailDto dto = dtoList.get(0);
|
||||
@@ -392,7 +300,219 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
} else {
|
||||
processAllTargets(dto, targetMap, result);
|
||||
}
|
||||
return result;
|
||||
int size = result.stream().map(DetailAbnormalVO.DetailLimitInnerVO::getTime).collect(Collectors.toSet()).size();
|
||||
v.setTimeSum(lineDetailMap.get(monitorBaseParam.getMonitorIds().get(0)).getTimeInterval() * size);
|
||||
v.setTime(result);
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
DetailAbnormalVO.Assess assess = new DetailAbnormalVO.Assess();
|
||||
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
|
||||
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
|
||||
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
|
||||
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
Overlimit overLimitDataById = overLimitService.getOverLimitDataById(monitorBaseParam.getMonitorIds().get(0));
|
||||
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> freq = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> voltage = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> uaberrance = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> ubalance = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> flicker = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> iNeg = new ArrayList<>();
|
||||
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> uharm = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> iharm = new ArrayList<>();
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> inuharm = new ArrayList<>();
|
||||
|
||||
for (DataLimitRateDetailDto dto : dtoList) {
|
||||
dealJsonArr(new JSONArray(dto.getFreqDevOvertime()), freq, DicDataEnum.FREQUENCY_DEV.getName(), null);
|
||||
dealJsonArr(new JSONArray(dto.getVoltageDevOvertime()), voltage, DicDataEnum.VOLTAGE_DEV.getName(), null);
|
||||
dealJsonArr(new JSONArray(dto.getUaberranceOvertime()), uaberrance, DicDataEnum.THD_V.getName(), null);
|
||||
dealJsonArr(new JSONArray(dto.getUbalanceOvertime()), ubalance, DicDataEnum.phase_Voltage.getName(), null);
|
||||
dealJsonArr(new JSONArray(dto.getFlickerOvertime()), flicker, DicDataEnum.FLICKER.getName(), null);
|
||||
dealJsonArr(new JSONArray(dto.getINegOvertime()), iNeg, DicDataEnum.NEG_CURRENT.getName(), null);
|
||||
// 处理谐波类指标
|
||||
processHarmonicTargetHarm(dto, DicDataEnum.HARMONIC_VOLTAGE.getName(), "uharm", 2, 25, uharm);
|
||||
processHarmonicTargetHarm(dto, DicDataEnum.HARMONIC_CURRENT.getName(), "iharm", 2, 25, iharm);
|
||||
processHarmonicTargetHarm(dto, DicDataEnum.INTERHARMONIC_VOLTAGE.getName(), "inuharm", 1, 16, inuharm);
|
||||
}
|
||||
assess.setFreqLimit(overLimitDataById.getFreqDev());
|
||||
assess.setVDevLimit(overLimitDataById.getVoltageDev());
|
||||
assess.setUDevLimit(overLimitDataById.getUvoltageDev());
|
||||
assess.setUaberranceLimit(overLimitDataById.getUaberrance());
|
||||
assess.setUnbalanceLimit(overLimitDataById.getUbalance());
|
||||
assess.setFlickerLimit(overLimitDataById.getFlicker());
|
||||
assess.setINegLimit(overLimitDataById.getINeg());
|
||||
Map<String, List<PqReasonableRangeDto>> map = new HashMap<>();
|
||||
DataCleanParam param = new DataCleanParam();
|
||||
param.setSystemType(DataCleanEnum.Pqs.getCode());
|
||||
List<PqReasonableRangeDto> list = pqReasonableRangeFeignClient.getData(param).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
map = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName));
|
||||
}
|
||||
|
||||
List<PqReasonableRangeDto> dataV = map.get(DataCleanEnum.DataV.getCode());
|
||||
Map<String, PqReasonableRangeDto> dataVCode = dataV.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
||||
//频率偏差
|
||||
if (CollUtil.isNotEmpty(freq)) {
|
||||
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.FreqDev.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(freq, dto);
|
||||
assess.setFreqData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
|
||||
//电压偏差
|
||||
if (CollUtil.isNotEmpty(voltage)) {
|
||||
//上偏差
|
||||
PqReasonableRangeDto dto1 = dataVCode.get(DataCleanEnum.VuDev.getCode());
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect = voltage.stream()
|
||||
.filter(x -> Double.valueOf(x.getVal()) > 0)
|
||||
.filter(x -> Double.valueOf(x.getVal()) < dto1.getMaxValue())
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
DetailAbnormalVO.DetailLimitInnerVO val;
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
val = collect.get(0);
|
||||
} else {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = voltage.stream()
|
||||
.filter(x -> Double.valueOf(x.getVal()) > 0)
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
|
||||
.collect(Collectors.toList());
|
||||
val = collect2.get(0);
|
||||
val.setVal(dto1.getMaxValue().toString());
|
||||
}
|
||||
assess.setVDevData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//下偏差
|
||||
PqReasonableRangeDto dto2 = dataVCode.get(DataCleanEnum.VlDev.getCode());
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = voltage.stream()
|
||||
.filter(x -> Double.valueOf(x.getVal()) < 0)
|
||||
.filter(x -> dto2.getMinValue() < Double.valueOf(x.getVal()))
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect2)) {
|
||||
DetailAbnormalVO.DetailLimitInnerVO val2;
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
val2 = collect.get(0);
|
||||
} else {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect3 = voltage.stream()
|
||||
.filter(x -> Double.valueOf(x.getVal()) < 0)
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
|
||||
.collect(Collectors.toList());
|
||||
val2 = collect3.get(0);
|
||||
val2.setVal(dto2.getMaxValue().toString());
|
||||
}
|
||||
assess.setUDevData(NumberUtil.round(val2.getVal(), 2).doubleValue());
|
||||
}
|
||||
}
|
||||
//负序电流
|
||||
if (CollUtil.isNotEmpty(iNeg)) {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect = iNeg.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
|
||||
.collect(Collectors.toList());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = collect.get(0);
|
||||
assess.setINegData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//电压总谐波
|
||||
if (CollUtil.isNotEmpty(uaberrance)) {
|
||||
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
|
||||
assess.setUaberranceData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//三相不平衡度
|
||||
if (CollUtil.isNotEmpty(ubalance)) {
|
||||
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VUnbalance.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(ubalance, dto);
|
||||
assess.setUnbalanceData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//闪变
|
||||
List<PqReasonableRangeDto> dataPlt = map.get(DataCleanEnum.DataPlt.getCode());
|
||||
Map<String, PqReasonableRangeDto> dataPltCode = dataPlt.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
||||
if (CollUtil.isNotEmpty(flicker)) {
|
||||
PqReasonableRangeDto dto = dataPltCode.get(DataCleanEnum.Plt.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(flicker, dto);
|
||||
assess.setFlickerData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//谐波电压
|
||||
List<PqReasonableRangeDto> dataHarmRate = map.get(DataCleanEnum.DataHarmRateV.getCode());
|
||||
Map<String, PqReasonableRangeDto> dataHarmRateCode = dataHarmRate.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
||||
if (CollUtil.isNotEmpty(uharm)) {
|
||||
PqReasonableRangeDto dto = dataHarmRateCode.get(DataCleanEnum.V_Rate.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uharm, dto);
|
||||
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
String[] split = val.getTargetName().split("次");
|
||||
try {
|
||||
Class<?> clazz = overLimitDataById.getClass();
|
||||
String methodName = "getUharm" + split[0];
|
||||
Method method = clazz.getMethod(methodName);
|
||||
Float value = (Float) method.invoke(overLimitDataById);
|
||||
assess.setUharmLimit(value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
if(CollUtil.isNotEmpty(uaberrance)){
|
||||
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
|
||||
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
}
|
||||
//谐波电流
|
||||
if (CollUtil.isNotEmpty(iharm)) {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect = iharm.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
|
||||
.collect(Collectors.toList());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = collect.get(0);
|
||||
assess.setIharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
String[] split = val.getTargetName().split("次");
|
||||
try {
|
||||
Class<?> clazz = overLimitDataById.getClass();
|
||||
String methodName = "getIharm" + split[0];
|
||||
Method method = clazz.getMethod(methodName);
|
||||
Float value = (Float) method.invoke(overLimitDataById);
|
||||
assess.setIharmLimit(value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
//间谐波电压
|
||||
List<PqReasonableRangeDto> dataInHarm = map.get(DataCleanEnum.DataInHarmV.getCode());
|
||||
Map<String, PqReasonableRangeDto> dataInHarmCode = dataInHarm.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
||||
if (CollUtil.isNotEmpty(inuharm)) {
|
||||
PqReasonableRangeDto dto = dataInHarmCode.get(DataCleanEnum.V_InHarm.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(inuharm, dto);
|
||||
assess.setInuharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
String[] split = val.getTargetName().split("次");
|
||||
try {
|
||||
Class<?> clazz = overLimitDataById.getClass();
|
||||
String methodName = "getInuharm" + (int)(Double.valueOf(split[0])+0.5);
|
||||
Method method = clazz.getMethod(methodName);
|
||||
Float value = (Float) method.invoke(overLimitDataById);
|
||||
assess.setInuharmLimit(value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return assess;
|
||||
}
|
||||
|
||||
private DetailAbnormalVO.DetailLimitInnerVO reasonAble(List<DetailAbnormalVO.DetailLimitInnerVO> limit, PqReasonableRangeDto dto) {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect = limit.stream()
|
||||
.filter(x -> dto.getMinValue() < Double.valueOf(x.getVal()) && Double.valueOf(x.getVal()) < dto.getMaxValue())
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed()).collect(Collectors.toList());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val;
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
val = collect.get(0);
|
||||
} else {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = limit.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
|
||||
.collect(Collectors.toList());
|
||||
val = collect2.get(0);
|
||||
val.setVal(dto.getMaxValue().toString());
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
private Map<String, DictData> getTargetMap() {
|
||||
@@ -463,6 +583,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.HARMONIC_CURRENT.getCode(), "iharm", 2, 25, result);
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.INTERHARMONIC_VOLTAGE.getCode(), "inuharm", 1, 16, result);
|
||||
}
|
||||
|
||||
private void processStandardTarget(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
|
||||
String targetCode, String data,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
@@ -482,6 +603,13 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
processSpecialTargets(tempList, result, targetName);
|
||||
}
|
||||
|
||||
private void processHarmonicTargetHarm(DataLimitRateDetailDto dto, String targetCode, String prefix, int start, int end,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
List<String> tempList = new ArrayList<>();
|
||||
collectHarmonicData(dto, prefix, start, end, tempList);
|
||||
processSpecialTargets(tempList, result, targetCode);
|
||||
}
|
||||
|
||||
private void processSpecialTargets(List<String> specialTargetList, List<DetailAbnormalVO.DetailLimitInnerVO> result, String targetName) {
|
||||
for (String strJson : specialTargetList) {
|
||||
String[] temStr = strJson.split(SEPARATOR);
|
||||
@@ -559,13 +687,15 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "uharm" + i + "Overtime";
|
||||
String iHarmKey = "iharm" + i + "Overtime";
|
||||
String inuHarmKey = "inuharm" + i + "Overtime";
|
||||
if (getFieldValue(it, uHarmKey) != null && getFieldValue(it, uHarmKey) == 1) {
|
||||
HARMONIC_VOLTAGE.add(it.getLineId());
|
||||
}
|
||||
if (getFieldValue(it, iHarmKey) != null && getFieldValue(it, iHarmKey) == 1) {
|
||||
HARMONIC_CURRENT.add(it.getLineId());
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String inuHarmKey = "inuharm" + i + "Overtime";
|
||||
if (getFieldValue(it, inuHarmKey) != null && getFieldValue(it, inuHarmKey) == 1) {
|
||||
INTERHARMONIC_VOLTAGE.add(it.getLineId());
|
||||
}
|
||||
@@ -599,7 +729,12 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
String fieldName = prefix + i + "Overtime";
|
||||
String json = getFieldValueForDetail(dto, fieldName);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
result.add(json + SEPARATOR + i);
|
||||
if (end == 16) {
|
||||
result.add(json + SEPARATOR + (i - 0.5));
|
||||
} else {
|
||||
result.add(json + SEPARATOR + i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -758,7 +893,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<LocalDate> dateList = list.stream().map(it -> it.getTime().toLocalDate()).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -770,7 +905,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<LocalDate> dateList = list.stream().map(DataLimitTargetDto::getTime).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -797,34 +932,44 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
}
|
||||
}
|
||||
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
result.forEach(it -> {
|
||||
if (areaMap.containsKey(it.getMonitorId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
|
||||
it.setMonitorName(areaLineInfoVO.getLineName());
|
||||
it.setStationName(areaLineInfoVO.getSubName());
|
||||
it.setDevName(areaLineInfoVO.getDeviceName());
|
||||
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
|
||||
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
|
||||
it.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
}
|
||||
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
|
||||
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
|
||||
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
|
||||
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
|
||||
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
|
||||
if (areaMap.containsKey(lineDetail.getLineId())) {
|
||||
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
|
||||
it.setMonitorName(lineDetail.getLineName());
|
||||
it.setStationName(lineDetail.getSubName());
|
||||
if (deptName.containsKey(lineDetail.getLineId())) {
|
||||
it.setCity(deptName.get(lineDetail.getLineId()));
|
||||
}
|
||||
it.setDevName(lineDetail.getDeviceName());
|
||||
it.setVoltageLevel(lineDetail.getVoltageScale());
|
||||
it.setIp(Base64.encode(lineDetail.getIp()));
|
||||
it.setManufacturer(lineDetail.getManufacturer());
|
||||
it.setObjType(lineDetail.getLoadType());
|
||||
it.setObjName(lineDetail.getObjName());
|
||||
info.add(it);
|
||||
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
// }
|
||||
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
result.clear();
|
||||
result.addAll(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -350,8 +350,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
Map<String, String> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
|
||||
List<DeviceRunEvaluateVO.Detail> info = new ArrayList<>();
|
||||
List<Integer> devRun=ObjectUtil.isNull(param.getLineRunFlag()) ? null : Arrays.asList(param.getLineRunFlag());
|
||||
param.setLineRunFlag(null);
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, ObjectUtil.isNull(param.getLineRunFlag()) ? null : Arrays.asList(param.getLineRunFlag()), Arrays.asList(1));
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, devRun, Arrays.asList(1));
|
||||
if (CollUtil.isNotEmpty(deviceInfo)) {
|
||||
List<String> deviceIds = deviceInfo.stream()
|
||||
.flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList())
|
||||
@@ -382,8 +384,6 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
onlineRateParam.setIds(lineIds);
|
||||
List<PqDataVerifyCount> sumVerify = pqDataVerifyCountService.getSumVerify(onlineRateParam);
|
||||
|
||||
//超标率
|
||||
// List<RStatLimitRateDPO> limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData();
|
||||
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
detail = new DeviceRunEvaluateVO.Detail();
|
||||
@@ -391,7 +391,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
detail.setCount(dto.getDeviceIndexes().size());
|
||||
detail.setOnline(onLineRate(onlineRateByDev, dto.getDeviceIndexes()));
|
||||
detail.setIntegrity(integrity(integrityList, dto.getLineIndexes()));
|
||||
detail.setQualified(verify(sumVerify, dto.getLineIndexes()));
|
||||
detail.setQualified(verifyDev(sumVerify, dto.getLineIndexes(), dto.getDeviceIndexes()));
|
||||
detail.setScore(ONINTEGRITY.multiply(detail.getIntegrity())
|
||||
.add(ONLINERATE.multiply(detail.getOnline())
|
||||
.add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP));
|
||||
@@ -434,18 +434,33 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
return info;
|
||||
}
|
||||
|
||||
private BigDecimal verifyDev(List<PqDataVerifyCount> sumVerify, List<String> lineIds, List<String> devIds) {
|
||||
//异常率
|
||||
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<String> verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(verifyLine)) {
|
||||
List<String> devIdsLine = lineMapper.getDevIdsLine(verifyLine);
|
||||
if (CollUtil.isNotEmpty(devIdsLine)) {
|
||||
return NumberUtil.round(Math.min(devIdsLine.size() * 100.0 / devIds.size(), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BigDecimal verify(List<PqDataVerifyCount> sumVerify, List<String> lineIds) {
|
||||
//异常率
|
||||
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(verifyList)) {
|
||||
double total = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotal).sum();
|
||||
double totalAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotalAll).sum();
|
||||
double flicker = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlicker).sum();
|
||||
double flickerAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlickerAll).sum();
|
||||
if (totalAll + flickerAll == 0) {
|
||||
if (totalAll == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min((total + flicker) * 100 / (totalAll + flickerAll), 100), 2);
|
||||
return NumberUtil.round(Math.min(total * 100.0 / totalAll, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
@@ -460,7 +475,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (dueTime == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(realTime * 100 / dueTime, 100), 2);
|
||||
return NumberUtil.round(Math.min(realTime * 100.0 / dueTime, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
@@ -472,7 +487,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
|
||||
if (offlineTime == 0) {
|
||||
if ((onlineTime + offlineTime) == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
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.common.mapper.onlinerate.OnLineRateMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
@@ -26,6 +27,7 @@ import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramProVO;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
|
||||
import com.njcn.device.pq.service.*;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -66,6 +68,7 @@ public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
private final LineService lineService;
|
||||
private final DeptLineService deptLineService;
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
private final OnLineRateMapper onLineRateMapper;
|
||||
|
||||
@Override
|
||||
public GridDiagramVO getGridDiagramMonitor(GridDiagramParam param) {
|
||||
@@ -472,13 +475,16 @@ public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
GridDiagramProVO.Details details = new GridDiagramProVO.Details();
|
||||
Stream<LineDetail> stream = lines.stream();
|
||||
Stream<LineDetail> stream2 = lines.stream();
|
||||
Stream<LineDetail> stream3 = lines.stream();
|
||||
if (gwType != null) {
|
||||
stream = stream.filter(x -> x.getMonitorFlag() == gwType);
|
||||
stream2 = stream2.filter(x -> x.getMonitorFlag() == gwType);
|
||||
stream3 = stream3.filter(x -> x.getMonitorFlag() == gwType);
|
||||
}
|
||||
if (powerFlag != null) {
|
||||
stream = stream.filter(x -> x.getPowerFlag() == powerFlag);
|
||||
stream2 = stream2.filter(x -> x.getPowerFlag() == powerFlag);
|
||||
stream3 = stream3.filter(x -> x.getPowerFlag() == powerFlag);
|
||||
}
|
||||
//总监测点
|
||||
List<String> ids = stream.map(LineDetail::getId).collect(Collectors.toList());
|
||||
@@ -496,6 +502,23 @@ public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
} else {
|
||||
details.setIntegrityRate(0.0f);
|
||||
}
|
||||
|
||||
List<String> devIds = stream3.map(LineDetail::getMonitorName).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
OnlineRateParam onlineRateParam = new OnlineRateParam();
|
||||
onlineRateParam.setIds(devIds);
|
||||
onlineRateParam.setStartTime(baseQueryParam.getStartTime());
|
||||
onlineRateParam.setEndTime(baseQueryParam.getEndTime());
|
||||
//获取所有终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
|
||||
if(CollUtil.isNotEmpty(onlineRateByDev)){
|
||||
details.setOnLineRate(onlineRateByDev.get(0).getOnlineRate().floatValue());
|
||||
}else{
|
||||
details.setOnLineRate(0.0f);
|
||||
}
|
||||
} else {
|
||||
details.setOnLineRate(0.0f);
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,13 +173,17 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
}
|
||||
|
||||
// 数据封装
|
||||
Double temValue = lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
|
||||
// 汇总所有监测点的实际时间和期望时间,重新计算完整性
|
||||
int totalRealTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
|
||||
int totalDueTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
|
||||
lineIntegrityDataVO.setRealTime(totalRealTime);
|
||||
lineIntegrityDataVO.setDueTime(totalDueTime);
|
||||
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
|
||||
LineIntegrityDataVO temp = lineList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
|
||||
lineIntegrityDataVO.setAlgoDescribe(temp.getAlgoDescribe());
|
||||
lineIntegrityDataVO.setId(generalDeviceDTO.getIndex());
|
||||
lineIntegrityDataVO.setName(generalDeviceDTO.getName());
|
||||
lineIntegrityDataVO.setLevel(0);
|
||||
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
|
||||
pro.add(lineIntegrityDataVO);
|
||||
|
||||
}
|
||||
@@ -193,12 +197,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
|
||||
|
||||
private void dealDataJinDu(List<LineIntegrityDataVO> mList,LineIntegrityDataVO children){
|
||||
double temValue = mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
|
||||
if(temValue!=3.14159){
|
||||
children.setIntegrityData(new BigDecimal(temValue).setScale(2,RoundingMode.HALF_UP).doubleValue());
|
||||
}else {
|
||||
children.setIntegrityData(temValue);
|
||||
}
|
||||
// 汇总子节点的实际时间和期望时间,重新计算完整性
|
||||
int totalRealTime = (int) mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
|
||||
int totalDueTime = (int) mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
|
||||
children.setRealTime(totalRealTime);
|
||||
children.setDueTime(totalDueTime);
|
||||
children.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
|
||||
}
|
||||
|
||||
private void dealMonitorData(List<LineIntegrityDataVO> lineList,List<LineDataIntegrity> percentageOfCompleteDatas,Map<String, Integer> mapA){
|
||||
@@ -209,10 +213,13 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if(dataIntegrityMap.containsKey(monitor.getId())){
|
||||
flag = true;
|
||||
LineDataIntegrity integrity = dataIntegrityMap.get(monitor.getId());
|
||||
monitor.setIntegrityData(DataStatisticsUtil.dataLimits(integrity.getIntegrityData()));
|
||||
monitor.setRealTime(integrity.getReal() == null ? 0 : integrity.getReal().intValue());
|
||||
monitor.setDueTime(integrity.getDue() == null ? 0 : integrity.getDue().intValue());
|
||||
Double integrityData = DataStatisticsUtil.calculateIntegrityRate(monitor.getRealTime(), monitor.getDueTime());
|
||||
monitor.setIntegrityData(integrityData);
|
||||
if (StrUtil.isNotBlank(monitor.getLineGrade())) {
|
||||
if (mapA.containsKey(monitor.getLineGrade())) {
|
||||
if (integrity.getIntegrityData() > mapA.get(monitor.getLineGrade())) {
|
||||
if (integrityData != 3.14159 && integrityData > mapA.get(monitor.getLineGrade())) {
|
||||
monitor.setValueOver(1);
|
||||
} else {
|
||||
monitor.setValueOver(0);
|
||||
@@ -228,6 +235,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if (!flag) {
|
||||
//表示未匹配到数据完整性
|
||||
monitor.setIntegrityData(3.14159);
|
||||
monitor.setRealTime(0);
|
||||
monitor.setDueTime(0);
|
||||
monitor.setValueOver(0);
|
||||
}
|
||||
}
|
||||
@@ -248,13 +257,19 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
outParam.setType(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
//根据监测点查询数据完整性
|
||||
List<PublicDTO> integrityData = getCondition(lineIndexes, integrityIconParam.getSearchBeginTime(), integrityIconParam.getSearchEndTime());
|
||||
double v = integrityData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159);
|
||||
outParam.setSingle(v!=3.14159?NumberUtil.round(v,2).doubleValue():v);
|
||||
// 汇总所有监测点的实际时间和期望时间,再计算总完整性
|
||||
int totalRealTime = (int) integrityData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
|
||||
int totalDueTime = (int) integrityData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
|
||||
double v = DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime);
|
||||
outParam.setSingle(v);
|
||||
//如果存在需要比较的时间,再获取对应数据
|
||||
if (StrUtil.isNotBlank(integrityIconParam.getPeriodBeginTime()) && StrUtil.isNotBlank(integrityIconParam.getPeriodEndTime())) {
|
||||
List<PublicDTO> compareData = getCondition(lineIndexes, integrityIconParam.getPeriodBeginTime(), integrityIconParam.getPeriodEndTime());
|
||||
double v1 = compareData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159);
|
||||
outParam.setRatio(v1!=3.14159?NumberUtil.round(v1,2).doubleValue():v1);
|
||||
// 汇总所有监测点的实际时间和期望时间,再计算总完整性
|
||||
int compareRealTime = (int) compareData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
|
||||
int compareDueTime = (int) compareData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
|
||||
double v1 = DataStatisticsUtil.calculateIntegrityRate(compareRealTime, compareDueTime);
|
||||
outParam.setRatio(v1);
|
||||
}
|
||||
out.add(outParam);
|
||||
}
|
||||
@@ -320,12 +335,14 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
for (LineDataIntegrity lineData : percentageOfCompleteDatas) {
|
||||
if (lineDataIntegrity.getId().equals(lineData.getLineId())) {
|
||||
flag = true;
|
||||
Double temValue = lineData.getIntegrityData();
|
||||
lineDataIntegrity.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
|
||||
lineDataIntegrity.setRealTime(lineData.getReal() == null ? 0 : lineData.getReal().intValue());
|
||||
lineDataIntegrity.setDueTime(lineData.getDue() == null ? 0 : lineData.getDue().intValue());
|
||||
Double temValue = DataStatisticsUtil.calculateIntegrityRate(lineDataIntegrity.getRealTime(), lineDataIntegrity.getDueTime());
|
||||
lineDataIntegrity.setIntegrityData(temValue);
|
||||
//根据等级判断是否越限
|
||||
if (StrUtil.isNotBlank(lineDataIntegrity.getLineGrade())) {
|
||||
if (mapA.containsKey(lineDataIntegrity.getLineGrade())) {
|
||||
if (temValue > mapA.get(lineDataIntegrity.getLineGrade())) {
|
||||
if (temValue != 3.14159 && temValue > mapA.get(lineDataIntegrity.getLineGrade())) {
|
||||
lineDataIntegrity.setValueOver(1);
|
||||
} else {
|
||||
lineDataIntegrity.setValueOver(0);
|
||||
@@ -343,6 +360,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if (!flag) {
|
||||
//表示未匹配到数据完整性
|
||||
lineDataIntegrity.setIntegrityData(3.14159);
|
||||
lineDataIntegrity.setRealTime(0);
|
||||
lineDataIntegrity.setDueTime(0);
|
||||
lineDataIntegrity.setValueOver(0);
|
||||
}
|
||||
}
|
||||
@@ -352,13 +371,17 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
lineIntegrityDataVO.setChildren(subList);
|
||||
|
||||
// 数据封装
|
||||
Double temValue = lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
|
||||
// 汇总所有监测点的实际时间和期望时间,重新计算完整性
|
||||
int totalRealTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
|
||||
int totalDueTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
|
||||
lineIntegrityDataVO.setRealTime(totalRealTime);
|
||||
lineIntegrityDataVO.setDueTime(totalDueTime);
|
||||
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
|
||||
LineIntegrityDataVO temp = lineList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
|
||||
lineIntegrityDataVO.setAlgoDescribe(temp.getAlgoDescribe());
|
||||
lineIntegrityDataVO.setId(generalDeviceDTO.getIndex());
|
||||
lineIntegrityDataVO.setName(generalDeviceDTO.getName());
|
||||
lineIntegrityDataVO.setLevel(0);
|
||||
lineIntegrityDataVO.setIntegrityData(Math.min(DataStatisticsUtil.dataLimits(temValue),100.0));
|
||||
pro.add(lineIntegrityDataVO);
|
||||
|
||||
}
|
||||
@@ -397,9 +420,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
for (String pid : pids) {
|
||||
if (lineAdministrationTree.getId().equals(pid)) {
|
||||
List<LineIntegrityDataVO> lineIntegrityDataVOList = groupLine.get(pid);
|
||||
//父级完整性匹配
|
||||
Double temValue = lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
|
||||
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
|
||||
//父级完整性匹配 - 汇总子节点的实际时间和期望时间,重新计算完整性
|
||||
int totalRealTime = (int) lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
|
||||
int totalDueTime = (int) lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
|
||||
lineAdministrationTree.setRealTime(totalRealTime);
|
||||
lineAdministrationTree.setDueTime(totalDueTime);
|
||||
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
|
||||
LineIntegrityDataVO temp = lineIntegrityDataVOList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
|
||||
lineAdministrationTree.setAlgoDescribe(temp.getAlgoDescribe());
|
||||
}
|
||||
@@ -418,10 +444,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
if (!CollectionUtils.isEmpty(data)) {
|
||||
data.forEach(po -> {
|
||||
PublicDTO publicDTO = new PublicDTO();
|
||||
//数据完整性 保留四位小数
|
||||
Double integrity = po.getIntegrityRate() == null ? 3.14159 : BigDecimal.valueOf(Double.parseDouble(po.getIntegrityRate().toString())).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
publicDTO.setId(po.getLineIndex());
|
||||
publicDTO.setData((integrity > 100.00) ? 100.00 : integrity);
|
||||
publicDTO.setOnlineMin(po.getRealTime() == null ? 0 : po.getRealTime().intValue());
|
||||
publicDTO.setOfflineMin(po.getDueTime() == null ? 0 : po.getDueTime().intValue());
|
||||
// 计算数据完整性
|
||||
Double integrity = DataStatisticsUtil.calculateIntegrityRate(publicDTO.getOnlineMin(), publicDTO.getOfflineMin());
|
||||
publicDTO.setData(integrity);
|
||||
integrityList.add(publicDTO);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
@@ -18,10 +19,12 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
@@ -33,10 +36,7 @@ import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -65,38 +65,34 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
private static final String SEPARATOR = "-";
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
|
||||
if (CollUtil.isNotEmpty(monitorIds)) {
|
||||
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
||||
verifyMonitorVO.setRunNum(monitorIds.size());
|
||||
verifyMonitorVO.setAbnormalNum(dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId)).size());
|
||||
List<PqDataVerifyBak> dataSumVerifyList = baseDataSumVerifyQuery(monitorIds, monitorBaseParam);
|
||||
// List<PqDataVerifyBak> dataSumVerifyList = baseDataSumVerifyQuery(monitorIds, monitorBaseParam);
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, dataVerifyList));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataSumVerifyList));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList,monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(dataVerifyList, monitorBaseParam));
|
||||
} else {
|
||||
verifyMonitorVO.setRunNum(0);
|
||||
verifyMonitorVO.setAbnormalNum(0);
|
||||
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, new ArrayList<>()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>(),monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam));
|
||||
}
|
||||
|
||||
@@ -111,7 +107,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
List<LocalDate> dateList = list.stream().map(PqDataVerifyBak::getTimeId).sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -137,34 +133,44 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
}
|
||||
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
result.forEach(it -> {
|
||||
if (areaMap.containsKey(it.getMonitorId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
|
||||
it.setMonitorName(areaLineInfoVO.getLineName());
|
||||
it.setStationName(areaLineInfoVO.getSubName());
|
||||
it.setDevName(areaLineInfoVO.getDeviceName());
|
||||
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
|
||||
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
|
||||
it.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
}
|
||||
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
|
||||
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
|
||||
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
|
||||
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
|
||||
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
|
||||
if (areaMap.containsKey(lineDetail.getLineId())) {
|
||||
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
|
||||
it.setMonitorName(lineDetail.getLineName());
|
||||
it.setStationName(lineDetail.getSubName());
|
||||
it.setDevName(lineDetail.getDeviceName());
|
||||
if(deptName.containsKey(lineDetail.getLineId())){
|
||||
it.setCity(deptName.get(lineDetail.getLineId()));
|
||||
}
|
||||
it.setVoltageLevel(lineDetail.getVoltageScale());
|
||||
it.setIp(Base64.encode(lineDetail.getIp()));
|
||||
it.setManufacturer(lineDetail.getManufacturer());
|
||||
it.setObjType(lineDetail.getLoadType());
|
||||
it.setObjName(lineDetail.getObjName());
|
||||
info.add(it);
|
||||
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
// }
|
||||
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
result.clear();
|
||||
result.addAll(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +183,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam) {
|
||||
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
List<DetailAbnormalVO> result = new ArrayList<>();
|
||||
//参数校验
|
||||
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
|
||||
@@ -199,67 +208,73 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
switch (monitorBaseParam.getTargetKey()) {
|
||||
case Param.freq:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getFreq, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.freq_dev:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getFreqDev, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.rms_v:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVRms, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.rms_lvr:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getRmsLvr, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.vu_dev:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVuDev, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.vl_dev:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVlDev, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.rms_i:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getIRms, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_thd:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVThd, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_1_v:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getV, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.phasic_v_1:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getV1Phasic, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.phasic_rate_x:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVPhasic, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_rate:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVHarm, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.in_v_rate:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVInharm, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_zero:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVZero, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_neg:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVNeg, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_pos:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVPos, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.v_unbalance:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getVUnbalance, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.fluc:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getFluc, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.pst:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getPst, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.plt:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getPlt, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.pf:
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getPf, 1);
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.Voltage_Dip:
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
case Param.Voltage_Rise:
|
||||
lambdaQueryWrapper.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount());
|
||||
break;
|
||||
default:
|
||||
log.error("方法{}未匹配到异常数据指标", "monitorAbnormalTable");
|
||||
@@ -267,97 +282,37 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
}
|
||||
List<PqDataVerifyBak> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
for (PqDataVerifyBak pqDataVerifyBak : dataVerifyList) {
|
||||
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(pqDataVerifyBak.getLineId());
|
||||
Map<String, List<PqDataVerifyBak>> VerifyMap = dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId));
|
||||
VerifyMap.forEach((key, value) -> {
|
||||
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(key);
|
||||
String temBgName = "";
|
||||
if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())) {
|
||||
temBgName = lineDevGetDTO.getBdName();
|
||||
} else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) {
|
||||
temBgName = lineDevGetDTO.getObjName();
|
||||
}
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
String[] errorTimeCount = {"0"};
|
||||
Long[] errAllCount = {0L};
|
||||
jsonArray.forEach(it -> {
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
JSONArray innerJson = targetJson.getJSONArray(monitorBaseParam.getTargetKey());
|
||||
PqReasonableRangeDto dto = rangeMap.get(monitorBaseParam.getTargetKey());
|
||||
if (Objects.nonNull(dto.getHarmStart()) && Objects.nonNull(dto.getHarmEnd())) {
|
||||
errorTimeCount[0] = targetJson.get("errorTimes").toString();
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
errorTimeCount[0] = jsonObjectTem.get("errorTimes").toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rangeMap.forEach((rangeKey, val) -> {
|
||||
if (targetJson.containsKey(rangeKey)) {
|
||||
JSONArray innerJson = targetJson.getJSONArray(rangeKey);
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
errorTimeCount[0] = targetJson.get("lineErrorTimes").toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setTimeSum(errorTimeCount[0]);
|
||||
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
detailAbnormalVO.setErrCount(errAllCount[0].toString());
|
||||
result.add(detailAbnormalVO);
|
||||
} catch (BusinessException b) {
|
||||
//文件为空时候的特殊处理
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setTimeSum("/");
|
||||
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常");
|
||||
List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
|
||||
DetailAbnormalVO.TimeAndTargetKey targetKey;
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
for (PqDataVerifyBak pqDataVerifyBak : value) {
|
||||
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
|
||||
targetKey.setDate(pqDataVerifyBak.getTimeId().format(DatePattern.NORM_DATE_FORMATTER));
|
||||
targetKey.setTargetKeys(getAbnormalTarget(Arrays.asList(pqDataVerifyBak),monitorBaseParam.getErrorTimeCount()).stream().filter(x->x.getIds().size()>0).collect(Collectors.toList()));
|
||||
targetKeyList.add(targetKey);
|
||||
}
|
||||
}
|
||||
detailAbnormalVO.setDateTargetList(targetKeyList);
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
public DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (!dtoMap.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
@@ -366,44 +321,50 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<PqDataVerifyBak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(PqDataVerifyBak::getTimeId);
|
||||
lambdaQueryWrapper.in(PqDataVerifyBak::getTimeId, monitorBaseParam.getTime())
|
||||
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds());
|
||||
|
||||
List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper);
|
||||
//index[0] 总异常时间 index[1]指标异常时间
|
||||
Integer[] errorTimeCount = {0, 0};
|
||||
Integer[] errAllCount = {0};
|
||||
for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) {
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
jsonArray.forEach(it->{
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
errorTimeCount[0] += Integer.valueOf(targetJson.get("lineErrorTimes").toString());
|
||||
}else{
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
|
||||
}
|
||||
} else {
|
||||
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (targetJson.containsKey(key)) {
|
||||
resultDeal(dtoMap, key, targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
|
||||
}
|
||||
}
|
||||
|
||||
PqDataVerifyBak pqDataVerifyBak = this.getOne(lambdaQueryWrapper);
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
for (Object it : jsonArray) {
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
String tarKey = "";
|
||||
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (targetJson.containsKey(key)) {
|
||||
tarKey = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
resultDeal(dtoMap, tarKey, targetJson, result);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常" + e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常");
|
||||
}
|
||||
// 排序实现
|
||||
result = result.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime)
|
||||
DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO();
|
||||
info.setTimeSum(StrUtil.isBlank(monitorBaseParam.getTargetKey()) ? errorTimeCount[0] : errorTimeCount[1]);
|
||||
info.setErrCount(errAllCount[0]);
|
||||
info.setTime(result.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName)
|
||||
.thenComparing(vo -> extractHarmonicOrder(vo.getTargetName()))
|
||||
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName))
|
||||
.collect(Collectors.toList());
|
||||
return result;
|
||||
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime))
|
||||
.collect(Collectors.toList()));
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,12 +392,14 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
* 处理json对象中list数组
|
||||
*/
|
||||
|
||||
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result) {
|
||||
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result, String date, Integer[] errorTimeCount, Integer[] errorCounts) {
|
||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey);
|
||||
JSONArray innerJson = targetJson.getJSONArray(targetKey);
|
||||
innerJson.forEach(oo -> {
|
||||
JSONObject jsonObjectTem = (JSONObject) oo;
|
||||
String targetName = jsonObjectTem.get("targetName").toString();
|
||||
errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString());
|
||||
errorTimeCount[1] += Integer.valueOf(jsonObjectTem.get("errorTimes").toString());
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>();
|
||||
list.forEach(listItem -> {
|
||||
@@ -447,7 +410,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
String valueType = object.get("valueType").toString();
|
||||
for (int i = 0; i < timeArr.size(); i++) {
|
||||
DetailAbnormalVO.DetailLimitInnerVO temData = new DetailAbnormalVO.DetailLimitInnerVO();
|
||||
temData.setTime(timeArr.get(i).toString());
|
||||
temData.setTime(date + " " + timeArr.get(i).toString());
|
||||
temData.setVal(valueArr.get(i).toString());
|
||||
temData.setTargetName(targetName);
|
||||
temData.setTargetKey(targetKey);
|
||||
@@ -475,11 +438,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
vo.setTargetKey(targetKey);
|
||||
vo.setPhaseType(phaseKey);
|
||||
|
||||
if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
} else {
|
||||
// if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
// vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
}
|
||||
// }
|
||||
valueList.forEach(ites -> {
|
||||
switch (ites.getType()) {
|
||||
case "AVG":
|
||||
@@ -493,6 +456,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
break;
|
||||
case "CP95":
|
||||
vo.setCp95(ites.getVal());
|
||||
break;
|
||||
case "Feature_Amplitude":
|
||||
vo.setFeatureAmplitude(ites.getVal());
|
||||
break;
|
||||
@@ -511,6 +475,52 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
lambdaQueryWrapper.between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorIds)
|
||||
.eq(PqDataVerifyBak::getState, 1)
|
||||
.and(x -> x.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount())
|
||||
)
|
||||
.orderByAsc(PqDataVerifyBak::getTimeId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
@@ -524,6 +534,52 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
.lambda().between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorIds)
|
||||
.eq(PqDataVerifyBak::getState, 1)
|
||||
.and(x -> x.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount())
|
||||
.or()
|
||||
.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount())
|
||||
)
|
||||
.groupBy(PqDataVerifyBak::getLineId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
@@ -564,102 +620,102 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
/**
|
||||
* 指标异常测点数量
|
||||
*/
|
||||
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList) {
|
||||
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList,Integer errorTimeCount) {
|
||||
List<VerifyTargetVO> result = new ArrayList<>();
|
||||
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
|
||||
rangeMap.forEach((key, dto) -> {
|
||||
Set<String> ids;
|
||||
switch (key) {
|
||||
case Param.freq:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getFreq() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqTime())).filter(it -> it.getFreqTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.freq_dev:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getFreqDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqDevTime())).filter(it -> it.getFreqDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_v:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVRms() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVRmsTime())).filter(it -> it.getVRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_lvr:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getRmsLvr() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRmsLvrTime())).filter(it -> it.getRmsLvrTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.vu_dev:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVuDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVuDevTime())).filter(it -> it.getVuDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.vl_dev:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVlDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVlDevTime())).filter(it -> it.getVlDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_i:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getIRms() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getIRmsTime())).filter(it -> it.getIRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_thd:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVThd() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVThdTime())).filter(it -> it.getVThdTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_1_v:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getV() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVTime())).filter(it -> it.getVTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.phasic_v_1:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getV1Phasic() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getV1PhasicTime())).filter(it -> it.getV1PhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.phasic_rate_x:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVPhasic() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPhasicTime())).filter(it -> it.getVPhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_rate:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVHarm() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVHarmTime())).filter(it -> it.getVHarmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.in_v_rate:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVInharm() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVInharmTime())).filter(it -> it.getVInharmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_zero:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVZero() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVZeroTime())).filter(it -> it.getVZeroTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_neg:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVNeg() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVNegTime())).filter(it -> it.getVNegTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_pos:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVPos() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPosTime())).filter(it -> it.getVPosTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_unbalance:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getVUnbalance() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVUnbalanceTime())).filter(it -> it.getVUnbalanceTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.fluc:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getFluc() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFlucTime())).filter(it -> it.getFlucTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.pst:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getPst() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPstTime())).filter(it -> it.getPstTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.plt:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getPlt() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPltTime())).filter(it -> it.getPltTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.pf:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getPf() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPfTime())).filter(it -> it.getPfTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Dip:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getDip() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getDipTime())).filter(it -> it.getDipTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Rise:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getRise() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRiseTime())).filter(it -> it.getRiseTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
default:
|
||||
@@ -685,12 +741,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
if (StrUtil.isNotBlank(dto.getUnit())) {
|
||||
unit = dto.getUnit();
|
||||
}
|
||||
if (temStr.equals(Param.rms_i)) {
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
|
||||
} else {
|
||||
// if (temStr.equals(Param.rms_i)) {
|
||||
// verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
|
||||
}
|
||||
|
||||
// }
|
||||
result.add(verifyTargetVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyCountMapper;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyCount;
|
||||
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyCountService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -31,4 +33,9 @@ public class PqDataVerifyCountServiceImpl extends ServiceImpl<PqDataVerifyCountM
|
||||
public List<PqDataVerifyCount> getSumVerify(OnlineRateParam param) {
|
||||
return this.baseMapper.selectSumVerify(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OnlineMonitorVo> getAnomalousData(LineBaseQueryParam par) {
|
||||
return this.baseMapper.getAnomalousData(par.getLineIds(),par.getStartTime(),par.getEndTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
|
||||
|
||||
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, lineIds.size()) : lineIds.size());
|
||||
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
||||
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, lineIds).doubleValue()>100.0?BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
||||
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
|
||||
DeviceOnlineRate.CitDetail citDetail;
|
||||
DeviceOnlineRate.LineDetail detail;
|
||||
@@ -169,7 +169,7 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
citDetail.setCitName(dto.getName());
|
||||
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
||||
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
|
||||
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
||||
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()).doubleValue()>100.0?BigDecimal.valueOf(100.0):calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
||||
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
||||
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||
for (LineDetailVO.Detail line : lineDetail) {
|
||||
@@ -185,7 +185,7 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
detail.setLineId(line.getLineId());
|
||||
detail.setLineName(line.getLineName());
|
||||
detail.setLatestTime(line.getTimeID());
|
||||
detail.setIntegrity(onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)));
|
||||
detail.setIntegrity(onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)).doubleValue()>100.0?BigDecimal.valueOf(100.0):onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)));
|
||||
detailList.add(detail);
|
||||
}
|
||||
citDetail.setDetailList(detailList);
|
||||
|
||||
@@ -75,11 +75,16 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
@Override
|
||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||
List<RunManageVO> resultList = new ArrayList<>();
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
deviceInfoParam.setServerName("pqs-common");
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0,1,2).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<String> lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> lineIndexes ;
|
||||
if(CollUtil.isNotEmpty(runManageParam.getIds())){
|
||||
lineIndexes =runManageParam.getIds();
|
||||
}else{
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
deviceInfoParam.setServerName("pqs-common");
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
if(CollUtil.isNotEmpty(resultList)){
|
||||
|
||||
@@ -182,11 +182,17 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getLineIndexes().size()+")");
|
||||
//根据终端索引集查询在线率
|
||||
List<PublicDTO> onlineRateList = getCondition(deviceIndexes, onlineRateCensusParam.getSearchBeginTime(), onlineRateCensusParam.getSearchEndTime());
|
||||
single.add(onlineRateList.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159));
|
||||
// 汇总所有设备的在线分钟和离线分钟,再计算总在线率
|
||||
int totalOnlineMin = (int) onlineRateList.stream().mapToLong(PublicDTO::getOnlineMin).sum();
|
||||
int totalOfflineMin = (int) onlineRateList.stream().mapToLong(PublicDTO::getOfflineMin).sum();
|
||||
single.add(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
|
||||
//如果存在需要比较的时间,再获取对应数据
|
||||
if(StrUtil.isNotBlank(onlineRateCensusParam.getPeriodBeginTime()) && StrUtil.isNotBlank(onlineRateCensusParam.getPeriodEndTime())){
|
||||
List<PublicDTO> compareData = getCondition(deviceIndexes, onlineRateCensusParam.getPeriodBeginTime(), onlineRateCensusParam.getPeriodEndTime());
|
||||
ratio.add(compareData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159));
|
||||
// 汇总所有设备的在线分钟和离线分钟,再计算总在线率
|
||||
int compareOnlineMin = (int) compareData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
|
||||
int compareOfflineMin = (int) compareData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
|
||||
ratio.add(DataStatisticsUtil.calculateOnlineRate(compareOnlineMin, compareOfflineMin));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,10 +216,12 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
data.forEach(po -> {
|
||||
PublicDTO publicDTO = new PublicDTO();
|
||||
//终端在线率 保留两位小数
|
||||
Double onlineRate = po.getOnlineRate() == null ? null : BigDecimal.valueOf(Double.parseDouble(po.getOnlineRate().toString())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
publicDTO.setId(po.getDevIndex());
|
||||
publicDTO.setData(DataStatisticsUtil.dataLimits(onlineRate));
|
||||
publicDTO.setOnlineMin(po.getOnlineMin() == null ? 0 : po.getOnlineMin().intValue());
|
||||
publicDTO.setOfflineMin(po.getOfflineMin() == null ? 0 : po.getOfflineMin().intValue());
|
||||
// 计算在线率
|
||||
Double onlineRate = DataStatisticsUtil.calculateOnlineRate(publicDTO.getOnlineMin(), publicDTO.getOfflineMin());
|
||||
publicDTO.setData(onlineRate);
|
||||
publicDTOList.add(publicDTO);
|
||||
});
|
||||
}
|
||||
@@ -321,14 +329,24 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
}
|
||||
}
|
||||
}
|
||||
Double devAvg = children.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
|
||||
devItem.setOnlineRate(devAvg);
|
||||
// 汇总子节点的在线分钟和离线分钟,重新计算在线率
|
||||
int totalOnlineMin = (int) children.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
|
||||
int totalOfflineMin = (int) children.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
|
||||
devItem.setOnlineMin(totalOnlineMin);
|
||||
devItem.setOfflineMin(totalOfflineMin);
|
||||
devItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
|
||||
}
|
||||
}
|
||||
Double devAvg = devs.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
|
||||
subItem.setOnlineRate(devAvg);
|
||||
// 汇总设备的在线分钟和离线分钟,重新计算变电站在线率
|
||||
int totalOnlineMin = (int)devs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
|
||||
int totalOfflineMin = (int)devs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
|
||||
subItem.setOnlineMin(totalOnlineMin);
|
||||
subItem.setOfflineMin(totalOfflineMin);
|
||||
subItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
|
||||
} else {
|
||||
subItem.setOnlineRate(3.14159);
|
||||
subItem.setOnlineMin(0);
|
||||
subItem.setOfflineMin(0);
|
||||
}
|
||||
if (Objects.nonNull(subItem.getAlgoDescribe())) {
|
||||
if (mapAlarm.containsKey(subItem.getAlgoDescribe())) {
|
||||
@@ -340,10 +358,16 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
}
|
||||
}
|
||||
}
|
||||
Double subAvg = subs.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
|
||||
gdItem.setOnlineRate(subAvg);
|
||||
// 汇总变电站的在线分钟和离线分钟,重新计算供电公司在线率
|
||||
int totalOnlineMin = (int) subs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
|
||||
int totalOfflineMin = (int) subs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
|
||||
gdItem.setOnlineMin(totalOnlineMin);
|
||||
gdItem.setOfflineMin(totalOfflineMin);
|
||||
gdItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
|
||||
} else {
|
||||
gdItem.setOnlineRate(3.14159);
|
||||
gdItem.setOnlineMin(0);
|
||||
gdItem.setOfflineMin(0);
|
||||
}
|
||||
if (Objects.nonNull(gdItem.getAlgoDescribe())) {
|
||||
if (mapAlarm.containsKey(gdItem.getAlgoDescribe())) {
|
||||
@@ -355,10 +379,16 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
}
|
||||
}
|
||||
}
|
||||
Double gdAvg = gds.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
|
||||
proItem.setOnlineRate(gdAvg);
|
||||
// 汇总供电公司的在线分钟和离线分钟,重新计算省会在线率
|
||||
int totalOnlineMin = (int) gds.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
|
||||
int totalOfflineMin = (int) gds.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
|
||||
proItem.setOnlineMin(totalOnlineMin);
|
||||
proItem.setOfflineMin(totalOfflineMin);
|
||||
proItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
|
||||
} else {
|
||||
proItem.setOnlineRate(3.14159);
|
||||
proItem.setOnlineMin(0);
|
||||
proItem.setOfflineMin(0);
|
||||
}
|
||||
if (Objects.nonNull(proItem.getAlgoDescribe())) {
|
||||
if (mapAlarm.containsKey(proItem.getAlgoDescribe()))
|
||||
|
||||
@@ -127,16 +127,26 @@ public class DataStatisticsUtil {
|
||||
for (TerminalOnlineRateData onlineRateData : terminalOnlineRateList) {
|
||||
if (onlineRateDataVO.getId().equals(onlineRateData.getDevId())) {
|
||||
flag = true;
|
||||
onlineRateDataVO.setOnlineRate( dataLimits(onlineRateData.getOnlineRate()));
|
||||
onlineRateDataVO.setOnlineMin(onlineRateData.getOnlineMin());
|
||||
onlineRateDataVO.setOfflineMin(onlineRateData.getOfflineMin());
|
||||
// 根据onlineMin和offlineMin计算在线率
|
||||
Double onlineRate = calculateOnlineRate(onlineRateData.getOnlineMin(), onlineRateData.getOfflineMin());
|
||||
onlineRateDataVO.setOnlineRate(onlineRate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
onlineRateDataVO.setOnlineRate(3.14159);
|
||||
onlineRateDataVO.setOnlineMin(0);
|
||||
onlineRateDataVO.setOfflineMin(0);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
} else {
|
||||
deviceList = deviceList.stream().peek(onlineRateDataVO -> onlineRateDataVO.setOnlineRate(3.14159)).collect(Collectors.toList());
|
||||
deviceList = deviceList.stream().peek(onlineRateDataVO -> {
|
||||
onlineRateDataVO.setOnlineRate(3.14159);
|
||||
onlineRateDataVO.setOnlineMin(0);
|
||||
onlineRateDataVO.setOfflineMin(0);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +159,45 @@ public class DataStatisticsUtil {
|
||||
return data>100?100:data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据在线分钟数和离线分钟数计算在线率
|
||||
* @param onlineMin 在线分钟数
|
||||
* @param offlineMin 离线分钟数
|
||||
* @return 在线率(保留两位小数,超过100则返回100)
|
||||
*/
|
||||
public static Double calculateOnlineRate(Integer onlineMin, Integer offlineMin) {
|
||||
if (onlineMin == null || offlineMin == null) {
|
||||
return 3.14159;
|
||||
}
|
||||
long totalMin = onlineMin + offlineMin;
|
||||
if (totalMin == 0) {
|
||||
return 3.14159;
|
||||
}
|
||||
double rate = onlineMin * 100.0 / totalMin;
|
||||
// 保留两位小数
|
||||
rate = Math.round(rate * 100.0) / 100.0;
|
||||
return dataLimits(rate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实际时间和期望时间计算数据完整性
|
||||
* @param realTime 实际时间
|
||||
* @param dueTime 期望时间
|
||||
* @return 数据完整性(保留两位小数,超过100则返回100)
|
||||
*/
|
||||
public static Double calculateIntegrityRate(Integer realTime, Integer dueTime) {
|
||||
if (realTime == null || dueTime == null) {
|
||||
return 3.14159;
|
||||
}
|
||||
if (dueTime == 0) {
|
||||
return 3.14159;
|
||||
}
|
||||
double rate = realTime * 100.0 / dueTime;
|
||||
// 保留两位小数
|
||||
rate = Math.round(rate * 100.0) / 100.0;
|
||||
return dataLimits(rate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -123,7 +123,10 @@
|
||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||
AND (sub.NAME LIKE #{searchValueLike}
|
||||
OR dev.name LIKE #{searchValueLike}
|
||||
OR line.NAME LIKE #{searchValueLike})
|
||||
OR line.NAME LIKE #{searchValueLike}
|
||||
OR loadtypeId.Name LIKE #{searchValueLike}
|
||||
OR manufacturerId.name LIKE #{searchValueLike}
|
||||
)
|
||||
</if>
|
||||
ORDER BY
|
||||
gdName,
|
||||
@@ -339,10 +342,10 @@
|
||||
</if>
|
||||
<if test="searchValue != '' and searchValue != null ">
|
||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||
AND sub.NAME LIKE #{searchValueLike}
|
||||
AND (sub.NAME LIKE #{searchValueLike}
|
||||
OR dev.NAME LIKE #{searchValueLike}
|
||||
OR devT.Name LIKE #{searchValueLike}
|
||||
OR device.IP LIKE #{searchValueLike}
|
||||
OR device.IP LIKE #{searchValueLike})
|
||||
</if>
|
||||
ORDER BY
|
||||
gdName,
|
||||
@@ -371,7 +374,8 @@
|
||||
deviceDetail.id deviceId,
|
||||
pv.scale lineVoltage,
|
||||
pqsub.scale subVoltage,
|
||||
lineDetail.monitor_id monitorId
|
||||
lineDetail.monitor_id monitorId,
|
||||
lineDetail.Actual_Area actualArea
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail lineDetail,
|
||||
|
||||
@@ -36,8 +36,10 @@ public class OnLineRateServiceImpl extends ServiceImpl<OnLineRateMapper, RStatOn
|
||||
@Override
|
||||
public DeviceOnlineRate deviceOnlineRateInfo(DeviceInfoParam.BusinessParam param) {
|
||||
DeviceOnlineRate rate = new DeviceOnlineRate();
|
||||
List<Integer> devRun = ObjectUtil.isNull(param.getLineRunFlag()) ? null : Arrays.asList(param.getLineRunFlag());
|
||||
param.setLineRunFlag(null);
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, ObjectUtil.isNull(param.getLineRunFlag()) ? null : Arrays.asList(param.getLineRunFlag()), Arrays.asList(1));
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, devRun, Arrays.asList(1));
|
||||
if (CollUtil.isNotEmpty(deviceInfo)) {
|
||||
List<String> deviceIds = deviceInfo.stream()
|
||||
.flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList())
|
||||
|
||||
@@ -81,7 +81,8 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType,
|
||||
@Param("powerFlag")Integer powerFlag,
|
||||
@Param("lineRunFlag") Integer lineRunFlag,
|
||||
@Param("monitorFlag") Integer monitorFlag
|
||||
@Param("monitorFlag") Integer monitorFlag,
|
||||
@Param("searchValue") String searchValue
|
||||
);
|
||||
|
||||
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,
|
||||
@@ -94,4 +95,6 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
|
||||
|
||||
List<String> getLineByDeptIdAndNewStation(@Param("ids") List<String> id,@Param("dictTree")List<String> dictTree);
|
||||
|
||||
List<DeptLine> getOnlineMonitor();
|
||||
}
|
||||
|
||||
@@ -579,4 +579,13 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
* 根据Pid获取所有子节点
|
||||
*/
|
||||
List<String> getSubIdByPid(@Param("pid") String pid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id获取终端id
|
||||
*
|
||||
* @param ids 监测点集合
|
||||
* @return 结果
|
||||
*/
|
||||
List<String> getDevIdsLine(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
@@ -194,6 +194,12 @@
|
||||
<if test="monitorFlag!=null ">
|
||||
and lineDetail.Monitor_Flag = #{monitorFlag}
|
||||
</if>
|
||||
<if test="searchValue != '' and searchValue != null ">
|
||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||
AND (substation.name LIKE #{searchValueLike}
|
||||
OR point.NAME LIKE #{searchValueLike}
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="getLineIdByDeptIds" resultType="string">
|
||||
select
|
||||
@@ -294,4 +300,16 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getOnlineMonitor" resultType="DeptLine">
|
||||
select
|
||||
t1.Line_Id lineId,
|
||||
t1.Id id
|
||||
from
|
||||
pq_dept_line t1,
|
||||
pq_line_detail t2
|
||||
where
|
||||
t1.Line_Id = t2.Id and t2.Run_Flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
SELECT
|
||||
DISTINCT
|
||||
detail.*,
|
||||
pqd.Com_Flag as comFlag
|
||||
pqd.Com_Flag as comFlag,
|
||||
pqd.id as monitorName
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.lineOrDevice==0">
|
||||
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.searchValue!='' and deviceInfoParam.lineOrDevice==0">
|
||||
AND t1.name like CONCAT(CONCAT('%', #{deviceInfoParam.searchValue}), '%')
|
||||
</if>
|
||||
<!-- xy -->
|
||||
@@ -344,7 +344,7 @@
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.lineOrDevice==1">
|
||||
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.searchValue!='' and deviceInfoParam.lineOrDevice==1">
|
||||
AND t1.name like CONCAT(CONCAT('%', #{deviceInfoParam.searchValue}), '%')
|
||||
</if>
|
||||
<if test="devIds!=null and devIds.size()!=0">
|
||||
@@ -570,7 +570,8 @@
|
||||
detail.New_Station_Id as newStationId,
|
||||
detail.obj_id,
|
||||
detail.big_obj_type,
|
||||
detail.small_obj_type
|
||||
detail.small_obj_type,
|
||||
detail.Power_Flag powerFlag
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
@@ -1541,7 +1542,7 @@
|
||||
<select id="selectByIds" resultType="com.njcn.device.pq.pojo.vo.LineDetailVO$Detail">
|
||||
SELECT DISTINCT
|
||||
line.id as lineId,
|
||||
dept.`Name` deptName,
|
||||
dept.Name deptName,
|
||||
area.name as areaId,
|
||||
gd.NAME gdName,
|
||||
substation.NAME subName,
|
||||
@@ -1934,5 +1935,19 @@
|
||||
AND t2.Monitor_Flag = 0
|
||||
</if>
|
||||
</select>
|
||||
<select id="getDevIdsLine" resultType="java.lang.String">
|
||||
SELECT
|
||||
DISTINCT d.id
|
||||
FROM
|
||||
pq_line a
|
||||
INNER JOIN pq_line v ON a.pid = v.id
|
||||
INNER JOIN pq_line d ON v.pid = d.id
|
||||
where
|
||||
a.id in
|
||||
<foreach collection="ids" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -44,6 +44,13 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
List<DeptLine> selectDeptBindLines(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id获取部门信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<DeptLine> selectDeptLine(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据部门ids集合查询所有监测点id
|
||||
* @param ids 部门ids
|
||||
@@ -115,7 +122,7 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devType);
|
||||
|
||||
|
||||
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,Integer powerFlag,Integer lineRunFlag,Integer monitorFlag);
|
||||
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,Integer powerFlag,Integer lineRunFlag,Integer monitorFlag,String searchValue);
|
||||
|
||||
List<SubGetBase> getSubStationList(SubstationParam substationParam);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -34,9 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -81,6 +80,15 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
detailMapper.update(null, new LambdaUpdateWrapper<LineDetail>()
|
||||
.set(LineDetail::getActualArea, data.getArea())
|
||||
.in(LineDetail::getId, lineIds));
|
||||
} else {
|
||||
List<String> deptList = Arrays.asList("130700000000", "130300000000", "130800000000", "130200000000", "131000000000");
|
||||
Dept data = deptFeignClient.getDeptById(deptLineParam.getId()).getData();
|
||||
if (deptList.contains(data.getArea())) {
|
||||
List<String> lineIds = list.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
detailMapper.update(null, new LambdaUpdateWrapper<LineDetail>()
|
||||
.set(LineDetail::getActualArea, data.getArea())
|
||||
.in(LineDetail::getId, lineIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.saveBatch(deptLines);
|
||||
@@ -101,6 +109,22 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
return this.lambdaQuery().in(DeptLine::getId, ids).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptLine> selectDeptLine(List<String> ids) {
|
||||
List<DeptLine> list = this.lambdaQuery().in(DeptLine::getLineId, ids).list();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<Dept> data = deptFeignClient.getAllDept().getData();
|
||||
Map<String, String> deptName = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
for (DeptLine deptLine : list) {
|
||||
if (deptName.containsKey(deptLine.getId())) {
|
||||
deptLine.setId(deptName.get(deptLine.getId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLineByDeptIds(List<String> ids,String manufacturer, List<Integer> runFlag, List<Integer> dataType, String objType) {
|
||||
return this.baseMapper.getLineIdByDeptIds(ids, manufacturer ,runFlag, dataType, objType);
|
||||
@@ -182,8 +206,13 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType, Integer powerFlag, Integer lineRunFlag,Integer monitorFlag) {
|
||||
return deptLineMapper.orgSubStationInfoGet(devType, powerFlag, lineRunFlag,monitorFlag);
|
||||
public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,
|
||||
Integer powerFlag,
|
||||
Integer lineRunFlag,
|
||||
Integer monitorFlag,
|
||||
String searchValue
|
||||
) {
|
||||
return deptLineMapper.orgSubStationInfoGet(devType, powerFlag, lineRunFlag,monitorFlag,searchValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
<select id="getOnIntegrityByIds" resultType="com.njcn.device.pq.pojo.vo.RStatIntegrityVO">
|
||||
SELECT
|
||||
line_index AS lineIndex,
|
||||
ROUND(sum( real_time )*1.0 / sum( due_time ) * 100,2) AS integrityRate
|
||||
sum(real_time) AS realTime,
|
||||
sum(due_time) AS dueTime,
|
||||
ROUND(sum( real_time )*100.0 / sum( due_time ) ,2) AS integrityRate
|
||||
FROM
|
||||
r_stat_integrity_d
|
||||
<where>
|
||||
@@ -112,13 +114,14 @@
|
||||
|
||||
<select id="getNoData" resultType="OnlineMonitorVo">
|
||||
SELECT DISTINCT
|
||||
t6.`Name` gdName,
|
||||
t5.`Name` subName,
|
||||
t4.`Name` deviceName,
|
||||
t6.Name gdName,
|
||||
t5.Name subName,
|
||||
t4.Name deviceName,
|
||||
t1.line_index lineId,
|
||||
t2.`Name` lineName,
|
||||
t8.`Name` monitorObjType,
|
||||
t2.Name lineName,
|
||||
t8.Name monitorObjType,
|
||||
t7.Obj_Name monitorObj,
|
||||
"完整性为0" as target,
|
||||
count(t1.time_id) lastDay
|
||||
FROM
|
||||
r_stat_integrity_d t1
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.njcn.event.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@@ -34,4 +36,30 @@ public class EventCount implements Serializable {
|
||||
public EventCount(String lineId) {
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Detail implements Serializable {
|
||||
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("暂态指标")
|
||||
private String dicData;
|
||||
|
||||
@ApiModelProperty("暂降次数")
|
||||
private BigDecimal count;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -28,6 +28,17 @@ public class EventBaseParam extends BaseParam implements Serializable {
|
||||
private String deptId;
|
||||
|
||||
|
||||
@Data
|
||||
public static class Info extends DeviceInfoParam.BusinessParam {
|
||||
|
||||
@ApiModelProperty("页码")
|
||||
private Integer pageNum;
|
||||
|
||||
@ApiModelProperty("页面尺寸")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(name = "dicData", value = "字典id")
|
||||
private String dicData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ public class TransientParam extends DeviceInfoParam.BusinessParam {
|
||||
private BigDecimal eventValueMin;
|
||||
|
||||
@ApiModelProperty("持续时间最大值")
|
||||
private Integer persistMax;
|
||||
private Double persistMax;
|
||||
|
||||
@ApiModelProperty("持续时间最小值")
|
||||
private Integer persistMin;
|
||||
private Double persistMin;
|
||||
|
||||
@ApiModelProperty("严重度最大值")
|
||||
private BigDecimal severityMax;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PqDevice implements Serializable {
|
||||
*/
|
||||
private Date nextTimeCheck;
|
||||
/**
|
||||
* 电镀功能 0关闭 1开启 默认关闭
|
||||
* 电度功能 0关闭 1开启 默认关闭
|
||||
*/
|
||||
private Integer electroplate;
|
||||
/**
|
||||
|
||||
@@ -105,6 +105,12 @@ public class AdvanceEventDetailVO {
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(value = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty(value = "监测对象")
|
||||
private String objName;
|
||||
|
||||
private String voltageId;
|
||||
|
||||
@ApiModelProperty(value = "特征值是否计算")
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.njcn.event.pojo.dto.EventCount;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -25,12 +27,21 @@ public class EventDetailVO implements Serializable {
|
||||
@ApiModelProperty(name = "swellTimes",value = "电压暂升发生次数")
|
||||
private Long swellTimes;
|
||||
|
||||
@ApiModelProperty(name = "swellTimes", value = "电压暂升发生监测点集合")
|
||||
private List<EventCount.Detail> swellTimesIds;
|
||||
|
||||
@ApiModelProperty(name = "sagTimes",value = "电压暂降发生次数")
|
||||
private Long sagTimes;
|
||||
|
||||
@ApiModelProperty(name = "sagTimes", value = "电压暂降发生监测点集合")
|
||||
private List<EventCount.Detail> sagTimesIds;
|
||||
|
||||
@ApiModelProperty(name = "interruptTimes",value = "短时中断发生次数")
|
||||
private Long interruptTimes;
|
||||
|
||||
@ApiModelProperty(name = "interruptTimesIds", value = "短时中断发生监测点集合")
|
||||
private List<EventCount.Detail> interruptTimesIds;
|
||||
|
||||
@ApiModelProperty(name = "rate90",value = "暂态严重度占比小于90%")
|
||||
private Double rate90;
|
||||
|
||||
|
||||
@@ -156,4 +156,14 @@ public class RmpEventDetailController extends BaseController {
|
||||
List<EventCount> eventCount = rmpEventDetailService.getEventCount(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventCount, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventByLineIdsCount")
|
||||
@ApiOperation("全景暂降详情列表")
|
||||
public HttpResult<Page<AdvanceEventDetailVO>> getEventByLineIdsCount(@RequestBody EventBaseParam.Info param) {
|
||||
String methodDescribe = getMethodDescribe("getEventByLineIdsCount");
|
||||
Page<AdvanceEventDetailVO> page = rmpEventDetailService.getEventByLineIdsCount(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
@Override
|
||||
public AreaAnalysisVO getEventReason(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
//获取暂降字典信息
|
||||
// DictData voltageData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
// if(ObjectUtil.isNull(voltageData)){
|
||||
// throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
// }
|
||||
DictData voltageData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
if(ObjectUtil.isNull(voltageData)){
|
||||
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
}
|
||||
AreaAnalysisVO areaAnalysisVO = new AreaAnalysisVO();
|
||||
List<DictData> dicReasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
|
||||
List<DictData> dicTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
|
||||
@@ -67,11 +67,11 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
List<String> lineIds = getAllLineIdList(generalDeviceDTOList);
|
||||
|
||||
//查询数据
|
||||
// List<AreaAnalysisVO.Children> reasonList = assData(dicReasonList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_reason");
|
||||
// List<AreaAnalysisVO.Children> reasonList = assData(dicReasonList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_reason");
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new QueryWrapper<RmpEventDetailPO>()
|
||||
.select("advance_reason,advance_type,count(event_id) as count")
|
||||
.in("measurement_point_id", lineIds)
|
||||
// .eq("event_type", voltageData.getId())
|
||||
.eq("event_type", voltageData.getId())
|
||||
.in("advance_reason", dicReasonList.stream().map(DictData::getId).collect(Collectors.toList()))
|
||||
.in("advance_type", dicTypeList.stream().map(DictData::getId).collect(Collectors.toList()))
|
||||
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()),"start_time" ,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
@@ -259,12 +259,10 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
|
||||
private List<AreaAnalysisVO.Children> assReasonPQ(Map<String, List<String>> stringListMap, List<RmpEventDetailPO> info, String typeId){
|
||||
List<AreaAnalysisVO.Children> reasonList = new ArrayList<>();
|
||||
|
||||
List<RmpEventDetailPO> reasons = info.stream().filter(x -> typeId.equals(x.getAdvanceReason())).collect(Collectors.toList());
|
||||
Integer allCount = 0;
|
||||
for (Map.Entry<String, List<String>> stringListEntry : stringListMap.entrySet()) {
|
||||
List<String> value = stringListEntry.getValue();
|
||||
Integer count = reasons.stream().filter(x -> value.contains(x.getAdvanceType())).mapToInt(RmpEventDetailPO::getCount).sum();
|
||||
Integer count = info.stream().filter(x -> value.contains(x.getAdvanceType())).mapToInt(RmpEventDetailPO::getCount).sum();
|
||||
AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children();
|
||||
allType.setName(stringListEntry.getKey());
|
||||
allType.setValue(count);
|
||||
|
||||
@@ -22,10 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -46,28 +43,29 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final EventDetailService eventDetailService;
|
||||
private final PollutionSubstationClient pollutionSubstationClient;
|
||||
|
||||
@Override
|
||||
public List<AreaSubLineVO> getAreaLineInfo(DeviceInfoParam.GridDiagram deviceInfoParam) {
|
||||
List<AreaSubLineVO> resultVOList = new ArrayList<>();
|
||||
List<String> lineIds =new ArrayList<>();
|
||||
List<String> lineIds = new ArrayList<>();
|
||||
Map<String, UserLinePollution> userMap = new HashMap<>();
|
||||
if(1==deviceInfoParam.getType()){
|
||||
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
|
||||
if (1 == deviceInfoParam.getType()) {
|
||||
if (CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())) {
|
||||
lineIds.addAll(deviceInfoParam.getCoutList());
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())){
|
||||
if (CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())) {
|
||||
lineIds.addAll(deviceInfoParam.getAlarmList());
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
lineIds.addAll(generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
if(1==deviceInfoParam.getType()){
|
||||
OnlineRateParam.Info param=new OnlineRateParam.Info();
|
||||
if (Objects.equals(1,deviceInfoParam.getIsPollution())) {
|
||||
OnlineRateParam.Info param = new OnlineRateParam.Info();
|
||||
param.setIds(resList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList()));
|
||||
param.setDicData(deviceInfoParam.getDicData());
|
||||
param.setStartTime(deviceInfoParam.getSearchBeginTime());
|
||||
@@ -76,11 +74,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
}
|
||||
|
||||
//设置冀北告警监测点类型
|
||||
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
|
||||
resList.stream().filter(x->deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x->x.setType(0));
|
||||
if (CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())) {
|
||||
resList.stream().filter(x -> deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x -> x.setType(0));
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())){
|
||||
resList.stream().filter(x->deviceInfoParam.getAlarmList().contains(x.getLineId())).forEach(x->x.setType(1));
|
||||
if (CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())) {
|
||||
resList.stream().filter(x -> deviceInfoParam.getAlarmList().contains(x.getLineId())).forEach(x -> x.setType(1));
|
||||
}
|
||||
|
||||
//查询监测点未处理暂态事件
|
||||
@@ -100,10 +98,10 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong));
|
||||
}
|
||||
}
|
||||
if(userMap.containsKey(areaLineInfoVO.getLineId())){
|
||||
if (userMap.containsKey(areaLineInfoVO.getLineId())) {
|
||||
UserLinePollution userLinePollution = userMap.get(areaLineInfoVO.getLineId());
|
||||
areaLineInfoVO.setVHarmonicValue(userLinePollution.getVHarmonicValue());
|
||||
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(),AreaLineInfoVO.User.class));
|
||||
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(), AreaLineInfoVO.User.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +148,8 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
eventDetailNew = BeanUtil.copyProperties(eventDetail, EventDetailNew.class);
|
||||
//监测点id
|
||||
eventDetailNew.setLineId(eventDetail.getMeasurementPointId());
|
||||
//需要转成百分比*100
|
||||
eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()*100);
|
||||
//持续时间
|
||||
eventDetailNew.setDuration(eventDetail.getDuration());
|
||||
//特征幅值
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.event.service.majornetwork.Impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -32,20 +31,22 @@ import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.mapper.majornetwork.RMpEventDetailMMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.dto.EventCount;
|
||||
import com.njcn.event.pojo.param.EventBaseParam;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.event.pojo.vo.EventDetailVO;
|
||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -55,16 +56,18 @@ import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
@@ -196,18 +199,18 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
if (Objects.isNull(rmpEventDetailPO)) {
|
||||
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
|
||||
}
|
||||
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
|
||||
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
|
||||
BeanUtils.copyProperties(rmpEventDetailPO, rmpEventDetailVO);
|
||||
if ("pms".equals(sysType)) {
|
||||
|
||||
if(Objects.isNull(smallType) || smallType == 0){
|
||||
if (Objects.isNull(smallType) || smallType == 0) {
|
||||
List<Monitor> monitorList = monitorClient.getMonitorList(monitorIds).getData();
|
||||
if (CollectionUtil.isNotEmpty(monitorList)) {
|
||||
rmpEventDetailVO.setMeasurementPointName(monitorList.get(0).getName());
|
||||
rmpEventDetailVO.setPowerStationName(monitorList.get(0).getPowerrName());
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
//配网
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = distributionMonitorClient.pwMonitorAreaDetailInfo(monitorIds).getData();
|
||||
if (CollectionUtil.isNotEmpty(pwPmsMonitorDTOList)) {
|
||||
@@ -228,21 +231,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> querySagEvents(BaseParam baseParam) {
|
||||
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
||||
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
|
||||
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||
if(CollUtil.isNotEmpty(lineIds)){
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper =new LambdaQueryWrapper<>();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.isNull(RmpEventDetailPO::getEventassIndex);
|
||||
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
||||
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
|
||||
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
||||
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(),AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item->{
|
||||
if(map.containsKey(item.getLineId())){
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||
if (map.containsKey(item.getLineId())) {
|
||||
item.setGdName(map.get(item.getLineId()).getGdName());
|
||||
item.setSubName(map.get(item.getLineId()).getSubName());
|
||||
switch (item.getDealFlag()) {
|
||||
@@ -262,9 +265,9 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
|
||||
}
|
||||
//录波文件
|
||||
if(Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1){
|
||||
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
|
||||
item.setBoFileFlag(EnumFlag.EXIST.description);
|
||||
}else {
|
||||
} else {
|
||||
item.setBoFileFlag(EnumFlag.ABSENCE.description);
|
||||
}
|
||||
|
||||
@@ -282,7 +285,6 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public RmpEventDetailPO queryEventDetailByEventId(String eventId) {
|
||||
return this.getById(eventId);
|
||||
@@ -302,17 +304,17 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
List<LineDevGetDTO> collect = deptGetChildrenMoreDTOS.stream()
|
||||
.filter(x->deptIDS.contains(x.getUnitId()))
|
||||
.filter(x -> deptIDS.contains(x.getUnitId()))
|
||||
.flatMap(x -> x.getLineBaseList().stream()).collect(Collectors.toList());
|
||||
|
||||
List<String> lineAllIds = collect.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
List<String> gwLineAllIds = collect.stream().filter(x->1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
List<String> gwLineAllIds = collect.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
List<RmpEventDetailPO> list1 = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(CollUtil.isNotEmpty(lineAllIds), RmpEventDetailPO::getMeasurementPointId, lineAllIds)
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||
);
|
||||
List<RmpEventDetailPO> list =list1.stream().filter(x->param.getIds().contains(x.getEventType())).collect(Collectors.toList());
|
||||
List<RmpEventDetailPO> list = list1.stream().filter(x -> param.getIds().contains(x.getEventType())).collect(Collectors.toList());
|
||||
|
||||
Map<String, DeptGetChildrenMoreDTO> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
|
||||
GridDiagramVO.LineStatistics lineStatistics;
|
||||
@@ -327,7 +329,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
gwLineStatistics.setOrgName(datum.getName());
|
||||
List<LineDevGetDTO> lineBaseList = deptLineMap.get(datum.getId()).getLineBaseList();
|
||||
List<String> lineIds = lineBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
long count = list.stream().filter(x -> lineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
||||
long gwCount = list.stream().filter(x -> gwLineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
||||
lineStatistics.setCount(count);
|
||||
@@ -345,38 +347,48 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> getEventDetailByList(GridDiagramParam param) {
|
||||
List<EventDetailVO> info=new ArrayList<>();
|
||||
//获取污区图统计类型
|
||||
List<EventDetailVO> info = new ArrayList<>();
|
||||
//获取统计类型
|
||||
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
|
||||
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
|
||||
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData();
|
||||
List<String> lineIds = data.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<RmpEventDetailPO> list = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.select(RmpEventDetailPO::getEventId,RmpEventDetailPO::getMeasurementPointId ,RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
|
||||
.select(RmpEventDetailPO::getEventId, RmpEventDetailPO::getMeasurementPointId, RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
|
||||
.in(CollUtil.isNotEmpty(lineIds), RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
||||
);
|
||||
Map<String, LineDetailVO.Detail> lineMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
List<LineDetailVO.Detail> lines = lineFeignClient.getLineDetailByIds(lineIds).getData();
|
||||
lineMap = lines.stream().collect(Collectors.toMap(LineDetailVO.Detail::getLineId, Function.identity()));
|
||||
}
|
||||
EventDetailVO vo;
|
||||
for (GeneralDeviceDTO datum : data) {
|
||||
vo=new EventDetailVO();
|
||||
vo = new EventDetailVO();
|
||||
vo.setId(datum.getIndex());
|
||||
vo.setName(datum.getName());
|
||||
List<RmpEventDetailPO> detailPOList = list.stream().filter(x -> datum.getLineIndexes().contains(x.getMeasurementPointId())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(detailPOList)){
|
||||
vo.setSwellTimes(detailPOList.stream().filter(x->x.getEventType().equals(rise.getId())).count());
|
||||
vo.setSagTimes(detailPOList.stream().filter(x->x.getEventType().equals(dip.getId())).count());
|
||||
vo.setInterruptTimes(detailPOList.stream().filter(x->x.getEventType().equals(interruptions.getId())).count());
|
||||
double v90 = detailPOList.stream().filter(x -> x.getSeverity()*100<=90).count() * 100.0 / detailPOList.size();
|
||||
double v50 = detailPOList.stream().filter(x -> x.getSeverity()*100<=50).count() * 100.0 / detailPOList.size();
|
||||
double v20 = detailPOList.stream().filter(x -> x.getSeverity()*100<=20).count() * 100.0 / detailPOList.size();
|
||||
vo.setRate90(NumberUtil.round(v90,2).doubleValue());
|
||||
vo.setRate50(NumberUtil.round(v50,2).doubleValue());
|
||||
vo.setRate20(NumberUtil.round(v20,2).doubleValue());
|
||||
}else {
|
||||
if (CollUtil.isNotEmpty(detailPOList)) {
|
||||
vo.setSwellTimes(detailPOList.stream().filter(x -> x.getEventType().equals(rise.getId())).count());
|
||||
vo.setSwellTimesIds(eventLine(detailPOList, rise.getId(), lineMap));
|
||||
|
||||
vo.setSagTimes(detailPOList.stream().filter(x -> x.getEventType().equals(dip.getId())).count());
|
||||
vo.setSagTimesIds(eventLine(detailPOList, dip.getId(), lineMap));
|
||||
|
||||
vo.setInterruptTimes(detailPOList.stream().filter(x -> x.getEventType().equals(interruptions.getId())).count());
|
||||
vo.setInterruptTimesIds(eventLine(detailPOList, interruptions.getId(), lineMap));
|
||||
|
||||
double v90 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 90).count() * 100.0 / detailPOList.size();
|
||||
double v50 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 50).count() * 100.0 / detailPOList.size();
|
||||
double v20 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 20).count() * 100.0 / detailPOList.size();
|
||||
vo.setRate90(NumberUtil.round(v90, 2).doubleValue());
|
||||
vo.setRate50(NumberUtil.round(v50, 2).doubleValue());
|
||||
vo.setRate20(NumberUtil.round(v20, 2).doubleValue());
|
||||
} else {
|
||||
vo.setSwellTimes(0L);
|
||||
vo.setSagTimes(0L);
|
||||
vo.setInterruptTimes(0L);
|
||||
@@ -389,6 +401,28 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
return info;
|
||||
}
|
||||
|
||||
public List<EventCount.Detail> eventLine(List<RmpEventDetailPO> detailPOList, String dicData, Map<String, LineDetailVO.Detail> lineMap) {
|
||||
List<EventCount.Detail> info = new ArrayList<>();
|
||||
Map<String, Long> collect = detailPOList.stream().filter(x -> x.getEventType().equals(dicData))
|
||||
.collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.counting()));
|
||||
collect.forEach((key, value) -> {
|
||||
if (lineMap.containsKey(key)) {
|
||||
LineDetailVO.Detail detail1 = lineMap.get(key);
|
||||
EventCount.Detail detail = new EventCount.Detail();
|
||||
detail.setLineId(key);
|
||||
detail.setDicData(dicData);
|
||||
detail.setLineName(detail1.getLineName());
|
||||
detail.setDevName(detail1.getDevName());
|
||||
detail.setSubName(detail1.getSubName());
|
||||
detail.setIp(detail1.getIp());
|
||||
detail.setCount(BigDecimal.valueOf(value));
|
||||
info.add(detail);
|
||||
}
|
||||
});
|
||||
info.sort(Comparator.comparing(EventCount.Detail::getCount).reversed());
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RMpEventDetailM getEventDetailByLine(StatisticsBizBaseParam param) {
|
||||
RMpEventDetailM rMpEventDetailM = eventDetailMMapper.selectOne(new LambdaQueryWrapper<RMpEventDetailM>()
|
||||
@@ -401,37 +435,37 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getImMonitorEvents(EventBaseParam param) {
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(),DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(),DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(), DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(), DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
||||
|
||||
QueryWrapper<RmpEventDetailPO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
if(StrUtil.isNotBlank(param.getLineId())){
|
||||
queryWrapper.eq("measurement_point_id",param.getSearchValue());
|
||||
}else {
|
||||
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),param.getDeptId()).getData();
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
if (StrUtil.isNotBlank(param.getLineId())) {
|
||||
queryWrapper.eq("measurement_point_id", param.getSearchValue());
|
||||
} else {
|
||||
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(), param.getDeptId()).getData();
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
return mapList;
|
||||
}
|
||||
queryWrapper.in("measurement_point_id",lineIds);
|
||||
queryWrapper.in("measurement_point_id", lineIds);
|
||||
}
|
||||
|
||||
//lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),)
|
||||
queryWrapper.select("measurement_point_id as lineId","count(event_id) as eventCount").between("start_time",param.getSearchBeginTime(),param.getSearchEndTime())
|
||||
.eq("event_type",eventDic.getId())
|
||||
queryWrapper.select("measurement_point_id as lineId", "count(event_id) as eventCount").between("start_time", param.getSearchBeginTime(), param.getSearchEndTime())
|
||||
.eq("event_type", eventDic.getId())
|
||||
.groupBy("measurement_point_id");
|
||||
mapList = this.baseMapper.selectMaps(queryWrapper);
|
||||
if(CollUtil.isEmpty(mapList)){
|
||||
if (CollUtil.isEmpty(mapList)) {
|
||||
return mapList;
|
||||
}
|
||||
List<String> ids = mapList.stream().map(it->it.get("lineId").toString()).distinct().collect(Collectors.toList());
|
||||
List<String> ids = mapList.stream().map(it -> it.get("lineId").toString()).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(ids).getData();
|
||||
Map<String,AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
||||
Map<String, AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
mapList.forEach(item->{
|
||||
mapList.forEach(item -> {
|
||||
AreaLineInfoVO tem = lineMap.get(item.get("lineId").toString());
|
||||
item.put("lineName",tem.getVoltageName()+"_"+tem.getLineName());
|
||||
item.put("lineName", tem.getVoltageName() + "_" + tem.getLineName());
|
||||
});
|
||||
|
||||
return mapList;
|
||||
@@ -452,9 +486,72 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
return eventCountList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param) {
|
||||
Page<AdvanceEventDetailVO> pageResult = new Page<>();
|
||||
param.setLineOrDevice(0);
|
||||
param.setDeptIndex(param.getDeptIndex());
|
||||
param.setStatisticalType(new SimpleDTO());
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
List<String> ids = deviceInfo.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
Page<RmpEventDetailPO> poPage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(CollUtil.isNotEmpty(ids), RmpEventDetailPO::getLineId, ids)
|
||||
.eq(StrUtil.isNotBlank(param.getDicData()), RmpEventDetailPO::getEventType, param.getDicData())
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
||||
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||
);
|
||||
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(tempLineIds)){
|
||||
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
||||
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||
if (map.containsKey(item.getLineId())) {
|
||||
item.setGdName(map.get(item.getLineId()).getGdName());
|
||||
item.setSubName(map.get(item.getLineId()).getSubName());
|
||||
item.setLineName(map.get(item.getLineId()).getLineName());
|
||||
item.setLoadType(map.get(item.getLineId()).getLoadType());
|
||||
item.setObjName(map.get(item.getLineId()).getObjName());
|
||||
switch (item.getDealFlag()) {
|
||||
case 0:
|
||||
item.setFeatureAmplitudeFlag(EnumFlag.UNTREATED.getDescription());
|
||||
break;
|
||||
case 1:
|
||||
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSED.getDescription());
|
||||
break;
|
||||
case 2:
|
||||
item.setFeatureAmplitudeFlag(EnumFlag.NODATA.getDescription());
|
||||
break;
|
||||
case 3:
|
||||
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSFAIL.getDescription());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
|
||||
}
|
||||
//录波文件
|
||||
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
|
||||
item.setBoFileFlag(EnumFlag.EXIST.description);
|
||||
} else {
|
||||
item.setBoFileFlag(EnumFlag.ABSENCE.description);
|
||||
}
|
||||
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
pageResult.setRecords(advanceEventDetailVOList);
|
||||
}
|
||||
pageResult.setTotal(poPage.getTotal());
|
||||
pageResult.setPages(poPage.getPages());
|
||||
pageResult.setSize(poPage.getSize());
|
||||
pageResult.setCurrent(poPage.getCurrent());
|
||||
return pageResult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<Double> setData(List<String> gwLineAllIds, List<RmpEventDetailPO> list) {
|
||||
List<Double> info=new ArrayList<>();
|
||||
List<Double> info = new ArrayList<>();
|
||||
long count90 = list.stream()
|
||||
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
|
||||
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
|
||||
@@ -463,21 +560,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
|
||||
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
|
||||
.filter(x -> 0.5 > x.getSeverity()).count();
|
||||
if(count90>0){
|
||||
info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue());
|
||||
}else {
|
||||
if (count90 > 0) {
|
||||
info.add(NumberUtil.round(count90 * 100.0 / list.size(), 2).doubleValue());
|
||||
} else {
|
||||
info.add(0.0);
|
||||
}
|
||||
if(count50>0){
|
||||
info.add(NumberUtil.round(count50*100.0/list.size(),2).doubleValue());
|
||||
}else {
|
||||
if (count50 > 0) {
|
||||
info.add(NumberUtil.round(count50 * 100.0 / list.size(), 2).doubleValue());
|
||||
} else {
|
||||
info.add(0.0);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部枚举类:高级算法处理事件的标识描述
|
||||
* 内部枚举类:高级算法处理事件的标识描述
|
||||
*/
|
||||
enum EnumFlag {
|
||||
PROCESSED(1, "计算成功"), UNTREATED(0, "未计算"), EXIST(1, "存在"), ABSENCE(0, "不存在"), NODATA(2, "无结果"), PROCESSFAIL(3, "计算失败");
|
||||
|
||||
@@ -204,13 +204,41 @@ public class TransientServiceImpl implements TransientService {
|
||||
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
||||
log.info("本地磁盘波形文件路径----" + cfgPath);
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
|
||||
//适配文件后缀小写
|
||||
cfgPath2 = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG.toLowerCase();
|
||||
datPath2 = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT.toLowerCase();
|
||||
log.info("本地磁盘波形文件路径----" + cfgPath2);
|
||||
log.info("本地磁盘波形文件路径----" + datPath2);
|
||||
try (
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||
)
|
||||
{
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("大写文件流为空");
|
||||
try {
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath2);
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath2);
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
} catch (Exception e1) {
|
||||
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
||||
}
|
||||
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
|
||||
} else {
|
||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||
@@ -495,22 +523,26 @@ public class TransientServiceImpl implements TransientService {
|
||||
try {
|
||||
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
||||
log.info("cfg-----"+cfgPath);
|
||||
log.info("cfg-----"+datPath);
|
||||
|
||||
|
||||
//判断文件是否存在
|
||||
boolean result1 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), cfgPath);
|
||||
if (!result1) {
|
||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG_LOWER;
|
||||
cfg = GeneralConstant.CFG_LOWER;
|
||||
File file = new File(cfgPath);
|
||||
if(!file.exists()){
|
||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG_LOWER;
|
||||
}
|
||||
|
||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
||||
boolean result2 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), datPath);
|
||||
if (!result2) {
|
||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT_LOWER;
|
||||
dat = GeneralConstant.DAT_LOWER;
|
||||
File file2 = new File(datPath);
|
||||
if(!file2.exists()){
|
||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT_LOWER;
|
||||
}
|
||||
|
||||
log.info("cfg-----"+cfgPath);
|
||||
log.info("cfg-----"+datPath);
|
||||
cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||
datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||
|
||||
} else {
|
||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||
boolean result1 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), cfgPath);
|
||||
|
||||
@@ -84,4 +84,6 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
|
||||
|
||||
|
||||
List<EventCount> getEventCount(GridDiagramParam param);
|
||||
|
||||
Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/12/9 21:12
|
||||
*/
|
||||
@Data
|
||||
public class AreaPollution {
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("评估分数")
|
||||
private Double score;
|
||||
|
||||
@ApiModelProperty("监测点详情")
|
||||
private List<PowerFlagPollution> powerFlagPollutionList;
|
||||
}
|
||||
@@ -9,6 +9,12 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class PowerFlagPollution implements Serializable {
|
||||
|
||||
/**
|
||||
* 变电站名称
|
||||
*/
|
||||
@Excel(name = "变电站名称", width = 35, replace = "/_null")
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
@@ -66,4 +72,10 @@ public class PowerFlagPollution implements Serializable {
|
||||
@ApiModelProperty("谐波污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
@ApiModelProperty("干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty("监测对象")
|
||||
private String objName;
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@ public class SubstationPollution implements Serializable {
|
||||
@ApiModelProperty("电站谐波污染值")
|
||||
private String subVStationValue;
|
||||
|
||||
@Excel(name = "项目名称", width = 25, needMerge = true)
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("污染值")
|
||||
private Double subValue;
|
||||
|
||||
|
||||
/**
|
||||
* 电网侧&非电网侧
|
||||
|
||||
@@ -24,4 +24,6 @@ public class UserLinePollution {
|
||||
private String lineId;
|
||||
private String city;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,4 +36,10 @@ public class StatSubstationBizBaseParam extends StatisticsBizBaseParam {
|
||||
@ApiModelProperty("电网侧标识")
|
||||
@Range(min = 0, max = 2, message = "电网侧标识" + ValidMessage.PARAM_FORMAT_ERROR)
|
||||
private Integer powerFlag;
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty("搜索值")
|
||||
private String searchValue;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ public class EvaluationVo {
|
||||
|
||||
@ApiModelProperty("越限占比")
|
||||
private Double ratio = 3.14159;
|
||||
|
||||
@ApiModelProperty("超标监测点数量")
|
||||
private Integer size=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GridDiagramHarmController extends BaseController {
|
||||
@ApiOperation("变电站污染告警占比")
|
||||
public HttpResult<GridDiagramVO> getPollutionAlarmData(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSubLineGiveAnAlarm");
|
||||
GridDiagramVO subLineGiveAnAlarm = pollutionSubstationService.getPollutionAlarmData(param);
|
||||
GridDiagramVO subLineGiveAnAlarm = pollutionSubstationService.getNewPollutionAlarmData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subLineGiveAnAlarm, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.AreaPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
@@ -122,7 +123,8 @@ public class PollutionSubstationController extends BaseController {
|
||||
public HttpResult<List<SubstationVo>> getSubstationInfo(@RequestParam(value = "deptIndex") String deptIndex,
|
||||
@RequestParam(value = "searchValue",required=false) String searchValue,
|
||||
@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam(value = "endTime") String endTime) {
|
||||
@RequestParam(value = "endTime") String endTime
|
||||
) {
|
||||
String methodDescribe = getMethodDescribe("getSubstationInfo");
|
||||
LogUtil.njcnDebug(log, "{},实体参数:{},{}", methodDescribe, deptIndex, searchValue);
|
||||
List<SubstationVo> list = pollutionSubstationService.getSubstationInfo(deptIndex,searchValue,startTime,endTime);
|
||||
@@ -174,4 +176,27 @@ public class PollutionSubstationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sumMap, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value = "区域污染值统计")
|
||||
@PostMapping(value = "/getAreaPollution")
|
||||
public HttpResult<List<AreaPollution>> getAreaPollution(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getAreaPollution");
|
||||
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
|
||||
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
|
||||
List<AreaPollution> areaPollution = pollutionSubstationService.getAreaPollution(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, areaPollution, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value ="敏感用户谐波污染值列表")
|
||||
@PostMapping(value ="/downPollutionSensitiveUser")
|
||||
public HttpResult<List<SubstationPollution>> downPollutionSensitiveUser(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("downPollutionSensitiveUser");
|
||||
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
|
||||
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
|
||||
List<SubstationPollution> linePollutions = pollutionSubstationService.downPollutionSensitiveUser(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, linePollutions, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ public class QualifiedReportController extends BaseController {
|
||||
@ApiImplicitParam(name = "qualifiedReportParam", value = "合格率报告参数", required = true)
|
||||
public HttpResult<Page<FpyReportDTO>> pageTable(@RequestBody @Validated QualifiedReportParam qualifiedReportParam) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
String searchValue = qualifiedReportParam.getSearchValue();
|
||||
Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||
if(pattern.matcher(searchValue).find()){
|
||||
throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||
}
|
||||
// String searchValue = qualifiedReportParam.getSearchValue();
|
||||
// Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||
// if(pattern.matcher(searchValue).find()){
|
||||
// throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||
// }
|
||||
String methodDescribe = getMethodDescribe("pageTable");
|
||||
Page<FpyReportDTO> result = qualifiedReportService.pageTable(qualifiedReportParam);
|
||||
log.info("合格率报告执行时长:"+timeInterval.interval());
|
||||
|
||||
@@ -73,4 +73,14 @@ public interface RStatLimitTargetDMapper extends BaseMapper<RStatLimitTargetDPO>
|
||||
List<RStatLimitTargetCountVO> getSumTargetCountDayes(@Param("ids") List<String> ids,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 获取谐波电压越线监测点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> getLinesHarmTarget(@Param("ids") List<String> ids,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
p1.id id,
|
||||
p2.Org_Name dept,
|
||||
p2.Powerr_Name substation,
|
||||
p3.`Name` deviceName,
|
||||
p2.`Name` lineName,
|
||||
p3.Name deviceName,
|
||||
p2.Name lineName,
|
||||
p1.line_id lineId,
|
||||
p4.`Name` businessType,
|
||||
p4.Name businessType,
|
||||
p2.Monitor_Object_Name objectName,
|
||||
p1.target_type targetType,
|
||||
p1.over_limit_day overLimitDay,
|
||||
|
||||
@@ -723,4 +723,56 @@
|
||||
GROUP BY
|
||||
A.lineId;
|
||||
</select>
|
||||
<select id="getLinesHarmTarget" resultType="java.lang.String">
|
||||
select
|
||||
my_index
|
||||
from (
|
||||
SELECT
|
||||
my_index,
|
||||
sum(if((
|
||||
uaberrance_overtime+
|
||||
uharm_2_overtime+
|
||||
uharm_3_overtime+
|
||||
uharm_4_overtime+
|
||||
uharm_5_overtime+
|
||||
uharm_6_overtime+
|
||||
uharm_7_overtime+
|
||||
uharm_8_overtime+
|
||||
uharm_9_overtime+
|
||||
uharm_10_overtime+
|
||||
uharm_11_overtime+
|
||||
uharm_12_overtime+
|
||||
uharm_13_overtime+
|
||||
uharm_14_overtime+
|
||||
uharm_15_overtime+
|
||||
uharm_16_overtime+
|
||||
uharm_17_overtime+
|
||||
uharm_18_overtime+
|
||||
uharm_19_overtime+
|
||||
uharm_20_overtime+
|
||||
uharm_21_overtime+
|
||||
uharm_22_overtime+
|
||||
uharm_23_overtime+
|
||||
uharm_24_overtime+
|
||||
uharm_25_overtime)>0,1,0)) AS allCount
|
||||
FROM
|
||||
r_stat_limit_rate_d
|
||||
<where>
|
||||
<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>
|
||||
<if test=" startTime != null and startTime !=''">
|
||||
AND time_id >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND time_id <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
my_index
|
||||
) a where allCount>0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -26,6 +26,13 @@ public interface IRStatLimitTargetDService extends IService<RStatLimitTargetDPO>
|
||||
*/
|
||||
List<String> getLinesTarget(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取谐波电压越线监测点
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<String> getLinesHarmTarget(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 根据监测点查询一个月各指标越线超标天数
|
||||
|
||||
@@ -2,12 +2,13 @@ package com.njcn.harmonic.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.AreaPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
@@ -20,8 +21,8 @@ import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.SubstationVo;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/10/13 8:56【需求编号】
|
||||
@@ -29,60 +30,64 @@ import java.util.List;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PollutionSubstationService extends IService<RStatPollutionSubstationM>{
|
||||
public interface PollutionSubstationService extends IService<RStatPollutionSubstationM> {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: getPollutionSubstationData
|
||||
* @Param: [pollutionSubstationQuryParam]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionSubstationVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/13
|
||||
*/
|
||||
* @Description: getPollutionSubstationData
|
||||
* @Param: [pollutionSubstationQuryParam]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionSubstationVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/13
|
||||
*/
|
||||
List<PollutionSubstationVO> getPollutionSubstationData(PollutionSubstationQuryParam pollutionSubstationQuryParam);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: getDeptSubstationRelations
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
* @Description: getDeptSubstationRelations
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam param);
|
||||
/**
|
||||
* @Description: getSubstationInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.dto.PollutionSubstationDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Description: getSubstationInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.dto.PollutionSubstationDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionSubstationDTO> getSubstationInfoById(HarmonicPublicParam param);
|
||||
|
||||
/**
|
||||
* @Description: getLineInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.biz.pojo.dto.PollutionLineDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Description: getLineInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.biz.pojo.dto.PollutionLineDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionLineDTO> getLineInfoById(HarmonicPublicParam param);
|
||||
|
||||
|
||||
List<PollutionLineDTO> getLineRankTop10(HarmonicPublicParam param);
|
||||
|
||||
/**
|
||||
* @Description: 污染告警信息
|
||||
* @param param
|
||||
* @Description: 污染告警信息
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2024/4/22 11:00
|
||||
*/
|
||||
@Deprecated
|
||||
GridDiagramVO getPollutionAlarmData(StatSubstationBizBaseParam param);
|
||||
|
||||
GridDiagramVO getNewPollutionAlarmData(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* @Description: 污染告警信息
|
||||
* @param param
|
||||
* @Description: 污染告警信息
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2024/4/22 11:00
|
||||
@@ -97,6 +102,7 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
|
||||
/**
|
||||
* 导出监测点谐波污染值
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param);
|
||||
@@ -109,10 +115,22 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
|
||||
/**
|
||||
* 变电站谐波电压污染值
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
|
||||
|
||||
|
||||
List<UserLinePollution> getSumList(OnlineRateParam.Info param);
|
||||
|
||||
/**
|
||||
* @param param
|
||||
* @Description: 区域污染值统计
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.excel.pollution.AreaPollution>
|
||||
* @Author: wr
|
||||
* @Date: 2025/12/10 17:53
|
||||
*/
|
||||
List<AreaPollution> getAreaPollution(StatSubstationBizBaseParam param);
|
||||
|
||||
List<SubstationPollution> downPollutionSensitiveUser(StatSubstationBizBaseParam param);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
@@ -297,23 +298,22 @@ public class GridServiceImpl implements IGridService {
|
||||
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);
|
||||
this.getDataByTarget(param.getHarmonicType(), l1, children, ll.size());
|
||||
}
|
||||
}
|
||||
childrenList.add(children);
|
||||
}
|
||||
});
|
||||
result.setChildrenList(childrenList);
|
||||
int overCount = 0;
|
||||
if (CollUtil.isNotEmpty(childrenList)) {
|
||||
OptionalDouble optionalAvg = childrenList.stream()
|
||||
.filter(child -> child.getRatio() != null && !child.getRatio().equals(3.14159))
|
||||
.mapToDouble(EvaluationVo.Children::getRatio)
|
||||
.average();
|
||||
if (optionalAvg.isPresent()) {
|
||||
double avg = optionalAvg.getAsDouble();
|
||||
result.setLineRatio(PubUtils.doubleRound(2, avg));
|
||||
for (EvaluationVo.Children children : childrenList) {
|
||||
overCount = overCount + children.getSize();
|
||||
}
|
||||
}
|
||||
if (!lineList.isEmpty()) {
|
||||
result.setLineRatio(NumberUtil.round(overCount * 100.0/lineList.size(),2).doubleValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -708,6 +708,7 @@ public class GridServiceImpl implements IGridService {
|
||||
List<Integer> list3 = getList(1, 16, "getInuharm", item2);
|
||||
Integer maxValue3 = list3.stream().max(Integer::compareTo).orElse(null);
|
||||
qualifiedDetail.setInuHarm(Objects.isNull(maxValue3) ? null : PubUtils.doubleRound(2, 100.0 - (maxValue3 * 100.0 / item2.getAllTime())));
|
||||
//负序电流
|
||||
qualifiedDetail.setINeg(PubUtils.doubleRound(2, 100.0 - (item2.getINegOvertime() * 100.0 / item2.getAllTime())));
|
||||
}
|
||||
if (item2.getFlickerAllTime() > 0) {
|
||||
@@ -813,84 +814,95 @@ public class GridServiceImpl implements IGridService {
|
||||
/**
|
||||
* 根据指标类型计算数据
|
||||
*/
|
||||
public void getDataByTarget(Integer type, List<RStatLimitRateDPO> limitRateList, EvaluationVo.Children children) {
|
||||
public void getDataByTarget(Integer type, List<RStatLimitRateDPO> limitRateList, EvaluationVo.Children children,int monitorTotal) {
|
||||
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()));
|
||||
children.setSize(filteredList0.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList0.size() * 100.0 / monitorTotal));
|
||||
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()));
|
||||
children.setSize(filteredList1.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList1.size() * 100.0 / monitorTotal));
|
||||
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()));
|
||||
children.setSize(filteredList2.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList2.size() * 100.0 / monitorTotal));
|
||||
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()));
|
||||
children.setSize(filteredList3.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList3.size() * 100.0 / monitorTotal));
|
||||
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()));
|
||||
children.setSize(filteredList4.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList4.size() * 100.0 / monitorTotal));
|
||||
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()));
|
||||
children.setSize(filteredList5.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList5.size() * 100.0 / monitorTotal));
|
||||
break;
|
||||
//谐波电压
|
||||
// 谐波电压
|
||||
// 谐波电压含有率 + 谐波电压有效值
|
||||
case 6:
|
||||
List<RStatLimitRateDPO> filteredList6 = limitRateList.stream()
|
||||
.filter(x -> getLimitRateStats(x, 2, 26, "uharm", "Overtime"))
|
||||
.filter(x -> getLimitRateStats(x, 2, 26, "uharm", "Overtime") || x.getUaberranceOvertime() > 0)
|
||||
.collect(Collectors.toList());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList6.size() * 100.0 / limitRateList.size()));
|
||||
children.setSize(filteredList6.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList6.size() * 100.0 / monitorTotal));
|
||||
break;
|
||||
//谐波电流
|
||||
case 7:
|
||||
List<RStatLimitRateDPO> filteredList7 = limitRateList.stream()
|
||||
.filter(x -> getLimitRateStats(x, 2, 26, "iharm", "Overtime"))
|
||||
.collect(Collectors.toList());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList7.size() * 100.0 / limitRateList.size()));
|
||||
children.setSize(filteredList7.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList7.size() * 100.0 / monitorTotal));
|
||||
break;
|
||||
//间谐波电压
|
||||
case 8:
|
||||
List<RStatLimitRateDPO> filteredList8 = limitRateList.stream()
|
||||
.filter(x -> getLimitRateStats(x, 1, 16, "inuharm", "Overtime"))
|
||||
.collect(Collectors.toList());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList8.size() * 100.0 / limitRateList.size()));
|
||||
children.setSize(filteredList8.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList8.size() * 100.0 / monitorTotal));
|
||||
break;
|
||||
//负序电流
|
||||
case 9:
|
||||
List<RStatLimitRateDPO> filteredList9 = limitRateList.stream()
|
||||
.filter(data -> data.getINegOvertime() > 0)
|
||||
.collect(Collectors.toList());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList9.size() * 100.0 / limitRateList.size()));
|
||||
children.setSize(filteredList9.size());
|
||||
children.setRatio(PubUtils.doubleRound(2, filteredList9.size() * 100.0 / monitorTotal));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public AssessDetailVo getAssessData(String deptId, String deptName, List<String> lineList, List<RStatAssesDPO> list1, List<PQSComAssesPO> list2, List<RStatLimitRateDPO> list3) {
|
||||
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);
|
||||
@@ -946,12 +958,61 @@ public class GridServiceImpl implements IGridService {
|
||||
//计算总稳态合格率
|
||||
double all1 = 100 - (devTime + freqTime + thdTime + ubalanceTime) * 100.0 / (allTime * 4);
|
||||
double all2 = 100 - pltTime * 100.0 / allFlickerTime;
|
||||
comAssess.setQualifyData(allTime <= 0 ? 3.14159 : PubUtils.doubleRound(2, (all1 + all2) / 2.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 / allFlickerTime));
|
||||
comAssess.setUnbalanceQualifyData(allTime <= 0 ? 3.14159 : PubUtils.doubleRound(2, 100 - ubalanceTime * 100.0 / allTime));
|
||||
|
||||
double data1,data2,data3,data4,data5,data6;
|
||||
if (Double.isNaN(all1+all2)) {
|
||||
data1 = 3.14159;
|
||||
} else if (Double.isInfinite(all1+all2)) {
|
||||
data1 = 100.0;
|
||||
} else {
|
||||
data1 = PubUtils.doubleRound(2, (all1 + all2) / 2.0);
|
||||
}
|
||||
|
||||
if (Double.isNaN(100 - devTime * 100.0 / allTime)) {
|
||||
data2 = 3.14159;
|
||||
} else if (Double.isInfinite(100 - devTime * 100.0 / allTime)) {
|
||||
data2 = 100.0;
|
||||
} else {
|
||||
data2 = PubUtils.doubleRound(2, 100 - devTime * 100.0 / allTime);
|
||||
}
|
||||
|
||||
if (Double.isNaN(100 - freqTime * 100.0 / allTime)) {
|
||||
data3 = 3.14159;
|
||||
} else if (Double.isInfinite(100 - freqTime * 100.0 / allTime)) {
|
||||
data3 = 100.0;
|
||||
} else {
|
||||
data3 = PubUtils.doubleRound(2, 100 - freqTime * 100.0 / allTime);
|
||||
}
|
||||
|
||||
if (Double.isNaN(100 - thdTime * 100.0 / allTime)) {
|
||||
data4 = 3.14159;
|
||||
} else if (Double.isInfinite(100 - thdTime * 100.0 / allTime)) {
|
||||
data4 = 100.0;
|
||||
} else {
|
||||
data4 = PubUtils.doubleRound(2, 100 - thdTime * 100.0 / allTime);
|
||||
}
|
||||
|
||||
if (Double.isNaN(100 - pltTime * 100.0 / allFlickerTime)) {
|
||||
data5 = 3.14159;
|
||||
} else if (Double.isInfinite(100 - pltTime * 100.0 / allFlickerTime)) {
|
||||
data5 = 100.0;
|
||||
} else {
|
||||
data5 = PubUtils.doubleRound(2, 100 - pltTime * 100.0 / allFlickerTime);
|
||||
}
|
||||
|
||||
if (Double.isNaN(100 - pltTime * 100.0 / allTime)) {
|
||||
data6 = 3.14159;
|
||||
} else if (Double.isInfinite(100 - pltTime * 100.0 / allTime)) {
|
||||
data6 = 100.0;
|
||||
} else {
|
||||
data6 = PubUtils.doubleRound(2, 100 - ubalanceTime * 100.0 / allTime);
|
||||
}
|
||||
comAssess.setQualifyData(allTime <= 0 ? 3.14159 : data1);
|
||||
comAssess.setVDevQualifyData(allTime <= 0 ? 3.14159 : data2);
|
||||
comAssess.setFreqQualifyData(allTime <= 0 ? 3.14159 : data3);
|
||||
comAssess.setHarmQualifyData(allTime <= 0 ? 3.14159 : data4);
|
||||
comAssess.setFlickerQualifyData(allTime <= 0 ? 3.14159 : data5);
|
||||
comAssess.setUnbalanceQualifyData(allTime <= 0 ? 3.14159 : data6);
|
||||
}
|
||||
}
|
||||
return comAssess;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
@@ -61,13 +62,23 @@ import com.njcn.harmonic.rstatlimitrate.mapper.RStatLimitRateDMapper;
|
||||
import com.njcn.harmonic.service.PollutionSubstationService;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.api.UserReportManageFeignClient;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -77,13 +88,6 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -129,6 +133,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final RmpEventDetailFeignClient detailFeignClient;
|
||||
private final CommLineClient commLineClient;
|
||||
private final UserReportManageFeignClient userReportManageFeignClient;
|
||||
|
||||
/**
|
||||
* @param pollutionSubstationQuryParam
|
||||
@@ -833,6 +838,37 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridDiagramVO getNewPollutionAlarmData(StatSubstationBizBaseParam param) {
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
deptGetLineParam.setIsUpToGrid(param.getIsUpToGrid());
|
||||
List<DeptGetSubStationDTO.Info> detSub = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
//获取全部变电站信息
|
||||
List<SubGetBase> collect = detSub.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList());
|
||||
GridDiagramVO vo = new GridDiagramVO();
|
||||
List<Double> info = new ArrayList<>();
|
||||
List<Double> gwInfo = new ArrayList<>();
|
||||
|
||||
|
||||
// if (CollUtil.isNotEmpty(subAll)) {
|
||||
// List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
|
||||
// .select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue)
|
||||
// .in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationM::getSubstationId, subAll)
|
||||
// .in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds())
|
||||
// .ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||
// .le(StrUtil.isNotBlank(param.getEndTime()), RStatPollutionSubstationM::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||
// );
|
||||
// info.addAll(substationMlist.stream().map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
|
||||
// gwInfo.addAll(substationMlist.stream()
|
||||
// .filter(x -> subGw.contains(x.getSubstationId()))
|
||||
// .map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
|
||||
// }
|
||||
vo.setInfo(info);
|
||||
vo.setGwInfo(gwInfo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PollutionGridDiagramDTO> getPollutionAlarmPageData(StatSubstationBizBaseParam param) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -889,7 +925,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList,
|
||||
Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
|
||||
// Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
|
||||
param.getIds(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> dept;
|
||||
@@ -911,6 +948,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(deptIndex);
|
||||
deptGetLineParam.setMonitorStateRunning(false);
|
||||
deptGetLineParam.setSearchValue(searchValue);
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
List<String> lineIds = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).flatMap(x -> x.getUnitChildrenList().stream()).distinct().collect(Collectors.toList());
|
||||
|
||||
@@ -925,17 +963,18 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAllOverTimes(lineList, startTime, endTime);
|
||||
Map<String, RStatLimitRateDPO> monitorMap = limitRateList.stream().collect(Collectors.toMap(RStatLimitRateDPO::getLineId, Function.identity()));
|
||||
//todo 获取监测点污染数据
|
||||
//谐波电压
|
||||
String v = dicDataFeignClient.getDicDataByCode(DicDataEnum.V_HARMONIC_LIMIT.getCode()).getData().getId();
|
||||
//谐波电流
|
||||
String i = dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL_LIMIT.getCode()).getData().getId();
|
||||
List<String> list = Arrays.asList(v, i);
|
||||
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectList(new LambdaQueryWrapper<RMpPollutionDPO>()
|
||||
.in(CollUtil.isNotEmpty(lineList), RMpPollutionDPO::getLineId, lineList)
|
||||
.in(CollUtil.isNotEmpty(list), RMpPollutionDPO::getPollutionType, list)
|
||||
.ge(StrUtil.isNotBlank(startTime), RMpPollutionDPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
||||
.le(StrUtil.isNotBlank(endTime), RMpPollutionDPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(endTime)))
|
||||
);
|
||||
//谐波电压
|
||||
String v = dicDataFeignClient.getDicDataByCode(DicDataEnum.V_HARMONIC.getCode()).getData().getId();
|
||||
List<RMpPollutionDPO> harmonicV = lineData.stream().filter(x -> v.equals(x.getPollutionType())).collect(Collectors.toList());
|
||||
|
||||
//谐波电流
|
||||
String i = dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId();
|
||||
List<RMpPollutionDPO> harmonicI = lineData.stream().filter(x -> i.equals(x.getPollutionType())).collect(Collectors.toList());
|
||||
|
||||
List<SubGetBase> subNameMap = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).distinct().collect(Collectors.toList());
|
||||
@@ -956,13 +995,14 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
}
|
||||
});
|
||||
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / unitChildrenList.size(), 2).doubleValue());
|
||||
OptionalDouble maxV = harmonicV.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
vo.setVPollutionData(maxV.isPresent() ? maxV.getAsDouble() : 0.0D);
|
||||
OptionalDouble maxI = harmonicI.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
vo.setIPollutionData(maxI.isPresent() ? maxV.getAsDouble() : 0.0D);
|
||||
double maxV = harmonicV.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).sum();
|
||||
vo.setVPollutionData(NumberUtil.round(maxV,2).doubleValue());
|
||||
double maxI = harmonicI.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).sum();
|
||||
vo.setIPollutionData(NumberUtil.round(maxI,2).doubleValue());
|
||||
result.add(vo);
|
||||
}
|
||||
}
|
||||
result.sort(Comparator.comparing(SubstationVo::getVPollutionData).reversed());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1115,6 +1155,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
PowerFlagPollution lineItemPollution = new PowerFlagPollution();
|
||||
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
|
||||
lineItemPollution.setVHarmonicValue(linePollution.getHarmonicValue());
|
||||
lineItemPollution.setSubName(linePollution.getSubStationName());
|
||||
lineItemPollutionList.add(lineItemPollution);
|
||||
}
|
||||
substationPollution.setPowerFlagPollutionList(lineItemPollutionList);
|
||||
@@ -1154,6 +1195,138 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaPollution> getAreaPollution(StatSubstationBizBaseParam param) {
|
||||
List<AreaPollution> info = new ArrayList<>();
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
deviceInfoParam.setDeptIndex(param.getId());
|
||||
deviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<GeneralDeviceDTO> deptData = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIdList = deptData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(lineIdList)) {
|
||||
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData();
|
||||
Map<String, String> deptId = deptList.stream().filter(x ->!x.getId().equals("46364ea96a55095ebc250be698d5262c") &&
|
||||
!x.getId().equals("a3069759b0b6072c99cf9a7af6c162e9")).collect(Collectors.toMap(DeptDTO::getArea, DeptDTO::getId));
|
||||
|
||||
List<RMpPollutionDPO> pollutionList = rMpPollutionDPOMapper.selectSumList(lineIdList, param.getIds(), param.getStartTime(), param.getEndTime());
|
||||
Map<String, Double> pollutionMap = pollutionList.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId, RMpPollutionDPO::getValue));
|
||||
|
||||
List<PollutionLineInfoDTO> lineDetailList = commLineClient.getPollutionLineInfo(lineIdList).getData();
|
||||
List<String> ids = deptData.stream()
|
||||
.filter(x -> x.getIndex().equals("46364ea96a55095ebc250be698d5262c") ||
|
||||
x.getIndex().equals("a3069759b0b6072c99cf9a7af6c162e9"))
|
||||
.flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
//获取到了部门风光储和超高压的其他部门信息
|
||||
Map<String, List<String>> fgIds = lineDetailList
|
||||
.stream().filter(x -> ids.contains(x.getLineId()))
|
||||
.collect(Collectors.groupingBy(x -> deptId.get(x.getActualArea()), Collectors.mapping(PollutionLineInfoDTO::getLineId, Collectors.toList())));
|
||||
for (GeneralDeviceDTO dto : deptData) {
|
||||
if (dto.getIndex().equals("46364ea96a55095ebc250be698d5262c") ||
|
||||
dto.getIndex().equals("a3069759b0b6072c99cf9a7af6c162e9")) {
|
||||
break;
|
||||
}
|
||||
if (fgIds.containsKey(dto.getIndex())) {
|
||||
dto.getLineIndexes().addAll(fgIds.get(dto.getIndex()));
|
||||
}
|
||||
List<PowerFlagPollution> linePollutionList = new ArrayList<>();
|
||||
AreaPollution pollution = new AreaPollution();
|
||||
pollution.setDeptName(dto.getName());
|
||||
pollution.setDeptId(dto.getIndex());
|
||||
List<PollutionLineInfoDTO> lineDetails = lineDetailList.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||
PowerFlagPollution pollution1;
|
||||
for (PollutionLineInfoDTO lineDetail : lineDetails) {
|
||||
pollution1 = new PowerFlagPollution();
|
||||
pollution1.setSubName(lineDetail.getSubStationName());
|
||||
pollution1.setLineName(lineDetail.getLineName());
|
||||
pollution1.setDevName(lineDetail.getDevName());
|
||||
pollution1.setManufacturer(lineDetail.getManufacturer());
|
||||
pollution1.setDevType(lineDetail.getDevType());
|
||||
pollution1.setLoginTime(lineDetail.getLoginTime());
|
||||
pollution1.setInterval(lineDetail.getTimeInterval());
|
||||
pollution1.setPowerFlag(lineDetail.getPowerFlag());
|
||||
pollution1.setLoadType(lineDetail.getLoadType());
|
||||
pollution1.setObjName(lineDetail.getObjName());
|
||||
pollution1.setVHarmonicValue(pollutionMap.containsKey(lineDetail.getLineId()) ? NumberUtil.round(pollutionMap.get(lineDetail.getLineId()), 2).doubleValue() : 0.0);
|
||||
linePollutionList.add(pollution1);
|
||||
}
|
||||
pollution.setPowerFlagPollutionList(linePollutionList.stream().sorted(Comparator.comparing(PowerFlagPollution::getVHarmonicValue).reversed()).collect(Collectors.toList()));
|
||||
pollution.setScore(NumberUtil.round(linePollutionList.stream().mapToDouble(PowerFlagPollution::getVHarmonicValue).sum(), 2).doubleValue());
|
||||
info.add(pollution);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubstationPollution> downPollutionSensitiveUser(StatSubstationBizBaseParam param) {
|
||||
List<SubstationPollution> result = new ArrayList<>();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getDeptId());
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
deptGetLineParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
List<String> lineList = list.stream()
|
||||
.flatMap(dto -> dto.getLineBaseList().stream().map(LineDevGetDTO::getPointId))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//全部监测点污染值
|
||||
List<LinePollution> finalLinePollutionList = pollutionCalcList(param,lineList);
|
||||
//根据变电站分组
|
||||
Map<String, List<LinePollution>> linePollutionMap = finalLinePollutionList.stream().collect(Collectors.groupingBy(LinePollution::getSubStationName));
|
||||
//获取部门id
|
||||
SensitiveUserParam sensitiveUserParam = new SensitiveUserParam();
|
||||
sensitiveUserParam.setDeptId(param.getDeptId());
|
||||
sensitiveUserParam.setProjectName(param.getSearchValue());
|
||||
List<UserReportPO> userReportPOList = userReportManageFeignClient.getSensitiveUserByDept(sensitiveUserParam).getData();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
userReportPOList.forEach(item -> {
|
||||
if (ObjectUtil.isNotNull(item.getSubstation()) && !Objects.equals(item.getSubstation(), "")) {
|
||||
List<BigDecimal> value = new ArrayList<>();
|
||||
List<PowerFlagPollution> ll = new ArrayList<>();
|
||||
String[] parts = item.getSubstation().split("、");
|
||||
for (String part : parts) {
|
||||
// 移除数字+kV和"变电站"
|
||||
String name = part.replaceAll("\\d+kV", "").replace("变电站", "");
|
||||
//根据变电站名称获取污染值
|
||||
for (Map.Entry<String, List<LinePollution>> entry : linePollutionMap.entrySet()) {
|
||||
if (entry.getKey().contains(name)) {
|
||||
BigDecimal v = BigDecimal.valueOf(entry.getValue().stream().mapToDouble(LinePollution::getHarmonicValue).average().getAsDouble());
|
||||
value.add(v);
|
||||
for (LinePollution pojo : entry.getValue()) {
|
||||
PowerFlagPollution lineItemPollution = new PowerFlagPollution();
|
||||
BeanUtil.copyProperties(pojo, lineItemPollution, true);
|
||||
lineItemPollution.setVHarmonicValue(pojo.getHarmonicValue());
|
||||
lineItemPollution.setSubName(pojo.getSubStationName());
|
||||
ll.add(lineItemPollution);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SubstationPollution linePollution = new SubstationPollution();
|
||||
linePollution.setGdName(item.getCity());
|
||||
linePollution.setSubStationName(item.getSubstation());
|
||||
linePollution.setProjectName(item.getProjectName());
|
||||
if (CollectionUtil.isEmpty(ll)) {
|
||||
linePollution.setSubValue(null);
|
||||
} else {
|
||||
linePollution.setSubValue(BigDecimal.valueOf(value.stream()
|
||||
.mapToDouble(BigDecimal::doubleValue)
|
||||
.average()
|
||||
.orElse(0.0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
linePollution.setPowerFlagPollutionList(ll);
|
||||
}
|
||||
result.add(linePollution);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.sort(Comparator.comparing(SubstationPollution::getSubValue,Comparator.nullsLast(Comparator.reverseOrder())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private List<String> addList(List<RMpPollutionDPO> pollLinelist, List<SubGetBase> notNum) {
|
||||
List<String> info = new ArrayList<>();
|
||||
|
||||
@@ -72,10 +72,12 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
List<Dept> data = deptFeignClient.getDirectSonSelf(param.getId()).getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
deptGetLineParam.setMonitorStateRunning(false);
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
|
||||
List<String> lineIDS = deptGetChildrenMoreDTOS.stream()
|
||||
.flatMap(x -> x.getStationIds().stream().flatMap(l -> l.getUnitChildrenList().stream()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//根据r_stat_limit_target_d来判断是否告警allTime flicker_overtime
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.harmonic.service.IRStatLimitTargetDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,11 @@ public class RStatLimitTargetDServiceImpl extends ServiceImpl<RStatLimitTargetDM
|
||||
return this.baseMapper.getLinesTarget(param.getIds(),param.getStartTime(),param.getEndTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLinesHarmTarget(StatSubstationBizBaseParam param) {
|
||||
return this.baseMapper.getLinesHarmTarget(param.getIds(), param.getStartTime(), param.getEndTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RStatLimitTargetCountVO getGridDiagramTargetData(StatisticsBizBaseParam param) {
|
||||
List<RStatLimitTargetCountVO> sumTargetDetails = this.baseMapper.getSumTargetCountDayes(Arrays.asList(param.getId()),
|
||||
|
||||
@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.harmonic.mapper.RStatDataHarmRateVDMapper;
|
||||
import com.njcn.harmonic.mapper.RStatDataIDMapper;
|
||||
import com.njcn.harmonic.mapper.RStatDataInharmVDMapper;
|
||||
import com.njcn.harmonic.mapper.ReportMapper;
|
||||
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
|
||||
import com.njcn.harmonic.pojo.param.ReportQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
|
||||
@@ -32,6 +34,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
private final ReportMapper reportMapper;
|
||||
private final IRStatDataVDService statDataVDService;
|
||||
private final RStatDataHarmRateVDMapper rStatDataHarmRateVDMapper;
|
||||
private final RStatDataIDMapper rStatDataIDMapper;
|
||||
private final RStatDataInharmVDMapper rStatDataInharmVDMapper;
|
||||
|
||||
@@ -220,7 +223,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
//获取电压含有率,不包含基波
|
||||
List<ReportValue> listRate = dataV(param, Arrays.asList("A", "B", "C"), 2, 51, false, 1);
|
||||
List<ReportValue> listRate = dataHarmV(param, Arrays.asList("A", "B", "C"), 2, 51, false, 1);
|
||||
|
||||
if (CollUtil.isEmpty(listRate)) {
|
||||
for (int i = 0; i < 49; i++) {
|
||||
@@ -382,6 +385,76 @@ public class ReportServiceImpl implements ReportService {
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* 电压信息
|
||||
*
|
||||
* @param param 查询条件
|
||||
* @param valueTypes 区分类别 例如"A","B","C"
|
||||
* @param num 循环开始
|
||||
* @param size 循环结束
|
||||
* @param fly 否是启用获取属性电压
|
||||
* @param index 获取属性位置名称
|
||||
* @return
|
||||
*/
|
||||
private List<ReportValue> dataHarmV(ReportQueryParam param, List<String> valueTypes, Integer num, Integer size, Boolean fly, Integer index) {
|
||||
List<RStatDataHarmrateVDPO> harmRateVDPOS = rStatDataHarmRateVDMapper.selectList(new LambdaQueryWrapper<RStatDataHarmrateVDPO>()
|
||||
.eq(RStatDataHarmrateVDPO::getLineId, param.getLineId())
|
||||
.in(CollUtil.isNotEmpty(valueTypes), RStatDataHarmrateVDPO::getPhaseType, valueTypes)
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataHarmrateVDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataHarmrateVDPO::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||
);
|
||||
String max = "MAX";
|
||||
String avg = "AVG";
|
||||
String min = "MIN";
|
||||
String cp95 = "CP95";
|
||||
List<ReportValue> a = new ArrayList<>();
|
||||
Map<String, List<RStatDataHarmrateVDPO>> collect = harmRateVDPOS.stream().collect(Collectors.groupingBy(RStatDataHarmrateVDPO::getPhaseType));
|
||||
collect.forEach((key, value) -> {
|
||||
Map<String, List<RStatDataHarmrateVDPO>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataHarmrateVDPO::getValueType));
|
||||
|
||||
for (int i = num; i < size; i++) {
|
||||
ReportValue reportValue = new ReportValue();
|
||||
String attribute = "";
|
||||
if (fly) {
|
||||
if (index == 0) {
|
||||
attribute = attributeV(i);
|
||||
} else {
|
||||
attribute = attributeV(index);
|
||||
}
|
||||
} else {
|
||||
attribute = "v" + i;
|
||||
}
|
||||
|
||||
if (valueTypeMap.containsKey(max)) {
|
||||
List<Float> aa = reflectDataHarmV(valueTypeMap.get(max), max, attribute);
|
||||
reportValue.setPhaseType(key);
|
||||
Float maxNum = aa.stream().distinct().max(Float::compareTo).get();
|
||||
reportValue.setFmaxValue(maxNum);
|
||||
}
|
||||
if (valueTypeMap.containsKey(avg)) {
|
||||
List<Float> aa = reflectDataHarmV(valueTypeMap.get(avg), avg, attribute);
|
||||
reportValue.setPhaseType(key);
|
||||
Double avgNum = aa.stream().distinct().collect(Collectors.averagingDouble(Float::doubleValue));
|
||||
reportValue.setMeanValue(avgNum.floatValue());
|
||||
}
|
||||
if (valueTypeMap.containsKey(min)) {
|
||||
List<Float> aa = reflectDataHarmV(valueTypeMap.get(min), min, attribute);
|
||||
reportValue.setPhaseType(key);
|
||||
double minNum = aa.stream().distinct().min(Float::compareTo).get();
|
||||
reportValue.setMinValue((float) minNum);
|
||||
}
|
||||
if (valueTypeMap.containsKey(cp95)) {
|
||||
List<Float> aa = reflectDataHarmV(valueTypeMap.get(cp95), cp95, attribute);
|
||||
reportValue.setPhaseType(key);
|
||||
List<Float> cp95Num = aa.stream().distinct().sorted(Comparator.comparing(Float::doubleValue).reversed()).collect(Collectors.toList());
|
||||
reportValue.setCp95Value(cp95Num.get(0).floatValue());
|
||||
}
|
||||
a.add(reportValue);
|
||||
}
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* 电压反射取属性值
|
||||
*
|
||||
@@ -411,6 +484,27 @@ public class ReportServiceImpl implements ReportService {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Float> reflectDataHarmV(List<RStatDataHarmrateVDPO> value, String name, String attribute) {
|
||||
Field field = null;
|
||||
try {
|
||||
field = RStatDataHarmrateVDPO.class.getDeclaredField(attribute);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
field.setAccessible(true);
|
||||
|
||||
Field finalField = field;
|
||||
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
|
||||
Double o = null;
|
||||
try {
|
||||
o = (Double) finalField.get(temp);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return o.floatValue();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 电压反射取属性值
|
||||
*
|
||||
|
||||
@@ -81,33 +81,56 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
|
||||
@Override
|
||||
public SteadyQualifyCensusVO getSteadyQualifyCensus(DeviceInfoParam.BusinessParam steadyCensusParam) {
|
||||
List<SteadyQualifyVO> steadyQualifyList = getSteadyQualifyData(steadyCensusParam);
|
||||
SteadyQualifyCensusVO steadyQualifyCensusVO = new SteadyQualifyCensusVO();
|
||||
List<String> type = new ArrayList<>();
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyCensusParam).getData();
|
||||
List<Double> harmonicVoltage = new ArrayList<>(), voltageOffset = new ArrayList<>(),
|
||||
VoltageUnbalance = new ArrayList<>(), interHarmonic = new ArrayList<>(),
|
||||
harmonicCurrent = new ArrayList<>(), negativeCurrent = new ArrayList<>(),
|
||||
freqOffset = new ArrayList<>(), flicker = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(deviceDataList)) {
|
||||
for (GeneralDeviceDTO generalDeviceDTO : deviceDataList) {
|
||||
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
continue;
|
||||
}
|
||||
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
List<RStatLimitRateDPO> qualifiesRate = getQualifiesRate(lineIndexes, steadyCensusParam.getSearchBeginTime(), steadyCensusParam.getSearchEndTime());
|
||||
SteadyQualifyVO dataMoreMonitorMoreDay = getDataMoreMonitorMoreDay(qualifiesRate);
|
||||
harmonicVoltage.add(dataMoreMonitorMoreDay.getHarmonicVoltage());
|
||||
voltageOffset.add(dataMoreMonitorMoreDay.getVoltageOffset());
|
||||
VoltageUnbalance.add(dataMoreMonitorMoreDay.getVoltageUnbalance());
|
||||
interHarmonic.add(dataMoreMonitorMoreDay.getInterHarmonic());
|
||||
harmonicCurrent.add(dataMoreMonitorMoreDay.getHarmonicCurrent());
|
||||
negativeCurrent.add(dataMoreMonitorMoreDay.getNegativeCurrent());
|
||||
freqOffset.add(dataMoreMonitorMoreDay.getFreqOffset());
|
||||
flicker.add(dataMoreMonitorMoreDay.getFlicker());
|
||||
if (CollUtil.isNotEmpty(steadyQualifyList)) {
|
||||
for (SteadyQualifyVO steadyQualifyVO : steadyQualifyList) {
|
||||
// 还需要递归出有多少个测点
|
||||
int lineNum = seekLineNum(steadyQualifyVO);
|
||||
type.add(steadyQualifyVO.getName() + "\n(" + lineNum + ")");
|
||||
harmonicVoltage.add(steadyQualifyVO.getHarmonicVoltage());
|
||||
voltageOffset.add(steadyQualifyVO.getVoltageOffset());
|
||||
VoltageUnbalance.add(steadyQualifyVO.getVoltageUnbalance());
|
||||
interHarmonic.add(steadyQualifyVO.getInterHarmonic());
|
||||
harmonicCurrent.add(steadyQualifyVO.getHarmonicCurrent());
|
||||
negativeCurrent.add(steadyQualifyVO.getNegativeCurrent());
|
||||
freqOffset.add(steadyQualifyVO.getFreqOffset());
|
||||
flicker.add(steadyQualifyVO.getFlicker());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// List<String> type = new ArrayList<>();
|
||||
// //按照条件获取实际运行终端综合信息
|
||||
// List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyCensusParam).getData();
|
||||
// List<Double> harmonicVoltage = new ArrayList<>(), voltageOffset = new ArrayList<>(),
|
||||
// VoltageUnbalance = new ArrayList<>(), interHarmonic = new ArrayList<>(),
|
||||
// harmonicCurrent = new ArrayList<>(), negativeCurrent = new ArrayList<>(),
|
||||
// freqOffset = new ArrayList<>(), flicker = new ArrayList<>();
|
||||
// if (!CollectionUtils.isEmpty(deviceDataList)) {
|
||||
// for (GeneralDeviceDTO generalDeviceDTO : deviceDataList) {
|
||||
// List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
// if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
// continue;
|
||||
// }
|
||||
// type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
// List<RStatLimitRateDPO> qualifiesRate = getQualifiesRate(lineIndexes, steadyCensusParam.getSearchBeginTime(), steadyCensusParam.getSearchEndTime());
|
||||
// SteadyQualifyVO dataMoreMonitorMoreDay = getDataMoreMonitorMoreDay(qualifiesRate);
|
||||
// harmonicVoltage.add(dataMoreMonitorMoreDay.getHarmonicVoltage());
|
||||
// voltageOffset.add(dataMoreMonitorMoreDay.getVoltageOffset());
|
||||
// VoltageUnbalance.add(dataMoreMonitorMoreDay.getVoltageUnbalance());
|
||||
// interHarmonic.add(dataMoreMonitorMoreDay.getInterHarmonic());
|
||||
// harmonicCurrent.add(dataMoreMonitorMoreDay.getHarmonicCurrent());
|
||||
// negativeCurrent.add(dataMoreMonitorMoreDay.getNegativeCurrent());
|
||||
// freqOffset.add(dataMoreMonitorMoreDay.getFreqOffset());
|
||||
// flicker.add(dataMoreMonitorMoreDay.getFlicker());
|
||||
// }
|
||||
// }
|
||||
steadyQualifyCensusVO.setHarmonicVoltage(harmonicVoltage);
|
||||
steadyQualifyCensusVO.setVoltageOffset(voltageOffset);
|
||||
steadyQualifyCensusVO.setVoltageUnbalance(VoltageUnbalance);
|
||||
@@ -121,6 +144,25 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
return steadyQualifyCensusVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归出有多少个测点
|
||||
*
|
||||
* @param steadyQualifyVO 最上层的信息
|
||||
*/
|
||||
private int seekLineNum(SteadyQualifyVO steadyQualifyVO) {
|
||||
List<SteadyQualifyVO> children = steadyQualifyVO.getChildren();
|
||||
// 如果没有子节点,说明当前就是最底层节点,计数1
|
||||
if (children == null || children.isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
// 如果有子节点,递归计算所有子节点的最底层节点总数
|
||||
int total = 0;
|
||||
for (SteadyQualifyVO child : children) {
|
||||
total += seekLineNum(child);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SteadyQualifyVO> getEnterpriseSteadyQualify(DeviceInfoParam.BusinessParam steadyParam) {
|
||||
List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>();
|
||||
@@ -365,7 +407,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
steadyQualifyDTO.getIharm24Overtime() +
|
||||
steadyQualifyDTO.getIharm25Overtime())));
|
||||
//间谐波电压含有率
|
||||
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime()*16, (steadyQualifyDTO.getInuharm1Overtime() +
|
||||
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime() * 16, (steadyQualifyDTO.getInuharm1Overtime() +
|
||||
steadyQualifyDTO.getInuharm2Overtime() +
|
||||
steadyQualifyDTO.getInuharm3Overtime() +
|
||||
steadyQualifyDTO.getInuharm4Overtime() +
|
||||
@@ -497,7 +539,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
return 3.14159;
|
||||
} else {
|
||||
if (allTime >= overTime) {
|
||||
return NumberUtil.round((1 - ((double) overTime /allTime)) * 100, 2).doubleValue();
|
||||
return NumberUtil.round((1 - ((double) overTime / allTime)) * 100, 2).doubleValue();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.njcn.harmonic.mapper.THDistortionMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpVThd;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
@@ -102,20 +103,23 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
@Override
|
||||
public THDistortionCensusVO getTHDistortionCensus(DeviceInfoParam.BusinessParam thDistortionCensusParam) {
|
||||
List<THDistortionVO> thDistortionVOS = getTHDistortionData(thDistortionCensusParam, 0);
|
||||
|
||||
THDistortionCensusVO distortionCensusVO = new THDistortionCensusVO();
|
||||
thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName());
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData();
|
||||
// thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName());
|
||||
// List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData();
|
||||
List<String> type = new ArrayList<>();
|
||||
List<Double> single = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
continue;
|
||||
}
|
||||
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
|
||||
single.add(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
|
||||
if (!CollectionUtils.isEmpty(thDistortionVOS)) {
|
||||
for (THDistortionVO thDistortionVO : thDistortionVOS) {
|
||||
// List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
// if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
// continue;
|
||||
// }
|
||||
// type.add(thDistortionVO.getName() + "\n(" + seekLineNum(thDistortionVO) + ")");
|
||||
type.add(thDistortionVO.getName() );
|
||||
// List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
|
||||
single.add(thDistortionVO.getDistortion());
|
||||
}
|
||||
distortionCensusVO.setType(type);
|
||||
distortionCensusVO.setSingle(single);
|
||||
@@ -123,6 +127,25 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
return distortionCensusVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归出有多少个测点
|
||||
*
|
||||
* @param thDistortionVO 最上层的信息
|
||||
*/
|
||||
private int seekLineNum(THDistortionVO thDistortionVO) {
|
||||
List<THDistortionVO> children = thDistortionVO.getChildren();
|
||||
// 如果没有子节点,说明当前就是最底层节点,计数1
|
||||
if (children == null || children.isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
// 如果有子节点,递归计算所有子节点的最底层节点总数
|
||||
int total = 0;
|
||||
for (THDistortionVO child : children) {
|
||||
total += seekLineNum(child);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param statisticsBizBaseParam
|
||||
* @Description: 谐波总畸变率前十列表
|
||||
|
||||
@@ -74,89 +74,90 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
private final DistributionMonitorClient distributionMonitorClient;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<RStatLimitTargetDPO> monitorIdsGetLimitTargetInfo(String date, List<String> monitorIds) {
|
||||
return rStatLimitTargetDMapper.selectList(new LambdaQueryWrapper<RStatLimitTargetDPO>().in(RStatLimitTargetDPO::getLineId,monitorIds)
|
||||
.eq(RStatLimitTargetDPO::getTime,date).gt(RStatLimitTargetDPO::getAllTime,0));
|
||||
return rStatLimitTargetDMapper.selectList(new LambdaQueryWrapper<RStatLimitTargetDPO>().in(RStatLimitTargetDPO::getLineId, monitorIds)
|
||||
.eq(RStatLimitTargetDPO::getTime, date).gt(RStatLimitTargetDPO::getAllTime, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatLimitTargetVO> monitorOverLimitDays(String date, String endDate, List<String> monitorIds) {
|
||||
return rStatLimitTargetDMapper.getSumTargetDetails(monitorIds,date,endDate);
|
||||
return rStatLimitTargetDMapper.getSumTargetDetails(monitorIds, date, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridDiagramVO.LineData> getGridDiagramLineData(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<GridDiagramVO.LineData> info=new ArrayList<>();
|
||||
List<GridDiagramVO.LineData> info = new ArrayList<>();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> list = data.stream().sorted(Comparator.comparing(x -> x.getLineIndexes().size(),Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
List<GeneralDeviceDTO> list = data.stream().sorted(Comparator.comparing(x -> x.getLineIndexes().size(), Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
//终端总数量
|
||||
List<String> devIds = list.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
//监测点总数量
|
||||
List<String> lineIds = list.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
//超标监测点信息
|
||||
List<RStatLimitTargetVO> limitTargetList =new ArrayList<>();
|
||||
List<RStatIntegrityD> integrityList =new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(lineIds)){
|
||||
limitTargetList = rStatLimitTargetDMapper.getSumTargetDetails(lineIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())).toString());
|
||||
List<String> limitTargetList = new ArrayList<>();
|
||||
List<RStatIntegrityD> integrityList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
StatSubstationBizBaseParam baseParam = new StatSubstationBizBaseParam();
|
||||
baseParam.setIds(lineIds);
|
||||
baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())).toString());
|
||||
baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())).toString());
|
||||
limitTargetList = targetDService.getLinesHarmTarget(baseParam);
|
||||
integrityList = lineIntegrityClient.getIntegrityByLineIds(lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime()).getData();
|
||||
}
|
||||
//终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateList =new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
OnlineRateParam param=new OnlineRateParam();
|
||||
List<RStatOnlineRateVO> onlineRateList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
OnlineRateParam param = new OnlineRateParam();
|
||||
param.setIds(devIds);
|
||||
param.setStartTime(deviceInfoParam.getSearchBeginTime());
|
||||
param.setEndTime(deviceInfoParam.getSearchEndTime());
|
||||
onlineRateList = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
}
|
||||
List<GeneralDeviceDTO> topList=new ArrayList<>();
|
||||
List<GeneralDeviceDTO> otherList=new ArrayList<>();
|
||||
if(ObjectUtil.isNotNull(deviceInfoParam.getStatisticalType())){
|
||||
List<GeneralDeviceDTO> topList = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> otherList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(deviceInfoParam.getStatisticalType())) {
|
||||
SimpleDTO statisticalType = deviceInfoParam.getStatisticalType();
|
||||
if(!StatisticsEnum.POWER_NETWORK.getCode().equals(statisticalType.getCode())){
|
||||
if(list.size()>4){
|
||||
if (!StatisticsEnum.POWER_NETWORK.getCode().equals(statisticalType.getCode())) {
|
||||
if (list.size() > 4) {
|
||||
topList.addAll(list.subList(0, 4));
|
||||
otherList.addAll(list.subList(4, list.size()));
|
||||
}else{
|
||||
if(list.size()>3){
|
||||
} else {
|
||||
if (list.size() > 3) {
|
||||
topList.addAll(list.subList(0, 3));
|
||||
otherList.addAll(list.subList(3, list.size()));
|
||||
}else{
|
||||
if(list.size()>2){
|
||||
} else {
|
||||
if (list.size() > 2) {
|
||||
topList.addAll(list.subList(0, 2));
|
||||
otherList.addAll(list.subList(2, list.size()));
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list.subList(0, 1));
|
||||
otherList.addAll(list.subList(1, list.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list);
|
||||
}
|
||||
GridDiagramVO.LineData lineData;
|
||||
for (GeneralDeviceDTO dto : topList) {
|
||||
lineData=new GridDiagramVO.LineData();
|
||||
lineData = new GridDiagramVO.LineData();
|
||||
lineData.setOrgId(dto.getIndex());
|
||||
lineData.setOrgName(dto.getName()+"("+dto.getLineIndexes().size()+")");
|
||||
onLineAndIntegrity(dto.getLineIndexes(), integrityList, dto.getDeviceIndexes(), onlineRateList,limitTargetList, lineData);
|
||||
lineData.setOrgName(dto.getName() + "(" + dto.getLineIndexes().size() + ")");
|
||||
onLineAndIntegrity(dto.getLineIndexes(), integrityList, dto.getDeviceIndexes(), onlineRateList, limitTargetList, lineData);
|
||||
info.add(lineData);
|
||||
}
|
||||
if(CollUtil.isNotEmpty(otherList)){
|
||||
if (CollUtil.isNotEmpty(otherList)) {
|
||||
List<String> otherDevIds = otherList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<String> otherLineIds = otherList.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
lineData=new GridDiagramVO.LineData();
|
||||
lineData = new GridDiagramVO.LineData();
|
||||
lineData.setOrgId("123456");
|
||||
lineData.setOrgName("其他("+otherLineIds.size()+")");
|
||||
onLineAndIntegrity(otherLineIds, integrityList, otherDevIds, onlineRateList,limitTargetList, lineData);
|
||||
lineData.setOrgName("其他(" + otherLineIds.size() + ")");
|
||||
onLineAndIntegrity(otherLineIds, integrityList, otherDevIds, onlineRateList, limitTargetList, lineData);
|
||||
info.add(lineData);
|
||||
}
|
||||
return info;
|
||||
@@ -166,7 +167,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
public List<GridDiagramVO.AreaData> getGridDiagramAreaData(DeviceInfoParam.BusinessParam param) {
|
||||
List<GridDiagramVO.AreaData> info = new ArrayList<>();
|
||||
param.setLineRunFlag(0);
|
||||
GridDiagramVO.AreaData areaData ;
|
||||
GridDiagramVO.AreaData areaData;
|
||||
//监测点总数
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
//在线
|
||||
@@ -183,11 +184,11 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
Map<String, DeptGetSubStationDTO.Info> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetSubStationDTO.Info::getUnitId, Function.identity()));
|
||||
|
||||
StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam();
|
||||
StatSubstationBizBaseParam baseParam = new StatSubstationBizBaseParam();
|
||||
baseParam.setIds(onLine);
|
||||
baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
|
||||
baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> linesTarget=targetDService.getLinesTarget(baseParam);
|
||||
List<String> linesTarget = targetDService.getLinesHarmTarget(baseParam);
|
||||
List<RStatIntegrityD> integrityDS = lineIntegrityClient.getIntegrityByLineIds(onLine,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()).getData();
|
||||
@@ -200,7 +201,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
areaData.setLineNum(datum.getLineIndexes().size());
|
||||
areaData.setLineList(datum.getLineIndexes());
|
||||
areaData.setDeviceNum(datum.getDeviceIndexes().size());
|
||||
if(onMap.containsKey(datum.getIndex())){
|
||||
if (onMap.containsKey(datum.getIndex())) {
|
||||
GeneralDeviceDTO dto = onMap.get(datum.getIndex());
|
||||
areaData.setOnlineNum(dto.getLineIndexes().size());
|
||||
areaData.setOnlineList(dto.getLineIndexes());
|
||||
@@ -221,7 +222,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
if (0 == param.getMonitorFlag()) {
|
||||
lineIds.addAll(x.getUnitChildrenList());
|
||||
onlineIds.addAll(x.getUnitChildrenList().stream().filter(d -> onLine.contains(d)).collect(Collectors.toList()));
|
||||
}else {
|
||||
} else {
|
||||
lineIds.addAll(x.getGwUnitChildrenList());
|
||||
onlineIds.addAll(x.getGwUnitChildrenList().stream().filter(d -> onLine.contains(d)).collect(Collectors.toList()));
|
||||
}
|
||||
@@ -268,21 +269,20 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
List<GeneralDeviceDTO> onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
List<String> online = onData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
|
||||
StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam();
|
||||
StatSubstationBizBaseParam baseParam = new StatSubstationBizBaseParam();
|
||||
baseParam.setIds(online);
|
||||
baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
|
||||
baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> linesTarget=targetDService.getLinesTarget(baseParam);
|
||||
List<RStatIntegrityD> integrityDS = lineIntegrityClient.getIntegrityByLineIds(online,
|
||||
List<String> linesTarget = targetDService.getLinesHarmTarget(baseParam);
|
||||
List<RStatIntegrityD> integrityDS = lineIntegrityClient.getIntegrityByLineIds(line,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()).getData();
|
||||
List<String> integrityDS0 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
//在线率大于90的点
|
||||
List<String> integrityDS90 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
|
||||
//合格-告警
|
||||
GridDiagramVO.RunData alarmData=new GridDiagramVO.RunData();
|
||||
List<String> lineAlarm = new ArrayList<>();
|
||||
lineAlarm.addAll(integrityDS0.stream().filter(d -> !linesTarget.contains(d)).distinct().collect(Collectors.toList()));
|
||||
List<String> alarm = lineAlarm.stream().distinct().collect(Collectors.toList());
|
||||
GridDiagramVO.RunData alarmData = new GridDiagramVO.RunData();
|
||||
List<String> alarm = integrityDS90.stream().filter(d -> !linesTarget.contains(d)).distinct().collect(Collectors.toList());
|
||||
List<String> us = line.stream().filter(x -> !alarm.contains(x)).distinct().collect(Collectors.toList());
|
||||
alarmData.setLineNumOne(alarm.size());
|
||||
alarmData.setLineListOne(alarm);
|
||||
@@ -291,7 +291,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
info.add(alarmData);
|
||||
|
||||
//在线-离线
|
||||
GridDiagramVO.RunData runData=new GridDiagramVO.RunData();
|
||||
GridDiagramVO.RunData runData = new GridDiagramVO.RunData();
|
||||
List<String> Offline = line.stream().filter(x -> !online.contains(x)).distinct().collect(Collectors.toList());
|
||||
runData.setLineNumOne(online.size());
|
||||
runData.setLineListOne(online);
|
||||
@@ -300,9 +300,8 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
info.add(runData);
|
||||
|
||||
//数据完整性≥90% - <90%
|
||||
GridDiagramVO.RunData integrityData=new GridDiagramVO.RunData();
|
||||
List<String> integrityDS90 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
List<String> integrity = online.stream().filter(x -> !integrityDS90.contains(x)).distinct().collect(Collectors.toList());
|
||||
GridDiagramVO.RunData integrityData = new GridDiagramVO.RunData();
|
||||
List<String> integrity = line.stream().filter(x -> !integrityDS90.contains(x)).distinct().collect(Collectors.toList());
|
||||
integrityData.setLineNumOne(integrityDS90.size());
|
||||
integrityData.setLineListOne(integrityDS90);
|
||||
integrityData.setLineNumTwo(integrity.size());
|
||||
@@ -311,8 +310,8 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
|
||||
|
||||
//电能质量指标未超标-超标
|
||||
GridDiagramVO.RunData targetData=new GridDiagramVO.RunData();
|
||||
List<String> integrityS = online.stream().filter(x -> !linesTarget.contains(x)).distinct().collect(Collectors.toList());
|
||||
GridDiagramVO.RunData targetData = new GridDiagramVO.RunData();
|
||||
List<String> integrityS = line.stream().filter(x -> !linesTarget.contains(x)).distinct().collect(Collectors.toList());
|
||||
targetData.setLineNumOne(integrityS.size());
|
||||
targetData.setLineListOne(integrityS);
|
||||
targetData.setLineNumTwo(linesTarget.size());
|
||||
@@ -324,63 +323,63 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
|
||||
@Override
|
||||
public Page<MonitorLimitRateVO> pwMonitorLimitData(PwUserMonitorParam pwUserMonitorParam) {
|
||||
Page<MonitorLimitRateVO> pageResult = new Page<>(PageFactory.getPageNum(pwUserMonitorParam),PageFactory.getPageSize(pwUserMonitorParam));
|
||||
Page<MonitorLimitRateVO> pageResult = new Page<>(PageFactory.getPageNum(pwUserMonitorParam), PageFactory.getPageSize(pwUserMonitorParam));
|
||||
List<PwUserMonitorDataVO> pwUserMonitorDataVOList = distributionMonitorClient.getPwUserIds(pwUserMonitorParam).getData();
|
||||
if(CollUtil.isEmpty(pwUserMonitorDataVOList)){
|
||||
if (CollUtil.isEmpty(pwUserMonitorDataVOList)) {
|
||||
return pageResult;
|
||||
}
|
||||
List<String> ids = pwUserMonitorDataVOList.stream().map(PwUserMonitorDataVO::getId).collect(Collectors.toList());
|
||||
|
||||
QueryWrapper<RStatLimitRateDPO> queryWrapper = new QueryWrapper<>();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for(int i = 2;i<26;i++){
|
||||
if(i == 25){
|
||||
for (int i = 2; i < 26; i++) {
|
||||
if (i == 25) {
|
||||
stringBuilder.append("sum(uharm_").append(i).append("_overtime) as uharm_").append(i).append("_overtime ");
|
||||
}else {
|
||||
} else {
|
||||
stringBuilder.append("sum(uharm_").append(i).append("_overtime) as uharm_").append(i).append("_overtime").append(",");
|
||||
}
|
||||
}
|
||||
queryWrapper.select("my_index lineId ,sum(all_time) all_time,sum(flicker_all_time) flicker_all_time,sum(freq_dev_overtime) freq_dev_overtime,sum(voltage_dev_overtime) voltage_dev_overtime,sum(ubalance_overtime) ubalance_overtime,sum(flicker_overtime) flicker_overtime,sum(uaberrance_overtime) uaberrance_overtime",stringBuilder.toString())
|
||||
.in("my_index",ids).between("time_id",pwUserMonitorParam.getSearchBeginTime(),pwUserMonitorParam.getSearchEndTime()).eq("phasic_type","T").groupBy("my_index");
|
||||
queryWrapper.select("my_index lineId ,sum(all_time) all_time,sum(flicker_all_time) flicker_all_time,sum(freq_dev_overtime) freq_dev_overtime,sum(voltage_dev_overtime) voltage_dev_overtime,sum(ubalance_overtime) ubalance_overtime,sum(flicker_overtime) flicker_overtime,sum(uaberrance_overtime) uaberrance_overtime", stringBuilder.toString())
|
||||
.in("my_index", ids).between("time_id", pwUserMonitorParam.getSearchBeginTime(), pwUserMonitorParam.getSearchEndTime()).eq("phasic_type", "T").groupBy("my_index");
|
||||
|
||||
if(StrUtil.isNotBlank(pwUserMonitorParam.getOrderBy())){
|
||||
if (StrUtil.isNotBlank(pwUserMonitorParam.getOrderBy())) {
|
||||
String sortBy = strToSql(pwUserMonitorParam.getSortBy());
|
||||
if(pwUserMonitorParam.getOrderBy().equals("asc")){
|
||||
queryWrapper.orderBy(true,true,sortBy);
|
||||
}else {
|
||||
queryWrapper.orderBy(true,false,sortBy);
|
||||
if (pwUserMonitorParam.getOrderBy().equals("asc")) {
|
||||
queryWrapper.orderBy(true, true, sortBy);
|
||||
} else {
|
||||
queryWrapper.orderBy(true, false, sortBy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Page<RStatLimitRateDPO> temPage = rStatLimitRateDMapper.selectPage(new Page<>(PageFactory.getPageNum(pwUserMonitorParam),PageFactory.getPageSize(pwUserMonitorParam)),queryWrapper);
|
||||
Page<RStatLimitRateDPO> temPage = rStatLimitRateDMapper.selectPage(new Page<>(PageFactory.getPageNum(pwUserMonitorParam), PageFactory.getPageSize(pwUserMonitorParam)), queryWrapper);
|
||||
pageResult.setTotal(temPage.getTotal());
|
||||
if(CollUtil.isNotEmpty(temPage.getRecords())){
|
||||
Map<String,PwUserMonitorDataVO> map = pwUserMonitorDataVOList.stream().collect(Collectors.toMap(PwUserMonitorDataVO::getId,Function.identity()));
|
||||
if (CollUtil.isNotEmpty(temPage.getRecords())) {
|
||||
Map<String, PwUserMonitorDataVO> map = pwUserMonitorDataVOList.stream().collect(Collectors.toMap(PwUserMonitorDataVO::getId, Function.identity()));
|
||||
List<MonitorLimitRateVO> resultList = new ArrayList<>();
|
||||
for(RStatLimitRateDPO item : temPage.getRecords()){
|
||||
for (RStatLimitRateDPO item : temPage.getRecords()) {
|
||||
MonitorLimitRateVO monitorLimitRateVO = new MonitorLimitRateVO();
|
||||
PwUserMonitorDataVO pwUserMonitorDataVO = map.get(item.getLineId());
|
||||
BeanUtil.copyProperties(pwUserMonitorDataVO,monitorLimitRateVO);
|
||||
if(item.getAllTime() == 0){
|
||||
BeanUtil.copyProperties(pwUserMonitorDataVO, monitorLimitRateVO);
|
||||
if (item.getAllTime() == 0) {
|
||||
monitorLimitRateVO.setFreqDevOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setUaberranceOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setUbalanceOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(BigDecimal.valueOf(3.14159));
|
||||
}else {
|
||||
monitorLimitRateVO.setFreqDevOvertime(calculatePercentage(item.getFreqDevOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setUaberranceOvertime(calculatePercentage(item.getUaberranceOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setUbalanceOvertime(calculatePercentage(item.getUbalanceOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(calculatePercentage(item.getVoltageDevOvertime(),item.getAllTime()));
|
||||
} else {
|
||||
monitorLimitRateVO.setFreqDevOvertime(calculatePercentage(item.getFreqDevOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setUaberranceOvertime(calculatePercentage(item.getUaberranceOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setUbalanceOvertime(calculatePercentage(item.getUbalanceOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(calculatePercentage(item.getVoltageDevOvertime(), item.getAllTime()));
|
||||
}
|
||||
|
||||
if(item.getFlickerAllTime() == 0){
|
||||
if (item.getFlickerAllTime() == 0) {
|
||||
monitorLimitRateVO.setFlickerOvertime(BigDecimal.valueOf(3.14159));
|
||||
}else {
|
||||
monitorLimitRateVO.setFlickerOvertime(calculatePercentage(item.getFlickerOvertime(),item.getFlickerAllTime()));
|
||||
} else {
|
||||
monitorLimitRateVO.setFlickerOvertime(calculatePercentage(item.getFlickerOvertime(), item.getFlickerAllTime()));
|
||||
}
|
||||
|
||||
setUharmOvertimeRatios(item,monitorLimitRateVO);
|
||||
setUharmOvertimeRatios(item, monitorLimitRateVO);
|
||||
resultList.add(monitorLimitRateVO);
|
||||
}
|
||||
pageResult.setRecords(resultList);
|
||||
@@ -393,7 +392,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
* 计算百分比,结果不超过100
|
||||
*
|
||||
* @param flickerOvertime 闪烁超时时间
|
||||
* @param flickerAllTime 总闪烁时间
|
||||
* @param flickerAllTime 总闪烁时间
|
||||
* @return 计算的百分比(如果结果超过100,则返回100)
|
||||
*/
|
||||
public BigDecimal calculatePercentage(Integer flickerOvertime, Integer flickerAllTime) {
|
||||
@@ -417,7 +416,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
@Override
|
||||
public List<PwLimitDataVO> pwMonitorLimitDataRange(PwUserMonitorParam pwUserMonitorParam) {
|
||||
List<PwLimitDataVO> result = new ArrayList<>();
|
||||
if(CollUtil.isEmpty(pwUserMonitorParam.getIds())){
|
||||
if (CollUtil.isEmpty(pwUserMonitorParam.getIds())) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -426,81 +425,77 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
LocalDate startDate = LocalDate.parse(pwUserMonitorParam.getSearchBeginTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
LocalDate endDate = LocalDate.parse(pwUserMonitorParam.getSearchEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
|
||||
lambdaQueryWrapper.select(RStatLimitTargetDPO::getLineId,RStatLimitTargetDPO::getTime,RStatLimitTargetDPO::getAllTime).in(RStatLimitTargetDPO::getLineId,pwUserMonitorParam.getIds());
|
||||
lambdaQueryWrapper.between(RStatLimitTargetDPO::getTime,pwUserMonitorParam.getSearchBeginTime(),pwUserMonitorParam.getSearchEndTime());
|
||||
List<RStatLimitTargetDPO> rStatLimitTargetDPOList = rStatLimitTargetDMapper.selectList(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(rStatLimitTargetDPOList)){
|
||||
Map<String,List<RStatLimitTargetDPO>> map = rStatLimitTargetDPOList.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getLineId));
|
||||
processDateRange(startDate,endDate,map,result);
|
||||
}
|
||||
lambdaQueryWrapper.select(RStatLimitTargetDPO::getLineId, RStatLimitTargetDPO::getTime, RStatLimitTargetDPO::getAllTime).in(RStatLimitTargetDPO::getLineId, pwUserMonitorParam.getIds());
|
||||
lambdaQueryWrapper.between(RStatLimitTargetDPO::getTime, pwUserMonitorParam.getSearchBeginTime(), pwUserMonitorParam.getSearchEndTime());
|
||||
List<RStatLimitTargetDPO> rStatLimitTargetDPOList = rStatLimitTargetDMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(rStatLimitTargetDPOList)) {
|
||||
Map<String, List<RStatLimitTargetDPO>> map = rStatLimitTargetDPOList.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getLineId));
|
||||
processDateRange(startDate, endDate, map, result);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void processDateRange(LocalDate startDate, LocalDate endDate,Map<String,List<RStatLimitTargetDPO>> map,List<PwLimitDataVO> result) {
|
||||
map.forEach((lineKey,list)->{
|
||||
PwLimitDataVO pwLimitDataVO = new PwLimitDataVO();
|
||||
pwLimitDataVO.setLineId(lineKey);
|
||||
pwLimitDataVO.setName(lineKey);
|
||||
List<PwLimitDataVO.LimitDetail> detailList = new ArrayList<>();
|
||||
public void processDateRange(LocalDate startDate, LocalDate endDate, Map<String, List<RStatLimitTargetDPO>> map, List<PwLimitDataVO> result) {
|
||||
map.forEach((lineKey, list) -> {
|
||||
PwLimitDataVO pwLimitDataVO = new PwLimitDataVO();
|
||||
pwLimitDataVO.setLineId(lineKey);
|
||||
pwLimitDataVO.setName(lineKey);
|
||||
List<PwLimitDataVO.LimitDetail> detailList = new ArrayList<>();
|
||||
|
||||
if (startDate.getYear() == endDate.getYear() && startDate.getMonth() == endDate.getMonth()) {
|
||||
Map<LocalDate, RStatLimitTargetDPO> targetDPOMap = list.stream().collect(Collectors.toMap(RStatLimitTargetDPO::getTime, Function.identity()));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate.minusDays(1)); date = date.plusDays(1)) {
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
limitDetail.setLimitFlag(targetDPOMap.get(date).getAllTime() > 0 ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(date.getDayOfMonth() +"日");
|
||||
detailList.add(limitDetail);
|
||||
if (startDate.getYear() == endDate.getYear() && startDate.getMonth() == endDate.getMonth()) {
|
||||
Map<LocalDate, RStatLimitTargetDPO> targetDPOMap = list.stream().collect(Collectors.toMap(RStatLimitTargetDPO::getTime, Function.identity()));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate.minusDays(1)); date = date.plusDays(1)) {
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
limitDetail.setLimitFlag(targetDPOMap.get(date).getAllTime() > 0 ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(date.getDayOfMonth() + "日");
|
||||
detailList.add(limitDetail);
|
||||
}
|
||||
|
||||
}else {
|
||||
Map<String,List<RStatLimitTargetDPO>> targetDPOMap = list.stream().collect(Collectors.groupingBy(it->LocalDateTimeUtil.format(it.getTime(),DatePattern.NORM_MONTH_PATTERN)));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
} else {
|
||||
Map<String, List<RStatLimitTargetDPO>> targetDPOMap = list.stream().collect(Collectors.groupingBy(it -> LocalDateTimeUtil.format(it.getTime(), DatePattern.NORM_MONTH_PATTERN)));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
|
||||
// 如果不在同一个月,则遍历每个月(这里简化处理,只打印月份和年份)
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
String date = LocalDateTimeUtil.format(currentDate,DatePattern.NORM_MONTH_PATTERN);
|
||||
// 如果不在同一个月,则遍历每个月(这里简化处理,只打印月份和年份)
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
String date = LocalDateTimeUtil.format(currentDate, DatePattern.NORM_MONTH_PATTERN);
|
||||
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if(targetDPOMap.containsKey(date)){
|
||||
boolean res = targetDPOMap.get(date).stream().anyMatch(item->item.getAllTime()>0);
|
||||
limitDetail.setLimitFlag(res ? 2:1);
|
||||
}else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(currentDate.getMonthValue() +"月");
|
||||
detailList.add(limitDetail);
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
boolean res = targetDPOMap.get(date).stream().anyMatch(item -> item.getAllTime() > 0);
|
||||
limitDetail.setLimitFlag(res ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(currentDate.getMonthValue() + "月");
|
||||
detailList.add(limitDetail);
|
||||
|
||||
|
||||
// 跳到下一个月的第一天(注意:这里简化了处理,没有实际遍历这个月的每一天)
|
||||
currentDate = currentDate.plusMonths(1).withDayOfMonth(1);
|
||||
|
||||
// 跳到下一个月的第一天(注意:这里简化了处理,没有实际遍历这个月的每一天)
|
||||
currentDate = currentDate.plusMonths(1).withDayOfMonth(1);
|
||||
|
||||
// 如果当前月已经超过了结束月,则退出循环
|
||||
if (currentDate.isAfter(endDate)) {
|
||||
break;
|
||||
}
|
||||
// 如果当前月已经超过了结束月,则退出循环
|
||||
if (currentDate.isAfter(endDate)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
pwLimitDataVO.setDetailList(detailList);
|
||||
result.add(pwLimitDataVO);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
pwLimitDataVO.setDetailList(detailList);
|
||||
result.add(pwLimitDataVO);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String strToSql(String originalString){
|
||||
public String strToSql(String originalString) {
|
||||
StringBuilder modifiedStringBuilder = new StringBuilder();
|
||||
|
||||
// 标记是否需要在下一个字符前添加下划线
|
||||
@@ -569,7 +564,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
monitorLimitRateVO.getClass().getMethod(setterName, BigDecimal.class)
|
||||
.invoke(monitorLimitRateVO, BigDecimal.valueOf(3.14159));
|
||||
} else {
|
||||
BigDecimal ratio = BigDecimal.valueOf((double) uharmOvertime / allTime*100)
|
||||
BigDecimal ratio = BigDecimal.valueOf((double) uharmOvertime / allTime * 100)
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
ratio = ratio.compareTo(BigDecimal.valueOf(100)) > 0 ? BigDecimal.valueOf(100) : ratio;
|
||||
monitorLimitRateVO.getClass().getMethod(setterName, BigDecimal.class)
|
||||
@@ -583,13 +578,13 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
}
|
||||
|
||||
|
||||
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlineRateVO> onlineRateByDevIds, List<RStatLimitTargetVO> limitTargetList, GridDiagramVO.LineData lineData) {
|
||||
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlineRateVO> onlineRateByDevIds, List<String> limitTargetList, GridDiagramVO.LineData lineData) {
|
||||
//监测完整率
|
||||
List<RStatIntegrityD> integrityDS = onIntegrityByIds.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getDueTime).sum();
|
||||
lineData.setIntegrityRate(Math.min(NumberUtil.round(realTime * 100.0 / dueTime, 2).floatValue(),100));
|
||||
lineData.setIntegrityRate(Math.min(NumberUtil.round(realTime * 100.0 / dueTime, 2).floatValue(), 100));
|
||||
} else {
|
||||
lineData.setIntegrityRate(0.0f);
|
||||
}
|
||||
@@ -598,14 +593,14 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
|
||||
lineData.setOnLineRate(Math.min(NumberUtil.round(onlineTime * 100.0 / (onlineTime + offlineTime), 2).floatValue(),100));
|
||||
lineData.setOnLineRate(Math.min(NumberUtil.round(onlineTime * 100.0 / (onlineTime + offlineTime), 2).floatValue(), 100));
|
||||
} else {
|
||||
lineData.setOnLineRate(0.0f);
|
||||
}
|
||||
//监测点超标占比
|
||||
List<RStatLimitTargetVO> limitTarget = limitTargetList.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<String> limitTarget = limitTargetList.stream().filter(x -> lineIds.contains(x)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(limitTarget)) {
|
||||
long count = limitTarget.stream().filter(o->o.getAllOvertime() > 0 || o.getFlickerAllTime()>0).count();
|
||||
long count = limitTarget.size();
|
||||
lineData.setOutOfStandardRate(NumberUtil.round(count * 100.0 / lineIds.size(), 2).floatValue());
|
||||
} else {
|
||||
lineData.setOutOfStandardRate(0.0f);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class RStatLimitRateDController extends BaseController {
|
||||
/**
|
||||
* 来源于RStatLimitController的getOverData
|
||||
*/
|
||||
@PostMapping("/getOverData")
|
||||
@PostMapping("/limitRateD/getOverData")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询单监测点超标数据")
|
||||
@ApiImplicitParams({
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
line_index id,
|
||||
LEAST(ROUND(SUM(real_time) / SUM(due_time), 2) * 100,100) integrityData
|
||||
FROM
|
||||
`r_stat_integrity_d`
|
||||
r_stat_integrity_d
|
||||
WHERE time_id between #{startTime} and #{endTime}
|
||||
GROUP BY line_index
|
||||
</select>
|
||||
@@ -35,9 +35,9 @@
|
||||
100
|
||||
) integrityData
|
||||
FROM
|
||||
`r_stat_onlinerate_d`
|
||||
r_stat_onlinerate_d
|
||||
WHERE time_id between #{startTime} and #{endTime}
|
||||
GROUP BY dev_index
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.UserReportFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 徐扬
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserReportFeignClientFallbackFactory.class)
|
||||
public interface UserReportManageFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/getSensitiveUserByDept")
|
||||
@ApiOperation("根据部门获取敏感用户信息")
|
||||
HttpResult<List<UserReportPO>> getSensitiveUserByDept(@RequestBody @Validated SensitiveUserParam param) ;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.UserReportManageFeignClient;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserReportFeignClientFallbackFactory implements FallbackFactory<UserReportManageFeignClient> {
|
||||
@Override
|
||||
public UserReportManageFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new UserReportManageFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(SensitiveUserParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据部门获取敏感用户信息异常", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class SensitiveReportExcel implements Serializable {
|
||||
// private String orgId;
|
||||
|
||||
|
||||
@Excel(name = "工程预期投产日期(yyyy-MM-dd)", width = 30)
|
||||
@Excel(name = "*工程预期投产日期(yyyy-MM-dd)", width = 30)
|
||||
private String expectedProductionDate;
|
||||
|
||||
@Excel(name = "电压等级", width = 30)
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SensitiveUserSExcel implements Serializable {
|
||||
// private String orgId;
|
||||
|
||||
|
||||
@Excel(name = "工程预期投产日期(yyyy-MM-dd)", width = 30)
|
||||
@Excel(name = "*工程预期投产日期(yyyy-MM-dd)", width = 30)
|
||||
@NotBlank(message = "工程预期投产日期不能为空")
|
||||
private String expectedProductionDate;
|
||||
|
||||
|
||||
@@ -209,16 +209,16 @@ public class SupervisionDevMainReportExcel {
|
||||
private String timeSyncFunction = "0";
|
||||
|
||||
/**
|
||||
* 电镀功能
|
||||
* 电度功能
|
||||
*/
|
||||
@Excel(name = "电镀功能", width = 30, replace = {"关闭_0", "开启_1"})
|
||||
@Excel(name = "电度功能", width = 30, replace = {"关闭_0", "开启_1"})
|
||||
private String electroplatingFunction = "0";
|
||||
|
||||
|
||||
/**
|
||||
* 召换标志
|
||||
* 召唤标志
|
||||
*/
|
||||
@Excel(name = "召换标志", width = 30, replace = {"周期触发_0", "变位触发_1"})
|
||||
@Excel(name = "召唤标志", width = 30, replace = {"周期触发_0", "变位触发_1"})
|
||||
private String summonFlag = "0";
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.supervision.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SensitiveUserParam implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private String deptId;
|
||||
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -206,9 +206,9 @@ public class SupervisionTempDeviceReportParam {
|
||||
private Integer timeSyncFunction;
|
||||
|
||||
/**
|
||||
* 电镀功能
|
||||
* 电度功能
|
||||
*/
|
||||
@ApiModelProperty(value="电镀功能")
|
||||
@ApiModelProperty(value="电度功能")
|
||||
private Integer electroplatingFunction;
|
||||
|
||||
/**
|
||||
@@ -218,9 +218,9 @@ public class SupervisionTempDeviceReportParam {
|
||||
private String monitoringDeviceInstallationPosition;
|
||||
|
||||
/**
|
||||
* 召换标志
|
||||
* 召唤标志
|
||||
*/
|
||||
@ApiModelProperty(value="召换标志")
|
||||
@ApiModelProperty(value="召唤标志")
|
||||
private String summonFlag;
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user