21 Commits

Author SHA1 Message Date
hzj
6a1bd88ab8 修改算法 2025-02-07 10:13:26 +08:00
hzj
169b701fa9 注释掉代码 2025-01-21 10:58:39 +08:00
6a97015cd6 国网推送台账信息添加更新时间字段 2025-01-21 09:02:44 +08:00
hzj
b2ab4ee825 添加平台项目服务名 2025-01-17 15:42:16 +08:00
hzj
cc85660043 添加平台项目服务名 2025-01-17 15:09:14 +08:00
hzj
4f7b444737 添加平台项目服务名 2025-01-17 14:56:40 +08:00
xy
e729485d25 定时任务更新 2025-01-09 11:51:58 +08:00
xy
f701507fae 正则调整 2025-01-07 13:58:52 +08:00
xy
149d017c49 冀北现场问题调整 2025-01-06 15:34:33 +08:00
11116929cc 台账识别码修改 2025-01-06 15:13:33 +08:00
e4049de260 台账识别码修改 2025-01-06 14:36:01 +08:00
b4be12e30e 台账识别码修改 2025-01-06 14:10:38 +08:00
1b169830f9 台账识别码修改 2025-01-06 09:38:32 +08:00
xy
417b36c884 微调 2025-01-03 13:12:17 +08:00
d5c18198b9 稳态趋势图调整 2025-01-03 08:58:36 +08:00
4a38148d7a pms上送报错问题解决 2024-12-30 08:56:07 +08:00
ab68a98999 pmsbug修改 2024-12-27 15:58:07 +08:00
xy
d435398c64 河北新增在线监测功能 2024-12-25 11:09:38 +08:00
1acba83ff2 浙江无线报表调整 2024-12-24 15:27:26 +08:00
43af977942 浙江无线报表调整 2024-12-24 15:01:37 +08:00
xy
f0ffb63cff 微调 2024-12-23 10:50:01 +08:00
40 changed files with 1338 additions and 230 deletions

View File

@@ -143,13 +143,15 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
//流程状态排除不通过的,不通过会放在待办中,一直到该流程通过
processInstanceQuery.variableValueNotEquals(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, BpmTaskStatusEnum.REJECT.getStatus());
if (Objects.nonNull(bpmProcessInstancePageParam.getSearchBeginTime()) && Objects.nonNull(bpmProcessInstancePageParam.getSearchEndTime())) {
String beginTimeStr = bpmProcessInstancePageParam.getSearchBeginTime();
String endTimeStr = bpmProcessInstancePageParam.getSearchEndTime();
LocalDateTime beginTime = LocalDateTimeUtil.parse(beginTimeStr, DatePattern.NORM_DATE_PATTERN);
LocalDateTime endTime = PubUtils.endTimeToLocalDateTime(endTimeStr);
processInstanceQuery.startedBefore(DateUtils.of(endTime));
processInstanceQuery.startedAfter(DateUtils.of(beginTime));
}
// 查询数量
long processInstanceCount = processInstanceQuery.count();
if (processInstanceCount == 0) {

View File

@@ -142,12 +142,14 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
taskQuery.processDefinitionNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
}
if (Objects.nonNull(bpmTaskQueryParam.getSearchBeginTime()) && Objects.nonNull(bpmTaskQueryParam.getSearchEndTime())) {
String beginTimeStr = bpmTaskQueryParam.getSearchBeginTime();
String endTimeStr = bpmTaskQueryParam.getSearchEndTime();
LocalDateTime beginTime = LocalDateTimeUtil.parse(beginTimeStr, DatePattern.NORM_DATE_PATTERN);
LocalDateTime endTime = PubUtils.endTimeToLocalDateTime(endTimeStr);
taskQuery.taskCreatedBefore(DateUtils.of(endTime));
taskQuery.taskCreatedAfter(DateUtils.of(beginTime));
}
// 执行查询
long count = taskQuery.count();
if (count == 0) {

View File

@@ -182,7 +182,7 @@ public interface PatternRegex {
/**
* 描述32
*/
String DES32_REGEX = "^.{0,10}$";
String DES32_REGEX = "^.{0,32}$";
/**
* 描述64

View File

@@ -51,5 +51,16 @@ public interface ServerInfo {
String DATA_PLATFORM = "data-platform-boot";
String PLATFORM_STAT_BOOT = "stat-boot";
String PLATFORM_RT_BOOT = "rt-boot";
String PLATFORM_EVENT_BOOT = "event-boot";
String PLATFORM_DATA_PROCESSING_BOOT = "data-processing-boot";
String PLATFORM_MESSAGE_BOOT = "message-boot";
}

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pms.pojo.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -28,7 +29,7 @@ public class PushMonitorDTO {
private String customName;
private String status;
private Date ctime;
private Date updateTime;
private LocalDateTime updateTime;
private String lineId;
private String chv;
private String chi;

View File

@@ -222,12 +222,7 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
/* if (tranMap.containsKey(item.getPotentialTransFormerType())) {
pushMonitorDTO.setEvtType(tranMap.get(item.getPotentialTransFormerType()).getValue());
}
if (pointMap.containsKey(item.getNeutralGroundingMode())) {
pushMonitorDTO.setNeutralGround(pointMap.get(item.getNeutralGroundingMode()).getValue());
}*/
pushMonitorDTO.setUpdateTime(item.getUpdateTime());
if (StrUtil.isNotBlank(item.getOrgName())) {

View File

@@ -23,7 +23,7 @@ public class DeviceUtil {
public static String decoderString(Integer cd,String content){
String seriesTmp = null;
if (cd == 0) {
seriesTmp = Base64.decodeBase64(content).toString();
seriesTmp = new String(Base64.decodeBase64(content));
} else if (cd == 1) {
seriesTmp = ThreeDesUtil.decryptThreeDes(content);
} else if (cd == 2) {

View File

@@ -274,7 +274,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
deviceDetail.setUpdateTime(LocalDateTime.now());
//处理装置识别码秘钥
coderM3d(deviceDetail);
coderM3d(deviceDetail,false);
deviceMapper.insert(deviceDetail);
//装置功能
List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
@@ -633,7 +633,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Device deviceDetail = new Device();
BeanUtils.copyProperties(updateDeviceParam, deviceDetail);
deviceDetail.setId(updateDeviceParam.getDevIndex());
coderM3d(deviceDetail);
coderM3d(deviceDetail,true);
this.updateById(device);
deviceMapper.updateById(deviceDetail);
}
@@ -813,7 +813,17 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
return true;
}
private void coderM3d(Device deviceDetail){
private void coderM3d(Device deviceDetail,Boolean updateFlag){
if(updateFlag){
Device deviceRes = deviceMapper.selectById(deviceDetail.getId());
if(StrUtil.isNotBlank(deviceDetail.getDevKey()) && !deviceRes.getDevKey().equals(deviceDetail.getDevKey())){
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD,deviceDetail.getDevKey()));
}
if(StrUtil.isNotBlank(deviceDetail.getSeries()) && !deviceRes.getSeries().equals(deviceDetail.getSeries())){
deviceDetail.setSeries(DeviceUtil.encodeString(devCD,deviceDetail.getSeries()));
}
}else {
if(StrUtil.isNotBlank(deviceDetail.getDevKey())){
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD,deviceDetail.getDevKey()));
}
@@ -821,6 +831,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
deviceDetail.setSeries(DeviceUtil.encodeString(devCD,deviceDetail.getSeries()));
}
}
}
private void decoderM3d(Device deviceDetail){
if(StrUtil.isNotBlank(deviceDetail.getDevKey())){
deviceDetail.setDevKey(DeviceUtil.decoderString(devCD,deviceDetail.getDevKey()));
@@ -951,7 +963,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Device deviceDetail = deviceMapper.selectById(device.getId());
//解密
decoderM3d(deviceDetail);
//decoderM3d(deviceDetail);
BeanUtils.copyProperties(deviceDetail, deviceVO);
deviceVO.setDevIndex(device.getId());
//母线
@@ -1011,7 +1023,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Device deviceDetail = deviceMapper.selectById(obj.getId());
//解密
decoderM3d(deviceDetail);
//decoderM3d(deviceDetail);
BeanUtils.copyProperties(deviceDetail, deviceVO);
deviceVO.setDevIndex(obj.getId());
@@ -1107,7 +1119,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
deviceVO.setSort(device.getSort());
Device deviceDetail = deviceMapper.selectById(device.getId());
//解密
decoderM3d(deviceDetail);
//decoderM3d(deviceDetail);
BeanUtils.copyProperties(deviceDetail, deviceVO);
deviceVO.setDevIndex(device.getId());
@@ -1158,7 +1170,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Device deviceDetail = deviceMapper.selectById(device.getId());
//解密
decoderM3d(deviceDetail);
//decoderM3d(deviceDetail);
BeanUtils.copyProperties(deviceDetail, deviceVO);
deviceVO.setDevIndex(device.getId());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -237,91 +237,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
objectListData.add(list);
}
;
//下面代码稳定后可删除
/* List<HarmonicHistoryData> aList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_A))
.collect(Collectors.toList());
List<HarmonicHistoryData> bList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_B))
.collect(Collectors.toList());
List<HarmonicHistoryData> cList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_C))
.collect(Collectors.toList());
int maxSize = Math.max(aList.size(), Math.max(bList.size(), cList.size()));
if (maxSize == aList.size()) {
time = aList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
} else if (maxSize == bList.size()) {
time = bList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
} else {
time = cList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
}
aValue = aList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
bValue = bList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
cValue = cList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
//组装二维数组
boolean flagA = true,flagB = true,flagC =true;
if(CollectionUtil.isEmpty(aValue)){
flagA = false;
}
if(CollectionUtil.isEmpty(bValue)){
flagB = false;
}
if(CollectionUtil.isEmpty(cValue)){
flagC = false;
}
for (int i = 0; i < time.size(); i++) {
List<Object> objects = new ArrayList<>();
//指定
objects.add(time.get(i));
if(flagA){
objects.add(aValue.get(i));
}
if(flagB) {
objects.add(bValue.get(i));
}
if(flagC) {
objects.add(cValue.get(i));
}
objectListData.add(objects);
}
Float aValueMin = CollectionUtil.isEmpty(aValue) ? null : Collections.min(aValue);
Float bValueMin = CollectionUtil.isEmpty(bValue) ? null : Collections.min(bValue);
Float cValueMin = CollectionUtil.isEmpty(cValue) ? null : Collections.min(cValue);
Float aValueMax = CollectionUtil.isEmpty(aValue) ? null : Collections.max(aValue);
Float bValueMax = CollectionUtil.isEmpty(bValue) ? null : Collections.max(bValue);
Float cValueMax = CollectionUtil.isEmpty(cValue) ? null : Collections.max(cValue);
List<Float> list = Arrays.asList(aValueMin, bValueMin, cValueMin, aValueMax, bValueMax, cValueMax);
Optional<Float> min = list.stream()
.filter(Objects::nonNull) // 过滤掉null值
.min(Float::compareTo);
if (min.isPresent()) {
historyDataResultVO.setMinValue(min.get());
}
Optional<Float> max = list.stream()
.filter(Objects::nonNull) // 过滤掉null值
.max(Float::compareTo);
if (min.isPresent()) {
historyDataResultVO.setMaxValue(max.get());
}*/
historyDataResultVO.setMaxValue(maxI);
historyDataResultVO.setMinValue(minI);
historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit());
@@ -507,7 +423,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,14 +442,18 @@ 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 +
targetName = "基波电压幅值";
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');";
unit.add(pqsDeviceUnit.getPhaseVoltage());
} else {
targetName = "谐波电压含有率";
sql = "SELECT time as time, v_" + number + " 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');";
if (number < 26) {
topLimit = PubUtils.getValueByMethod(overlimit, "getUharm", number);
}
unit.add("%");
}
if (ptType == 0) {
phasicType.add("A相");
@@ -544,28 +464,33 @@ public class HistoryResultServiceImpl implements HistoryResultService {
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("%");
targetName = "谐波电压含有率";
break;
case 41:
//谐波电流含有率
if (number == 1) {
sql = "SELECT time as time, i as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
targetName = "谐波电流幅值";
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');";
unit.add("A");
} else {
targetName = "谐波电流含有率";
sql = "SELECT time as time, i_" + number + " 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');";
unit.add("%");
}
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("%");
targetName = "谐波电流含有率";
break;
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 +
@@ -582,64 +507,76 @@ public class HistoryResultServiceImpl implements HistoryResultService {
}
if (number == 1) {
unit.add(pqsDeviceUnit.getVfundEffective());
targetName = "基波电压幅值";
} else {
unit.add("V");
}
targetName = "谐波电压幅值";
}
break;
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');";
targetName = "基波电流幅值";
} else {
sql = "SELECT time as time, i_" + number + " 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');";
if (number < 26) {
topLimit = PubUtils.getValueByMethod(overlimit, "getIharm", number);
}
targetName = "谐波电流幅值";
}
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("A");
targetName = "谐波电流幅值";
break;
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 +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
}
if (ptType == 0) {
targetName = "基波电压相角";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
} else {
targetName = "谐波电压相角";
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
}
unit.add("°");
targetName = "谐波电压相角";
break;
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');";
targetName = "基波电流相角";
} else {
sql = "SELECT time as time, i_" + number + " 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');";
targetName = "谐波电流相角";
}
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
unit.add("°");
targetName = "谐波电流相角";
break;
case 46:
//间谐波电压含有率
@@ -872,6 +809,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
phasicType.add("CA相");
}
targetName = "电压波动";
unit.add("%");
break;
default:
break;

View File

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

View File

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

View File

@@ -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);
//分片上传

View File

@@ -36,6 +36,7 @@ import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -293,11 +294,11 @@ public class RStatOrgServiceImpl implements RStatOrgService {
between("data_date",begin,end);
RMpPassRateMPO rMpPassRateMPO = rMpPassRateMMapper.selectOne(rMpPassRateMPOQueryWrapper);
//todo 这边有点问题,每日监测点信息从公共接口获取,当日监测点应该都一样,不存在表数据不一致的情况
// if (!Objects.isNull(rMpPassRateMPO)){
if (!Objects.isNull(rMpPassRateMPO)){
rStatOrgMPO.setFreqPassRate(rMpPassRateMPO.getFreqPassRate());
rStatOrgMPO.setFlickerPassRate(rMpPassRateMPO.getFlickerPassRate());
rStatOrgMPO.setVDevPassRate(rMpPassRateMPO.getVDevPassRate());
// }
}
/*11、日均监测到暂态指标的监测点数*/
rMpEventDetailDPOQueryWrapper.clear();

View File

@@ -104,7 +104,7 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
* @Description: 3、频率在【4555】之间
* 4、相电压有效值在【0.85p.u.1.2p.u.】之间p.u=电压等级/1.732
* 5、线电压有效值在【0.85p.u.1.2p.u.】之间p.u=电压等级
* 6、电压总谐波畸变率在【0.1%20%】之间;
* 6、电压总谐波畸变率在【0%20%】之间;
* 7、负序电压不平衡度在【020%】。满足以上条件则是一条有效数据
* @Param: [fiveItems, pmsAbnormalRules, voltage]
* @return: java.lang.Integer
@@ -144,12 +144,12 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
Boolean rmsLvrflag = false;
Boolean vUnbalanceflag = false;
freqCount++;
unbalanceCount++;
phaseVoltageCount++;
lineVoltageCount++;
vThdCount++;
effectiveMinuteCount++;
// freqCount++;
// unbalanceCount++;
// phaseVoltageCount++;
// lineVoltageCount++;
// vThdCount++;
// effectiveMinuteCount++;
// 先注释掉 校验跑出监测点
if (freqLimit.getLowerLimit() <= freqMin && freqMax <= freqLimit.getUpperLimit()) {
freqCount++;

View File

@@ -93,7 +93,7 @@ public class ROperatingMonitorDServiceImpl extends MppServiceImpl<ROperatingMoni
rOperatingMonitorDPO.setDataRightRate (BigDecimal.valueOf(
(Double.valueOf(rMpMonitorEvaluateD.getFreqCount ()+ rMpMonitorEvaluateD.getLineVoltageCount ()+
rMpMonitorEvaluateD.getPhaseVoltageCount ()+ rMpMonitorEvaluateD.getUnbalanceCount ()+
rMpMonitorEvaluateD.getVThdCount ()))/(5* rMpMonitorEvaluateD.getEffectiveMinuteCount ())
rMpMonitorEvaluateD.getVThdCount ()))*statisticalInterval/(5*1440)
).setScale(5, BigDecimal.ROUND_HALF_UP));
}

View File

@@ -20,7 +20,7 @@ public interface ROperatingMonitorService extends IMppService<ROperatingMonitorD
* @Description: 采用以下公式计算数据完整率:
* 〖数据完整率〗_日统计=有效值数据个数/(1440/interval)*100%
* 采用以下公式计算数据准确率
* 〖数据准确率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(有效值数据个数*5)*100%
* 〖数据准确率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(有效值数据个数*5)*100%有效值数据个数修改为1440/interval)
* 采用以下公式计算指标完整率
* 〖指标完整率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(1440/interval*5)*100% 采用以下公式计算数据完整率:
* 〖数据完整率〗_日统计=有效值数据个数/(1440/interval)*100%

View File

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

View File

@@ -224,7 +224,9 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
.distinct()
.collect(Collectors.toList());
QueryWrapper<LineWarning> queryWrapper = new QueryWrapper<>();
if (Objects.nonNull(param.getSearchBeginTime()) && Objects.nonNull(param.getSearchEndTime())) {
queryWrapper.between("A.alarm_time", param.getSearchBeginTime(), param.getSearchEndTime());
}
//监测点id
if (CollUtil.isNotEmpty(lineList)) {
queryWrapper.in("A.line_id", lineList);

View File

@@ -160,10 +160,11 @@ public class QuitRunningDeviceServiceImpl extends ServiceImpl<QuitRunningDeviceM
// quitRunningDeviceVOQueryWrapper.eq("supervision_quit_running_device.device_type", quitRunningDeviceQueryParam.getDeviceType());
// quitRunningDeviceVOQueryWrapper.eq("supervision_quit_running_device.device_id", quitRunningDeviceQueryParam.getDeviceId());
// }
//添加上时间范围
if (Objects.nonNull(quitRunningDeviceQueryParam.getSearchBeginTime()) && Objects.nonNull(quitRunningDeviceQueryParam.getSearchEndTime())) {
quitRunningDeviceVOQueryWrapper.between("supervision_quit_running_device.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(quitRunningDeviceQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(quitRunningDeviceQueryParam.getSearchEndTime())));
}
//判断监测点/设备的选择
quitRunningDeviceVOQueryWrapper.eq("supervision_quit_running_device.device_type", quitRunningDeviceQueryParam.getDeviceType());
if (2 == quitRunningDeviceQueryParam.getDeviceType()) {

View File

@@ -226,9 +226,11 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
);
}
//添加上时间范围
if (Objects.nonNull(supervisionDevMainReportQuery.getSearchBeginTime()) && Objects.nonNull(supervisionDevMainReportQuery.getSearchEndTime())) {
queryWrapper.between("supervision_dev_main_report.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchEndTime())));
}
queryWrapper.orderByDesc("supervision_dev_main_report.Update_Time");
Page<SupervisionDevMainReportVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionDevMainReportQuery), PageFactory.getPageSize(supervisionDevMainReportQuery)), queryWrapper);
page.getRecords().forEach(temp -> {

View File

@@ -244,9 +244,11 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
);
}
//添加上时间范围
if (Objects.nonNull(supervisionTempLineDebugQuery.getSearchBeginTime()) && Objects.nonNull(supervisionTempLineDebugQuery.getSearchEndTime())) {
queryWrapper.between("supervision_temp_line_debug.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime())));
}
queryWrapper.orderByDesc("supervision_temp_line_debug.Update_Time");
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper);
}
@@ -271,9 +273,11 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
queryWrapper.eq("supervision_temp_line_debug.status", supervisionTempLineDebugQuery.getStatus());
}
//添加上时间范围
if (Objects.nonNull(supervisionTempLineDebugQuery.getSearchBeginTime()) && Objects.nonNull(supervisionTempLineDebugQuery.getSearchEndTime())) {
queryWrapper.between("supervision_temp_line_debug.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime())));
}
queryWrapper.orderByDesc("supervision_temp_line_debug.Update_Time");
return this.baseMapper.pageHasDebug(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper);
}

View File

@@ -173,9 +173,11 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl<Supervisio
);
}
//添加上时间范围
if (Objects.nonNull(supervisionTempLineReportQuery.getSearchBeginTime()) && Objects.nonNull(supervisionTempLineReportQuery.getSearchEndTime())) {
queryWrapper.between("supervision_temp_line_report.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchEndTime())));
}
queryWrapper.orderByDesc("supervision_temp_line_report.Update_Time");
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionTempLineReportQuery), PageFactory.getPageSize(supervisionTempLineReportQuery)), queryWrapper);
}

View File

@@ -130,11 +130,13 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
public Page<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(warningLeafletQueryParam)) {
if (Objects.nonNull(warningLeafletQueryParam.getSearchBeginTime()) && Objects.nonNull(warningLeafletQueryParam.getSearchEndTime())) {
//添加上时间范围
warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchEndTime())));
}
}
//筛选负责单位
if (StrUtil.isNotBlank(warningLeafletQueryParam.getDeptIndex())) {
@@ -336,11 +338,13 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
public Page<WarningLeafletVO> alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(warningLeafletQueryParam)) {
if (Objects.nonNull(warningLeafletQueryParam.getSearchBeginTime()) && Objects.nonNull(warningLeafletQueryParam.getSearchEndTime())) {
//添加上时间范围
warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchEndTime())));
}
}
warningLeafletVOQueryWrapper
.and(w -> w.in("supervision_warning_leaflet.status", Arrays.asList(BpmTaskStatusEnum.RUNNING.getStatus(),
BpmTaskStatusEnum.APPROVE.getStatus(),

View File

@@ -81,9 +81,11 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
QueryWrapper<SurveyPlanVO> surveyPlanVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(surveyPlanQueryParam)) {
//添加上时间范围
if (Objects.nonNull(surveyPlanQueryParam.getSearchBeginTime()) && Objects.nonNull(surveyPlanQueryParam.getSearchEndTime())) {
surveyPlanVOQueryWrapper.and(x -> x.between("supervision_survey_plan.plan_start_time",
DateUtil.beginOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchEndTime()))).or().isNull("supervision_survey_plan.plan_start_time"));
}
//根据工程名称模糊搜索
if (StrUtil.isNotBlank(surveyPlanQueryParam.getSearchValue())) {
surveyPlanVOQueryWrapper.like("supervision_survey_plan.plan_name", surveyPlanQueryParam.getSearchValue());

View File

@@ -90,6 +90,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
QueryWrapper<SurveyTestVO> surveyTestVOQueryWrapper = new QueryWrapper<>();
List<String> deptIds = new ArrayList<>();
if (Objects.nonNull(surveyTestQueryParam)) {
if (Objects.nonNull(surveyTestQueryParam.getSearchBeginTime()) && Objects.nonNull(surveyTestQueryParam.getSearchEndTime())) {
//添加上时间范围
surveyTestVOQueryWrapper.and(wrapper ->
wrapper.between("supervision_survey_plan.plan_start_time",
@@ -106,7 +107,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
DateUtil.endOfDay(DateUtil.parse(surveyTestQueryParam.getSearchEndTime())))
)
);
}
//根据工程名称模糊搜索
if (Objects.nonNull(surveyTestQueryParam.getSearchValue())) {
LambdaQueryWrapper<SurveyPlan> surveyPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();

View File

@@ -1,7 +1,9 @@
package com.njcn.system.timer.tasks;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.csdevice.api.WlRecordFeignClient;
import com.njcn.supervision.api.CheckDeviceFeignClient;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@@ -17,6 +19,9 @@ public class CheckDeviceTaskRunner implements TimerTaskRunner {
@Override
public void action(String date) {
if(StrUtil.isBlank(date)){
date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
}
wlRecordFeignClient.dayDealNoEndTimeEvent(date);
}
}

View File

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

View File

@@ -296,7 +296,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
}
//运维管理员展示管理员和App用户
else if (Objects.equals(UserType.ADMINISTRATOR, type) && roleCodeList.contains("operation_manager")) {
types.addAll(Arrays.asList(UserType.ADMINISTRATOR, UserType.APP));
types.addAll(Arrays.asList(UserType.ADMINISTRATOR, UserType.USER, UserType.APP));
}
if (ObjectUtil.isNotNull(queryParam)) {
//查询参数不为空,进行条件填充