53 Commits

Author SHA1 Message Date
cdf
eeb27c519b sql适配大梦数据库 2025-12-19 16:15:55 +08:00
wr
670eaf7d38 微调 2025-12-19 10:19:59 +08:00
xy
2b79cefad6 微调 2025-12-19 10:18:13 +08:00
xy
212db18835 新增异常数据问题 2025-12-18 22:24:03 +08:00
wr
e9a1c34160 调整异常数据界面业务 2025-12-18 22:22:36 +08:00
wr
fb7a2b7084 调整异常数据界面业务 2025-12-17 19:25:08 +08:00
wr
4b3ec39a11 Merge remote-tracking branch 'origin/main' 2025-12-16 18:25:33 +08:00
wr
2d255a5dd3 微调 2025-12-16 18:23:43 +08:00
hzj
614647d36d Merge remote-tracking branch 'origin/main' 2025-12-16 16:23:57 +08:00
hzj
a899614c89 添加注释 2025-12-16 16:22:53 +08:00
wr
2543f87dd2 Merge remote-tracking branch 'origin/main' 2025-12-16 15:37:53 +08:00
wr
c5074df93d 1.调整台账管理变电站搜索
2.解决优化部分台账信息
2025-12-16 13:57:04 +08:00
24e4c4de37 调整bug 2025-12-16 13:48:59 +08:00
wr
4f70566c65 微调 2025-12-15 19:14:23 +08:00
wr
dc11d34add 微调 2025-12-15 18:20:42 +08:00
xy
9f3bb52d9a 微调 2025-12-15 16:41:23 +08:00
wr
567ba2f56e 微调 2025-12-15 14:33:48 +08:00
wr
371d4efb29 微调 2025-12-15 13:56:14 +08:00
wr
47b08d4797 1.调整全景稳态统计超标监测点占比
2.优化稳态word报告
2025-12-15 13:32:38 +08:00
xy
65805e4f50 微调 2025-12-15 13:25:12 +08:00
xy
41d555121c 添加电网标识字段 2025-12-14 22:28:10 +08:00
wr
4d48b42c98 完善全景详情监测点超标信息 2025-12-14 16:43:17 +08:00
wr
f5e1fac55d 微调 2025-12-14 15:42:55 +08:00
wr
cebda9323e 增加暂态信息搜索,调整全景区域污染值逻辑 2025-12-14 14:24:15 +08:00
xy
d09f1472a9 代码优化 2025-12-14 00:55:49 +08:00
xy
b9696e957d 代码优化 2025-12-13 23:59:26 +08:00
xy
12cfecac7e 敏感用户污染值统计 2025-12-13 20:33:08 +08:00
xy
3a97f01383 地市合格率报错 2025-12-13 11:11:50 +08:00
wr
10273dd2b0 调整全景监测点详情里,监测点超标为只为谐波电压超标 2025-12-13 11:09:23 +08:00
wr
5e8e03cbb1 微调 2025-12-12 17:53:21 +08:00
wr
b103141a54 1.技术监督修改 2025-12-12 17:33:04 +08:00
wr
a6d2d6ed47 1.全景增加技术监督计划调整
2.增加暂态列表信息和监测点评估信息
2025-12-12 15:01:29 +08:00
xy
601a78246e 代码优化 2025-12-12 14:58:35 +08:00
xy
5e7b973d5f 1.稳态告警查询优化 2.在线监测数据异常排查 2025-12-11 15:04:31 +08:00
wr
e89c6a2888 1.全景增加暂态信息和调整告警条件
2.增加暂态列表信息和冀北树污染值条件
2025-12-11 15:02:52 +08:00
xy
2166529b4d Merge remote-tracking branch 'origin/main' 2025-12-10 16:25:57 +08:00
xy
2117e16b61 1.修改全景稳态告警数据不一致问题 2.初步修改在线监测功能 2025-12-10 16:25:38 +08:00
wr
054d5534a8 微调 2025-12-10 16:25:04 +08:00
wr
c03a516931 Merge remote-tracking branch 'origin/main' 2025-12-10 16:22:42 +08:00
wr
0fdc3edb89 1.解决变电站数量不统一问题
2.替换最新污染值
3.解决终端数量不一致问题
2025-12-10 16:19:35 +08:00
a730ad61b1 调整白名单 2025-12-10 15:32:32 +08:00
9b758dc7c9 增加swagger配置 2025-12-10 14:56:01 +08:00
a74dd460d1 Merge remote-tracking branch 'origin/main' 2025-12-10 14:55:48 +08:00
2708aa8b81 增加swagger配置 2025-12-10 14:55:31 +08:00
wr
6d833678a6 微调 2025-12-08 15:08:21 +08:00
xy
be264acd79 功能优化 2025-12-08 15:07:48 +08:00
wr
186d46752c Merge remote-tracking branch 'origin/main' 2025-12-05 15:34:12 +08:00
wr
e03478eeec 终端运行评价,异常数据率 2025-12-05 15:25:10 +08:00
贾同学
0c1bb606d6 feat(user): 支持组件时间标识集合字段 2025-12-03 15:16:31 +08:00
wr
42b619fa56 微调 2025-12-02 16:42:46 +08:00
wr
f0894ca0ed 微调 2025-12-02 16:05:13 +08:00
wr
8a958fa34c Merge remote-tracking branch 'origin/main' 2025-12-02 12:32:21 +08:00
wr
b4e5d0c638 微调 2025-12-01 09:12:29 +08:00
144 changed files with 4373 additions and 1233 deletions

View File

@@ -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);

View File

@@ -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")

View File

@@ -45,6 +45,9 @@ public class Knife4jSwaggerConfig {
@Value("${microservice.gateway.url}")
private String gatewayUrl;
@Value("${swagger.enable:true}")
private Boolean swaggerEnable;
/**
* swagger通用配置
*/
@@ -96,7 +99,7 @@ public class Knife4jSwaggerConfig {
//securyContext
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.enable(true)
.enable(swaggerEnable)
.select()
// 指定添加swagger注解的方法
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))

View File

@@ -51,6 +51,9 @@ public interface CommTerminalGeneralClient {
@PostMapping("deptGetLine")
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
@PostMapping("deptGetAllLine")
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
/**
* 根据单位获取所有变电站

View File

@@ -50,6 +50,12 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
log.error("{}异常,降级处理,异常为:{}", "根据单位获取all监测点信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<DeptGetSubStationDTO>> deptSubStation(DeptGetLineParam deptGetLineParam) {
log.error("{}异常,降级处理,异常为:{}", "根据单位获取所有变电站", throwable.toString());

View File

@@ -28,6 +28,8 @@ public class LineDevGetDTO {
private String pointName;
private Integer lineRunFlag;
/**
* 装置监测点索引集合
*/

View File

@@ -13,6 +13,8 @@ public class PollutionLineInfoDTO {
/**
* 所属变电站
*/
private String subStationId;
private String subStationName;
/**
@@ -97,4 +99,9 @@ public class PollutionLineInfoDTO {
* 监测点名称
*/
private String lineName;
/**
* 实际安装位置
*/
private String actualArea;
}

View File

@@ -32,7 +32,6 @@ public class DeptGetLineParam {
private Boolean monitorStateRunning=true;
@ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的")
private Integer isUpToGrid;
/**
* 0-电网侧
@@ -48,4 +47,7 @@ public class DeptGetLineParam {
@ApiModelProperty("监测点运行状态")
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
private Integer lineRunFlag;
@ApiModelProperty("搜索值")
private String searchValue;
}

View File

@@ -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>

View File

@@ -9,7 +9,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.TopMsgPO;
import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -70,6 +70,16 @@ public interface GeneralDeviceInfoClient {
HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
/**
* 获取变电站分类的所有终端综合信息
*
* @param deviceInfoParam 查询终端条件
* @return 获取变电站分类的所有终端综合信息
*/
@PostMapping("/getPracticalAllDeviceInfoAsSubstation")
HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
/**
* 获取实际运行终端综合信息
*
@@ -111,7 +121,7 @@ public interface GeneralDeviceInfoClient {
* @return
*/
@PostMapping("/getOnlineRateByDevIds")
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
/**
*根据单位获取投运监测点(双系统)

View File

@@ -3,7 +3,9 @@ package com.njcn.device.pq.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
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.api.fallback.DeviceTreeClientFallbackFactory;
import com.njcn.device.pq.api.fallback.LineIntegrityClientFallbackFactory;
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
@@ -11,6 +13,8 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@@ -51,4 +55,7 @@ public interface LineIntegrityClient {
@PostMapping("/lineDataQuality")
HttpResult<List<LineDataQualityDTO>> getLineDataQuality(@RequestBody LineDataQualityParam lineDataQualityParam);
@PostMapping("/noData")
HttpResult<List<OnlineMonitorVo>> getNoData(@RequestBody LineBaseQueryParam param);
}

View File

@@ -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);
}

View File

@@ -10,7 +10,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.TopMsgPO;
import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.biz.utils.DeviceEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
@@ -59,6 +59,12 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam) {
log.error("{}异常,降级处理,异常为:{}", "获取变电站分类的所有终端综合信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(DeviceInfoParam deviceInfoParam) {
log.error("{}异常,降级处理,异常为:{}", "获取实际运行终端综合信息", throwable.toString());
@@ -84,7 +90,7 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
}
@Override
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(OnlineRateParam param) {
public HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(OnlineRateParam param) {
log.error("{}异常,降级处理,异常为:{}", "获取终端在线率(谐波专用)", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -11,6 +11,7 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -54,6 +55,12 @@ public class LineIntegrityClientFallbackFactory implements FallbackFactory<LineI
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<OnlineMonitorVo>> getNoData(LineBaseQueryParam param) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点数据完成性为0的数据", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -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);
}
};
}
}

View File

@@ -105,6 +105,14 @@ public class DeviceInfoParam implements Serializable {
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
private Integer lineRunFlag;
@ApiModelProperty("0按照监测点搜索 1按照装置搜索")
private Integer lineOrDevice;
/**
* 搜索值
*/
@ApiModelProperty("搜索值")
private String searchValue;
/**
* 默认全部监测点
*
@@ -207,6 +215,12 @@ public class DeviceInfoParam implements Serializable {
@ApiModelProperty("是否是冀北电网一张图树 0:否 1:是")
private Integer type = 0;
@ApiModelProperty("指标")
private List<String> dicData;
@ApiModelProperty("是否展示污染值 0:否 1:是")
private Integer isPollution;
}
public Boolean isUserLedger() {

View File

@@ -13,7 +13,6 @@ import java.util.List;
* @createTime: 2023-04-03
*/
@Data
@ApiModel
public class OnlineRateParam {
@ApiModelProperty(name = "ids", value = "设备id")
@@ -27,4 +26,10 @@ public class OnlineRateParam {
@ApiModelProperty(name = "type", value = "区分类型0topid搜索 1devid搜索")
private Integer type;
@Data
public static class Info extends OnlineRateParam {
@ApiModelProperty(name = "dicData", value = "字典id")
private List<String> dicData;
}
}

View File

@@ -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;
}

View File

@@ -38,4 +38,9 @@ public class MonitorBaseParam extends BaseParam {
@ApiModelProperty(value = "终端厂家")
private String manufacturer;
@ApiModelProperty(value = "监测点运行状态")
private Integer lineRunFlag;
@ApiModelProperty(value = "异常天数时间")
private List<String> time;
}

View File

@@ -0,0 +1,56 @@
package com.njcn.device.pq.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
*
* </p>
*
* @author xy
* @since 2025-02-17
*/
@Getter
@Setter
@TableName("pq_data_verify_count")
public class PqDataVerifyCount implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 监测点id
*/
@MppMultiId
@TableField(value = "line_id")
private String lineId;
/**
* 数据时间
*/
@MppMultiId
@TableField(value = "time_id")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private LocalDate time;
/**
* 异常指标数量
*/
@TableField(value = "total")
private Integer total ;
/**
* 总指标数量
*/
@TableField(value = "total_all")
private Integer totalAll ;
}

View File

@@ -0,0 +1,165 @@
package com.njcn.device.pq.pojo.po.jb;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fbs_distribution_area")
public class DistributionArea extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 台区编号
*/
private String id;
/**
* 台区名称
*/
private String name;
/**
* 组织机构名称
*/
private String orgName;
/**
* 组织机构ID(外键)
*/
private String orgId;
/**
* 运维单位名称
*/
private String operationName;
/**
* 运维单位ID(外键)
*/
private String operationId;
/**
* 变电站名称
*/
private String powerrName;
/**
* 电站ID(外键)
*/
private String powerStationId;
/**
* 监测线路名称
*/
private String lineName;
/**
* 所属线路ID(外键)
*/
private String lineId;
/**
* 电压等级
*/
private String voltageLevel;
/**
* 配变容量
*/
private Float pCapacity;
/**
* 地区特征(字典)
*/
private String regionalism;
/**
* 设备地区特征(字典)
*/
private String devRegionalism;
/**
* 是否农网0-否1
*/
private Integer ifRuralPowerGrid;
/**
* 使用性质
*/
private String natureOfUse;
/**
* 供电半径
*/
private Float powerSupplyRadius;
/**
* 供电线路总长度
*/
private Float lineLength;
/**
* 运行状态(字典)
*/
private String state;
/**
* 分布式光伏用户数
*/
private Integer distributedPhotovoltaicNum;
/**
* 分布式光伏总装机容量
*/
private Float photovoltaicCapacity;
/**
* 是否有电动汽车接入0-否1
*/
private Integer ifBevAp;
/**
* 接入负荷类型(字典)
*/
private String apLoadType;
/**
* 是否是上送国网监测点,0-否 1-是
*/
private Integer isUpToGrid;
/**
* 经度
*/
private Double longitude;
/**
* 维度
*/
private Double latitude;
/**
* 数据状态0-删除1-正常;
*/
private Integer status;
/**
* 数据状态0-手动录入1-gw台账录入
*/
private Integer inputStatus;
}

View File

@@ -0,0 +1,128 @@
package com.njcn.device.pq.pojo.po.jb;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
/**
* <p>
* 发电用户
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fbs_power_generation_user")
public class GenerationUser extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 用户编号
*/
private String id;
/**
* 用户名称
*/
private String name;
/**
* 组织机构名称
*/
private String orgName;
/**
* 组织机构ID(外键)
*/
private String orgId;
/**
* 运维单位名称
*/
private String operationName;
/**
* 运维单位ID(外键)
*/
private String operationId;
/**
* 电源类别(字典)
*/
private String powerCategory;
/**
* 电站类型(字典)
*/
private String powerStationType;
/**
* 发电方式(字典)
*/
private String powerGenerationMode;
/**
* 并网电压等级(字典)
*/
private String voltageLevel;
/**
* 总装机容量
*/
private Float sourceCapacity;
/**
* 并网日期
*/
private LocalDate connectionDate;
/**
* 能源消纳方式(字典)
*/
private String connectionMode;
/**
* 客户状态(字典)
*/
private String gcStat;
/**
* 供电变电站(外键)
*/
private String powerStationId;
/**
* 供电线路(外键)
*/
private String lineId;
/**
* 供电台区(外键)
*/
private String platformId;
/**
* 用户标签
*/
private String userTag;
/**
* 是否是上送国网监测点,0-否 1-是
*/
private Integer isUpToGrid;
/**
* 数据状态0-删除1-正常;
*/
private Integer status;
}

View File

@@ -5,6 +5,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 监测点详细信息
@@ -129,6 +130,24 @@ 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;
@ApiModelProperty(name = "vHarmonicValue",value = "污染值")
private Double vHarmonicValue;
@ApiModelProperty(name = "userList",value = "敏感用户信息")
private List<User> userList;
@Data
public static class User{
private String id;
private String projectName;
private String stationId;
private String lineId;
private String city;
}
}

View File

@@ -36,6 +36,9 @@ public class GridDiagramProVO {
@ApiModelProperty(name = "integrityRate", value = "数据完整率")
private Float integrityRate;
@ApiModelProperty(name = "onLineRate", value = "数据在线率")
private Float onLineRate;
}
}

View File

@@ -0,0 +1,41 @@
package com.njcn.device.pq.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author xy
*/
@Data
public class OnlineMonitorVo implements Serializable {
@ApiModelProperty("负责单位")
private String gdName;
@ApiModelProperty("变电站名称")
private String subName;
@ApiModelProperty("终端名称")
private String deviceName;
@ApiModelProperty("监测点id")
private String lineId;
@ApiModelProperty("监测点名称")
private String lineName;
@ApiModelProperty("监测对象类型")
private String monitorObjType;
@ApiModelProperty("监测对象名称")
private String monitorObj;
@ApiModelProperty("指标类型 ")
private String target;
@ApiModelProperty("累计天数")
private Integer lastDay;
}

View File

@@ -1,8 +1,8 @@
package com.njcn.device.pq.pojo.vo;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -26,6 +26,6 @@ public class RStatIntegrityVO {
private Integer realTime;
private Double integrityRate;
private BigDecimal integrityRate;
}

View File

@@ -2,6 +2,7 @@ package com.njcn.device.pq.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -11,7 +12,7 @@ import java.time.LocalDateTime;
* @createTime: 2023-04-03
*/
@Data
public class RStatOnlinerateVO {
public class RStatOnlineRateVO {
private static final long serialVersionUID = 1L;
private LocalDateTime timeId;
@@ -22,5 +23,5 @@ public class RStatOnlinerateVO {
private Integer offlineMin;
private Float onlineRate;
private BigDecimal onlineRate;
}

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@@ -23,7 +24,7 @@ public class DeviceOnlineRate {
private Integer belowNum;
@ApiModelProperty("总终端在线率")
private String totalOnlineRate;
private BigDecimal totalOnlineRate;
@ApiModelProperty("统计信息")
List<CitDetail> citDetailList;
@@ -41,7 +42,7 @@ public class DeviceOnlineRate {
private Integer citBelowNum;
@ApiModelProperty("总终端在线率")
private String citTotalOnlineRate;
private BigDecimal citTotalOnlineRate;
@ApiModelProperty("统计信息")
List<?> detailList;
@@ -82,7 +83,7 @@ public class DeviceOnlineRate {
private LocalDateTime timeID;
@ApiModelProperty("在线率")
private String onlineRate;
private BigDecimal onlineRate;
}
@Data
@@ -123,7 +124,7 @@ public class DeviceOnlineRate {
private LocalDateTime latestTime;
@ApiModelProperty("数据完整性")
private Double integrity;
private BigDecimal integrity;
}
}

View File

@@ -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<String> dateList;
private String monitorName;
private String bdName;
@@ -55,6 +60,15 @@ public class DetailAbnormalVO {
}
@Data
public static class DetailAbnormalCountVO {
private Integer timeSum;
private Integer errCount;
private List<DetailAbnormalInnerVO> time;
}
@Data
public static class DetailLimitInnerVO{
@@ -78,4 +92,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;
}
}

View File

@@ -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;
}

View File

@@ -108,8 +108,17 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@PostMapping("deptGetAllLine")
@ApiOperation("根据单位获取监测点信息(all line)")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetLine");
List<DeptGetChildrenMoreDTO> result = commTerminalService.deptGetAllLine(deptGetLineParam);
log.info("运行时长" + timer.intervalSecond());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据单位获取所有变电站

View File

@@ -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);
}
@@ -141,5 +141,14 @@ public class DataVerifyController extends BaseController {
}
@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);
}
}

View File

@@ -81,6 +81,7 @@ public class DeviceRunEvaluateController extends BaseController {
@ApiOperation("终端评价列表(冀北)")
public HttpResult<List<DeviceRunEvaluateVO.Detail>> getRunEvaluateInfo(@RequestBody DeviceInfoParam.BusinessParam businessParam) {
String methodDescribe = getMethodDescribe("getRunEvaluateInfo");
businessParam.setLineOrDevice(1);
List<DeviceRunEvaluateVO.Detail> runEvaluate = deviceRunEvaluateService.getRunEvaluate(businessParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, runEvaluate, methodDescribe);
}

View File

@@ -136,6 +136,22 @@ public class GeneralDeviceInfoController extends BaseController {
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getPracticalAllDeviceInfoAsSubstation")
@ApiOperation("获取按变电站分类的所有终端综合信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "deviceInfoParam", value = "查询终端条件", required = true)
})
public HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("getPracticalAllDeviceInfoAsSubstation");
List<GeneralDeviceDTO> substationDeviceInfos = generalDeviceService.getDeviceInfoAsSubstation(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(substationDeviceInfos)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDeviceInfos, methodDescribe);
}
}
/**
* 获取实际运行终端综合信息
*/
@@ -269,9 +285,9 @@ public class GeneralDeviceInfoController extends BaseController {
@PostMapping("/getOnlineRateByDevIds")
@ApiOperation("终端在线率(谐波专用)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param) {
public HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param) {
String methodDescribe = getMethodDescribe("getOnlineRateByDevIds");
List<RStatOnlinerateVO> onlineRateByDevIds = onlineRateMapper.getOnlineRateByDevIds(param);
List<RStatOnlineRateVO> onlineRateByDevIds = onlineRateMapper.getOnlineRateByDevIds(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onlineRateByDevIds,methodDescribe);
}

View File

@@ -56,7 +56,6 @@ public class GridDiagramController extends BaseController {
@ApiOperation("变电站趋势分析")
public HttpResult<Map<String, Long>> getGridDiagramSubTendency(@RequestBody GridDiagramParam param){
String methodDescribe = getMethodDescribe("getGridDiagramSubTendency");
param.getDeviceInfoParam().setPowerFlag(0);
Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,3);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe);
}
@@ -91,6 +90,7 @@ public class GridDiagramController extends BaseController {
@ApiOperation("监测点趋势分析")
public HttpResult<Map<String, Long>> getGridDiagramLineTendency(@RequestBody GridDiagramParam param){
String methodDescribe = getMethodDescribe("getGridDiagramLineTendency");
param.getDeviceInfoParam().setLineRunFlag(0);
Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,6);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe);
}

View File

@@ -16,6 +16,7 @@ import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import com.njcn.device.pq.service.IRStatIntegrityDService;
import com.njcn.device.pq.service.LineIntegrityDataService;
@@ -153,9 +154,20 @@ public class LineIntegrityDataController extends BaseController {
@ApiOperation("监测点数据完整性(冀北)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) {
param.setLineOrDevice(0);
String methodDescribe = getMethodDescribe("getData");
DeviceOnlineRate rate = irStatIntegrityDService.getData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/noData")
@ApiOperation("监测点数据完整性为0的数据(冀北)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<List<OnlineMonitorVo>> getNoData(@RequestBody LineBaseQueryParam param) {
String methodDescribe = getMethodDescribe("getNoData");
List<OnlineMonitorVo> rate = irStatIntegrityDService.getNoData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
}
}

View File

@@ -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);
}
}

View File

@@ -6,13 +6,11 @@ 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.mapper.RStatOnlinerateDMapper;
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.param.TerminalOnlineRateDataParam;
import com.njcn.device.pq.pojo.vo.OnlineRateCensusVO;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.pq.pojo.vo.TerminalOnlineRateDataVO;
import com.njcn.device.pq.service.TerminalOnlineRateDataService;
import com.njcn.web.controller.BaseController;
@@ -80,9 +78,9 @@ public class TerminalOnlineRateDataController extends BaseController {
@PostMapping("/getOnlineRateByDevIds")
@ApiOperation("终端在线率(谐波专用)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param) {
public HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param) {
String methodDescribe = getMethodDescribe("getOnlineRateByDevIds");
List<RStatOnlinerateVO> onlineRateByDevIds = onlineRateMapper.getOnlineRateByDevIds(param);
List<RStatOnlineRateVO> onlineRateByDevIds = onlineRateMapper.getOnlineRateByDevIds(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onlineRateByDevIds,methodDescribe);
}

View File

@@ -0,0 +1,121 @@
package com.njcn.device.pq.controller.jb;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
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.common.utils.LogUtil;
import com.njcn.device.pms.annotation.TerminalOperationLogDesc;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pq.pojo.po.jb.DistributionArea;
import com.njcn.device.pq.service.IPowerDistributionAreaService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 台区信息增删改查
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Slf4j
@RestController
@RequestMapping("/distributionArea")
@Api(tags = "台账-台区信息")
@RequiredArgsConstructor
@Validated
public class PmsPowerDistributionAreaController extends BaseController {
private final IPowerDistributionAreaService powerDistributionAreaService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("getPowerDistributionAreaList")
@ApiOperation("分页查询台区所有信息")
@ApiImplicitParam(name = "baseParam",value = "查询台区信息",required = true)
public HttpResult<Page<DistributionArea>> getList(@RequestBody TaiZhangParam baseParam){
String methodDescribe = getMethodDescribe("getList");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, baseParam);
Page<DistributionArea> res = powerDistributionAreaService.getList(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,res,methodDescribe);
}
/**
* 新增台区信息
* @author hany
* @date 2022/10/26
*/
@PostMapping("/addPowerDistributionArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType=OperateType.ADD)
@ApiOperation("新增台区信息")
@ApiImplicitParam(name = "newParam", value = "模板实体", required = true)
@TerminalOperationLogDesc(value = "新增台区信息",module = 3)
public HttpResult<Object> add(@RequestBody @Validated PowerDistributionareaParam newParam){
String methodDescribe = getMethodDescribe("add");
boolean result = powerDistributionAreaService.add(newParam);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
/**
* 修改台区信息
* @author hany
* @date 2022/10/26
*/
@PostMapping("/updatePowerDistributionArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改台区信息")
@ApiImplicitParam(name = "UpdateParam", value = "更新实体", required = true)
@TerminalOperationLogDesc(value = "修改台区信息",module = 3)
public HttpResult<Object> update(@RequestBody @Validated PowerDistributionareaParam UpdateParam){
String methodDescribe = getMethodDescribe("update");
boolean result = powerDistributionAreaService.update(UpdateParam);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
/**
* 删除台区信息
* @param ids id
* @author hany
* @date 2022/10/26
*/
@PostMapping("/deletePowerDistributionArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
@ApiOperation("删除台区信息")
@ApiImplicitParam(name = "ids", value = "ID索引", required = true)
@TerminalOperationLogDesc(value = "删除台区信息",module = 3)
public HttpResult<Object> delete(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delete");
boolean result = powerDistributionAreaService.delete(ids);
if(result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
}

View File

@@ -0,0 +1,100 @@
package com.njcn.device.pq.controller.jb;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
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.pms.annotation.TerminalOperationLogDesc;
import com.njcn.device.pms.pojo.param.PowerGenerationUserParam;
import com.njcn.device.pq.pojo.po.jb.GenerationUser;
import com.njcn.device.pq.service.IPowerGenerationUserService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@RestController
@RequestMapping("/generationUser")
@Api(tags = "台账-发电用户")
@RequiredArgsConstructor
public class PmsPowerGenerationUserController extends BaseController {
private final IPowerGenerationUserService iPowerGenerationUserService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@PostMapping("/addPowerGenerationUser")
@ApiOperation("新增发电用户")
@ApiImplicitParam(name = "powerGenerationUserParam", value = "发电用户实体", required = true)
@TerminalOperationLogDesc(value = "新增发电用户",module = 4)
public HttpResult<Boolean> addPowerGenerationUser(@RequestBody @Validated PowerGenerationUserParam powerGenerationUserParam) {
String methodDescribe = getMethodDescribe("addPowerGenerationUser");
boolean result = iPowerGenerationUserService.addPowerGenerationUser(powerGenerationUserParam);
if(result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
@PostMapping("/updatePowerGenerationUser")
@ApiOperation("修改发电用户")
@ApiImplicitParam(name = "powerGenerationUserParam", value = "发电用户实体", required = true)
@TerminalOperationLogDesc(value = "修改发电用户",module = 4)
public HttpResult<Boolean> updatePowerGenerationUser(@RequestBody @Validated PowerGenerationUserParam powerGenerationUserParam) {
String methodDescribe = getMethodDescribe("updatePowerGenerationUser");
boolean result = iPowerGenerationUserService.updatePowerGenerationUser(powerGenerationUserParam);
if(result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
@DeleteMapping("/delPowerGenerationUser")
@ApiOperation("删除发电用户")
@ApiImplicitParam(name = "powerGenerationUserIds", value = "发电用户ids", required = true)
@TerminalOperationLogDesc(value = "删除发电用户",module = 4)
public HttpResult<Boolean> delPowerGenerationUser(@RequestBody @NotEmpty(message = "发电用户id不可为空") List<String> powerGenerationUserIds) {
String methodDescribe = getMethodDescribe("delPowerGenerationUser");
boolean result = iPowerGenerationUserService.delPowerGenerationUser(powerGenerationUserIds);
if(result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getPowerGenerationUserPageList")
@ApiOperation("分页获取发电用户列表")
@ApiImplicitParam(name = "baseParam", value = "基本查询体", required = true)
public HttpResult<Page<GenerationUser>> getPowerGenerationUserPageList(@RequestBody BaseParam baseParam) {
String methodDescribe = getMethodDescribe("getPowerGenerationUserPageList");
Page<GenerationUser> result = iPowerGenerationUserService.getPowerGenerationUserPageList(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -0,0 +1,19 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.po.jb.DistributionArea;
/**
* <p>
* Mapper 台区
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
public interface PowerDistributionAreaMapper extends BaseMapper<DistributionArea> {
}

View File

@@ -0,0 +1,19 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.po.jb.GenerationUser;
/**
* <p>
* Mapper 台区
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
public interface PowerGenerationUserMapper extends BaseMapper<GenerationUser> {
}

View File

@@ -0,0 +1,25 @@
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;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2025-06-10
*/
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);
}

View File

@@ -4,7 +4,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.RStatOnlinerateD;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -26,7 +26,7 @@ public interface RStatOnlinerateDMapper extends BaseMapper<RStatOnlinerateD> {
* @param param
* @return List<OnlineRate>
*/
List<RStatOnlinerateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
List<RStatOnlineRateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
/**
* @Description: 根据终端id集合获取总终端在线lv

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.PqDataVerifyCountMapper">
<select id="selectSumVerify" resultType="com.njcn.device.pq.pojo.po.PqDataVerifyCount">
SELECT
line_id AS lineId,
SUM(total) AS total,
SUM(total_all) AS totalAll
FROM
pq_data_verify_count
<where>
<if test="param!=null and param.ids != null and param.ids.size > 0">
AND line_id IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test=" param.startTime != null and param.startTime !=''">
AND time_id >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND time_id &lt;= #{param.endTime}
</if>
</where>
group by line_id ;
</select>
<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 &lt;= #{endTime}
</if>
GROUP BY
Line_Id
order by lastDay desc
</select>
</mapper>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.RStatOnlinerateDMapper">
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlinerateVO">
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlineRateVO">
select
dev_index,
sum(online_min) as onlineMin,

View File

@@ -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

View File

@@ -40,11 +40,10 @@ public interface CommTerminalService {
*/
List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam);
List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam);
List<LineDevGetDTO> deptGetLineByIdList(List<String> monitorIds);
/**
* 根据单位获取所有变电站
* @author cdf

View File

@@ -44,4 +44,5 @@ public interface IDataVerifyService extends IService<DataVerify> {
List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
}

View File

@@ -0,0 +1,46 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pq.pojo.po.jb.DistributionArea;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
public interface IPowerDistributionAreaService extends IService<DistributionArea> {
/**
* 分页查询所有
* @return
*/
Page<DistributionArea> getList(TaiZhangParam baseParam);
/**
* 新增
*/
boolean add(PowerDistributionareaParam newParam);
/**
* 修改
* @param
*/
boolean update(PowerDistributionareaParam updateParam);
/**
* 删除
* @param ids ids
*/
boolean delete(List<String> ids);
}

View File

@@ -0,0 +1,63 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.PowerGenerationUserParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.po.PowerGenerationUser;
import com.njcn.device.pms.pojo.vo.PowerGenerationUserVO;
import com.njcn.device.pq.pojo.po.jb.DistributionArea;
import com.njcn.device.pq.pojo.po.jb.GenerationUser;
import com.njcn.web.pojo.param.BaseParam;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
public interface IPowerGenerationUserService extends IService<GenerationUser> {
/**
* 新增发电用户
* @author cdf
* @date 2022/10/25
* @param powerGenerationUserParam 发电用户
* @return boolean
*/
boolean addPowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam);
/**
* 修改发电用户
* @author cdf
* @date 2022/10/25
* @param powerGenerationUserParam 发电用户
* @return boolean
*/
boolean updatePowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam);
/**
* 删除发电用户
* @author cdf
* @date 2022/10/25
* @param powerGenerationUserIds 发电用户
* @return boolean
*/
boolean delPowerGenerationUser(List<String> powerGenerationUserIds);
/**
* 分页查询发电用户列表
* @author cdf
* @date 2022/10/25
* @param baseParam 基础参数
* @return boolean
*/
Page<GenerationUser> getPowerGenerationUserPageList(BaseParam baseParam);
}

View File

@@ -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);

View File

@@ -0,0 +1,26 @@
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;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2025-06-10
*/
public interface IPqDataVerifyCountService extends IService<PqDataVerifyCount> {
List<PqDataVerifyCount> getSumVerify( OnlineRateParam param);
List<OnlineMonitorVo> getAnomalousData(LineBaseQueryParam par);
}

View File

@@ -9,6 +9,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import java.util.List;
@@ -37,4 +38,6 @@ public interface IRStatIntegrityDService extends IMppService<RStatIntegrityD> {
Boolean saveOrUpdateData(List<MonitorIntegrityDTO> monitorIntegrityDTOList);
DeviceOnlineRate getData(DeviceInfoParam.BusinessParam param);
List<OnlineMonitorVo> getNoData(LineBaseQueryParam param);
}

View File

@@ -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,47 @@ 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()));
}
});
lineList.addAll(map.get(i));
}
});
//去重
ArrayList<LineDevGetDTO> collect = lineList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(LineDevGetDTO::getPointId)
)), ArrayList::new));
deptGetChildrenMoreDTO.setLineBaseList(collect);
}
result.add(deptGetChildrenMoreDTO);
});
return result;
}
@Override
public List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
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.lineDevAllGet(filterDataTypeNew(deptGetLineParam.getServerName()),
1, deptGetLineParam.getLineRunFlag(), deptGetLineParam.getIsUpToGrid());
temDept.forEach(item -> {
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
deptGetChildrenMoreDTO.setUnitName(item.getUnitName());
deptGetChildrenMoreDTO.setUnitChildrenList(item.getUnitChildrenList());
deptGetChildrenMoreDTO.setDeptLevel(item.getDeptLevel());
List<String> deptIds = item.getUnitChildrenList();
if (CollectionUtil.isNotEmpty(deptIds)) {
List<LineDevGetDTO> lineList = new ArrayList<>();
deptIds.forEach(i -> {
if (map.containsKey(i)) {
map.get(i).forEach(x -> {
if (deptMap.containsKey(x.getUnitId())) {
x.setUnitName(deptMap.get(x.getUnitId()));
}
});
@@ -145,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()));
}
});
@@ -161,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());
@@ -186,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());
@@ -227,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());
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 -> {
@@ -245,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));
}
//国网监测点
@@ -279,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()));
}
});
@@ -295,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(),Stream.of(RunFlagEnum.RUNNING.getStatus()).collect(Collectors.toList()),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;
}

View File

@@ -128,7 +128,7 @@ public class CommunicateServiceImpl implements CommunicateService {
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(endTime)).toString());
if (state == 1) {
//在线率
List<RStatOnlinerateVO> onlineRateByDevIds = onlinerateDMapper.getOnlineRateByDevIds(param);
List<RStatOnlineRateVO> onlineRateByDevIds = onlinerateDMapper.getOnlineRateByDevIds(param);
if (CollUtil.isNotEmpty(onlineRateByDevIds)) {
onlineRateByDevIds.forEach(po -> {
//数据完整性 保留四位小数

View File

@@ -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;
@@ -21,31 +22,32 @@ 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.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 +69,20 @@ 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 IOverLimitService overLimitService;
private final DeptLineService deptLineService;
private final PqDataVerifyBakMapper pqDataVerifyBakMapper;
@Override
@@ -214,7 +208,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 +229,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);
}
@@ -349,7 +343,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
});
}
} else {
if(StrUtil.isNotBlank(jonsStr)){
if (StrUtil.isNotBlank(jonsStr)) {
JSONArray jsonArray = new JSONArray(jonsStr);
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
jsonBaseVOList.forEach(it -> {
@@ -358,13 +352,13 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
}
}
if(timeSet.size()>0){
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.setTimeSum(String.valueOf(timeInterval * timeSet.size()));
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
}
@@ -395,6 +389,213 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
return result;
}
@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{
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" + split[0];
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() {
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
return dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
@@ -463,6 +664,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 +684,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 +768,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());
}
@@ -758,7 +969,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 +981,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 +1008,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);
}
}

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
@@ -14,22 +15,19 @@ import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
import com.njcn.device.common.service.GeneralDeviceService;
import com.njcn.device.line.mapper.LineMapper;
import com.njcn.device.line.service.DeptLineService;
import com.njcn.device.line.service.LineService;
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DevRunEvaluateParam;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.device.pq.pojo.vo.*;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.enums.PowerFlagEnum;
import com.njcn.device.pq.enums.RunFlagEnum;
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.dto.MonitorInfoDTO;
import com.njcn.device.pq.pojo.param.DevRunEvaluateParam;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.service.DeviceRunEvaluateService;
import com.njcn.device.pq.service.IPqDataVerifyCountService;
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
import com.njcn.harmonic.api.RStatLimitRateDClient;
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
@@ -48,9 +46,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@@ -73,6 +70,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
private final OnLineRateMapper onLineRateMapper;
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
private final IPqDataVerifyCountService pqDataVerifyCountService;
/**
* 数据完整性:50%
*/
@@ -352,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())
@@ -378,10 +378,12 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
DeviceRunEvaluateVO.Detail detail;
//完整率
List<RStatIntegrityVO> integrityList = integrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
//超标率
List<RStatLimitRateDPO> limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData();
//获取所有终端在线率
List<RStatOnlinerateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
List<RStatOnlineRateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
//异常信息
onlineRateParam.setIds(lineIds);
List<PqDataVerifyCount> sumVerify = pqDataVerifyCountService.getSumVerify(onlineRateParam);
for (GeneralDeviceDTO dto : deviceInfo) {
detail = new DeviceRunEvaluateVO.Detail();
@@ -389,10 +391,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
detail.setCount(dto.getDeviceIndexes().size());
detail.setOnline(onLineRate(onlineRateByDev, dto.getDeviceIndexes()));
detail.setIntegrity(integrity(integrityList, dto.getLineIndexes()));
detail.setQualified(limitRate(limitRatePOList, 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());
.add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP));
Map<String, List<DevDetailVO>> dev = lineDeviceByDevIds
.stream()
.filter(x -> dto.getDeviceIndexes().contains(x.getDevId()))
@@ -406,6 +408,8 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
evaluateVO.setName(value.get(0).getDevName());
evaluateVO.setSubName(value.get(0).getSubName());
evaluateVO.setIp(value.get(0).getIp());
evaluateVO.setCompany(value.get(0).getCompany());
evaluateVO.setRunFlag(RunFlagEnum.getRunFlagRemarkByStatus(value.get(0).getRunFlag()));
//部门
if (deptMap.containsKey(value.get(0).getCit())) {
evaluateVO.setCit(deptMap.get(value.get(0).getCit()));
@@ -416,10 +420,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
}
evaluateVO.setOnLineRate(onLineRate(onlineRateByDev, Arrays.asList(key)));
evaluateVO.setIntegrityRate(integrity(integrityList, ids));
evaluateVO.setPassRate(limitRate(limitRatePOList, ids));
evaluateVO.setPassRate(verify(sumVerify, ids));
evaluateVO.setEvaluate(ONINTEGRITY.multiply(evaluateVO.getIntegrityRate())
.add(ONLINERATE.multiply(evaluateVO.getOnLineRate())
.add(LIMITRATE.multiply(evaluateVO.getPassRate()))).stripTrailingZeros());
.add(LIMITRATE.multiply(evaluateVO.getPassRate()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP));
deviceDetail.add(evaluateVO);
});
}
@@ -430,24 +434,57 @@ 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());
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);
}
}
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();
if (totalAll == 0) {
return new BigDecimal(0);
}
return NumberUtil.round(Math.min(total * 100.0 / totalAll, 100), 2);
} else {
return new BigDecimal(0);
}
}
private BigDecimal integrity(List<RStatIntegrityVO> integrityList, List<String> lineIds) {
//监测完整率
List<RStatIntegrityVO> integrityDS = integrityList.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(integrityDS)) {
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getRealTime).sum();
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getDueTime).sum();
return NumberUtil.round(Math.min(realTime * 100 / dueTime, 100), 2);
if (dueTime == 0) {
return new BigDecimal(0);
}
return NumberUtil.round(Math.min(realTime * 100.0 / dueTime, 100), 2);
} else {
return new BigDecimal(0);
}
}
private BigDecimal onLineRate(List<RStatOnlinerateVO> onlineRateByDev, List<String> devIds) {
private BigDecimal onLineRate(List<RStatOnlineRateVO> onlineRateByDev, List<String> devIds) {
//终端在线率
List<RStatOnlinerateVO> onlineRateDS = onlineRateByDev.stream().filter(x -> devIds.contains(x.getDevIndex())).collect(Collectors.toList());
List<RStatOnlineRateVO> onlineRateDS = onlineRateByDev.stream().filter(x -> devIds.contains(x.getDevIndex())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(onlineRateDS)) {
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateVO::getOnlineMin).sum();
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateVO::getOfflineMin).sum();
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
if ((onlineTime + offlineTime) == 0) {
return new BigDecimal(0);
}
return NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2);
} else {
return new BigDecimal(0);
@@ -455,6 +492,9 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
}
private BigDecimal limitRate(List<RStatLimitRateDPO> limitRatePOList, List<String> lineIds) {
if (CollUtil.isEmpty(limitRatePOList)) {
return new BigDecimal(0);
}
//超标信息
List<RStatLimitRateDPO> limitRateDPOS = limitRatePOList.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(limitRateDPOS)) {

View File

@@ -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) {
@@ -74,15 +77,14 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<DictData> v = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PANORAMIC_VOLTAGE.getCode()).getData();
List<String> voltageIds;
//获取电压等级550 220 110 35
if(CollUtil.isNotEmpty(v)){
if (CollUtil.isNotEmpty(v)) {
List<String> vName = v.stream().map(DictData::getName).collect(Collectors.toList());
voltageIds = dictDataList.stream().filter(item -> vName.contains(item.getName())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
}else{
} else {
voltageIds = dictDataList.stream().filter(item -> Objects.equals(DicDataEnum.DY_500KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_220KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_110KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_35KV.getCode(), item.getCode())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
}
GridDiagramVO gridDiagramVO = new GridDiagramVO();
List<GridDiagramVO.LineStatistics> info = new ArrayList<>();
List<GridDiagramVO.LineStatistics> gwInfo = new ArrayList<>();
@@ -295,11 +297,11 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override
public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) {
param.getDeviceInfoParam().setLineRunFlag(0);
if (type == 3) {
param.getDeviceInfoParam().setPowerFlag(0);
List<Integer> runFlag = new ArrayList<>();
if (3 != type) {
runFlag.add(0);
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), runFlag, Stream.of(1).collect(Collectors.toList()));
Map<String, Long> map = new LinkedHashMap<>();
DateField dateField;
DateTime parse;
@@ -359,7 +361,6 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override
public List<GridDiagramVO.DeviceData> getGridDiagramDevData(GridDiagramParam param) {
param.getDeviceInfoParam().setLineRunFlag(0);
// 获取所有数据
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
List<String> devIDs = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
@@ -399,9 +400,8 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override
public List<GridDiagramVO.DevData> getGridDiagramDevDataList(GridDiagramParam param) {
param.getDeviceInfoParam().setLineRunFlag(0);
List<GridDiagramVO.DevData> info = new ArrayList<>();
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(param.getDeviceInfoParam(), null, Stream.of(1).collect(Collectors.toList()));
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(param.getDeviceInfoParam(), Arrays.asList(0), Stream.of(1).collect(Collectors.toList()));
List<String> devIds = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList());
//终端信息
List<Device> devList = new ArrayList<>();
@@ -475,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());
@@ -499,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;
}

View File

@@ -0,0 +1,104 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pq.mapper.PowerDistributionAreaMapper;
import com.njcn.device.pq.pojo.po.jb.DistributionArea;
import com.njcn.device.pq.service.IPowerDistributionAreaService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* <p>
* 台区信息
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Service
@RequiredArgsConstructor
public class PowerDistributionAreaServiceImpl extends ServiceImpl<PowerDistributionAreaMapper, DistributionArea> implements IPowerDistributionAreaService {
@Override
public Page<DistributionArea> getList(TaiZhangParam baseParam) {
LambdaQueryWrapper<DistributionArea> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DistributionArea::getStatus,DataStateEnum.ENABLE.getCode())
.and(StrUtil.isNotBlank(baseParam.getSearchValue()),
i->i.like(DistributionArea::getName,baseParam.getSearchValue())
.or()
.like(DistributionArea::getPowerrName,baseParam.getSearchValue())
.or()
.like(DistributionArea::getLineName,baseParam.getSearchValue())
.or()
.like(DistributionArea::getOrgName,baseParam.getSearchValue())).orderByDesc(DistributionArea::getCreateTime);
//初始化分页数据
return this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
}
/**
* 新增台区信息
* @author hany
* @date 2022/10/26
*/
@Override
public boolean add(PowerDistributionareaParam newParam) {
LambdaQueryWrapper<DistributionArea> che = new LambdaQueryWrapper<>();
che.eq(DistributionArea::getId,newParam.getId());
int count = this.count(che);
if(count>0){
throw new BusinessException(PmsDeviceResponseEnum.POWER_CODE_SAME);
}
DistributionArea powerDistributionarea = new DistributionArea();
BeanUtils.copyProperties(newParam,powerDistributionarea);
//设为正常状态
powerDistributionarea.setStatus(DataStateEnum.ENABLE.getCode());
return this.save(powerDistributionarea);
}
/**
* 修改台区信息
* @author hany
* @date 2022/10/26
*/
@Override
public boolean update(PowerDistributionareaParam updateParam) {
DistributionArea powerDistributionarea = this.getById(updateParam.getId());
if(Objects.isNull(powerDistributionarea)){
throw new BusinessException(PmsDeviceResponseEnum.POWER_DIS_NOT_FIND);
}
BeanUtils.copyProperties(updateParam,powerDistributionarea);
return this.updateById(powerDistributionarea);
}
/**
* 删除
* @param ids
*/
@Override
@Transactional(rollbackFor=RuntimeException.class)
public boolean delete(List<String> ids) {
return this.removeByIds(ids);
}
}

View File

@@ -0,0 +1,78 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
import com.njcn.device.pms.pojo.param.PowerGenerationUserParam;
import com.njcn.device.pq.mapper.PowerGenerationUserMapper;
import com.njcn.device.pq.pojo.po.jb.GenerationUser;
import com.njcn.device.pq.service.IPowerGenerationUserService;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 台区信息
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Service
@RequiredArgsConstructor
public class PowerGenerationUserServiceImpl extends ServiceImpl<PowerGenerationUserMapper, GenerationUser> implements IPowerGenerationUserService {
@Override
public boolean addPowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam) {
LambdaQueryWrapper<GenerationUser> che = new LambdaQueryWrapper<>();
che.eq(GenerationUser::getId,powerGenerationUserParam.getId());
int count = this.count(che);
if(count>0){
throw new BusinessException(PmsDeviceResponseEnum.POWER_CODE_SAME);
}
GenerationUser powerDistributionarea = new GenerationUser();
BeanUtils.copyProperties(powerGenerationUserParam,powerDistributionarea);
//设为正常状态
powerDistributionarea.setStatus(DataStateEnum.ENABLE.getCode());
return this.save(powerDistributionarea);
}
@Override
public boolean updatePowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam) {
GenerationUser powerDistributionarea = this.getById(powerGenerationUserParam.getId());
if(Objects.isNull(powerDistributionarea)){
throw new BusinessException(PmsDeviceResponseEnum.POWER_DIS_NOT_FIND);
}
BeanUtils.copyProperties(powerGenerationUserParam,powerDistributionarea);
return this.updateById(powerDistributionarea);
}
@Override
public boolean delPowerGenerationUser(List<String> powerGenerationUserIds) {
return this.removeByIds(powerGenerationUserIds);
}
@Override
public Page<GenerationUser> getPowerGenerationUserPageList(BaseParam baseParam) {
LambdaQueryWrapper<GenerationUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(GenerationUser::getStatus, DataStateEnum.ENABLE.getCode())
.and(StrUtil.isNotBlank(baseParam.getSearchValue()),
i->i.like(GenerationUser::getName,baseParam.getSearchValue())
.or()
.like(GenerationUser::getOrgName,baseParam.getSearchValue())).orderByDesc(GenerationUser::getCreateTime);
//初始化分页数据
return this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
}
}

View File

@@ -18,10 +18,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 +35,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,19 +64,13 @@ 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) {
@@ -94,7 +87,6 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
} else {
verifyMonitorVO.setRunNum(0);
verifyMonitorVO.setAbnormalNum(0);
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, new ArrayList<>()));
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>()));
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam));
@@ -111,7 +103,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 +129,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);
}
}
@@ -267,97 +269,29 @@ 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("数据异常");
}
}
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setDateList(value.stream().map(x -> x.getTimeId().format(DatePattern.NORM_DATE_FORMATTER)).collect(Collectors.toList()));
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 +300,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());
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;
List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper);
Integer[] errorTimeCount = {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(), errAllCount);
}
} else {
String tarKey = "";
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
String key = entry.getKey();
if (targetJson.containsKey(key)) {
tarKey = key;
}
}
resultDeal(dtoMap, tarKey, targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount);
}
}
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(errorTimeCount[0]);
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 +371,13 @@ 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[] 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());
JSONArray list = jsonObjectTem.getJSONArray("list");
List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>();
list.forEach(listItem -> {
@@ -447,7 +388,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 +416,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 +434,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
break;
case "CP95":
vo.setCp95(ites.getVal());
break;
case "Feature_Amplitude":
vo.setFeatureAmplitude(ites.getVal());
break;
@@ -685,12 +627,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);
}

View File

@@ -0,0 +1,41 @@
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;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2025-06-10
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class PqDataVerifyCountServiceImpl extends ServiceImpl<PqDataVerifyCountMapper, PqDataVerifyCount> implements IPqDataVerifyCountService {
@Override
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());
}
}

View File

@@ -25,6 +25,7 @@ import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import com.njcn.device.pq.service.IRStatIntegrityDService;
@@ -34,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -69,9 +71,9 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
@Override
public List<LineDataQualityDTO> getLineDataQuality(LineDataQualityParam lineDataQualityParam) {
List<String> lineIds = lineDataQualityParam.getLineIds();
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,lineIds));
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId, lineIds));
lineList = lineList.stream().peek(item->{
lineList = lineList.stream().peek(item -> {
String devId = item.getPids().split(StrUtil.COMMA)[4];
item.setPid(devId);
}).collect(Collectors.toList());
@@ -81,35 +83,35 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
QueryWrapper<RStatOnlinerateD> onlineQuery = new QueryWrapper<>();
onlineQuery.select("dev_index,avg(online_min/offline_min+online_min) as onlineRate")
.lambda()
.in(RStatOnlinerateD::getDevIndex,devIds)
.between(RStatOnlinerateD::getTimeId, DateUtil.parse(lineDataQualityParam.getBeginTime(), DatePattern.NORM_DATE_PATTERN),DateUtil.parse(lineDataQualityParam.getEndTime(), DatePattern.NORM_DATE_PATTERN))
.in(RStatOnlinerateD::getDevIndex, devIds)
.between(RStatOnlinerateD::getTimeId, DateUtil.parse(lineDataQualityParam.getBeginTime(), DatePattern.NORM_DATE_PATTERN), DateUtil.parse(lineDataQualityParam.getEndTime(), DatePattern.NORM_DATE_PATTERN))
.groupBy(RStatOnlinerateD::getDevIndex);
List<RStatOnlinerateD> rStatOnlinerateDList = onlineRateMapper.selectList(onlineQuery);
Map<String,RStatOnlinerateD> onlineMap = rStatOnlinerateDList.stream().collect(Collectors.toMap(RStatOnlinerateD::getDevIndex, Function.identity()));
Map<String, RStatOnlinerateD> onlineMap = rStatOnlinerateDList.stream().collect(Collectors.toMap(RStatOnlinerateD::getDevIndex, Function.identity()));
QueryWrapper<RStatIntegrityD> integrityQuery = new QueryWrapper<>();
integrityQuery.select("line_index,avg(real_time/due_time) as integrityData")
.lambda()
.in(RStatIntegrityD::getLineIndex,lineIds)
.between(RStatIntegrityD::getTimeId, DateUtil.parse(lineDataQualityParam.getBeginTime(), DatePattern.NORM_DATE_PATTERN),DateUtil.parse(lineDataQualityParam.getEndTime(), DatePattern.NORM_DATE_PATTERN))
.in(RStatIntegrityD::getLineIndex, lineIds)
.between(RStatIntegrityD::getTimeId, DateUtil.parse(lineDataQualityParam.getBeginTime(), DatePattern.NORM_DATE_PATTERN), DateUtil.parse(lineDataQualityParam.getEndTime(), DatePattern.NORM_DATE_PATTERN))
.groupBy(RStatIntegrityD::getLineIndex);
List<RStatIntegrityD> rStatIntegrityDList = rStatIntegrityDMapper.selectList(integrityQuery);
Map<String,RStatIntegrityD> integrityMap = rStatIntegrityDList.stream().collect(Collectors.toMap(RStatIntegrityD::getLineIndex,Function.identity()));
Map<String, RStatIntegrityD> integrityMap = rStatIntegrityDList.stream().collect(Collectors.toMap(RStatIntegrityD::getLineIndex, Function.identity()));
List<LineDataQualityDTO> result = new ArrayList<>();
for(Line item : lineList){
for (Line item : lineList) {
LineDataQualityDTO lineDataQualityDTO = new LineDataQualityDTO();
lineDataQualityDTO.setLineId(item.getId());
lineDataQualityDTO.setLineName(item.getName());
if(onlineMap.containsKey(item.getPid())){
if (onlineMap.containsKey(item.getPid())) {
lineDataQualityDTO.setOnlineRate(Double.valueOf(onlineMap.get(item.getPid()).getOnlineRate()));
}else {
} else {
lineDataQualityDTO.setOnlineRate(0.00);
}
if(integrityMap.containsKey(item.getId())){
if (integrityMap.containsKey(item.getId())) {
lineDataQualityDTO.setIntegrityRate(Double.valueOf(integrityMap.get(item.getId()).getIntegrityData()));
}else {
} else {
lineDataQualityDTO.setIntegrityRate(0.00);
}
result.add(lineDataQualityDTO);
@@ -132,7 +134,7 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
return rStatIntegrityD;
}).collect(Collectors.toList());
this.saveOrUpdateBatchByMultiId(collect1,200);
this.saveOrUpdateBatchByMultiId(collect1, 200);
return true;
}
@@ -149,25 +151,25 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
.collect(Collectors.toList());
rate.setTotalNum(lineIds.size());
//获取所有监测点的数据完整性
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds,param.getSearchBeginTime(),param.getSearchEndTime());
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
//获取所有监测点信息信息
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo)?calculateIntegrityRate(lineIntegrityRateInfo,90):lineIds.size());
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo,lineIds).toString());
List<DeviceOnlineRate.CitDetail> citDetailList=new ArrayList<>();
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, lineIds.size()) : lineIds.size());
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;
for (GeneralDeviceDTO dto : deviceInfo) {
//获取部门终端集合
List<RStatIntegrityVO> citDevOnRate = lineIntegrityRateInfo.stream().filter(x -> dto.getLineIndexes().contains(x.getLineIndex())).collect(Collectors.toList());
Map<String, Double> onlineRateByDevMap = citDevOnRate.stream()
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
citDetail=new DeviceOnlineRate.CitDetail();
citDetail = new DeviceOnlineRate.CitDetail();
citDetail.setCitName(dto.getName());
citDetail.setCitTotalNum(dto.getLineIndexes().size());
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate)?calculateIntegrityRate(lineIntegrityRateInfo,90):dto.getLineIndexes().size());
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo,dto.getLineIndexes()).toString());
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
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) {
@@ -183,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(), 0.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);
@@ -194,19 +196,26 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
return rate;
}
private Double calculateIntegrityRate(List<RStatIntegrityVO> lineIntegrityRateInfo ,List<String> deviceIds){
List<RStatIntegrityVO> list = lineIntegrityRateInfo.stream().filter(x -> deviceIds.contains(x.getLineIndex())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(list)){
BigDecimal onlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatIntegrityVO::getDueTime).sum());
BigDecimal offlineMin =BigDecimal.valueOf( list.stream().mapToLong(RStatIntegrityVO::getRealTime).sum());
BigDecimal sumMin= onlineMin.add(offlineMin);
return sumMin.doubleValue();
}
return 0.0;
@Override
public List<OnlineMonitorVo> getNoData(LineBaseQueryParam param) {
return this.baseMapper.getNoData(param.getLineIds(), param.getStartTime(), param.getEndTime());
}
private Integer calculateIntegrityRate(List<RStatIntegrityVO> onlineRateByDev,Integer limit){
return (int) onlineRateByDev.stream().filter(x -> x.getIntegrityRate() < limit).count();
private BigDecimal calculateIntegrityRate(List<RStatIntegrityVO> lineIntegrityRateInfo, List<String> deviceIds) {
List<RStatIntegrityVO> list = lineIntegrityRateInfo.stream().filter(x -> deviceIds.contains(x.getLineIndex())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) {
BigDecimal dueTime = BigDecimal.valueOf(list.stream().mapToLong(RStatIntegrityVO::getDueTime).sum());
BigDecimal realTime = BigDecimal.valueOf(list.stream().mapToLong(RStatIntegrityVO::getRealTime).sum());
if (BigDecimal.ZERO.compareTo(dueTime) == 0) {
BigDecimal.valueOf(0);
}
return realTime.multiply(BigDecimal.valueOf(100.0)).divide(dueTime, 2, RoundingMode.HALF_UP);
}
return BigDecimal.valueOf(0);
}
private Integer calculateIntegrityRate(List<RStatIntegrityVO> onlineRateByDev, Integer limit, Integer count) {
return count - onlineRateByDev.stream().filter(x -> x.getIntegrityRate().doubleValue() >= limit).collect(Collectors.toList()).size();
}

View File

@@ -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)){

View File

@@ -2,12 +2,8 @@ package com.njcn.device.pq.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.common.service.GeneralDeviceService;
@@ -16,20 +12,15 @@ import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.mapper.*;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
import com.njcn.device.pq.pojo.dto.PublicDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.param.TerminalOnlineRateDataParam;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.device.pq.pojo.po.TerminalOnlineRateData;
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
import com.njcn.device.pq.pojo.vo.OnlineRateCensusVO;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.pq.pojo.vo.TerminalOnlineRateDataVO;
import com.njcn.device.pq.service.TerminalOnlineRateDataService;
import com.njcn.device.pq.utils.DataStatisticsUtil;
@@ -215,7 +206,7 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
param.setIds(deviceIndexes);
param.setStartTime( DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toString());
param.setEndTime( DateUtil.endOfDay(DateUtil.parse(searchEndTime)).toString());
List<RStatOnlinerateVO> data = onlineRateMapper.getOnlineRateByDevIds(param);
List<RStatOnlineRateVO> data = onlineRateMapper.getOnlineRateByDevIds(param);
if (CollUtil.isNotEmpty(data)) {
data.forEach(po -> {
PublicDTO publicDTO = new PublicDTO();

View File

@@ -4,7 +4,7 @@ package com.njcn.device.common.mapper.onlinerate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -26,6 +26,6 @@ public interface OnLineRateMapper extends BaseMapper<RStatOnlinerateD> {
* @param param
* @return List<OnlineRate>
*/
List<RStatOnlinerateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
List<RStatOnlineRateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.common.mapper.onlinerate.OnLineRateMapper">
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlinerateVO">
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlineRateVO">
select
dev_index,
sum(online_min) as onlineMin,

View File

@@ -428,7 +428,7 @@ public class GeneralDeviceService {
//2.筛选出终端id理论上监测点的pids中第五个id为终端id
List<String> devIds = voltages.stream().map(Line::getPid).distinct().collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam);
//3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds = devices.stream().map(Line::getPid).distinct().collect(Collectors.toList());

View File

@@ -129,7 +129,7 @@ public interface TerminalBaseService {
* @param deviceType 终端筛选条件
* @param manufacturer 终端厂家
*/
List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, List<SimpleDTO> manufacturer);
List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, DeviceInfoParam manufacturer);
/**
* 查询母线信息

View File

@@ -9,7 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.device.service.OnLineRateService;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
@@ -41,6 +41,7 @@ public class OnLineRateController extends BaseController {
@ApiOperation("终端在线率列表(冀北)")
public HttpResult<DeviceOnlineRate> deviceOnlineRateInfo(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("deviceOnlineRateInfo");
deviceInfoParam.setLineOrDevice(1);
DeviceOnlineRate rate = onLineRateService.deviceOnlineRateInfo(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
}
@@ -48,9 +49,9 @@ public class OnLineRateController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getOnlineRateByDevIds")
@ApiOperation("通用终端在线率(冀北)")
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam deviceInfoParam) {
public HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("deviceOnlineRateInfo");
List<RStatOnlinerateVO> rate = onLineRateService.getOnlineRateByDevIds(deviceInfoParam);
List<RStatOnlineRateVO> rate = onLineRateService.getOnlineRateByDevIds(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
}

View File

@@ -339,10 +339,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,
@@ -355,6 +355,7 @@
line.id lineId,
line.name lineName,
gdinfo.NAME AS gdName,
substation.id AS subStationId,
substation.NAME AS subStationName,
device.NAME AS devName,
deviceDetail.Com_Flag AS comFlag,
@@ -370,7 +371,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,

View File

@@ -3,7 +3,7 @@ package com.njcn.device.device.service;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import java.util.List;
@@ -31,5 +31,5 @@ public interface OnLineRateService {
* @param
* @return
*/
List<RStatOnlinerateVO> getOnlineRateByDevIds(OnlineRateParam onlineRateParam);
List<RStatOnlineRateVO> getOnlineRateByDevIds(OnlineRateParam onlineRateParam);
}

View File

@@ -12,12 +12,13 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@@ -35,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())
@@ -49,24 +52,24 @@ public class OnLineRateServiceImpl extends ServiceImpl<OnLineRateMapper, RStatOn
onlineRateParam.setStartTime(param.getSearchBeginTime());
onlineRateParam.setEndTime(param.getSearchEndTime());
//获取所有终端在线率
List<RStatOnlinerateVO> onlineRateByDev = this.baseMapper.getOnlineRateByDevIds(onlineRateParam);
List<RStatOnlineRateVO> onlineRateByDev = this.baseMapper.getOnlineRateByDevIds(onlineRateParam);
//获取所有终端信息
List<DevDetail> devInfoByIds = deviceService.getDevInfoByIds(deviceIds);
rate.setBelowNum(CollUtil.isNotEmpty(onlineRateByDev) ? calculateOnLineRate(onlineRateByDev, 90) : deviceIds.size());
rate.setBelowNum(CollUtil.isNotEmpty(onlineRateByDev) ? calculateOnLineRate(onlineRateByDev, 90, deviceIds.size()) : deviceIds.size());
rate.setTotalOnlineRate(calculateOnLineRate(onlineRateByDev, deviceIds));
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
DeviceOnlineRate.CitDetail citDetail;
DeviceOnlineRate.Detail detail;
for (GeneralDeviceDTO dto : deviceInfo) {
//获取部门终端集合
List<RStatOnlinerateVO> citDevOnRate = onlineRateByDev.stream().filter(x -> dto.getDeviceIndexes().contains(x.getDevIndex())).collect(Collectors.toList());
Map<String, Float> onlineRateByDevMap = citDevOnRate.stream()
.collect(Collectors.toMap(RStatOnlinerateVO::getDevIndex, RStatOnlinerateVO::getOnlineRate));
List<RStatOnlineRateVO> citDevOnRate = onlineRateByDev.stream().filter(x -> dto.getDeviceIndexes().contains(x.getDevIndex())).collect(Collectors.toList());
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
.collect(Collectors.toMap(x -> x.getDevIndex(), x -> x.getOnlineRate()));
citDetail = new DeviceOnlineRate.CitDetail();
citDetail.setCitName(dto.getName());
citDetail.setCitTotalNum(dto.getDeviceIndexes().size());
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateOnLineRate(onlineRateByDev, 90) : dto.getDeviceIndexes().size());
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateOnLineRate(citDevOnRate, 90, dto.getDeviceIndexes().size()) : dto.getDeviceIndexes().size());
citDetail.setCitTotalOnlineRate(calculateOnLineRate(onlineRateByDev, dto.getDeviceIndexes()));
List<DeviceOnlineRate.Detail> detailList = new ArrayList<>();
List<DevDetail> details = devInfoByIds.stream().filter(x -> dto.getDeviceIndexes().contains(x.getDevIndex())).collect(Collectors.toList());
@@ -82,7 +85,7 @@ public class OnLineRateServiceImpl extends ServiceImpl<OnLineRateMapper, RStatOn
detail.setRunFlag(RunFlagEnum.getRunFlagRemarkByStatus(dev.getRunFlag()));
detail.setComFlag(dev.getComFlag() == 0 ? "中断" : "正常");
detail.setTimeID(dev.getTimeID());
detail.setOnlineRate(onlineRateByDevMap.containsKey(dev.getDevIndex()) ? onlineRateByDevMap.get(dev.getDevIndex()).toString() : "0");
detail.setOnlineRate(onlineRateByDevMap.containsKey(dev.getDevIndex()) ? onlineRateByDevMap.get(dev.getDevIndex()) : BigDecimal.valueOf(0));
detailList.add(detail);
}
citDetail.setDetailList(detailList);
@@ -94,23 +97,26 @@ public class OnLineRateServiceImpl extends ServiceImpl<OnLineRateMapper, RStatOn
}
@Override
public List<RStatOnlinerateVO> getOnlineRateByDevIds(OnlineRateParam onlineRateParam) {
public List<RStatOnlineRateVO> getOnlineRateByDevIds(OnlineRateParam onlineRateParam) {
return this.baseMapper.getOnlineRateByDevIds(onlineRateParam);
}
private String calculateOnLineRate(List<RStatOnlinerateVO> onlineRateByDev, List<String> deviceIds) {
List<RStatOnlinerateVO> list = onlineRateByDev.stream().filter(x -> deviceIds.contains(x.getDevIndex())).collect(Collectors.toList());
private BigDecimal calculateOnLineRate(List<RStatOnlineRateVO> onlineRateByDev, List<String> deviceIds) {
List<RStatOnlineRateVO> list = onlineRateByDev.stream().filter(x -> deviceIds.contains(x.getDevIndex())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) {
BigDecimal onlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatOnlinerateVO::getOnlineMin).sum());
BigDecimal offlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatOnlinerateVO::getOfflineMin).sum());
BigDecimal onlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatOnlineRateVO::getOnlineMin).sum());
BigDecimal offlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatOnlineRateVO::getOfflineMin).sum());
BigDecimal sumMin = onlineMin.add(offlineMin);
return onlineMin.divide(sumMin, 2).toString();
if (BigDecimal.ZERO.compareTo(sumMin) == 0) {
BigDecimal.valueOf(0);
}
return onlineMin.multiply(BigDecimal.valueOf(100.0)).divide(sumMin, 2, RoundingMode.HALF_UP);
}
return "0";
return BigDecimal.valueOf(0);
}
private Integer calculateOnLineRate(List<RStatOnlinerateVO> onlineRateByDev, Integer limit) {
return onlineRateByDev.stream().filter(x -> x.getOnlineRate() < limit).collect(Collectors.toList()).size();
private Integer calculateOnLineRate(List<RStatOnlineRateVO> onlineRateByDev, Integer limit, Integer count) {
return count - onlineRateByDev.stream().filter(x -> x.getOnlineRate().doubleValue() >= limit).collect(Collectors.toList()).size();
}

View File

@@ -74,11 +74,22 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag);
List<LineDevGetDTO> lineDevAllGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag, @Param("lineType") Integer lineType);
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType,@Param("powerFlag")Integer powerFlag,@Param("lineRunFlag") Integer lineRunFlag);
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType,
@Param("powerFlag")Integer powerFlag,
@Param("lineRunFlag") Integer lineRunFlag,
@Param("monitorFlag") Integer monitorFlag,
@Param("searchValue") String searchValue
);
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("manufacturer")String manufacturer,@Param("runFlag")List<Integer> runFlag,@Param("dataType")List<Integer> dataType,@Param("objType")String objType);
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,
@Param("manufacturer")String manufacturer,
@Param("runFlag")List<Integer> runFlag,
@Param("dataType")List<Integer> dataType,
@Param("objType")String objType);
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);

View File

@@ -155,7 +155,7 @@ public interface LineMapper extends BaseMapper<Line> {
* @param deviceType 终端筛选条件
* @param manufacturer 终端厂家
*/
List<Line> getDeviceByCondition(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType, @Param("manufacturer") List<SimpleDTO> manufacturer);
List<Line> getDeviceByCondition(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType, @Param("deviceInfoParam") DeviceInfoParam manufacturer);
/**
* 查询母线信息
@@ -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);
}

View File

@@ -74,6 +74,71 @@
</select>
<select id="lineDevAllGet" resultType="com.njcn.device.biz.pojo.dto.LineDevGetDTO">
select
<!--监测点-->
<if test="type == 1">
pq_dept_line.id unitId,
point.id pointId,
lineDetail.Time_Interval as timeInterval,
lineDetail.load_type lineTag,
lineDetail.Run_Flag as lineRunFlag,
dic.id voltageLevel,
dev.id devId,
device.com_flag comFlag,
1 as lineType,
0 as type,
lineDetail.obj_id,
lineDetail.monitor_flag as isUpToGrid,
point.name pointName
</if>
<!--母线-->
<if test="type == 2">
DISTINCT
pq_dept_line.id unitId,
dic.id voltageLevel,
voltage.id pointId,
point.id devId
</if>
<!--装置-->
<if test="type == 3">
DISTINCT
pq_dept_line.id unitId,
dev.id devId,
dic.id voltageLevel,
1 as type ,
device.update_time,
device.Com_Flag as comFlag
</if>
from pq_dept_line pq_dept_line
inner join pq_line point on pq_dept_line.line_id = point.id
inner join pq_line_detail lineDetail on point.id = lineDetail.id
inner join pq_line voltage on point.pid = voltage.id
inner join pq_voltage pq_voltage on voltage.id = pq_voltage.id
inner join sys_dict_data dic on pq_voltage.Scale= dic.id
inner join pq_line dev on voltage.pid = dev.id
inner join pq_device device on dev.id = device.id
where device.Dev_Model = 1
and point.state = 1
and device.Dev_Data_Type in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="lineRunFlag!=null ">
and lineDetail.Run_Flag = #{lineRunFlag}
</if>
<if test="lineType!=null and lineType!=''">
<choose>
<when test="lineType == 0">
and lineDetail.Monitor_Id is not null
</when>
<otherwise>
and (lineDetail.Monitor_Id is null or lineDetail.Monitor_Id = '')
</otherwise>
</choose>
</if>
</select>
<select id="orgSubStationGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase">
select
@@ -124,7 +189,16 @@
and lineDetail.Power_Flag = #{powerFlag}
</if>
<if test="lineRunFlag!=null ">
and device.Run_Flag = 0 and lineDetail.Run_Flag = #{lineRunFlag}
and lineDetail.Run_Flag = #{lineRunFlag}
</if>
<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">
@@ -142,10 +216,12 @@
<foreach collection="dataType" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and device.run_flag in
<foreach collection="runFlag" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="runFlag!=null and runFlag.size() > 0">
and lineDetail.run_flag in
<foreach collection="runFlag" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="objType!=null and objType!=''">
and lineDetail.big_obj_type = #{objType}
</if>

View File

@@ -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,

View File

@@ -294,6 +294,9 @@
#{item.id}
</foreach>
</if>
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.searchValue!='' and deviceInfoParam.lineOrDevice==0">
AND t1.name like CONCAT(CONCAT('%', #{deviceInfoParam.searchValue}), '%')
</if>
<!-- xy -->
<choose>
<when test="deviceInfoParam.statFlag">
@@ -335,12 +338,15 @@
#{item}
</foreach>
</if>
<if test="manufacturer!=null and manufacturer.size()!=0">
<if test="deviceInfoParam.manufacturer!=null and deviceInfoParam.manufacturer.size()!=0">
AND t2.manufacturer in
<foreach collection="manufacturer" open="(" close=")" item="item" separator=",">
<foreach collection="deviceInfoParam.manufacturer" open="(" close=")" item="item" separator=",">
#{item.id}
</foreach>
</if>
<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">
AND t1.id IN
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
@@ -564,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,
@@ -1535,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,
@@ -1928,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>

View File

@@ -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
@@ -105,7 +112,7 @@ public interface DeptLineService extends IService<DeptLine> {
*/
Map<String, List<LineDevGetDTO>> lineDevGet(List<Integer> devType,Integer type,Integer lineRunFlag);
Map<String, List<LineDevGetDTO>> lineDevAllGet(List<Integer> devType,Integer type,Integer lineRunFlag, Integer lineType);
/**
* 获取根据单位分组的变电站集合信息
@@ -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);
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,Integer powerFlag,Integer lineRunFlag,Integer monitorFlag,String searchValue);
List<SubGetBase> getSubStationList(SubstationParam substationParam);

View File

@@ -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);
@@ -169,6 +193,12 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
return deptLines.stream().collect(Collectors.groupingBy(LineDevGetDTO::getUnitId));
}
@Override
public Map<String, List<LineDevGetDTO>> lineDevAllGet(List<Integer> devDataType, Integer type, Integer lineRunFlag, Integer lineType) {
List<LineDevGetDTO> deptLines = deptLineMapper.lineDevAllGet(devDataType, type, lineRunFlag,lineType);
return deptLines.stream().collect(Collectors.groupingBy(LineDevGetDTO::getUnitId));
}
@Override
public Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devDataType) {
List<TerminalGetBase> deptLines = deptLineMapper.orgSubStationGet(devDataType);
@@ -176,8 +206,13 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
}
@Override
public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType, Integer powerFlag, Integer lineRunFlag) {
return deptLineMapper.orgSubStationInfoGet(devType, powerFlag, lineRunFlag);
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

View File

@@ -6,6 +6,7 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
import org.apache.ibatis.annotations.Param;
@@ -56,4 +57,10 @@ public interface RStatIntegrityDMapper extends MppBaseMapper<RStatIntegrityD> {
*/
List<RStatIntegrityVO> getLineIntegrityRateInfo(@Param("lineIds")List<String> lineIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
/**
* 获取监测点数据完整性为0的数据
* @author xy
* @date 2025/12/10
*/
List<OnlineMonitorVo> getNoData(@Param("lineIds")List<String> lineIds, @Param("startTime")String startTime, @Param("endTime")String endTime);
}

View File

@@ -110,4 +110,42 @@
group by line_index
</select>
<select id="getNoData" resultType="OnlineMonitorVo">
SELECT DISTINCT
t6.Name gdName,
t5.Name subName,
t4.Name deviceName,
t1.line_index lineId,
t2.Name lineName,
t8.Name monitorObjType,
t7.Obj_Name monitorObj,
"完整性为0" as target,
count(t1.time_id) lastDay
FROM
r_stat_integrity_d t1
left join pq_line t2 on t1.line_index = 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_index = t7.Id
left join sys_dict_data t8 on t7.Load_Type = t8.Id
WHERE
t1.real_time = 0
<if test="lineIds!=null and lineIds.size > 0">
and line_index 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 &lt;= #{endTime}
</if>
GROUP BY
line_index
order by lastDay desc
</select>
</mapper>

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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 = "特征值是否计算")

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -8,20 +8,21 @@ 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.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.AreaSubLineVO;
import com.njcn.event.service.majornetwork.AreaInfoService;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.harmonic.api.PollutionSubstationClient;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
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;
@@ -41,32 +42,43 @@ public class AreaInfoServiceImpl implements AreaInfoService {
private final GeneralDeviceInfoClient generalDeviceInfoClient;
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<>();
if(1==deviceInfoParam.getType()){
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
List<String> lineIds = new ArrayList<>();
Map<String, UserLinePollution> userMap = new HashMap<>();
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(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
resList.stream().filter(x->deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x->x.setType(0));
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());
param.setEndTime(deviceInfoParam.getSearchEndTime());
userMap = pollutionSubstationClient.getSumList(param).getData();
}
if(CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())){
resList.stream().filter(x->deviceInfoParam.getAlarmList().contains(x.getLineId())).forEach(x->x.setType(1));
//设置冀北告警监测点类型
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));
}
//查询监测点未处理暂态事件
@@ -86,6 +98,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong));
}
}
if (userMap.containsKey(areaLineInfoVO.getLineId())) {
UserLinePollution userLinePollution = userMap.get(areaLineInfoVO.getLineId());
areaLineInfoVO.setVHarmonicValue(userLinePollution.getVHarmonicValue());
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(), AreaLineInfoVO.User.class));
}
}
//组装成变电站

View File

@@ -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,34 +486,95 @@ 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()))
.filter(x -> 0.9 > x.getFeatureAmplitude())
.map(RmpEventDetailPO::getFeatureAmplitude).count();
.filter(x -> 0.9 > x.getSeverity()).count();
long count50 = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
.filter(x -> 0.5 > x.getFeatureAmplitude())
.map(RmpEventDetailPO::getFeatureAmplitude).count();
if(count90>0){
info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue());
}else {
.filter(x -> 0.5 > x.getSeverity()).count();
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, "计算失败");

View File

@@ -84,4 +84,6 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
List<EventCount> getEventCount(GridDiagramParam param);
Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param);
}

View File

@@ -217,6 +217,7 @@ whitelist:
- /pqs-auth/judgeToken/guangZhou
- /webjars/**
- /actuator/**
- /doc.html
- /swagger-resources/**
- /*/v2/api-docs

View File

@@ -0,0 +1,24 @@
package com.njcn.harmonic.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
@FeignClient(
value = ServerInfo.HARMONIC,
path = "/PollutionSubstation",
fallbackFactory = RStatLimitRateDFeignClientFallbackFactory.class,
contextId = "PollutionSubstation")
public interface PollutionSubstationClient {
@PostMapping(value ="/getSumList")
HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param);
}

View File

@@ -0,0 +1,43 @@
package com.njcn.harmonic.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.pojo.param.OnlineRateParam;
import com.njcn.harmonic.api.PollutionSubstationClient;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author hongawen
* @version 1.0.0
* @date 2023年07月21日 14:31
*/
@Slf4j
@Component
public class PollutionSubstationClientFactory implements FallbackFactory<PollutionSubstationClient> {
@Override
public PollutionSubstationClient 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 PollutionSubstationClient() {
@Override
public HttpResult<Map<String, UserLinePollution>> getSumList(OnlineRateParam.Info param) {
log.error("{}异常,降级处理,异常为:{}", "国网上送-典型源荷指标统计数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
};
}
}

View File

@@ -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;
}

View File

@@ -24,6 +24,8 @@ public class LinePollution implements Serializable {
@ApiModelProperty("变电站")
private String subStationName;
private String subStationId;
/**
* 终端名称
*/

View File

@@ -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;
}

View File

@@ -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;
/**
* 电网侧&非电网侧

Some files were not shown because too many files have changed in this diff Show More