Compare commits
7 Commits
HaiNan2024
...
2024-12
| Author | SHA1 | Date | |
|---|---|---|---|
| d5c18198b9 | |||
| 4a38148d7a | |||
| ab68a98999 | |||
| d435398c64 | |||
| 1acba83ff2 | |||
| 43af977942 | |||
| f0ffb63cff |
@@ -0,0 +1,20 @@
|
||||
package com.njcn.harmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.harmonic.api.fallback.PmsLineWarningFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.HARMONIC, path = "/onlineMonitor", fallbackFactory = PmsLineWarningFeignClientFallbackFactory.class)
|
||||
public interface PmsLineWarningFeignClient {
|
||||
|
||||
@PostMapping("/heBeiNorthAdd")
|
||||
HttpResult<String> heBeiNorthAdd();
|
||||
|
||||
}
|
||||
@@ -1,23 +1,12 @@
|
||||
package com.njcn.harmonic.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.harmonic.api.fallback.HarmDataFeignClientFallbackFactory;
|
||||
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
|
||||
import com.njcn.harmonic.pojo.param.HistoryHarmParam;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
|
||||
import com.njcn.influx.pojo.dto.HarmHistoryDataDTO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.harmonic.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.harmonic.api.PmsLineWarningFeignClient;
|
||||
import com.njcn.harmonic.utils.HarmonicEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PmsLineWarningFeignClientFallbackFactory implements FallbackFactory<PmsLineWarningFeignClient> {
|
||||
@Override
|
||||
public PmsLineWarningFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = HarmonicEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PmsLineWarningFeignClient() {
|
||||
@Override
|
||||
public HttpResult<String> heBeiNorthAdd() {
|
||||
log.error("{}异常,降级处理,异常为:{}", "新增在线监测数据(冀北-按月统计累计超标天数)", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.njcn.harmonic.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/6/18 15:53
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OnlineParam extends BaseParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty(value = "指标id")
|
||||
private String targetId;
|
||||
|
||||
@ApiModelProperty(value = "指标集合")
|
||||
private List<String> targetList;
|
||||
|
||||
@ApiModelProperty(value = "预警阈值")
|
||||
private Integer alertThreshold;
|
||||
|
||||
@ApiModelProperty(value = "告警阈值")
|
||||
private Integer alarmThreshold;
|
||||
|
||||
@ApiModelProperty(value = "数据类型")
|
||||
private Integer dataType;
|
||||
|
||||
@ApiModelProperty(value = "监测点类型 0:电网侧 1:非电网侧")
|
||||
private String lineType;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ReportParam extends OnlineParam {
|
||||
|
||||
@ApiModelProperty(name = "type", value = "1:预警单 2:告警单")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(name = "issueDetail", value = "问题描述")
|
||||
private String issueDetail;
|
||||
|
||||
@ApiModelProperty(name = "reformAdvice", value = "整改意见")
|
||||
private String reformAdvice;
|
||||
|
||||
@ApiModelProperty(name = "year", value = "年")
|
||||
private String year;
|
||||
|
||||
@ApiModelProperty(name = "number", value = "编号")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(name = "idList", value = "问题id集合")
|
||||
private List<String> idList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class DetailParam extends OnlineParam {
|
||||
|
||||
@ApiModelProperty(name = "lineId", value = "监测点id")
|
||||
private String lineId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.njcn.harmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点每日稳态指标超标天数统计表
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-06-17
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("supervision_line_warning")
|
||||
public class PmsLineWarning extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 告警时间
|
||||
*/
|
||||
@MppMultiId(value = "alarm_time")
|
||||
private LocalDate alarmTime;
|
||||
|
||||
/**
|
||||
* 责任部门id
|
||||
*/
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
@MppMultiId(value = "line_id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 指标类型(字典id)
|
||||
*/
|
||||
@MppMultiId(value = "target_type")
|
||||
private String targetType;
|
||||
|
||||
/**
|
||||
* 越限天数
|
||||
*/
|
||||
private Integer overLimitDay;
|
||||
|
||||
/**
|
||||
* 是否发送单子(0:未发 1:已发)
|
||||
*/
|
||||
private Integer initiateWarningFlag;
|
||||
|
||||
/**
|
||||
* 当前流程(0:无告警 1:预警 2:告警)
|
||||
*/
|
||||
private Integer step;
|
||||
|
||||
/**
|
||||
* 预警阈值
|
||||
*/
|
||||
private Integer alertThreshold;
|
||||
|
||||
/**
|
||||
* 告警阈值
|
||||
*/
|
||||
private Integer alarmThreshold;
|
||||
|
||||
/**
|
||||
* 阈值来源(0:系统生成 1:界面)
|
||||
*/
|
||||
private Integer thresholdResource;
|
||||
|
||||
/**
|
||||
* 预告警单id
|
||||
*/
|
||||
private String leafletId;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 在线监测监测点越限详情
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-07-05
|
||||
*/
|
||||
@Data
|
||||
public class LineLimitDetailVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@JsonFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate time;
|
||||
|
||||
@ApiModelProperty("越限详情")
|
||||
private String overLimitInfo;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/6/18 16:44
|
||||
*/
|
||||
@Data
|
||||
public class PmsOnlineVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("责任单位")
|
||||
private String dept;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String substation;
|
||||
|
||||
@ApiModelProperty("装置名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("监测对象类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("监测对象名称")
|
||||
private String objectName;
|
||||
|
||||
@ApiModelProperty("指标id")
|
||||
private String targetType;
|
||||
|
||||
@ApiModelProperty("超标天数")
|
||||
private Integer overLimitDay;
|
||||
|
||||
@ApiModelProperty("频率偏差")
|
||||
private Integer freq;
|
||||
|
||||
@ApiModelProperty("电压偏差")
|
||||
private Integer voltage;
|
||||
|
||||
@ApiModelProperty("闪变")
|
||||
private Integer flicker;
|
||||
|
||||
@ApiModelProperty("三相电压不平衡度")
|
||||
private Integer ubalance;
|
||||
|
||||
@ApiModelProperty("负序电流")
|
||||
private Integer iNeg;
|
||||
|
||||
@ApiModelProperty("谐波电压")
|
||||
private Integer harmonicV;
|
||||
|
||||
@ApiModelProperty("谐波电流")
|
||||
private Integer harmonicI;
|
||||
|
||||
@ApiModelProperty("间谐波电压")
|
||||
private Integer inuharmV;
|
||||
|
||||
@ApiModelProperty("数据来源 0:系统默认 1:自定义")
|
||||
private Integer dataResource;
|
||||
|
||||
@ApiModelProperty("当前流程(null:无流程 1:预警 2:告警)")
|
||||
private Integer step;
|
||||
|
||||
@ApiModelProperty("最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.njcn.harmonic.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.harmonic.pojo.param.OnlineParam;
|
||||
import com.njcn.harmonic.pojo.vo.LineLimitDetailVo;
|
||||
import com.njcn.harmonic.pojo.vo.PmsOnlineVo;
|
||||
import com.njcn.harmonic.service.IPmsLineWarningService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点每日稳态指标超标天数统计表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-06-17
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/onlineMonitor")
|
||||
@Api(tags = "在线监测")
|
||||
@AllArgsConstructor
|
||||
public class PmsLineWarningController extends BaseController {
|
||||
|
||||
private final IPmsLineWarningService iPmsLineWarningService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/heBeiNorthAdd")
|
||||
@ApiOperation("新增在线监测数据(按月统计累计超标天数)")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间")
|
||||
})
|
||||
public HttpResult<String> heBeiNorthAdd(@RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime) {
|
||||
String methodDescribe = getMethodDescribe("heBeiNorthAdd");
|
||||
iPmsLineWarningService.addHeBeiNorthLineWarning(startTime,endTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询在线监测数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<Page<PmsOnlineVo>> lineWarningList(@RequestBody @Validated OnlineParam param) {
|
||||
String methodDescribe = getMethodDescribe("lineWarningList");
|
||||
Page<PmsOnlineVo> list = iPmsLineWarningService.getLineWarningList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/overLimitDetail")
|
||||
@ApiOperation("查看越限详情")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<LineLimitDetailVo>> getOverLimitDetail(@RequestBody @Validated OnlineParam.DetailParam param) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitDetail");
|
||||
List<LineLimitDetailVo> result = iPmsLineWarningService.getOverLimitDetail(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.harmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.harmonic.pojo.po.PmsLineWarning;
|
||||
import com.njcn.harmonic.pojo.vo.PmsOnlineVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点每日稳态指标超标天数统计表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-06-17
|
||||
*/
|
||||
public interface PmsLineWarningMapper extends MppBaseMapper<PmsLineWarning> {
|
||||
|
||||
Page<PmsOnlineVo> page(@Param("page") Page<PmsLineWarning> page, @Param("ew") QueryWrapper<PmsLineWarning> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.harmonic.mapper.PmsLineWarningMapper">
|
||||
|
||||
<select id="page" resultType="PmsOnlineVo">
|
||||
SELECT
|
||||
p1.id id,
|
||||
p2.Org_Name dept,
|
||||
p2.Powerr_Name substation,
|
||||
p3.`Name` deviceName,
|
||||
p2.`Name` lineName,
|
||||
p1.line_id lineId,
|
||||
p4.`Name` businessType,
|
||||
p2.Monitor_Object_Name objectName,
|
||||
p1.target_type targetType,
|
||||
p1.over_limit_day overLimitDay,
|
||||
p3.Update_Time updateTime
|
||||
FROM
|
||||
supervision_line_warning p1
|
||||
LEFT JOIN pms_monitor p2 ON p1.line_id = p2.Id
|
||||
LEFT JOIN pms_terminal p3 ON p2.Terminal_Id = p3.Id
|
||||
LEFT JOIN sys_dict_data p4 ON p2.Monitor_Type = p4.Id
|
||||
<where>
|
||||
and ${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.harmonic.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.harmonic.pojo.param.OnlineParam;
|
||||
import com.njcn.harmonic.pojo.po.PmsLineWarning;
|
||||
import com.njcn.harmonic.pojo.vo.LineLimitDetailVo;
|
||||
import com.njcn.harmonic.pojo.vo.PmsOnlineVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点每日稳态指标超标天数统计表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-06-17
|
||||
*/
|
||||
public interface IPmsLineWarningService extends IService<PmsLineWarning> {
|
||||
|
||||
/**
|
||||
* 每日统计当前月各监测点各指标累计超标天数
|
||||
*/
|
||||
void addHeBeiNorthLineWarning(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 获取在线监测的数据列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Page<PmsOnlineVo> getLineWarningList(OnlineParam param);
|
||||
|
||||
/**
|
||||
* 按监测点id,指标id查看越限详情,具体展示每日超标的
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<LineLimitDetailVo> getOverLimitDetail(OnlineParam.DetailParam param);
|
||||
|
||||
}
|
||||
@@ -1180,8 +1180,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
|
||||
//组装最后监测点条件
|
||||
List<WlRecord> temList = wlRecordFeignClient.getWlAssByWlId(reportSearchParam.getLineId()).getData();
|
||||
List<WlRecord> wlRecordList = temList.stream().filter(it -> it.getType() == 1).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(wlRecordList)) {
|
||||
//List<WlRecord> wlRecordList = temList.stream().filter(it -> it.getType() == 1).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(temList) && temList.size()==1) {
|
||||
throw new BusinessException("当前测试项无测试数据");
|
||||
}
|
||||
|
||||
@@ -1209,13 +1209,13 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
|
||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
|
||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
|
||||
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1247,7 +1247,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
finalTerminalMap.put("pt",wlRecordMain.getCt().toString());
|
||||
finalTerminalMap.put("ct",wlRecordMain.getPt().toString());
|
||||
|
||||
finalTerminalMap.put("Standard_Capacity",wlRecordMain.getCapacitySi().toString());
|
||||
finalTerminalMap.put("Standard_Capacity",wlRecordMain.getCapacitySscb().toString());
|
||||
finalTerminalMap.put("Short_Capacity",wlRecordMain.getCapacitySscmin().toString());
|
||||
finalTerminalMap.put("Deal_Capacity",wlRecordMain.getCapacitySi().toString());
|
||||
finalTerminalMap.put("Dev_Capacity",wlRecordMain.getCapacitySt().toString());
|
||||
@@ -1336,7 +1336,10 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
.append(InfluxDbSqlConstant.QM);
|
||||
|
||||
List<Map<String, Object>> allList = new ArrayList<>();
|
||||
|
||||
WlRecord ceShiItem = wlRecordList.stream().filter(it->it.getType()==0).collect(Collectors.toList()).get(0);
|
||||
for (WlRecord wlRecord : wlRecordList) {
|
||||
if(wlRecord.getType().equals(1)) {
|
||||
StringBuilder temSql = new StringBuilder(sql);
|
||||
String start = LocalDateTimeUtil.format(wlRecord.getStartTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
String end = LocalDateTimeUtil.format(wlRecord.getEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
@@ -1357,9 +1360,17 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
String key = entry.getKey();
|
||||
double val = (double) entry.getValue();
|
||||
String zi = key.substring(0, key.indexOf("#"));
|
||||
String[] temStrArr = zi.split("_");
|
||||
boolean flag = isInteger(temStrArr[temStrArr.length-1]);
|
||||
if(flag){
|
||||
zi = zi.substring(0,zi.lastIndexOf("_"));
|
||||
}
|
||||
if (pqdMap.containsKey(zi)) {
|
||||
EleEpdPqd eleEpdPqd = pqdMap.get(zi).get(0);
|
||||
double vRes = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), val / 1000, (double) wlRecord.getPt(), (double) wlRecord.getCt());
|
||||
if(!eleEpdPqd.getPrimaryFormula().equals("*CT")){
|
||||
val = val / 1000;
|
||||
}
|
||||
double vRes = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(),val, (double) ceShiItem.getPt(), (double) ceShiItem.getCt());
|
||||
entry.setValue(vRes);
|
||||
}
|
||||
}
|
||||
@@ -1369,6 +1380,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
allList.add(temMapList.get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = dealResultMap(method, allList);
|
||||
if (resultMap.isEmpty()) {
|
||||
@@ -1428,7 +1440,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
// 遍历当前Map的键值对
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!key.equals("time")) {
|
||||
if (Objects.nonNull(entry.getValue()) && !key.equals("time")) {
|
||||
double value = (double) entry.getValue();
|
||||
// 检查结果Map中是否已包含该键
|
||||
if (!resultMap.containsKey(key) || (double) resultMap.get(key) > value) {
|
||||
@@ -1443,7 +1455,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
// 遍历当前Map的键值对
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!key.equals("time")) {
|
||||
if (Objects.nonNull(entry.getValue()) && !key.equals("time")) {
|
||||
double value = (double) entry.getValue();
|
||||
// 检查结果Map中是否已包含该键
|
||||
if (!resultMap.containsKey(key) || (double) resultMap.get(key) < value) {
|
||||
@@ -1461,7 +1473,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
// 遍历当前Map的键值对
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!key.equals("time")) {
|
||||
if (Objects.nonNull(entry.getValue()) && !key.equals("time")) {
|
||||
double value = (double) entry.getValue();
|
||||
|
||||
// 更新累计和
|
||||
@@ -1659,6 +1671,14 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isInteger(String str) {
|
||||
try {
|
||||
Integer.parseInt(str);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -507,7 +507,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 22:
|
||||
//负序电流
|
||||
sql = "SELECT time as time, i_neg as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_i WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = overlimit.getINeg();
|
||||
phasicType.add("负序电流");
|
||||
unit.add("A");
|
||||
@@ -526,7 +526,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 40:
|
||||
//谐波电压含有率
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, v as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, v_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder +
|
||||
@@ -550,7 +550,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 41:
|
||||
//谐波电流含有率
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, i as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, i_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, i_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
|
||||
@@ -565,7 +565,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 42:
|
||||
//谐波电压幅值
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, v as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_v WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_v WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, v_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_v WHERE " + stringBuilder +
|
||||
@@ -590,7 +590,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 43:
|
||||
//谐波电流幅值
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, i as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_i WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, i_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_i WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, i_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_i WHERE " + stringBuilder +
|
||||
@@ -608,7 +608,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 44:
|
||||
//谐波电压相角
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, v as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_v WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_v WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, v_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_v WHERE " + stringBuilder +
|
||||
@@ -629,7 +629,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 45:
|
||||
//谐波电流相角
|
||||
if (number == 1) {
|
||||
sql = "SELECT time as time, i as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_i WHERE " + stringBuilder +
|
||||
sql = "SELECT time as time, i_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_i WHERE " + stringBuilder +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
|
||||
} else {
|
||||
sql = "SELECT time as time, i_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmphasic_i WHERE " + stringBuilder +
|
||||
@@ -872,6 +872,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
phasicType.add("CA相");
|
||||
}
|
||||
targetName = "电压波动";
|
||||
unit.add("%");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,572 @@
|
||||
package com.njcn.harmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
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.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||
import com.njcn.harmonic.mapper.PmsLineWarningMapper;
|
||||
import com.njcn.harmonic.pojo.param.OnlineParam;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.PmsLineWarning;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.vo.LineLimitDetailVo;
|
||||
import com.njcn.harmonic.pojo.vo.PmsOnlineVo;
|
||||
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
|
||||
import com.njcn.harmonic.service.IPmsLineWarningService;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.*;
|
||||
import com.njcn.influx.pojo.po.*;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点每日稳态指标超标天数统计表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-06-17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PmsLineWarningServiceImpl extends MppServiceImpl<PmsLineWarningMapper, PmsLineWarning> implements IPmsLineWarningService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final RStatLimitRateDClient limitRateDClient;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DataVMapper dataVMapper;
|
||||
private final DataIMapper dataIMapper;
|
||||
private final DataHarmRateVMapper dataHarmRateVMapper;
|
||||
private final DataInHarmVMapper dataInHarmVMapper;
|
||||
private final DataPltMapper dataPltMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addHeBeiNorthLineWarning(String startTime, String endTime) {
|
||||
List<PmsLineWarning> result = new ArrayList<>();
|
||||
//获取指标集合(10个指标)
|
||||
List<DictData> dataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
Map<String, DictData> targetMap = dataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
//获取监测点和部门表关系
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
List<LineDevGetDTO> dtoList = new ArrayList<>();
|
||||
for (DeptGetChildrenMoreDTO dto : list) {
|
||||
if (!CollectionUtils.isEmpty(dto.getLineBaseList())) {
|
||||
dtoList = Stream.concat(dtoList.stream(), dto.getLineBaseList().stream())
|
||||
.collect(Collectors.collectingAndThen(Collectors.toSet(), ArrayList::new));
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(dtoList)) {
|
||||
//获取监测点按时间统计越限天数
|
||||
LocalDate firstDayOfMonth = Objects.isNull(startTime) ? LocalDate.now().minusDays(1).with(TemporalAdjusters.firstDayOfMonth()) : LocalDate.parse(startTime);
|
||||
String date = Objects.isNull(startTime) ? DateUtil.format(firstDayOfMonth.atStartOfDay(), DatePattern.NORM_DATE_PATTERN) : startTime;
|
||||
String endDate = Objects.isNull(endTime) ? DateUtil.format(LocalDateTime.now().minusDays(1), DatePattern.NORM_DATE_PATTERN) : endTime;
|
||||
RStatLimitQueryParam rStatLimitQueryParam = new RStatLimitQueryParam(null, date, endDate);
|
||||
List<RStatLimitTargetVO> limitTarget = limitRateDClient.monitorOverLimitDays(rStatLimitQueryParam).getData();
|
||||
Map<String, RStatLimitTargetVO> limitMap = limitTarget.stream().collect(Collectors.toMap(RStatLimitTargetVO::getLineId, Function.identity()));
|
||||
for (LineDevGetDTO item : dtoList) {
|
||||
if (Objects.isNull(limitMap.get(item.getPointId()))) {
|
||||
continue;
|
||||
}
|
||||
//频率偏差
|
||||
PmsLineWarning l1 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.FREQUENCY_DEV.getCode()).getId(), limitMap.get(item.getPointId()).getFreqDevOvertime());
|
||||
//电压偏差
|
||||
PmsLineWarning l2 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.VOLTAGE_DEV.getCode()).getId(), limitMap.get(item.getPointId()).getVoltageDevOvertime());
|
||||
//长时闪变
|
||||
PmsLineWarning l3 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.FLICKER.getCode()).getId(), limitMap.get(item.getPointId()).getFlickerOvertime());
|
||||
//谐波电压
|
||||
PmsLineWarning l4 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.HARMONIC_VOLTAGE.getCode()).getId(), limitMap.get(item.getPointId()).getUharmOvertime());
|
||||
//谐波电流
|
||||
PmsLineWarning l5 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.HARMONIC_CURRENT.getCode()).getId(), limitMap.get(item.getPointId()).getIharmOvertime());
|
||||
//间谐波电压
|
||||
PmsLineWarning l6 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.INTERHARMONIC_VOLTAGE.getCode()).getId(), limitMap.get(item.getPointId()).getInuharmOvertime());
|
||||
//负序电压不平衡度
|
||||
PmsLineWarning l7 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.PHASE_VOLTAGE.getCode()).getId(), limitMap.get(item.getPointId()).getUbalanceOvertime());
|
||||
//负序电流
|
||||
PmsLineWarning l8 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.NEG_CURRENT.getCode()).getId(), limitMap.get(item.getPointId()).getINegOvertime());
|
||||
//电压总谐波畸变率
|
||||
PmsLineWarning l9 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.THD_V.getCode()).getId(), limitMap.get(item.getPointId()).getUaberranceOvertime());
|
||||
//总稳态指标
|
||||
PmsLineWarning l10 = overData(firstDayOfMonth, item.getPointId(), item.getUnitId(), targetMap.get(DicDataEnum.TOTAL_INDICATOR.getCode()).getId(), limitMap.get(item.getPointId()).getAllOvertime());
|
||||
result.addAll(Arrays.asList(l1, l2, l3, l4, l5, l6, l7, l8, l9, l10));
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PmsOnlineVo> getLineWarningList(OnlineParam param) {
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getDeptId());
|
||||
deptGetLineParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
List<String> lineList = list.stream()
|
||||
.flatMap(dto -> dto.getLineBaseList().stream().map(LineDevGetDTO::getPointId))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
QueryWrapper<PmsLineWarning> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.between("p1.alarm_time", param.getSearchBeginTime(), param.getSearchEndTime());
|
||||
//监测点id
|
||||
if (CollUtil.isNotEmpty(lineList)) {
|
||||
queryWrapper.in("p1.line_id", lineList);
|
||||
}
|
||||
//监测点类型
|
||||
if (StringUtils.isNotBlank(param.getLineType())) {
|
||||
if (Objects.equals(param.getLineType(),"0")) {
|
||||
queryWrapper.eq("p2.Power_Flag", "101");
|
||||
} else {
|
||||
queryWrapper.eq("p2.Power_Flag", "102");
|
||||
}
|
||||
}
|
||||
//指标判断
|
||||
if (CollUtil.isNotEmpty(param.getTargetList())) {
|
||||
queryWrapper.in("p1.target_type", param.getTargetList());
|
||||
}
|
||||
if (Objects.nonNull(param.getAlarmThreshold())) {
|
||||
queryWrapper.ge("p1.over_limit_day", param.getAlarmThreshold());
|
||||
}
|
||||
queryWrapper.orderBy(true, true, "p2.Org_Name", "p2.Powerr_Name", "p3.`Name`");
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineLimitDetailVo> getOverLimitDetail(OnlineParam.DetailParam param) {
|
||||
List<LineLimitDetailVo> result = new ArrayList<>();
|
||||
String targetCode = dicDataFeignClient.getDicDataById(param.getTargetId()).getData().getCode();
|
||||
//获取监测点统计间隔
|
||||
Integer timeInterval = commTerminalGeneralClient.getMonitorDetail(param.getLineId()).getData().getInterval();
|
||||
//获取限值
|
||||
Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(param.getLineId()).getData();
|
||||
//处理数据
|
||||
List<LineLimitDetailVo> data = chanelTarget(param, overlimit, timeInterval, targetCode);
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
result = data.stream().sorted(Comparator.comparing(LineLimitDetailVo::getTime)).collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//指标数据处理
|
||||
public List<LineLimitDetailVo> chanelTarget(OnlineParam.DetailParam param, Overlimit overlimit, Integer timeInterval, String targetCode) {
|
||||
List<LineLimitDetailVo> result = new ArrayList<>(), finalList = new ArrayList<>();
|
||||
//频率偏差
|
||||
if (Objects.equals(targetCode, DicDataEnum.FREQUENCY_DEV.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 1).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getFreqDev(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getFreqDev();
|
||||
channelEachData(item, maxData > 0 ? overlimit.getFreqDev() : -overlimit.getFreqDev(), "getFreqDev", result, DicDataEnum.FREQUENCY_DEV.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
//电压偏差
|
||||
if (Objects.equals(targetCode, DicDataEnum.VOLTAGE_DEV.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 2).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
Float overLimit;
|
||||
Double maxData;
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
List<DataV> voltageList = getVoltageDev(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
);
|
||||
List<Double> voltage = voltageList.stream().map(DataV::getVuDev).collect(Collectors.toList());
|
||||
if (Math.abs(voltage.get(0)) >= Math.abs(voltage.get(1))) {
|
||||
overLimit = overlimit.getUvoltageDev();
|
||||
maxData = voltage.get(0);
|
||||
} else {
|
||||
overLimit = overlimit.getVoltageDev();
|
||||
maxData = voltage.get(1);
|
||||
}
|
||||
channelEachData(item, overLimit, "getVoltageDev", result, DicDataEnum.VOLTAGE_DEV.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
//长时闪变
|
||||
if (Objects.equals(targetCode, DicDataEnum.FLICKER.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 3).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getFlicker(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getPlt();
|
||||
channelEachData(item, overlimit.getFlicker(), "getFlicker", result, DicDataEnum.FLICKER.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
//电压总谐波畸变率
|
||||
if (Objects.equals(targetCode, DicDataEnum.THD_V.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 4).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getVThd(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getVThd();
|
||||
channelEachData(item, overlimit.getUaberrance(), "getUaberrance", result, DicDataEnum.THD_V.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
//谐波电压
|
||||
if (Objects.equals(targetCode, DicDataEnum.HARMONIC_VOLTAGE.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
//电压总谐波畸变率
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 4).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getVThd(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getVThd();
|
||||
channelEachData(item, overlimit.getUaberrance(), "getUaberrance", result, DicDataEnum.THD_V.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
//谐波电压含有率2~25次
|
||||
List<RStatLimitRateDPO> list2 = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 7).getData();
|
||||
if (CollUtil.isNotEmpty(list2)) {
|
||||
list2.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
DataHarmRateV dataHarmRateV = getDataHarmRateV(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59").get(0);
|
||||
channelHarmonicData(dataHarmRateV, null, null, item, overlimit, result, "getUharm", DicDataEnum.HARMONIC_VOLTAGE.getName(), timeInterval, 2, 25);
|
||||
});
|
||||
}
|
||||
}
|
||||
//谐波电流
|
||||
if (Objects.equals(targetCode, DicDataEnum.HARMONIC_CURRENT.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 8).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
DataI dataI = getDataI(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59").get(0);
|
||||
channelHarmonicData(null, dataI, null, item, overlimit, result, "getIharm", DicDataEnum.HARMONIC_CURRENT.getName(), timeInterval, 2, 25);
|
||||
});
|
||||
}
|
||||
}
|
||||
//间谐波电压
|
||||
if (Objects.equals(targetCode, DicDataEnum.INTERHARMONIC_VOLTAGE.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 9).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
DataInHarmV dataInHarmV = getDataInHarmV(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59").get(0);
|
||||
channelHarmonicData(null, null, dataInHarmV, item, overlimit, result, "getInuharm", DicDataEnum.INTERHARMONIC_VOLTAGE.getName(), timeInterval, 1, 16);
|
||||
});
|
||||
}
|
||||
}
|
||||
//负序电压不平衡度
|
||||
if (Objects.equals(targetCode, DicDataEnum.PHASE_VOLTAGE.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 5).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getUnbalance(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getVUnbalance();
|
||||
channelEachData(item, overlimit.getUbalance(), "getUbalance", result, DicDataEnum.PHASE_VOLTAGE.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
//负序电流
|
||||
if (Objects.equals(targetCode, DicDataEnum.NEG_CURRENT.getCode()) || Objects.equals(targetCode, DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
List<RStatLimitRateDPO> list = limitRateDClient.getOverData(param.getLineId(), param.getSearchBeginTime(), param.getSearchEndTime(), 6).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
String time = item.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
double maxData = getINeg(param.getLineId()
|
||||
, time + " 00:00:00"
|
||||
, time + " 23:59:59"
|
||||
).get(0).getINeg();
|
||||
channelEachData(item, overlimit.getINeg(), "getINeg", result, DicDataEnum.NEG_CURRENT.getName(), timeInterval, maxData);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
Map<LocalDate, List<LineLimitDetailVo>> map = result.stream().collect(Collectors.groupingBy(LineLimitDetailVo::getTime, LinkedHashMap::new, Collectors.toList()));
|
||||
map.forEach((k, v) -> {
|
||||
StringBuilder describe = new StringBuilder();
|
||||
LineLimitDetailVo lineLimitDetailVo = new LineLimitDetailVo();
|
||||
lineLimitDetailVo.setTime(k);
|
||||
v.forEach(item -> {
|
||||
describe.append(item.getOverLimitInfo());
|
||||
});
|
||||
lineLimitDetailVo.setOverLimitInfo(describe.toString());
|
||||
finalList.add(lineLimitDetailVo);
|
||||
});
|
||||
}
|
||||
return finalList;
|
||||
}
|
||||
|
||||
//处理单指标
|
||||
public void channelEachData(RStatLimitRateDPO dpo, float limit, String getColum, List<LineLimitDetailVo> result, String targetName, Integer timeInterval, double maxData) {
|
||||
try {
|
||||
Class<?> clazz = dpo.getClass();
|
||||
String methodName = getColum + "Overtime";
|
||||
Method method;
|
||||
method = clazz.getMethod(methodName);
|
||||
int value = (int) method.invoke(dpo);
|
||||
LineLimitDetailVo vo = new LineLimitDetailVo();
|
||||
vo.setTime(dpo.getTime());
|
||||
vo.setOverLimitInfo(targetName + "最大幅值:" + PubUtils.doubleRound(2, maxData) + ",限值:" + limit + ",超标时间:" + value * timeInterval + "分钟;");
|
||||
result.add(vo);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//处理谐波数据 谐波电压、谐波电流、间谐波电压
|
||||
public void channelHarmonicData(DataHarmRateV dataHarmRateV, DataI dataI, DataInHarmV dataInHarmV, RStatLimitRateDPO dpo, Overlimit overlimit, List<LineLimitDetailVo> result, String getColum, String targetName, Integer timeInterval, Integer startTimes, Integer endTimes) {
|
||||
LinkedHashMap<Integer, Integer> overMap = new LinkedHashMap<>();
|
||||
StringBuilder describe = new StringBuilder();
|
||||
LineLimitDetailVo vo = new LineLimitDetailVo();
|
||||
vo.setTime(dpo.getTime());
|
||||
//查看具体哪几次超标
|
||||
Class<?> clazz = dpo.getClass();
|
||||
for (int i = startTimes; i <= endTimes; i++) {
|
||||
String methodName = getColum + i + "Overtime";
|
||||
try {
|
||||
Method method = clazz.getMethod(methodName);
|
||||
int value = (int) method.invoke(dpo);
|
||||
if (value > 0) {
|
||||
overMap.put(i, value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Class<?> clazz2 = null;
|
||||
String targetName2 = null;
|
||||
double value2;
|
||||
if (Objects.nonNull(dataHarmRateV)) {
|
||||
clazz2 = dataHarmRateV.getClass();
|
||||
targetName2 = "getV";
|
||||
} else if (Objects.nonNull(dataI)) {
|
||||
clazz2 = dataI.getClass();
|
||||
targetName2 = "getI";
|
||||
} else if (Objects.nonNull(dataInHarmV)) {
|
||||
clazz2 = dataInHarmV.getClass();
|
||||
targetName2 = "getV";
|
||||
}
|
||||
for (Integer key : overMap.keySet()) {
|
||||
int value = overMap.get(key);
|
||||
String methodName = targetName2 + key;
|
||||
Method method;
|
||||
try {
|
||||
method = clazz2.getMethod(methodName);
|
||||
if (Objects.nonNull(dataHarmRateV)) {
|
||||
value2 = (double) method.invoke(dataHarmRateV);
|
||||
describe.append(key).append("次").append(targetName).append("CP95值最大幅值:").append(PubUtils.doubleRound(2, value2)).append("%,限值:").append(getOverLimitData(overlimit, getColum, key)).append("%,超标时间:").append(value * timeInterval).append("分钟;");
|
||||
} else if (Objects.nonNull(dataI)) {
|
||||
value2 = (double) method.invoke(dataI);
|
||||
describe.append(key).append("次").append(targetName).append("CP95值最大幅值:").append(PubUtils.doubleRound(2, value2)).append("%,限值:").append(getOverLimitData(overlimit, getColum, key)).append("%,超标时间:").append(value * timeInterval).append("分钟;");
|
||||
} else if (Objects.nonNull(dataInHarmV)) {
|
||||
value2 = (double) method.invoke(dataInHarmV);
|
||||
describe.append((key - 0.5)).append("次").append(targetName).append("CP95值最大幅值:").append(PubUtils.doubleRound(2, value2)).append("%,限值:").append(getOverLimitData(overlimit, getColum, key)).append("%,超标时间:").append(value * timeInterval).append("分钟;");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
vo.setOverLimitInfo(describe.toString().trim());
|
||||
result.add(vo);
|
||||
}
|
||||
|
||||
public PmsLineWarning overData(LocalDate date, String lineId, String deptId, String codeId, Integer overDays) {
|
||||
PmsLineWarning lineWarning = new PmsLineWarning();
|
||||
lineWarning.setAlarmTime(date);
|
||||
lineWarning.setDeptId(deptId);
|
||||
lineWarning.setLineId(lineId);
|
||||
lineWarning.setTargetType(codeId);
|
||||
lineWarning.setOverLimitDay(overDays);
|
||||
return lineWarning;
|
||||
}
|
||||
|
||||
private float getOverLimitData(Overlimit overlimit, String targetName, Integer times) {
|
||||
float result;
|
||||
Class<?> clazz = overlimit.getClass();
|
||||
String methodName = targetName + times;
|
||||
try {
|
||||
Method method = clazz.getMethod(methodName);
|
||||
result = (float) method.invoke(overlimit);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取频率偏差-日最大值-最大值
|
||||
*/
|
||||
public List<DataV> getFreqDev(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper2.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
|
||||
.eq(DataV::getPhaseType, "T")
|
||||
.max(DataV::getFreqDev)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
return dataVMapper.getStatisticsByWraper(influxQueryWrapper2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电压偏差-日最大值&&日最小值 日最大值的最大值 日最小值的最小值
|
||||
*/
|
||||
public List<DataV> getVoltageDev(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.MIN)
|
||||
.regular(DataV::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.min(DataV::getVuDev)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
List<DataV> result = new ArrayList<>(dataVMapper.getStatisticsByWraper(influxQueryWrapper));
|
||||
InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper2.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
|
||||
.regular(DataV::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.max(DataV::getVuDev)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
result.addAll(dataVMapper.getStatisticsByWraper(influxQueryWrapper2));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取长时闪变-日最大值-最大值
|
||||
*/
|
||||
public List<DataPlt> getFlicker(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
|
||||
influxQueryWrapper.eq(DataPlt::getLineId, lineIndex)
|
||||
.regular(DataPlt::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.max(DataPlt::getPlt)
|
||||
.between(DataPlt::getTime, startTime, endTime);
|
||||
return dataPltMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电压总谐波畸变率-日CP95-最大值
|
||||
*/
|
||||
public List<DataV> getVThd(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.CP95)
|
||||
.regular(DataV::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.max(DataV::getVThd)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
return dataVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取负序电压不平衡度-日最大值-最大值
|
||||
*/
|
||||
public List<DataV> getUnbalance(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
|
||||
.eq(DataV::getPhaseType, "T")
|
||||
.max(DataV::getVUnbalance)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
return dataVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取负序电流-日最大值-最大值
|
||||
*/
|
||||
public List<DataI> getINeg(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||
influxQueryWrapper.eq(DataI::getLineId, lineIndex)
|
||||
.eq(DataI::getValueType, InfluxDbSqlConstant.MAX)
|
||||
.eq(DataI::getPhaseType, "T")
|
||||
.max(DataI::getINeg)
|
||||
.between(DataI::getTime, startTime, endTime);
|
||||
return dataIMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取谐波电压含有率 2~25次数据
|
||||
*/
|
||||
public List<DataHarmRateV> getDataHarmRateV(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmRateV.class);
|
||||
influxQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(2, 25, 1));
|
||||
influxQueryWrapper.eq(DataHarmRateV::getLineId, lineIndex)
|
||||
.eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.CP95)
|
||||
.regular(DataHarmRateV::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.between(DataHarmRateV::getTime, startTime, endTime);
|
||||
return dataHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取谐波电流含有率 2~25次数据
|
||||
*/
|
||||
public List<DataI> getDataI(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||
influxQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(2, 25, 1));
|
||||
influxQueryWrapper.eq(DataI::getLineId, lineIndex)
|
||||
.eq(DataI::getValueType, InfluxDbSqlConstant.CP95)
|
||||
.regular(DataI::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.between(DataI::getTime, startTime, endTime);
|
||||
return dataIMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取间谐波电压含有率 2~25次数据
|
||||
*/
|
||||
public List<DataInHarmV> getDataInHarmV(String lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmV.class);
|
||||
influxQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 16, 1));
|
||||
influxQueryWrapper.eq(DataInHarmV::getLineId, lineIndex)
|
||||
.eq(DataInHarmV::getValueType, InfluxDbSqlConstant.CP95)
|
||||
.regular(DataInHarmV::getPhaseType, Arrays.asList("A", "B", "C"))
|
||||
.between(DataInHarmV::getTime, startTime, endTime);
|
||||
return dataInHarmVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class PmsTemProcessTrackServiceImpl extends ServiceImpl<PmsTemProcessTrac
|
||||
PmsTemUserPO pmsTemUserPO = iPmsTemUserService.getById(updatePmsTemProcessTrackParam.getTempUserDossierId());
|
||||
pmsTemProcessTrackPO.setTempUserDossierName(pmsTemUserPO.getConsName());
|
||||
|
||||
PmsTemProcessTrackPO tem = this.getById(updatePmsTemProcessTrackParam.getObjId());
|
||||
PmsTemProcessTrackPO tem = this.getById(updatePmsTemProcessTrackParam.getTempUserDossierId());
|
||||
if(Integer.valueOf(DicDataEnum.Has_Upload.getCode()).equals(tem.getUploadStatus())){
|
||||
pmsTemProcessTrackPO.setUploadStatus(Integer.valueOf(DicDataEnum.Return_Upload.getCode()));
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PointStatisticalDataServiceImpl extends ServiceImpl<RUploadPointSta
|
||||
}
|
||||
|
||||
list = list.stream().peek(item->item.setStationType(dictDataMap.get(item.getStationType()).getValue())).collect(Collectors.toList());
|
||||
List<List<RUploadPointStatisticalDataD>> partition = ListUtils.partition(list, 100);
|
||||
List<List<RUploadPointStatisticalDataD>> partition = ListUtils.partition(list, 50);
|
||||
StrBuilder resultLog = new StrBuilder();
|
||||
AtomicBoolean resultFlag = new AtomicBoolean(true);
|
||||
//分片上传
|
||||
|
||||
@@ -154,6 +154,19 @@ public class ProblemVO extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime discoveryTime;
|
||||
|
||||
|
||||
@ApiModelProperty("告预警单id,当ifReleaseWarning为是时,必填")
|
||||
private String workAlarmId;
|
||||
|
||||
|
||||
public String getWorkAlarmId() {
|
||||
return workAlarmId;
|
||||
}
|
||||
|
||||
public void setWorkAlarmId(String workAlarmId) {
|
||||
this.workAlarmId = workAlarmId;
|
||||
}
|
||||
|
||||
public void setProblemId(String problemId) {
|
||||
if (StrUtil.isNotBlank(problemId)) {
|
||||
this.problemId = problemId;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.system.timer.tasks;
|
||||
|
||||
import com.njcn.harmonic.api.PmsLineWarningFeignClient;
|
||||
import com.njcn.system.timer.TimerTaskRunner;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class PmsLineWarningTaskRunner implements TimerTaskRunner {
|
||||
|
||||
private final PmsLineWarningFeignClient pmsLineWarningFeignClient;
|
||||
|
||||
@Override
|
||||
public void action(String date) {
|
||||
pmsLineWarningFeignClient.heBeiNorthAdd();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user