73 Commits

Author SHA1 Message Date
wr
184b2b8fad Merge remote-tracking branch 'origin/main' 2026-01-04 14:54:04 +08:00
wr
fe029fcb95 1.异常数据界面业务调整
2.技术监督增加仿真治理方案
2026-01-04 14:50:03 +08:00
hzj
9143466ce7 海南bug修改提交 2025-12-29 15:29:51 +08:00
hzj
9409d57243 海南bug修改提交 2025-12-29 14:26:30 +08:00
63603dee08 海南数据不一致问题处理 2025-12-29 10:34:38 +08:00
wr
e35bbd9b34 Merge remote-tracking branch 'origin/main' 2025-12-29 09:27:20 +08:00
wr
ea2173fff4 增加二级评估用户绑定 2025-12-29 09:27:03 +08:00
faac7953d3 海南数据不一致问题处理 2025-12-26 15:29:33 +08:00
xy
c3cc39973e Merge remote-tracking branch 'origin/main' 2025-12-26 11:24:40 +08:00
xy
6d8bfacd0a 在线监测算法每日更新导致告警单丢失问题 2025-12-26 11:24:22 +08:00
wr
ab5d28e3cb 变电站台账数据调整 2025-12-26 11:23:47 +08:00
wr
2dccb22cf8 Merge remote-tracking branch 'origin/main' 2025-12-26 11:22:51 +08:00
xy
6b0bad6047 微调 2025-12-25 20:44:52 +08:00
9ffbdbdf57 驾驶舱全局处理 2025-12-25 20:39:28 +08:00
wr
778f689b3e 优化异常数据和稳态告警接口信息 2025-12-25 15:32:21 +08:00
hzj
917e3fb2d5 海南bug修改提交 2025-12-23 11:40:18 +08:00
cdf
e0f1e314a4 组件管理加排序 2025-12-23 09:33:18 +08:00
cdf
2f2ed06a35 组件管理加排序 2025-12-22 19:59:25 +08:00
xy
277400670d 微调 2025-12-22 14:11:16 +08:00
xy
a1031109c4 微调 2025-12-22 10:09:15 +08:00
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
184 changed files with 5432 additions and 1632 deletions

View File

@@ -83,10 +83,10 @@ public class EventRelevantAnalysisController extends BaseController {
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
String methodDescribe = getMethodDescribe("queryEventsAssPage");
String searchValue = baseParam.getSearchValue();
Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
if(pattern.matcher(searchValue).find()){
throw new BusinessException(ValidMessage.SPECIAL_REGEX);
}
// Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
// if(pattern.matcher(searchValue).find()){
// throw new BusinessException(ValidMessage.SPECIAL_REGEX);
// }
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}

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

@@ -322,10 +322,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
@Override
public boolean deleteEventData(List<String> ids) {
return this.lambdaUpdate()
.set(SgEvent::getState, DataStateEnum.DELETED.getCode())
.in(SgEvent::getId, ids)
.update();
return this.removeByIds(ids);
}
@Override

View File

@@ -51,6 +51,7 @@ import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -471,6 +472,8 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
item.setFeatureAmplitude(roundHalfUp(item.getFeatureAmplitude()*100));
if (map.containsKey(item.getLineId())) {
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
item.setGdName(areaLineInfoVO.getGdName());
@@ -489,7 +492,17 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
}
/**
* 四舍五入保留两位小数
*/
private Double roundHalfUp(double num) {
if (num == 3.14159) {
return num;
}
BigDecimal b = new BigDecimal(num);
//保留2位小数
return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
@Override
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());

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

@@ -8,4 +8,8 @@ public class PublicDTO {
private String id;
private Double data;
private Integer onlineMin;
private Integer offlineMin;
}

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

@@ -93,7 +93,7 @@ public class DeviceParam {
@NotBlank(message = "设备制造商不能为空")
private String manufacturer;
@ApiModelProperty(name = "electroplate",value = "功能",required = true)
@ApiModelProperty(name = "electroplate",value = "功能",required = true)
@NotNull(message = "电镀标识不能为空")
private Integer electroplate;

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,12 @@ public class MonitorBaseParam extends BaseParam {
@ApiModelProperty(value = "终端厂家")
private String manufacturer;
@ApiModelProperty(value = "监测点运行状态")
private Integer lineRunFlag;
@ApiModelProperty(value = "异常天数时间")
private List<String> time;
@ApiModelProperty(value = "过滤异常时间次数")
private Integer errorTimeCount;
}

View File

@@ -1,8 +1,9 @@
package com.njcn.device.pq.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import java.time.LocalDate;
import lombok.Getter;
import lombok.Setter;
@@ -25,136 +26,306 @@ public class PqDataVerifyBak {
/**
* 监测点id
*/
@MppMultiId
@TableField(value = "line_id")
private String lineId;
/**
* 异常数据时间
*/
@MppMultiId
@TableField(value = "time_id")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate timeId;
/**
* 频率(0:正常 1:异常)
* 监测点状态
* 判断所有指标 0:无异常 1:异常
*/
private Integer freq;
@TableField(value = "state")
private Integer state ;
/**
* 频率偏差(0:正常 1:异常)
* 频率指标
*/
private Integer freqDev;
@TableField(value = "freq")
private Integer freq ;
/**
* 相电压有效值(0:正常 1:异常)
* 频率异常时间
*/
private Integer vRms;
@TableField(value = "freq_time")
private Integer freqTime ;
/**
* 正序电压(0:正常 1:异常)
* 频率偏差指标
*/
private Integer vPos;
@TableField(value = "freq_dev")
private Integer freqDev ;
/**
* 负序电压(0:正常 1:异常)
* 频率偏差异常时间
*/
private Integer vNeg;
@TableField(value = "freq_dev_time")
private Integer freqDevTime ;
/**
* 零序电压(0:正常 1:异常)
* 相电压有效值
*/
private Integer vZero;
@TableField(value = "v_rms")
private Integer vRms ;
/**
* 电压不平衡度(0:正常 1:异常)
* 电压有效值异常时间
*/
private Integer vUnbalance;
@TableField(value = "v_rms_time")
private Integer vRmsTime ;
/**
* 线电压有效值(0:正常 1:异常)
* 正序电压
*/
private Integer rmsLvr;
@TableField(value = "v_pos")
private Integer vPos ;
/**
* 电压正偏差(0:正常 1:异常)
* 正序电压异常时间
*/
private Integer vuDev;
@TableField(value = "v_pos_time")
private Integer vPosTime ;
/**
* 电压负偏差(0:正常 1:异常)
* 负序电压
*/
private Integer vlDev;
@TableField(value = "v_neg")
private Integer vNeg ;
/**
* 电压总谐波畸变率(0:正常 1:异常)
* 负序电压异常时间
*/
private Integer vThd;
@TableField(value = "v_neg_time")
private Integer vNegTime ;
/**
* 相电压基波有效值(0:正常 1:异常)
* 零序电压
*/
private Integer v;
@TableField(value = "v_zero")
private Integer vZero ;
/**
* 电流有效值(0:正常 1:异常)
* 零序电压异常时间
*/
private Integer iRms;
@TableField(value = "v_zero_time")
private Integer vZeroTime ;
/**
* 长时闪变(0:正常 1:异常)
* 电压不平衡度
*/
private Integer plt;
@TableField(value = "v_unbalance")
private Integer vUnbalance ;
/**
* 间谐波电压含有率(0:正常 1:异常)
* 电压不平衡度异常时间
*/
private Integer vInharm;
@TableField(value = "v_unbalance_time")
private Integer vUnbalanceTime ;
/**
* 谐波电压含有率(0:正常 1:异常)
* 线电压有效值
*/
private Integer vHarm;
@TableField(value = "rms_lvr")
private Integer rmsLvr ;
/**
* 功率因数(0:正常 1:异常)
* 线电压有效值异常时间
*/
private Integer pf;
@TableField(value = "rms_lvr_time")
private Integer rmsLvrTime ;
/**
* 谐波电压相角(0:正常 1:异常)
* 电压正偏差
*/
private Integer vPhasic;
@TableField(value = "vu_dev")
private Integer vuDev ;
/**
* 谐波电压基波相角(0:正常 1:异常)
* 电压正偏差异常时间
*/
private Integer v1Phasic;
@TableField(value = "vu_dev_time")
private Integer vuDevTime ;
/**
* 电压波动(0:正常 1:异常)
* 电压负偏差
*/
private Integer fluc;
@TableField(value = "vl_Dev")
private Integer vlDev ;
/**
* 短时闪变(0:正常 1:异常)
* 电压负偏差异常时间
*/
private Integer pst;
@TableField(value = "vl_Dev_time")
private Integer vlDevTime ;
/**
* 电压总谐波畸变率
*/
@TableField(value = "v_thd")
private Integer vThd ;
/**
* 电压总谐波畸变率异常时间
*/
@TableField(value = "v_thd_time")
private Integer vThdTime ;
/**
* 相电压基波有效值
*/
@TableField(value = "v")
private Integer v ;
/**
* 相电压基波有效值异常时间
*/
@TableField(value = "v_time")
private Integer vTime ;
/**
* 电流有效值
*/
@TableField(value = "i_rms")
private Integer iRms ;
/**
* 电流有效值异常时间
*/
@TableField(value = "i_rms_time")
private Integer iRmsTime ;
/**
* 长时闪变
*/
@TableField(value = "plt")
private Integer plt ;
/**
* 长时闪变异常时间
*/
@TableField(value = "plt_time")
private Integer pltTime ;
/**
* 间谐波电压含有率
*/
@TableField(value = "v_inharm")
private Integer vInharm ;
/**
* 间谐波电压含有率异常时间
*/
@TableField(value = "v_Inharm_time")
private Integer vInharmTime ;
/**
* 谐波电压含有率
*/
@TableField(value = "v_harm")
private Integer vHarm ;
/**
* 谐波电压含有率异常时间
*/
@TableField(value = "v_harm_time")
private Integer vHarmTime ;
/**
* 功率因数
*/
@TableField(value = "pf")
private Integer pf ;
/**
* 功率因数异常时间
*/
@TableField(value = "pf_time")
private Integer pfTime ;
/**
* 谐波电压相角
*/
@TableField(value = "v_phasic")
private Integer vPhasic ;
/**
* 谐波电压相角异常时间
*/
@TableField(value = "v_phasic_time")
private Integer vPhasicTime ;
/**
* 谐波电压基波相角
*/
@TableField(value = "v1_phasic")
private Integer v1Phasic ;
/**
* 谐波电压基波相角异常时间
*/
@TableField(value = "v1_phasic_time")
private Integer v1PhasicTime ;
/**
* 电压波动
*/
@TableField(value = "fluc")
private Integer fluc ;
/**
* 电压波动异常时间
*/
@TableField(value = "fluc_time")
private Integer flucTime ;
/**
* 短时闪变
*/
@TableField(value = "pst")
private Integer pst ;
/**
* 短时闪变异常时间
*/
@TableField(value = "pst_time")
private Integer pstTime ;
/**
* 电压暂降(0:正常 1:异常)
*/
private Integer dip;
@TableField(value = "dip")
private Integer dip ;
/**
* 电压暂降异常时间
*/
@TableField(value = "dip_time")
private Integer dipTime ;
/**
* 电压暂升(0:正常 1:异常)
*/
private Integer rise;
@TableField(value = "rise")
private Integer rise ;
/**
* 判断所有指标 0:无异常 1:有异常
* 电压暂升异常时间
*/
private Integer state;
@TableField(value = "rise_time")
private Integer riseTime ;
/**
* 文件路径
*/
@TableField(value = "path")
private String path;

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

@@ -96,7 +96,7 @@ public class DeviceVO implements Serializable {
@ApiModelProperty(name = "manufacturer",value = "设备制造商Guid")
private String manufacturer;
@ApiModelProperty(name = "electroplate",value = "功能")
@ApiModelProperty(name = "electroplate",value = "功能")
private Integer electroplate;
@ApiModelProperty(name = "thisTimeCheck",value = "本次定检时间")

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

@@ -136,6 +136,18 @@ public class LineIntegrityDataVO implements Serializable {
@ApiModelProperty(name = "integrityData",value = "数据完整性")
private Double integrityData;
/**
* 实际时间
*/
@ApiModelProperty(name = "realTime",value = "实际时间")
private Integer realTime;
/**
* 期望时间
*/
@ApiModelProperty(name = "dueTime",value = "期望时间")
private Integer dueTime;
/**
* 监测点合格率
*/

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

@@ -77,6 +77,18 @@ public class TerminalOnlineRateDataVO implements Serializable {
@ApiModelProperty(name = "onlineRate",value = "在线率")
private Double onlineRate;
/**
* 在线分钟数
*/
@ApiModelProperty(name = "onlineMin",value = "在线分钟数")
private Integer onlineMin;
/**
* 离线分钟数
*/
@ApiModelProperty(name = "offlineMin",value = "离线分钟数")
private Integer offlineMin;
/**
* 最新数据时间
*/

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<TimeAndTargetKey> dateTargetList;
private String monitorName;
private String bdName;
@@ -24,7 +29,13 @@ public class DetailAbnormalVO {
private String targetKey;
@Data
public static class TimeAndTargetKey {
private String date;
private List<VerifyTargetVO> targetKeys;
}
/**
* 异常实体
*/
@@ -55,6 +66,23 @@ public class DetailAbnormalVO {
}
@Data
public static class DetailAbnormalCountVO {
private Integer timeSum;
private Integer errCount;
private List<DetailAbnormalInnerVO> time;
}
@Data
public static class DetailLimitCountVO {
private Integer timeSum;
private Integer errCount;
private List<DetailLimitInnerVO> time;
}
@Data
public static class DetailLimitInnerVO{
@@ -78,4 +106,96 @@ public class DetailAbnormalVO {
//限值
private float overLimitValue;
}
@Data
public static class Assess {
/**
* 频率偏差
*/
@ApiModelProperty("频率偏差")
private Double freqData = 3.14159;
@ApiModelProperty("频率偏差限值")
private Float freqLimit = 3.14159F;
/**
* 电压闪变
*/
@ApiModelProperty("电压闪变")
private Double flickerData = 3.14159;
@ApiModelProperty("电压闪变限值")
private Float flickerLimit = 3.14159F;
/**
* 电压偏差上
*/
@ApiModelProperty("电压上偏差")
private Double vDevData = 3.14159;
@ApiModelProperty("电压上偏差限值")
private Float vDevLimit = 3.14159F;
/**
* 电压偏差下
*/
@ApiModelProperty("电压下偏差")
private Double uDevData = 3.14159;
@ApiModelProperty("电压下偏差限值")
private Float uDevLimit = 3.14159F;
/**
* 三相电压不平衡度
*/
@ApiModelProperty("三相电压不平衡度")
private Double unbalanceData = 3.14159;
@ApiModelProperty("三相电压不平衡度限值")
private Float unbalanceLimit = 3.14159F;
/**
* 总谐波畸变率
*/
@ApiModelProperty("总谐波畸变率")
private Double uaberranceData = 3.14159;
@ApiModelProperty("总谐波畸变率限值")
private Float uaberranceLimit = 3.14159F;
/**
* 负序电流限值天数
*/
@ApiModelProperty("负序电流")
private Double iNegData= 3.14159;
@ApiModelProperty("负序电流限值")
private Float iNegLimit= 3.14159F;
/**
* 谐波电压越限天数
*/
@ApiModelProperty("谐波电压")
private Double uharmData = 3.14159;
@ApiModelProperty("谐波电压限值")
private Float uharmLimit= 3.14159F;
/**
* 谐波电流越限天数
*/
@ApiModelProperty("谐波电流")
private Double iharmData = 3.14159;
@ApiModelProperty("谐波电流限值")
private Float iharmLimit= 3.14159F;
/**
* 间谐波限值天数
*/
@ApiModelProperty("间谐波电压")
private Double inuharmData = 3.14159;
@ApiModelProperty("间谐波电压限值")
private Float inuharmLimit= 3.14159F;
}
}

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);
}
@@ -134,12 +134,21 @@ public class DataVerifyController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/monitorLimitTableDetail")
@ApiOperation("弹框-获取稳态告警监测点列表详情")
public HttpResult<List<DetailAbnormalVO.DetailLimitInnerVO>> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
public HttpResult<DetailAbnormalVO.DetailLimitCountVO> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
String methodDescribe = getMethodDescribe("monitorLimitTableDetail");
List<DetailAbnormalVO.DetailLimitInnerVO> list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
DetailAbnormalVO.DetailLimitCountVO list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/limitTableDetail")
@ApiOperation("监测点评价")
public HttpResult<DetailAbnormalVO.Assess> limitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) {
String methodDescribe = getMethodDescribe("limitTableDetail");
DetailAbnormalVO.Assess list = iDataVerifyService.limitTableDetail(monitorBaseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -168,10 +168,10 @@ public class DeptLineController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getAllData")
@ApiOperation("获取部门监测点表所有数据")
@ApiOperation("获取部门监测点表数据(仅查询在运监测点)")
public HttpResult<List<DeptLine>> getAllData() {
String methodDescribe = getMethodDescribe("getAllData");
List<DeptLine> list = deptLineMapper.selectList(null);
List<DeptLine> list = deptLineMapper.getOnlineMonitor();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

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

@@ -176,7 +176,6 @@
<select id="getDevOnlineByDevIds" resultType="TerminalOnlineRateData">
select
dev_index devId,
avg(online_min/(online_min+offline_min))*100 onlineRate,
sum(online_min) onlineMin,
sum(offline_min) offlineMin
from r_stat_onlinerate_d

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

@@ -41,7 +41,8 @@ public interface IDataVerifyService extends IService<DataVerify> {
List<DetailAbnormalVO> monitorLimitTable(MonitorBaseParam monitorBaseParam);
List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
}

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;
@@ -17,35 +18,38 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
import com.njcn.dataProcess.param.DataCleanParam;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.line.mapper.LineMapper;
import com.njcn.device.line.service.DeptLineService;
import com.njcn.device.overlimit.service.IOverLimitService;
import com.njcn.device.pq.mapper.DataVerifyMapper;
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
import com.njcn.device.pq.pojo.po.DataVerify;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.device.pq.pojo.vo.dataClean.*;
import com.njcn.device.pq.service.CommTerminalService;
import com.njcn.device.pq.service.IDataVerifyService;
import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.SysDicTreePO;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -67,28 +71,19 @@ import java.util.stream.Collectors;
public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVerify> implements IDataVerifyService {
private static final Logger logger = LoggerFactory.getLogger(DataVerifyServiceImpl.class);
private static final String SEPARATOR = "&";
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
private final CommTerminalService commTerminalService;
private final LineMapper lineMapper;
private final DictTreeFeignClient dictTreeFeignClient;
private final UserLedgerFeignClient userLedgerFeignClient;
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
private final DataLimitRateFeignClient dataLimitRateFeignClient;
private final DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final PqDataVerifyBakMapper pqDataVerifyBakMapper;
private final IOverLimitService overLimitService;
private final DeptLineService deptLineService;
@Override
@@ -214,7 +209,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
List<DataLimitTargetDto> limitTarget = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> it.getAllTime() > 0).collect(Collectors.toList());
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.toList());
long abnormalCount = limitList.stream().map(DataLimitTargetDto::getLineId).distinct().count();
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
verifyMonitorVO.setRunNum(monitorIds.size());
@@ -235,7 +230,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
List<DataLimitTargetDto> limitTarget = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> it.getAllTime() > 0).collect(Collectors.toList());
List<DataLimitTargetDto> limitList = limitTarget.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.toList());
return getLimitTable(limitList, monitorBaseParam);
}
@@ -244,137 +239,50 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
List<DetailAbnormalVO> result = new ArrayList<>();
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
lineCountEvaluateParam.setLineId(monitorBaseParam.getMonitorIds());
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
List<DataLimitRateDetailDto> dataLimitRateDetailDtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
Map<LocalDate, List<DataLimitRateDetailDto>> limitMap = dataLimitRateDetailDtoList.stream().collect(Collectors.groupingBy(DataLimitRateDetailDto::getTime));
limitMap.forEach((date, list) -> {
Map<String, DataLimitRateDetailDto> map = list.stream().collect(Collectors.toMap(DataLimitRateDetailDto::getLineId, Function.identity()));
map.forEach((lineId, line) -> {
LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId);
Integer timeInterval = lineInfoVO.getTimeInterval();
Set<String> timeSet = new HashSet<>();
List<String> specialTargetList = new ArrayList<>();
String jonsStr = "";
if (monitorBaseParam.getTargetKey().equals(DicDataEnum.VOLTAGE_DEV.getCode())) {
//电压偏差
jonsStr = line.getVoltageDevOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FLICKER.getCode())) {
jonsStr = line.getFlickerOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.phase_Voltage.getCode())) {
jonsStr = line.getUbalanceOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FREQUENCY_DEV.getCode())) {
jonsStr = line.getFreqDevOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.NEG_CURRENT.getCode())) {
jonsStr = line.getINegOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.THD_V.getCode())) {
jonsStr = line.getUaberranceOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_VOLTAGE.getCode())) {
for (int i = 2; i <= 25; i++) {
String uHarmKey = "uharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_CURRENT.getCode())) {
for (int i = 2; i <= 25; i++) {
String uHarmKey = "iharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.INTERHARMONIC_VOLTAGE.getCode())) {
for (int i = 1; i <= 16; i++) {
String uHarmKey = "inuharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
List<DataLimitTargetDto> dataLimitTargetDtoList = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
Map<String, List<DataLimitTargetDto>> limitMap = dataLimitTargetDtoList.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.groupingBy(DataLimitTargetDto::getLineId));
limitMap.forEach((lineId, value) -> {
LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId);
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setMonitorId(lineId);
List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
DetailAbnormalVO.TimeAndTargetKey targetKey;
for (DataLimitTargetDto dto : value) {
List<VerifyTargetVO> verifyS = assLimitTarget(Arrays.asList(dto)).stream().filter(x -> x.getIds().size() > 0).collect(Collectors.toList());
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
List<VerifyTargetVO> verify = verifyS.stream().filter(x -> x.getKey().equals(monitorBaseParam.getTargetKey())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(verify)) {
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
targetKey.setTargetKeys(verify);
targetKeyList.add(targetKey);
}
} else {
if (StrUtil.isNotBlank(line.getVoltageDevOvertime())) {
specialTargetList.add(line.getVoltageDevOvertime());
}
if (StrUtil.isNotBlank(line.getFlickerOvertime())) {
specialTargetList.add(line.getFlickerOvertime());
}
if (StrUtil.isNotBlank(line.getUbalanceOvertime())) {
specialTargetList.add(line.getUbalanceOvertime());
}
if (StrUtil.isNotBlank(line.getFreqDevOvertime())) {
specialTargetList.add(line.getFreqDevOvertime());
}
if (StrUtil.isNotBlank(line.getINegOvertime())) {
specialTargetList.add(line.getINegOvertime());
}
if (StrUtil.isNotBlank(line.getUaberranceOvertime())) {
specialTargetList.add(line.getUaberranceOvertime());
}
for (int i = 2; i <= 25; i++) {
String uHarmKey = "uharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
for (int i = 2; i <= 25; i++) {
String uHarmKey = "iharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
for (int i = 1; i <= 16; i++) {
String uHarmKey = "inuharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
targetKey.setTargetKeys(verifyS);
targetKeyList.add(targetKey);
}
if (CollUtil.isNotEmpty(specialTargetList)) {
for (String str : specialTargetList) {
JSONArray jsonArray = new JSONArray(str);
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
jsonBaseVOList.forEach(it -> {
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
});
}
} else {
if(StrUtil.isNotBlank(jonsStr)){
JSONArray jsonArray = new JSONArray(jonsStr);
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
jsonBaseVOList.forEach(it -> {
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
});
}
}
if(timeSet.size()>0){
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setMonitorId(lineId);
detailAbnormalVO.setDate(date.format(DATE_FORMAT));
detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
detailAbnormalVO.setBdName(lineInfoVO.getBdName());
detailAbnormalVO.setTimeSum(String.valueOf(timeInterval*timeSet.size()));
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
}
});
}
detailAbnormalVO.setDateTargetList(targetKeyList);
detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
detailAbnormalVO.setBdName(lineInfoVO.getBdName());
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
});
return result;
}
@Override
public List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
public DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
DetailAbnormalVO.DetailLimitCountVO v = new DetailAbnormalVO.DetailLimitCountVO();
List<DetailAbnormalVO.DetailLimitInnerVO> result = new ArrayList<>();
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
@@ -382,7 +290,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchBeginTime());
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
if (CollUtil.isEmpty(dtoList)) {
return result;
return v;
}
DataLimitRateDetailDto dto = dtoList.get(0);
@@ -392,7 +300,219 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
} else {
processAllTargets(dto, targetMap, result);
}
return result;
int size = result.stream().map(DetailAbnormalVO.DetailLimitInnerVO::getTime).collect(Collectors.toSet()).size();
v.setTimeSum(lineDetailMap.get(monitorBaseParam.getMonitorIds().get(0)).getTimeInterval() * size);
v.setTime(result);
return v;
}
@Override
public DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam) {
DetailAbnormalVO.Assess assess = new DetailAbnormalVO.Assess();
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
Overlimit overLimitDataById = overLimitService.getOverLimitDataById(monitorBaseParam.getMonitorIds().get(0));
List<DetailAbnormalVO.DetailLimitInnerVO> freq = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> voltage = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> uaberrance = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> ubalance = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> flicker = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> iNeg = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> uharm = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> iharm = new ArrayList<>();
List<DetailAbnormalVO.DetailLimitInnerVO> inuharm = new ArrayList<>();
for (DataLimitRateDetailDto dto : dtoList) {
dealJsonArr(new JSONArray(dto.getFreqDevOvertime()), freq, DicDataEnum.FREQUENCY_DEV.getName(), null);
dealJsonArr(new JSONArray(dto.getVoltageDevOvertime()), voltage, DicDataEnum.VOLTAGE_DEV.getName(), null);
dealJsonArr(new JSONArray(dto.getUaberranceOvertime()), uaberrance, DicDataEnum.THD_V.getName(), null);
dealJsonArr(new JSONArray(dto.getUbalanceOvertime()), ubalance, DicDataEnum.phase_Voltage.getName(), null);
dealJsonArr(new JSONArray(dto.getFlickerOvertime()), flicker, DicDataEnum.FLICKER.getName(), null);
dealJsonArr(new JSONArray(dto.getINegOvertime()), iNeg, DicDataEnum.NEG_CURRENT.getName(), null);
// 处理谐波类指标
processHarmonicTargetHarm(dto, DicDataEnum.HARMONIC_VOLTAGE.getName(), "uharm", 2, 25, uharm);
processHarmonicTargetHarm(dto, DicDataEnum.HARMONIC_CURRENT.getName(), "iharm", 2, 25, iharm);
processHarmonicTargetHarm(dto, DicDataEnum.INTERHARMONIC_VOLTAGE.getName(), "inuharm", 1, 16, inuharm);
}
assess.setFreqLimit(overLimitDataById.getFreqDev());
assess.setVDevLimit(overLimitDataById.getVoltageDev());
assess.setUDevLimit(overLimitDataById.getUvoltageDev());
assess.setUaberranceLimit(overLimitDataById.getUaberrance());
assess.setUnbalanceLimit(overLimitDataById.getUbalance());
assess.setFlickerLimit(overLimitDataById.getFlicker());
assess.setINegLimit(overLimitDataById.getINeg());
Map<String, List<PqReasonableRangeDto>> map = new HashMap<>();
DataCleanParam param = new DataCleanParam();
param.setSystemType(DataCleanEnum.Pqs.getCode());
List<PqReasonableRangeDto> list = pqReasonableRangeFeignClient.getData(param).getData();
if (CollUtil.isNotEmpty(list)) {
map = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName));
}
List<PqReasonableRangeDto> dataV = map.get(DataCleanEnum.DataV.getCode());
Map<String, PqReasonableRangeDto> dataVCode = dataV.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
//频率偏差
if (CollUtil.isNotEmpty(freq)) {
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.FreqDev.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(freq, dto);
assess.setFreqData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//电压偏差
if (CollUtil.isNotEmpty(voltage)) {
//上偏差
PqReasonableRangeDto dto1 = dataVCode.get(DataCleanEnum.VuDev.getCode());
List<DetailAbnormalVO.DetailLimitInnerVO> collect = voltage.stream()
.filter(x -> Double.valueOf(x.getVal()) > 0)
.filter(x -> Double.valueOf(x.getVal()) < dto1.getMaxValue())
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed()).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
DetailAbnormalVO.DetailLimitInnerVO val;
if (CollUtil.isNotEmpty(collect)) {
val = collect.get(0);
} else {
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = voltage.stream()
.filter(x -> Double.valueOf(x.getVal()) > 0)
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
.collect(Collectors.toList());
val = collect2.get(0);
val.setVal(dto1.getMaxValue().toString());
}
assess.setVDevData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//下偏差
PqReasonableRangeDto dto2 = dataVCode.get(DataCleanEnum.VlDev.getCode());
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = voltage.stream()
.filter(x -> Double.valueOf(x.getVal()) < 0)
.filter(x -> dto2.getMinValue() < Double.valueOf(x.getVal()))
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect2)) {
DetailAbnormalVO.DetailLimitInnerVO val2;
if (CollUtil.isNotEmpty(collect)) {
val2 = collect.get(0);
} else {
List<DetailAbnormalVO.DetailLimitInnerVO> collect3 = voltage.stream()
.filter(x -> Double.valueOf(x.getVal()) < 0)
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
.collect(Collectors.toList());
val2 = collect3.get(0);
val2.setVal(dto2.getMaxValue().toString());
}
assess.setUDevData(NumberUtil.round(val2.getVal(), 2).doubleValue());
}
}
//负序电流
if (CollUtil.isNotEmpty(iNeg)) {
List<DetailAbnormalVO.DetailLimitInnerVO> collect = iNeg.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
.collect(Collectors.toList());
DetailAbnormalVO.DetailLimitInnerVO val = collect.get(0);
assess.setINegData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//电压总谐波
if (CollUtil.isNotEmpty(uaberrance)) {
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
assess.setUaberranceData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//三相不平衡度
if (CollUtil.isNotEmpty(ubalance)) {
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VUnbalance.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(ubalance, dto);
assess.setUnbalanceData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//闪变
List<PqReasonableRangeDto> dataPlt = map.get(DataCleanEnum.DataPlt.getCode());
Map<String, PqReasonableRangeDto> dataPltCode = dataPlt.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
if (CollUtil.isNotEmpty(flicker)) {
PqReasonableRangeDto dto = dataPltCode.get(DataCleanEnum.Plt.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(flicker, dto);
assess.setFlickerData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
//谐波电压
List<PqReasonableRangeDto> dataHarmRate = map.get(DataCleanEnum.DataHarmRateV.getCode());
Map<String, PqReasonableRangeDto> dataHarmRateCode = dataHarmRate.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
if (CollUtil.isNotEmpty(uharm)) {
PqReasonableRangeDto dto = dataHarmRateCode.get(DataCleanEnum.V_Rate.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uharm, dto);
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
String[] split = val.getTargetName().split("");
try {
Class<?> clazz = overLimitDataById.getClass();
String methodName = "getUharm" + split[0];
Method method = clazz.getMethod(methodName);
Float value = (Float) method.invoke(overLimitDataById);
assess.setUharmLimit(value);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
if(CollUtil.isNotEmpty(uaberrance)){
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
}
//谐波电流
if (CollUtil.isNotEmpty(iharm)) {
List<DetailAbnormalVO.DetailLimitInnerVO> collect = iharm.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
.collect(Collectors.toList());
DetailAbnormalVO.DetailLimitInnerVO val = collect.get(0);
assess.setIharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
String[] split = val.getTargetName().split("");
try {
Class<?> clazz = overLimitDataById.getClass();
String methodName = "getIharm" + split[0];
Method method = clazz.getMethod(methodName);
Float value = (Float) method.invoke(overLimitDataById);
assess.setIharmLimit(value);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//间谐波电压
List<PqReasonableRangeDto> dataInHarm = map.get(DataCleanEnum.DataInHarmV.getCode());
Map<String, PqReasonableRangeDto> dataInHarmCode = dataInHarm.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
if (CollUtil.isNotEmpty(inuharm)) {
PqReasonableRangeDto dto = dataInHarmCode.get(DataCleanEnum.V_InHarm.getCode());
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(inuharm, dto);
assess.setInuharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
String[] split = val.getTargetName().split("");
try {
Class<?> clazz = overLimitDataById.getClass();
String methodName = "getInuharm" + (int)(Double.valueOf(split[0])+0.5);
Method method = clazz.getMethod(methodName);
Float value = (Float) method.invoke(overLimitDataById);
assess.setInuharmLimit(value);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return assess;
}
private DetailAbnormalVO.DetailLimitInnerVO reasonAble(List<DetailAbnormalVO.DetailLimitInnerVO> limit, PqReasonableRangeDto dto) {
List<DetailAbnormalVO.DetailLimitInnerVO> collect = limit.stream()
.filter(x -> dto.getMinValue() < Double.valueOf(x.getVal()) && Double.valueOf(x.getVal()) < dto.getMaxValue())
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed()).collect(Collectors.toList());
DetailAbnormalVO.DetailLimitInnerVO val;
if (CollUtil.isNotEmpty(collect)) {
val = collect.get(0);
} else {
List<DetailAbnormalVO.DetailLimitInnerVO> collect2 = limit.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailLimitInnerVO::getVal).reversed())
.collect(Collectors.toList());
val = collect2.get(0);
val.setVal(dto.getMaxValue().toString());
}
return val;
}
private Map<String, DictData> getTargetMap() {
@@ -463,6 +583,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
processHarmonicTarget(dto, targetMap, DicDataEnum.HARMONIC_CURRENT.getCode(), "iharm", 2, 25, result);
processHarmonicTarget(dto, targetMap, DicDataEnum.INTERHARMONIC_VOLTAGE.getCode(), "inuharm", 1, 16, result);
}
private void processStandardTarget(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
String targetCode, String data,
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
@@ -482,6 +603,13 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
processSpecialTargets(tempList, result, targetName);
}
private void processHarmonicTargetHarm(DataLimitRateDetailDto dto, String targetCode, String prefix, int start, int end,
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
List<String> tempList = new ArrayList<>();
collectHarmonicData(dto, prefix, start, end, tempList);
processSpecialTargets(tempList, result, targetCode);
}
private void processSpecialTargets(List<String> specialTargetList, List<DetailAbnormalVO.DetailLimitInnerVO> result, String targetName) {
for (String strJson : specialTargetList) {
String[] temStr = strJson.split(SEPARATOR);
@@ -559,13 +687,15 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
for (int i = 2; i <= 25; i++) {
String uHarmKey = "uharm" + i + "Overtime";
String iHarmKey = "iharm" + i + "Overtime";
String inuHarmKey = "inuharm" + i + "Overtime";
if (getFieldValue(it, uHarmKey) != null && getFieldValue(it, uHarmKey) == 1) {
HARMONIC_VOLTAGE.add(it.getLineId());
}
if (getFieldValue(it, iHarmKey) != null && getFieldValue(it, iHarmKey) == 1) {
HARMONIC_CURRENT.add(it.getLineId());
}
}
for (int i = 1; i <= 16; i++) {
String inuHarmKey = "inuharm" + i + "Overtime";
if (getFieldValue(it, inuHarmKey) != null && getFieldValue(it, inuHarmKey) == 1) {
INTERHARMONIC_VOLTAGE.add(it.getLineId());
}
@@ -599,7 +729,12 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
String fieldName = prefix + i + "Overtime";
String json = getFieldValueForDetail(dto, fieldName);
if (StrUtil.isNotBlank(json)) {
result.add(json + SEPARATOR + i);
if (end == 16) {
result.add(json + SEPARATOR + (i - 0.5));
} else {
result.add(json + SEPARATOR + i);
}
}
}
}
@@ -758,7 +893,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
List<LocalDate> dateList = list.stream().map(it -> it.getTime().toLocalDate()).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
processTable(monitorBaseParam, dateList, result, key);
});
dealTableResult(result);
dealTableResult(result, monitorBaseParam.getSearchValue());
return result;
}
@@ -770,7 +905,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
List<LocalDate> dateList = list.stream().map(DataLimitTargetDto::getTime).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
processTable(monitorBaseParam, dateList, result, key);
});
dealTableResult(result);
dealTableResult(result, monitorBaseParam.getSearchValue());
return result;
}
@@ -797,34 +932,44 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
}
}
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
if (CollUtil.isNotEmpty(result)) {
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
result.forEach(it -> {
if (areaMap.containsKey(it.getMonitorId())) {
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
it.setMonitorName(areaLineInfoVO.getLineName());
it.setStationName(areaLineInfoVO.getSubName());
it.setDevName(areaLineInfoVO.getDeviceName());
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
it.setManufacturer(areaLineInfoVO.getManufacturer());
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
}
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
if (areaMap.containsKey(lineDetail.getLineId())) {
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
it.setMonitorName(lineDetail.getLineName());
it.setStationName(lineDetail.getSubName());
if (deptName.containsKey(lineDetail.getLineId())) {
it.setCity(deptName.get(lineDetail.getLineId()));
}
it.setDevName(lineDetail.getDeviceName());
it.setVoltageLevel(lineDetail.getVoltageScale());
it.setIp(Base64.encode(lineDetail.getIp()));
it.setManufacturer(lineDetail.getManufacturer());
it.setObjType(lineDetail.getLoadType());
it.setObjName(lineDetail.getObjName());
info.add(it);
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
// }
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
// }
}
});
}
result.clear();
result.addAll(info);
}
}

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,62 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
return info;
}
private BigDecimal verifyDev(List<PqDataVerifyCount> sumVerify, List<String> lineIds, List<String> devIds) {
//异常率
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
List<String> verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList());
if (CollUtil.isNotEmpty(verifyLine)) {
List<String> devIdsLine = lineMapper.getDevIdsLine(verifyLine);
if (CollUtil.isNotEmpty(devIdsLine)) {
return NumberUtil.round(Math.min(devIdsLine.size() * 100.0 / devIds.size(), 100), 2);
} else {
return new BigDecimal(0);
}
} else {
return new BigDecimal(0);
}
}
private BigDecimal verify(List<PqDataVerifyCount> sumVerify, List<String> lineIds) {
//异常率
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(verifyList)) {
double total = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotal).sum();
double totalAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotalAll).sum();
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 +497,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

@@ -173,13 +173,17 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
}
// 数据封装
Double temValue = lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
// 汇总所有监测点的实际时间和期望时间,重新计算完整性
int totalRealTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
int totalDueTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
lineIntegrityDataVO.setRealTime(totalRealTime);
lineIntegrityDataVO.setDueTime(totalDueTime);
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
LineIntegrityDataVO temp = lineList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
lineIntegrityDataVO.setAlgoDescribe(temp.getAlgoDescribe());
lineIntegrityDataVO.setId(generalDeviceDTO.getIndex());
lineIntegrityDataVO.setName(generalDeviceDTO.getName());
lineIntegrityDataVO.setLevel(0);
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
pro.add(lineIntegrityDataVO);
}
@@ -193,12 +197,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
private void dealDataJinDu(List<LineIntegrityDataVO> mList,LineIntegrityDataVO children){
double temValue = mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
if(temValue!=3.14159){
children.setIntegrityData(new BigDecimal(temValue).setScale(2,RoundingMode.HALF_UP).doubleValue());
}else {
children.setIntegrityData(temValue);
}
// 汇总子节点的实际时间和期望时间,重新计算完整性
int totalRealTime = (int) mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
int totalDueTime = (int) mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
children.setRealTime(totalRealTime);
children.setDueTime(totalDueTime);
children.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
}
private void dealMonitorData(List<LineIntegrityDataVO> lineList,List<LineDataIntegrity> percentageOfCompleteDatas,Map<String, Integer> mapA){
@@ -209,10 +213,13 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
if(dataIntegrityMap.containsKey(monitor.getId())){
flag = true;
LineDataIntegrity integrity = dataIntegrityMap.get(monitor.getId());
monitor.setIntegrityData(DataStatisticsUtil.dataLimits(integrity.getIntegrityData()));
monitor.setRealTime(integrity.getReal() == null ? 0 : integrity.getReal().intValue());
monitor.setDueTime(integrity.getDue() == null ? 0 : integrity.getDue().intValue());
Double integrityData = DataStatisticsUtil.calculateIntegrityRate(monitor.getRealTime(), monitor.getDueTime());
monitor.setIntegrityData(integrityData);
if (StrUtil.isNotBlank(monitor.getLineGrade())) {
if (mapA.containsKey(monitor.getLineGrade())) {
if (integrity.getIntegrityData() > mapA.get(monitor.getLineGrade())) {
if (integrityData != 3.14159 && integrityData > mapA.get(monitor.getLineGrade())) {
monitor.setValueOver(1);
} else {
monitor.setValueOver(0);
@@ -228,6 +235,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
if (!flag) {
//表示未匹配到数据完整性
monitor.setIntegrityData(3.14159);
monitor.setRealTime(0);
monitor.setDueTime(0);
monitor.setValueOver(0);
}
}
@@ -248,13 +257,19 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
outParam.setType(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
//根据监测点查询数据完整性
List<PublicDTO> integrityData = getCondition(lineIndexes, integrityIconParam.getSearchBeginTime(), integrityIconParam.getSearchEndTime());
double v = integrityData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159);
outParam.setSingle(v!=3.14159?NumberUtil.round(v,2).doubleValue():v);
// 汇总所有监测点的实际时间和期望时间,再计算总完整性
int totalRealTime = (int) integrityData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
int totalDueTime = (int) integrityData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
double v = DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime);
outParam.setSingle(v);
//如果存在需要比较的时间,再获取对应数据
if (StrUtil.isNotBlank(integrityIconParam.getPeriodBeginTime()) && StrUtil.isNotBlank(integrityIconParam.getPeriodEndTime())) {
List<PublicDTO> compareData = getCondition(lineIndexes, integrityIconParam.getPeriodBeginTime(), integrityIconParam.getPeriodEndTime());
double v1 = compareData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159);
outParam.setRatio(v1!=3.14159?NumberUtil.round(v1,2).doubleValue():v1);
// 汇总所有监测点的实际时间和期望时间,再计算总完整性
int compareRealTime = (int) compareData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
int compareDueTime = (int) compareData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
double v1 = DataStatisticsUtil.calculateIntegrityRate(compareRealTime, compareDueTime);
outParam.setRatio(v1);
}
out.add(outParam);
}
@@ -320,12 +335,14 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
for (LineDataIntegrity lineData : percentageOfCompleteDatas) {
if (lineDataIntegrity.getId().equals(lineData.getLineId())) {
flag = true;
Double temValue = lineData.getIntegrityData();
lineDataIntegrity.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
lineDataIntegrity.setRealTime(lineData.getReal() == null ? 0 : lineData.getReal().intValue());
lineDataIntegrity.setDueTime(lineData.getDue() == null ? 0 : lineData.getDue().intValue());
Double temValue = DataStatisticsUtil.calculateIntegrityRate(lineDataIntegrity.getRealTime(), lineDataIntegrity.getDueTime());
lineDataIntegrity.setIntegrityData(temValue);
//根据等级判断是否越限
if (StrUtil.isNotBlank(lineDataIntegrity.getLineGrade())) {
if (mapA.containsKey(lineDataIntegrity.getLineGrade())) {
if (temValue > mapA.get(lineDataIntegrity.getLineGrade())) {
if (temValue != 3.14159 && temValue > mapA.get(lineDataIntegrity.getLineGrade())) {
lineDataIntegrity.setValueOver(1);
} else {
lineDataIntegrity.setValueOver(0);
@@ -343,6 +360,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
if (!flag) {
//表示未匹配到数据完整性
lineDataIntegrity.setIntegrityData(3.14159);
lineDataIntegrity.setRealTime(0);
lineDataIntegrity.setDueTime(0);
lineDataIntegrity.setValueOver(0);
}
}
@@ -352,13 +371,17 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
lineIntegrityDataVO.setChildren(subList);
// 数据封装
Double temValue = lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
// 汇总所有监测点的实际时间和期望时间,重新计算完整性
int totalRealTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
int totalDueTime = (int) lineList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
lineIntegrityDataVO.setRealTime(totalRealTime);
lineIntegrityDataVO.setDueTime(totalDueTime);
lineIntegrityDataVO.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
LineIntegrityDataVO temp = lineList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
lineIntegrityDataVO.setAlgoDescribe(temp.getAlgoDescribe());
lineIntegrityDataVO.setId(generalDeviceDTO.getIndex());
lineIntegrityDataVO.setName(generalDeviceDTO.getName());
lineIntegrityDataVO.setLevel(0);
lineIntegrityDataVO.setIntegrityData(Math.min(DataStatisticsUtil.dataLimits(temValue),100.0));
pro.add(lineIntegrityDataVO);
}
@@ -397,9 +420,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
for (String pid : pids) {
if (lineAdministrationTree.getId().equals(pid)) {
List<LineIntegrityDataVO> lineIntegrityDataVOList = groupLine.get(pid);
//父级完整性匹配
Double temValue = lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
//父级完整性匹配 - 汇总子节点的实际时间和期望时间,重新计算完整性
int totalRealTime = (int) lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getRealTime).sum();
int totalDueTime = (int) lineIntegrityDataVOList.stream().filter(item -> item.getIntegrityData() != 3.14159).mapToLong(LineIntegrityDataVO::getDueTime).sum();
lineAdministrationTree.setRealTime(totalRealTime);
lineAdministrationTree.setDueTime(totalDueTime);
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.calculateIntegrityRate(totalRealTime, totalDueTime));
LineIntegrityDataVO temp = lineIntegrityDataVOList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
lineAdministrationTree.setAlgoDescribe(temp.getAlgoDescribe());
}
@@ -418,10 +444,12 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
if (!CollectionUtils.isEmpty(data)) {
data.forEach(po -> {
PublicDTO publicDTO = new PublicDTO();
//数据完整性 保留四位小数
Double integrity = po.getIntegrityRate() == null ? 3.14159 : BigDecimal.valueOf(Double.parseDouble(po.getIntegrityRate().toString())).setScale(2, RoundingMode.HALF_UP).doubleValue();
publicDTO.setId(po.getLineIndex());
publicDTO.setData((integrity > 100.00) ? 100.00 : integrity);
publicDTO.setOnlineMin(po.getRealTime() == null ? 0 : po.getRealTime().intValue());
publicDTO.setOfflineMin(po.getDueTime() == null ? 0 : po.getDueTime().intValue());
// 计算数据完整性
Double integrity = DataStatisticsUtil.calculateIntegrityRate(publicDTO.getOnlineMin(), publicDTO.getOfflineMin());
publicDTO.setData(integrity);
integrityList.add(publicDTO);
});
}

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

@@ -4,6 +4,7 @@ package com.njcn.device.pq.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.*;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONConfig;
@@ -18,10 +19,12 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
import com.njcn.dataProcess.param.DataCleanParam;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import com.njcn.device.line.mapper.LineMapper;
import com.njcn.device.line.service.DeptLineService;
import com.njcn.device.pq.constant.Param;
import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
@@ -33,10 +36,7 @@ import com.njcn.device.pq.service.CommTerminalService;
import com.njcn.device.pq.service.IPqDataVerifyBakService;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.po.SysDicTreePO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -65,38 +65,34 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
private static final String SEPARATOR = "-";
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
private final CommTerminalService commTerminalService;
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
private final LineMapper lineMapper;
private final DictTreeFeignClient dictTreeFeignClient;
private final UserLedgerFeignClient userLedgerFeignClient;
private final FileStorageUtil fileStorageUtil;
private final DeptLineService deptLineService;
@Override
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
monitorBaseParam.setErrorTimeCount(720);
}
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
if (CollUtil.isNotEmpty(monitorIds)) {
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
verifyMonitorVO.setRunNum(monitorIds.size());
verifyMonitorVO.setAbnormalNum(dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId)).size());
List<PqDataVerifyBak> dataSumVerifyList = baseDataSumVerifyQuery(monitorIds, monitorBaseParam);
// List<PqDataVerifyBak> dataSumVerifyList = baseDataSumVerifyQuery(monitorIds, monitorBaseParam);
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, dataVerifyList));
verifyMonitorVO.setTargetList(getAbnormalTarget(dataSumVerifyList));
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList,monitorBaseParam.getErrorTimeCount()));
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(dataVerifyList, monitorBaseParam));
} else {
verifyMonitorVO.setRunNum(0);
verifyMonitorVO.setAbnormalNum(0);
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, new ArrayList<>()));
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>()));
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>(),monitorBaseParam.getErrorTimeCount()));
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam));
}
@@ -111,7 +107,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
List<LocalDate> dateList = list.stream().map(PqDataVerifyBak::getTimeId).sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
processTable(monitorBaseParam, dateList, result, key);
});
dealTableResult(result);
dealTableResult(result, monitorBaseParam.getSearchValue());
return result;
}
@@ -137,34 +133,44 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
}
}
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
if (CollUtil.isNotEmpty(result)) {
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
result.forEach(it -> {
if (areaMap.containsKey(it.getMonitorId())) {
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
it.setMonitorName(areaLineInfoVO.getLineName());
it.setStationName(areaLineInfoVO.getSubName());
it.setDevName(areaLineInfoVO.getDeviceName());
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
it.setManufacturer(areaLineInfoVO.getManufacturer());
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
}
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
if (areaMap.containsKey(lineDetail.getLineId())) {
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
it.setMonitorName(lineDetail.getLineName());
it.setStationName(lineDetail.getSubName());
it.setDevName(lineDetail.getDeviceName());
if(deptName.containsKey(lineDetail.getLineId())){
it.setCity(deptName.get(lineDetail.getLineId()));
}
it.setVoltageLevel(lineDetail.getVoltageScale());
it.setIp(Base64.encode(lineDetail.getIp()));
it.setManufacturer(lineDetail.getManufacturer());
it.setObjType(lineDetail.getLoadType());
it.setObjName(lineDetail.getObjName());
info.add(it);
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
// }
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
// }
}
});
}
result.clear();
result.addAll(info);
}
}
@@ -177,6 +183,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
@Override
public List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam) {
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
monitorBaseParam.setErrorTimeCount(720);
}
List<DetailAbnormalVO> result = new ArrayList<>();
//参数校验
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
@@ -199,67 +208,73 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
switch (monitorBaseParam.getTargetKey()) {
case Param.freq:
lambdaQueryWrapper.eq(PqDataVerifyBak::getFreq, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.freq_dev:
lambdaQueryWrapper.eq(PqDataVerifyBak::getFreqDev, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.rms_v:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVRms, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.rms_lvr:
lambdaQueryWrapper.eq(PqDataVerifyBak::getRmsLvr, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.vu_dev:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVuDev, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.vl_dev:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVlDev, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.rms_i:
lambdaQueryWrapper.eq(PqDataVerifyBak::getIRms, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_thd:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVThd, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_1_v:
lambdaQueryWrapper.eq(PqDataVerifyBak::getV, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.phasic_v_1:
lambdaQueryWrapper.eq(PqDataVerifyBak::getV1Phasic, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.phasic_rate_x:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVPhasic, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_rate:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVHarm, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.in_v_rate:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVInharm, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_zero:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVZero, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_neg:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVNeg, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_pos:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVPos, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.v_unbalance:
lambdaQueryWrapper.eq(PqDataVerifyBak::getVUnbalance, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.fluc:
lambdaQueryWrapper.eq(PqDataVerifyBak::getFluc, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.pst:
lambdaQueryWrapper.eq(PqDataVerifyBak::getPst, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.plt:
lambdaQueryWrapper.eq(PqDataVerifyBak::getPlt, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.pf:
lambdaQueryWrapper.eq(PqDataVerifyBak::getPf, 1);
lambdaQueryWrapper.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.Voltage_Dip:
lambdaQueryWrapper.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount());
break;
case Param.Voltage_Rise:
lambdaQueryWrapper.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount());
break;
default:
log.error("方法{}未匹配到异常数据指标", "monitorAbnormalTable");
@@ -267,97 +282,37 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
}
}
List<PqDataVerifyBak> dataVerifyList = this.list(lambdaQueryWrapper);
for (PqDataVerifyBak pqDataVerifyBak : dataVerifyList) {
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(pqDataVerifyBak.getLineId());
Map<String, List<PqDataVerifyBak>> VerifyMap = dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId));
VerifyMap.forEach((key, value) -> {
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(key);
String temBgName = "";
if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())) {
temBgName = lineDevGetDTO.getBdName();
} else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) {
temBgName = lineDevGetDTO.getObjName();
}
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
String[] errorTimeCount = {"0"};
Long[] errAllCount = {0L};
jsonArray.forEach(it -> {
JSONObject targetJson = (JSONObject) it;
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
JSONArray innerJson = targetJson.getJSONArray(monitorBaseParam.getTargetKey());
PqReasonableRangeDto dto = rangeMap.get(monitorBaseParam.getTargetKey());
if (Objects.nonNull(dto.getHarmStart()) && Objects.nonNull(dto.getHarmEnd())) {
errorTimeCount[0] = targetJson.get("errorTimes").toString();
for (Object oJson : innerJson) {
JSONObject jsonObjectTem = (JSONObject) oJson;
JSONArray list = jsonObjectTem.getJSONArray("list");
list.forEach(listItem -> {
JSONObject object = (JSONObject) listItem;
long errCount = Long.parseLong(object.get("errorCounts").toString());
errAllCount[0] += errCount;
});
}
} else {
for (Object oJson : innerJson) {
JSONObject jsonObjectTem = (JSONObject) oJson;
JSONArray list = jsonObjectTem.getJSONArray("list");
list.forEach(listItem -> {
JSONObject object = (JSONObject) listItem;
long errCount = Long.parseLong(object.get("errorCounts").toString());
errAllCount[0] += errCount;
});
errorTimeCount[0] = jsonObjectTem.get("errorTimes").toString();
}
}
}
} else {
rangeMap.forEach((rangeKey, val) -> {
if (targetJson.containsKey(rangeKey)) {
JSONArray innerJson = targetJson.getJSONArray(rangeKey);
for (Object oJson : innerJson) {
JSONObject jsonObjectTem = (JSONObject) oJson;
JSONArray list = jsonObjectTem.getJSONArray("list");
list.forEach(listItem -> {
JSONObject object = (JSONObject) listItem;
long errCount = Long.parseLong(object.get("errorCounts").toString());
errAllCount[0] += errCount;
});
}
}
});
if (targetJson.containsKey("lineErrorTimes")) {
errorTimeCount[0] = targetJson.get("lineErrorTimes").toString();
}
}
});
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setTimeSum(errorTimeCount[0]);
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
detailAbnormalVO.setBdName(temBgName);
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
detailAbnormalVO.setErrCount(errAllCount[0].toString());
result.add(detailAbnormalVO);
} catch (BusinessException b) {
//文件为空时候的特殊处理
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setTimeSum("/");
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
detailAbnormalVO.setBdName(temBgName);
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
} catch (Exception e) {
throw new BusinessException("数据异常");
List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
DetailAbnormalVO.TimeAndTargetKey targetKey;
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
for (PqDataVerifyBak pqDataVerifyBak : value) {
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
targetKey.setDate(pqDataVerifyBak.getTimeId().format(DatePattern.NORM_DATE_FORMATTER));
targetKey.setTargetKeys(getAbnormalTarget(Arrays.asList(pqDataVerifyBak),monitorBaseParam.getErrorTimeCount()).stream().filter(x->x.getIds().size()>0).collect(Collectors.toList()));
targetKeyList.add(targetKey);
}
}
detailAbnormalVO.setDateTargetList(targetKeyList);
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
detailAbnormalVO.setBdName(temBgName);
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
});
return result;
}
@Override
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
public DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (!dtoMap.containsKey(monitorBaseParam.getTargetKey())) {
@@ -366,44 +321,50 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
}
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
LambdaQueryWrapper<PqDataVerifyBak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(PqDataVerifyBak::getTimeId);
lambdaQueryWrapper.in(PqDataVerifyBak::getTimeId, monitorBaseParam.getTime())
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds());
List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper);
//index[0] 总异常时间 index[1]指标异常时间
Integer[] errorTimeCount = {0, 0};
Integer[] errAllCount = {0};
for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) {
try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) {
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
jsonArray.forEach(it->{
JSONObject targetJson = (JSONObject) it;
if (targetJson.containsKey("lineErrorTimes")) {
errorTimeCount[0] += Integer.valueOf(targetJson.get("lineErrorTimes").toString());
}else{
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
}
} else {
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
String key = entry.getKey();
if (targetJson.containsKey(key)) {
resultDeal(dtoMap, key, targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
}
}
PqDataVerifyBak pqDataVerifyBak = this.getOne(lambdaQueryWrapper);
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
for (Object it : jsonArray) {
JSONObject targetJson = (JSONObject) it;
if (targetJson.containsKey("lineErrorTimes")) {
continue;
}
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result);
break;
}
} else {
String tarKey = "";
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
String key = entry.getKey();
if (targetJson.containsKey(key)) {
tarKey = key;
break;
}
}
resultDeal(dtoMap, tarKey, targetJson, result);
}
});
} catch (Exception e) {
throw new BusinessException("数据异常" + e);
}
} catch (Exception e) {
throw new BusinessException("数据异常");
}
// 排序实现
result = result.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime)
DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO();
info.setTimeSum(StrUtil.isBlank(monitorBaseParam.getTargetKey()) ? errorTimeCount[0] : errorTimeCount[1]);
info.setErrCount(errAllCount[0]);
info.setTime(result.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName)
.thenComparing(vo -> extractHarmonicOrder(vo.getTargetName()))
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName))
.collect(Collectors.toList());
return result;
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime))
.collect(Collectors.toList()));
return info;
}
@@ -431,12 +392,14 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
* 处理json对象中list数组
*/
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result) {
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result, String date, Integer[] errorTimeCount, Integer[] errorCounts) {
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey);
JSONArray innerJson = targetJson.getJSONArray(targetKey);
innerJson.forEach(oo -> {
JSONObject jsonObjectTem = (JSONObject) oo;
String targetName = jsonObjectTem.get("targetName").toString();
errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString());
errorTimeCount[1] += Integer.valueOf(jsonObjectTem.get("errorTimes").toString());
JSONArray list = jsonObjectTem.getJSONArray("list");
List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>();
list.forEach(listItem -> {
@@ -447,7 +410,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
String valueType = object.get("valueType").toString();
for (int i = 0; i < timeArr.size(); i++) {
DetailAbnormalVO.DetailLimitInnerVO temData = new DetailAbnormalVO.DetailLimitInnerVO();
temData.setTime(timeArr.get(i).toString());
temData.setTime(date + " " + timeArr.get(i).toString());
temData.setVal(valueArr.get(i).toString());
temData.setTargetName(targetName);
temData.setTargetKey(targetKey);
@@ -475,11 +438,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
vo.setTargetKey(targetKey);
vo.setPhaseType(phaseKey);
if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
} else {
// if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
// vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
// } else {
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
}
// }
valueList.forEach(ites -> {
switch (ites.getType()) {
case "AVG":
@@ -493,6 +456,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
break;
case "CP95":
vo.setCp95(ites.getVal());
break;
case "Feature_Amplitude":
vo.setFeatureAmplitude(ites.getVal());
break;
@@ -511,6 +475,52 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
lambdaQueryWrapper.between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
.in(PqDataVerifyBak::getLineId, monitorIds)
.eq(PqDataVerifyBak::getState, 1)
.and(x -> x.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount())
)
.orderByAsc(PqDataVerifyBak::getTimeId);
return this.list(lambdaQueryWrapper);
}
@@ -524,6 +534,52 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
.lambda().between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
.in(PqDataVerifyBak::getLineId, monitorIds)
.eq(PqDataVerifyBak::getState, 1)
.and(x -> x.ge(PqDataVerifyBak::getFreqTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getFreqDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVRmsTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVPosTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVNegTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVZeroTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVUnbalanceTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getRmsLvrTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVuDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVlDevTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVThdTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getIRmsTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPltTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVInharmTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVHarmTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPfTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getVPhasicTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getV1PhasicTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getFlucTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getPstTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getDipTime, monitorBaseParam.getErrorTimeCount())
.or()
.ge(PqDataVerifyBak::getRiseTime, monitorBaseParam.getErrorTimeCount())
)
.groupBy(PqDataVerifyBak::getLineId);
return this.list(queryWrapper);
}
@@ -564,102 +620,102 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
/**
* 指标异常测点数量
*/
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList) {
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList,Integer errorTimeCount) {
List<VerifyTargetVO> result = new ArrayList<>();
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
rangeMap.forEach((key, dto) -> {
Set<String> ids;
switch (key) {
case Param.freq:
ids = dataVerifyList.stream().filter(it -> it.getFreq() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqTime())).filter(it -> it.getFreqTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.freq_dev:
ids = dataVerifyList.stream().filter(it -> it.getFreqDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqDevTime())).filter(it -> it.getFreqDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.rms_v:
ids = dataVerifyList.stream().filter(it -> it.getVRms() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVRmsTime())).filter(it -> it.getVRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.rms_lvr:
ids = dataVerifyList.stream().filter(it -> it.getRmsLvr() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRmsLvrTime())).filter(it -> it.getRmsLvrTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.vu_dev:
ids = dataVerifyList.stream().filter(it -> it.getVuDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVuDevTime())).filter(it -> it.getVuDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.vl_dev:
ids = dataVerifyList.stream().filter(it -> it.getVlDev() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVlDevTime())).filter(it -> it.getVlDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.rms_i:
ids = dataVerifyList.stream().filter(it -> it.getIRms() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getIRmsTime())).filter(it -> it.getIRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_thd:
ids = dataVerifyList.stream().filter(it -> it.getVThd() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVThdTime())).filter(it -> it.getVThdTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_1_v:
ids = dataVerifyList.stream().filter(it -> it.getV() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVTime())).filter(it -> it.getVTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.phasic_v_1:
ids = dataVerifyList.stream().filter(it -> it.getV1Phasic() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getV1PhasicTime())).filter(it -> it.getV1PhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.phasic_rate_x:
ids = dataVerifyList.stream().filter(it -> it.getVPhasic() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPhasicTime())).filter(it -> it.getVPhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_rate:
ids = dataVerifyList.stream().filter(it -> it.getVHarm() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVHarmTime())).filter(it -> it.getVHarmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.in_v_rate:
ids = dataVerifyList.stream().filter(it -> it.getVInharm() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVInharmTime())).filter(it -> it.getVInharmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_zero:
ids = dataVerifyList.stream().filter(it -> it.getVZero() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVZeroTime())).filter(it -> it.getVZeroTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_neg:
ids = dataVerifyList.stream().filter(it -> it.getVNeg() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVNegTime())).filter(it -> it.getVNegTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_pos:
ids = dataVerifyList.stream().filter(it -> it.getVPos() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPosTime())).filter(it -> it.getVPosTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.v_unbalance:
ids = dataVerifyList.stream().filter(it -> it.getVUnbalance() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVUnbalanceTime())).filter(it -> it.getVUnbalanceTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.fluc:
ids = dataVerifyList.stream().filter(it -> it.getFluc() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFlucTime())).filter(it -> it.getFlucTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.pst:
ids = dataVerifyList.stream().filter(it -> it.getPst() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPstTime())).filter(it -> it.getPstTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.plt:
ids = dataVerifyList.stream().filter(it -> it.getPlt() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPltTime())).filter(it -> it.getPltTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.pf:
ids = dataVerifyList.stream().filter(it -> it.getPf() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPfTime())).filter(it -> it.getPfTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.Voltage_Dip:
ids = dataVerifyList.stream().filter(it -> it.getDip() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getDipTime())).filter(it -> it.getDipTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
case Param.Voltage_Rise:
ids = dataVerifyList.stream().filter(it -> it.getRise() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRiseTime())).filter(it -> it.getRiseTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
assembleEntity(ids, dto, result);
break;
default:
@@ -685,12 +741,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
if (StrUtil.isNotBlank(dto.getUnit())) {
unit = dto.getUnit();
}
if (temStr.equals(Param.rms_i)) {
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
} else {
// if (temStr.equals(Param.rms_i)) {
// verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
// } else {
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
}
// }
result.add(verifyTargetVO);
}

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;
@@ -191,11 +182,17 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getLineIndexes().size()+")");
//根据终端索引集查询在线率
List<PublicDTO> onlineRateList = getCondition(deviceIndexes, onlineRateCensusParam.getSearchBeginTime(), onlineRateCensusParam.getSearchEndTime());
single.add(onlineRateList.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159));
// 汇总所有设备的在线分钟和离线分钟,再计算总在线率
int totalOnlineMin = (int) onlineRateList.stream().mapToLong(PublicDTO::getOnlineMin).sum();
int totalOfflineMin = (int) onlineRateList.stream().mapToLong(PublicDTO::getOfflineMin).sum();
single.add(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
//如果存在需要比较的时间,再获取对应数据
if(StrUtil.isNotBlank(onlineRateCensusParam.getPeriodBeginTime()) && StrUtil.isNotBlank(onlineRateCensusParam.getPeriodEndTime())){
List<PublicDTO> compareData = getCondition(deviceIndexes, onlineRateCensusParam.getPeriodBeginTime(), onlineRateCensusParam.getPeriodEndTime());
ratio.add(compareData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159));
// 汇总所有设备的在线分钟和离线分钟,再计算总在线率
int compareOnlineMin = (int) compareData.stream().mapToLong(PublicDTO::getOnlineMin).sum();
int compareOfflineMin = (int) compareData.stream().mapToLong(PublicDTO::getOfflineMin).sum();
ratio.add(DataStatisticsUtil.calculateOnlineRate(compareOnlineMin, compareOfflineMin));
}
}
}
@@ -215,14 +212,16 @@ 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();
//终端在线率 保留两位小数
Double onlineRate = po.getOnlineRate() == null ? null : BigDecimal.valueOf(Double.parseDouble(po.getOnlineRate().toString())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
publicDTO.setId(po.getDevIndex());
publicDTO.setData(DataStatisticsUtil.dataLimits(onlineRate));
publicDTO.setOnlineMin(po.getOnlineMin() == null ? 0 : po.getOnlineMin().intValue());
publicDTO.setOfflineMin(po.getOfflineMin() == null ? 0 : po.getOfflineMin().intValue());
// 计算在线率
Double onlineRate = DataStatisticsUtil.calculateOnlineRate(publicDTO.getOnlineMin(), publicDTO.getOfflineMin());
publicDTO.setData(onlineRate);
publicDTOList.add(publicDTO);
});
}
@@ -330,14 +329,24 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
}
}
}
Double devAvg = children.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
devItem.setOnlineRate(devAvg);
// 汇总子节点的在线分钟和离线分钟,重新计算在线率
int totalOnlineMin = (int) children.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
int totalOfflineMin = (int) children.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
devItem.setOnlineMin(totalOnlineMin);
devItem.setOfflineMin(totalOfflineMin);
devItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
}
}
Double devAvg = devs.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
subItem.setOnlineRate(devAvg);
// 汇总设备的在线分钟和离线分钟,重新计算变电站在线率
int totalOnlineMin = (int)devs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
int totalOfflineMin = (int)devs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
subItem.setOnlineMin(totalOnlineMin);
subItem.setOfflineMin(totalOfflineMin);
subItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
} else {
subItem.setOnlineRate(3.14159);
subItem.setOnlineMin(0);
subItem.setOfflineMin(0);
}
if (Objects.nonNull(subItem.getAlgoDescribe())) {
if (mapAlarm.containsKey(subItem.getAlgoDescribe())) {
@@ -349,10 +358,16 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
}
}
}
Double subAvg = subs.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
gdItem.setOnlineRate(subAvg);
// 汇总变电站的在线分钟和离线分钟,重新计算供电公司在线率
int totalOnlineMin = (int) subs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
int totalOfflineMin = (int) subs.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
gdItem.setOnlineMin(totalOnlineMin);
gdItem.setOfflineMin(totalOfflineMin);
gdItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
} else {
gdItem.setOnlineRate(3.14159);
gdItem.setOnlineMin(0);
gdItem.setOfflineMin(0);
}
if (Objects.nonNull(gdItem.getAlgoDescribe())) {
if (mapAlarm.containsKey(gdItem.getAlgoDescribe())) {
@@ -364,10 +379,16 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
}
}
}
Double gdAvg = gds.stream().filter(item -> item.getOnlineRate() != 3.14159).collect(Collectors.averagingDouble(TerminalOnlineRateDataVO::getOnlineRate));
proItem.setOnlineRate(gdAvg);
// 汇总供电公司的在线分钟和离线分钟,重新计算省会在线率
int totalOnlineMin = (int) gds.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOnlineMin).sum();
int totalOfflineMin = (int) gds.stream().filter(item -> item.getOnlineRate() != 3.14159).mapToLong(TerminalOnlineRateDataVO::getOfflineMin).sum();
proItem.setOnlineMin(totalOnlineMin);
proItem.setOfflineMin(totalOfflineMin);
proItem.setOnlineRate(DataStatisticsUtil.calculateOnlineRate(totalOnlineMin, totalOfflineMin));
} else {
proItem.setOnlineRate(3.14159);
proItem.setOnlineMin(0);
proItem.setOfflineMin(0);
}
if (Objects.nonNull(proItem.getAlgoDescribe())) {
if (mapAlarm.containsKey(proItem.getAlgoDescribe()))

View File

@@ -127,16 +127,26 @@ public class DataStatisticsUtil {
for (TerminalOnlineRateData onlineRateData : terminalOnlineRateList) {
if (onlineRateDataVO.getId().equals(onlineRateData.getDevId())) {
flag = true;
onlineRateDataVO.setOnlineRate( dataLimits(onlineRateData.getOnlineRate()));
onlineRateDataVO.setOnlineMin(onlineRateData.getOnlineMin());
onlineRateDataVO.setOfflineMin(onlineRateData.getOfflineMin());
// 根据onlineMin和offlineMin计算在线率
Double onlineRate = calculateOnlineRate(onlineRateData.getOnlineMin(), onlineRateData.getOfflineMin());
onlineRateDataVO.setOnlineRate(onlineRate);
break;
}
}
if (!flag) {
onlineRateDataVO.setOnlineRate(3.14159);
onlineRateDataVO.setOnlineMin(0);
onlineRateDataVO.setOfflineMin(0);
}
}).collect(Collectors.toList());
} else {
deviceList = deviceList.stream().peek(onlineRateDataVO -> onlineRateDataVO.setOnlineRate(3.14159)).collect(Collectors.toList());
deviceList = deviceList.stream().peek(onlineRateDataVO -> {
onlineRateDataVO.setOnlineRate(3.14159);
onlineRateDataVO.setOnlineMin(0);
onlineRateDataVO.setOfflineMin(0);
}).collect(Collectors.toList());
}
}
@@ -149,6 +159,45 @@ public class DataStatisticsUtil {
return data>100?100:data;
}
/**
* 根据在线分钟数和离线分钟数计算在线率
* @param onlineMin 在线分钟数
* @param offlineMin 离线分钟数
* @return 在线率保留两位小数超过100则返回100
*/
public static Double calculateOnlineRate(Integer onlineMin, Integer offlineMin) {
if (onlineMin == null || offlineMin == null) {
return 3.14159;
}
long totalMin = onlineMin + offlineMin;
if (totalMin == 0) {
return 3.14159;
}
double rate = onlineMin * 100.0 / totalMin;
// 保留两位小数
rate = Math.round(rate * 100.0) / 100.0;
return dataLimits(rate);
}
/**
* 根据实际时间和期望时间计算数据完整性
* @param realTime 实际时间
* @param dueTime 期望时间
* @return 数据完整性保留两位小数超过100则返回100
*/
public static Double calculateIntegrityRate(Integer realTime, Integer dueTime) {
if (realTime == null || dueTime == null) {
return 3.14159;
}
if (dueTime == 0) {
return 3.14159;
}
double rate = realTime * 100.0 / dueTime;
// 保留两位小数
rate = Math.round(rate * 100.0) / 100.0;
return dataLimits(rate);
}
}

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

@@ -123,7 +123,10 @@
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
AND (sub.NAME LIKE #{searchValueLike}
OR dev.name LIKE #{searchValueLike}
OR line.NAME LIKE #{searchValueLike})
OR line.NAME LIKE #{searchValueLike}
OR loadtypeId.Name LIKE #{searchValueLike}
OR manufacturerId.name LIKE #{searchValueLike}
)
</if>
ORDER BY
gdName,
@@ -339,10 +342,10 @@
</if>
<if test="searchValue != '' and searchValue != null ">
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
AND sub.NAME LIKE #{searchValueLike}
AND (sub.NAME LIKE #{searchValueLike}
OR dev.NAME LIKE #{searchValueLike}
OR devT.Name LIKE #{searchValueLike}
OR device.IP LIKE #{searchValueLike}
OR device.IP LIKE #{searchValueLike})
</if>
ORDER BY
gdName,
@@ -355,6 +358,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 +374,8 @@
deviceDetail.id deviceId,
pv.scale lineVoltage,
pqsub.scale subVoltage,
lineDetail.monitor_id monitorId
lineDetail.monitor_id monitorId,
lineDetail.Actual_Area actualArea
FROM
pq_line line,
pq_line_detail lineDetail,

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,14 +74,27 @@ 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);
List<String> getLineByDeptIdAndNewStation(@Param("ids") List<String> id,@Param("dictTree")List<String> dictTree);
List<DeptLine> getOnlineMonitor();
}

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>
@@ -224,4 +300,16 @@
</if>
</where>
</select>
<select id="getOnlineMonitor" resultType="DeptLine">
select
t1.Line_Id lineId,
t1.Id id
from
pq_dept_line t1,
pq_line_detail t2
where
t1.Line_Id = t2.Id and t2.Run_Flag = 0
</select>
</mapper>

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

@@ -19,7 +19,9 @@
<select id="getOnIntegrityByIds" resultType="com.njcn.device.pq.pojo.vo.RStatIntegrityVO">
SELECT
line_index AS lineIndex,
ROUND(sum( real_time )*1.0 / sum( due_time ) * 100,2) AS integrityRate
sum(real_time) AS realTime,
sum(due_time) AS dueTime,
ROUND(sum( real_time )*100.0 / sum( due_time ) ,2) AS integrityRate
FROM
r_stat_integrity_d
<where>
@@ -110,4 +112,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

@@ -36,10 +36,10 @@ public class TransientParam extends DeviceInfoParam.BusinessParam {
private BigDecimal eventValueMin;
@ApiModelProperty("持续时间最大值")
private Integer persistMax;
private Double persistMax;
@ApiModelProperty("持续时间最小值")
private Integer persistMin;
private Double persistMin;
@ApiModelProperty("严重度最大值")
private BigDecimal severityMax;

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