feat(alarm): 添加告警统计功能并优化设备管理
- 在AlarmVO中新增interruptCounts和warnCounts字段用于统计通信中断和终端告警次数 - 在CsAlarmServiceImpl中实现告警次数统计逻辑,解析告警事件数据并计算各类告警数量 - 重构CsEventUserPOServiceImpl中的查询逻辑,优化暂态事件详细信息查询接口 - 在CsEquipmentDeliveryServiceImpl中集成事件查询功能,实时获取设备告警状态 - 优化数据库查询语句,改进事件查询的排序和过滤逻辑
This commit is contained in:
@@ -66,6 +66,9 @@ public class ProjectEquipmentVO {
|
|||||||
@ApiModelProperty(value = "设备类型(监测设备:DEV_CLD 治理设备:Direct_Connected_Device)")
|
@ApiModelProperty(value = "设备类型(监测设备:DEV_CLD 治理设备:Direct_Connected_Device)")
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否存在告警(告警通过查询当日的未读的暂态事件判断)")
|
||||||
|
private Boolean isAlarm;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点集合")
|
@ApiModelProperty(value = "监测点集合")
|
||||||
private List<CsLinePO> lineList;
|
private List<CsLinePO> lineList;
|
||||||
|
|
||||||
|
|||||||
@@ -315,126 +315,6 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public DevCountVO devCount(String id,String time) {
|
|
||||||
// QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
|
||||||
//
|
|
||||||
// DevCountVO devCountVO = new DevCountVO();
|
|
||||||
//
|
|
||||||
// String userRole = RequestUtil.getUserRole();
|
|
||||||
// List<String> strings = JSONArray.parseArray(userRole, String.class);
|
|
||||||
// if(CollectionUtils.isEmpty(strings)){
|
|
||||||
// throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// userRole=strings.get(0);
|
|
||||||
//
|
|
||||||
// List<String> device = roleEngineerDevService.getDevice();
|
|
||||||
// if(CollectionUtils.isEmpty(device)){
|
|
||||||
// devCountVO.setOnLineDevCount(0);
|
|
||||||
// devCountVO.setOnLineDevs(new ArrayList<>());
|
|
||||||
// devCountVO.setOffLineDevCount(0);
|
|
||||||
// devCountVO.setOffLineDevs(new ArrayList<>());
|
|
||||||
// }else {
|
|
||||||
// queryWrapper.clear();
|
|
||||||
// queryWrapper.in("id",device);
|
|
||||||
//
|
|
||||||
// List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
|
||||||
// List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
|
||||||
// List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
|
||||||
// devCountVO.setOnLineDevCount(collect2.size());
|
|
||||||
// devCountVO.setOnLineDevs(collect2);
|
|
||||||
// devCountVO.setOffLineDevCount(collect.size());
|
|
||||||
// devCountVO.setOffLineDevs(collect);
|
|
||||||
// List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
|
||||||
// devCountVO.setEningerCount(roleengineer.size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree(null);
|
|
||||||
// //由于多加了一程便携式设备
|
|
||||||
// List<String> collect1 = deviceTree.stream()
|
|
||||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
|
||||||
// .filter(temp -> temp.getId().equals(id))
|
|
||||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
|
||||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
|
||||||
// .map(CsLedgerVO::getId).collect(Collectors.toList());
|
|
||||||
// //求交集
|
|
||||||
// device.retainAll(collect1);
|
|
||||||
// if(CollectionUtils.isEmpty(device)){
|
|
||||||
// devCountVO.setCurrentOnLineDevCount(0);
|
|
||||||
// devCountVO.setCurrentOnLineDevs(new ArrayList<>());
|
|
||||||
// devCountVO.setCurrentOffLineDevCount(0);
|
|
||||||
// devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
|
||||||
// devCountVO.setCurrentProjectCount(0);
|
|
||||||
//
|
|
||||||
// }else {
|
|
||||||
// queryWrapper.clear();
|
|
||||||
// queryWrapper.in("id",device);
|
|
||||||
//
|
|
||||||
// List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
|
||||||
// List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
|
||||||
// List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
|
||||||
// devCountVO.setCurrentOnLineDevCount(collect2.size());
|
|
||||||
// devCountVO.setCurrentOnLineDevs(collect2);
|
|
||||||
// devCountVO.setCurrentOffLineDevCount(collect.size());
|
|
||||||
// devCountVO.setCurrentOffLineDevs(collect);
|
|
||||||
// List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
|
||||||
// devCountVO.setCurrentProjectCount(list.size());
|
|
||||||
// }
|
|
||||||
// CsEventUserQueryParam csEventUserQueryParam = new CsEventUserQueryParam();
|
|
||||||
// csEventUserQueryParam.setStatus("0");
|
|
||||||
//
|
|
||||||
// //查询暂态事件、运行事件还是使用之前的方法
|
|
||||||
// List<EventDetailVO> data = eventUserFeignClient.queryEventList(csEventUserQueryParam).getData();
|
|
||||||
// //查询稳态事件 先获取监测点id
|
|
||||||
// csLinePOService.getLinesByDevList(device);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //查询运行告警事件
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// List<EventDetailVO> event = data.stream().filter(temp -> temp.getType() == 0).collect(Collectors.toList());
|
|
||||||
// List<EventDetailVO> harmonic = data.stream().filter(temp -> temp.getType() == 1).collect(Collectors.toList());
|
|
||||||
// List<EventDetailVO> alarm = data.stream().filter(temp -> temp.getType() == 3).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// if(Objects.equals(userRole, AppRoleEnum.APP_VIP_USER.getCode())){
|
|
||||||
// alarm = alarm.stream().filter(temp -> Objects.equals("3", temp.getLevel())).collect(Collectors.toList());
|
|
||||||
// }
|
|
||||||
// List<EventDetailVO> run = data.stream().filter(temp -> temp.getType() == 2).collect(Collectors.toList());
|
|
||||||
// if(Objects.equals(userRole,AppRoleEnum.APP_VIP_USER.getCode())||Objects.equals(userRole,AppRoleEnum.TOURIST.getCode())
|
|
||||||
// ||Objects.equals(userRole,AppRoleEnum.MARKET_USER.getCode())){
|
|
||||||
// devCountVO.setFeedBackCount(0);
|
|
||||||
//
|
|
||||||
// }else {
|
|
||||||
// CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
|
|
||||||
// csFeedbackQueryParm.setPageNum(1);
|
|
||||||
// csFeedbackQueryParm.setPageSize(100000);
|
|
||||||
// csFeedbackQueryParm.setStatus("1");
|
|
||||||
// Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
|
|
||||||
// List<CsFeedbackVO> collect = data1.getRecords().stream().filter(temp -> !Objects.equals(temp.getUserId(), RequestUtil.getUserIndex())).collect(Collectors.toList());
|
|
||||||
// devCountVO.setFeedBackCount(collect.size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //todo 后续添加警告数,事件数
|
|
||||||
// devCountVO.setEventCount(event.size());
|
|
||||||
// devCountVO.setAlarmCount(alarm.size());
|
|
||||||
// devCountVO.setRunCount(run.size());
|
|
||||||
// devCountVO.setHarmonicCount(harmonic.size());
|
|
||||||
// List<EventDetailVO> curEvent = event.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
|
||||||
// List<EventDetailVO> curHarmonic = harmonic.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
|
||||||
// List<EventDetailVO> curAlarm = alarm.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
|
||||||
// List<EventDetailVO> curRun = run.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// devCountVO.setCurrentEventCount(curEvent.size());
|
|
||||||
// devCountVO.setCurrentAlarmCount(curAlarm.size());
|
|
||||||
// devCountVO.setCurrentRunCount(curRun.size());
|
|
||||||
// devCountVO.setCurrentHarmonicCount(curHarmonic.size());
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// return devCountVO;
|
|
||||||
// }
|
|
||||||
/**
|
/**
|
||||||
* @Description: 判断当前用户是否是主用户 0-否1-是
|
* @Description: 判断当前用户是否是主用户 0-否1-是
|
||||||
* @Param:
|
* @Param:
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ import com.njcn.csdevice.service.*;
|
|||||||
import com.njcn.csdevice.util.QRCodeUtil;
|
import com.njcn.csdevice.util.QRCodeUtil;
|
||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
import com.njcn.csdevice.utils.StringUtil;
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
|
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||||
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
@@ -68,6 +71,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -109,6 +113,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final ICsCommunicateService csCommunicateService;
|
private final ICsCommunicateService csCommunicateService;
|
||||||
private final ICsUserPinsService csUserPinsService;
|
private final ICsUserPinsService csUserPinsService;
|
||||||
private final EngineeringFeignClient engineeringFeignClient;
|
private final EngineeringFeignClient engineeringFeignClient;
|
||||||
|
private final EventUserFeignClient eventUserFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -248,7 +253,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
||||||
//根据设备id获取监测点id集合
|
//根据设备id获取监测点id集合
|
||||||
List<CsLinePO> lineIds = csLinePOService.getLineByDev(device);
|
List<CsLinePO> lineIds = csLinePOService.getLineByDev(device);
|
||||||
|
//根据设备获取当日是否存在未读取的暂态事件
|
||||||
|
CsEventUserQueryParam param = new CsEventUserQueryParam();
|
||||||
|
param.setUserId(RequestUtil.getUserIndex());
|
||||||
|
param.setStartTime(LocalDate.now().atStartOfDay().format(DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
param.setEndTime(LocalDateTime.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
param.setEventIds(lineIds.stream().map(CsLinePO::getLineId).collect(Collectors.toList()));
|
||||||
|
List<CsEventPO> eventList = eventUserFeignClient.queryTempEventDetail(param).getData();
|
||||||
|
Map<String, List<CsEventPO>> eventMap = Optional.ofNullable(eventList)
|
||||||
|
.orElse(Collections.emptyList())
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
||||||
|
|
||||||
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
||||||
list.getRecords().forEach(temp->{
|
list.getRecords().forEach(temp->{
|
||||||
@@ -260,6 +275,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (!Objects.equals(DicDataEnum.PORTABLE.getCode(),temp.getDevType())) {
|
if (!Objects.equals(DicDataEnum.PORTABLE.getCode(),temp.getDevType())) {
|
||||||
recordList.add(temp);
|
recordList.add(temp);
|
||||||
}
|
}
|
||||||
|
//判断设备是否存在告警
|
||||||
|
temp.setIsAlarm(CollectionUtil.isNotEmpty(eventMap.get(temp.getEquipmentId())));
|
||||||
});
|
});
|
||||||
|
|
||||||
//获取用户置顶的设备
|
//获取用户置顶的设备
|
||||||
@@ -816,11 +833,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
||||||
boolean result;
|
boolean result;
|
||||||
//设备名称可以重复
|
|
||||||
//CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
|
||||||
//if(Objects.nonNull (one)){
|
|
||||||
// throw new BusinessException ("设备名称不能重复");
|
|
||||||
//}
|
|
||||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (param.getNdid());
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (param.getNdid());
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.csharmonic.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csharmonic.api.fallback.CsHarmonicPlanFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/csHarmonicPlan", fallbackFactory = CsHarmonicPlanFeignClientFallbackFactory.class,contextId = "csHarmonicPlan")
|
||||||
|
public interface CsHarmonicPlanFeignClient {
|
||||||
|
|
||||||
|
@GetMapping("/getById")
|
||||||
|
@ApiOperation("根据ID查询稳态指标方案")
|
||||||
|
HttpResult<CsHarmonicPlan> getById(@RequestParam("id") String id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csharmonic.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csharmonic.api.fallback.CsHarmonicPlanLineFeignClientFallbackFactory;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/csHarmonicPlanLine", fallbackFactory = CsHarmonicPlanLineFeignClientFallbackFactory.class,contextId = "csHarmonicPlanLine")
|
||||||
|
public interface CsHarmonicPlanLineFeignClient {
|
||||||
|
|
||||||
|
@GetMapping("/getPlanIdByLineId")
|
||||||
|
@ApiOperation("根据监测点ID查询方案ID")
|
||||||
|
HttpResult<String> getPlanIdByLineId(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
package com.njcn.csharmonic.api;
|
package com.njcn.csharmonic.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
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.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -33,6 +39,10 @@ public interface EventUserFeignClient {
|
|||||||
@ApiOperation("查询暂态事件(未读)")
|
@ApiOperation("查询暂态事件(未读)")
|
||||||
HttpResult<List<String>> queryTempEvent(@RequestBody CsEventUserQueryParam param);
|
HttpResult<List<String>> queryTempEvent(@RequestBody CsEventUserQueryParam param);
|
||||||
|
|
||||||
|
@PostMapping("/queryTempEventDetail")
|
||||||
|
@ApiOperation("查询暂态事件详细信息(未读)")
|
||||||
|
HttpResult<List<CsEventPO>> queryTempEventDetail(@RequestBody CsEventUserQueryParam param);
|
||||||
|
|
||||||
@PostMapping("/queryTempHarmonic")
|
@PostMapping("/queryTempHarmonic")
|
||||||
@ApiOperation("查询稳态事件(未读)")
|
@ApiOperation("查询稳态事件(未读)")
|
||||||
HttpResult<List<String>> queryTempHarmonic(@RequestBody CsEventUserQueryParam param);
|
HttpResult<List<String>> queryTempHarmonic(@RequestBody CsEventUserQueryParam param);
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.csharmonic.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.csharmonic.api.CsHarmonicFeignClient;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonic;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsHarmonicPlanFeignClientFallbackFactory implements FallbackFactory<CsHarmonicPlanFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsHarmonicPlanFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsHarmonicPlanFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsHarmonicPlan> getById(String id) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据ID查询稳态指标方案异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.csharmonic.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.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsHarmonicPlanLineFeignClientFallbackFactory implements FallbackFactory<CsHarmonicPlanLineFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsHarmonicPlanLineFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsHarmonicPlanLineFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> getPlanIdByLineId(String lineId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据监测点ID查询方案ID异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
@@ -52,6 +53,12 @@ public class EventUserFeignClientFallbackFactory implements FallbackFactory<Even
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsEventPO>> queryTempEventDetail(CsEventUserQueryParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询暂态事件详细信息(未读)异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<String>> queryTempHarmonic(CsEventUserQueryParam param) {
|
public HttpResult<List<String>> queryTempHarmonic(CsEventUserQueryParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询稳态事件(未读)异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询稳态事件(未读)异常",cause.toString());
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.csharmonic.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态指标方案与测点关系参数类
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsHarmonicPlanLineParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方案ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "方案ID")
|
||||||
|
@NotBlank(message = "方案ID不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点ID集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "监测点ID集合")
|
||||||
|
@NotEmpty(message = "监测点ID集合不能为空")
|
||||||
|
private List<String> lineIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.csharmonic.param;
|
||||||
|
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态指标方案参数类
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsHarmonicPlanParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态方案名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "稳态方案名称")
|
||||||
|
@NotBlank(message = "稳态方案名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态指标集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "稳态指标集合")
|
||||||
|
private String harmonicTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "监测点id集合")
|
||||||
|
private List<String> lineList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class UpdateCsHarmonicPlanParam extends CsHarmonicPlanParam {
|
||||||
|
@ApiModelProperty("ID")
|
||||||
|
@NotBlank(message = "ID不能为空")
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询参数类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class QueryParam extends BaseParam {
|
||||||
|
@ApiModelProperty(value = "稳态方案名称")
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("cs_harmonic_plan")
|
||||||
|
public class CsHarmonicPlan extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态方案名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 稳态指标集合
|
||||||
|
*/
|
||||||
|
private String harmonicTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点ID集合(非数据库字段)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> lineList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("cs_harmonic_plan_line")
|
||||||
|
public class CsHarmonicPlanLine implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,12 @@ public class AlarmVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "告警设备台数")
|
@ApiModelProperty(value = "告警设备台数")
|
||||||
private Integer warnNums;
|
private Integer warnNums;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "通讯中断告警次数")
|
||||||
|
private Integer interruptCounts;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "终端告警次数")
|
||||||
|
private Integer warnCounts;
|
||||||
|
|
||||||
@ApiModelProperty(value = "告警设备id集合")
|
@ApiModelProperty(value = "告警设备id集合")
|
||||||
private List<String> devIds;
|
private List<String> devIds;
|
||||||
|
|
||||||
@@ -42,6 +48,9 @@ public class AlarmVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "设备名称")
|
@ApiModelProperty(value = "设备名称")
|
||||||
private String devName;
|
private String devName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备类型")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "告警次数")
|
@ApiModelProperty(value = "告警次数")
|
||||||
private Integer warnCounts = 0;
|
private Integer warnCounts = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import lombok.Data;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +46,8 @@ public class EventDetailVO {
|
|||||||
*/
|
*/
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备类型")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备名称")
|
@ApiModelProperty(value = "设备名称")
|
||||||
private String equipmentName;
|
private String equipmentName;
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
import com.njcn.csharmonic.service.ICsHarmonicPlanService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
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 2026-04-15
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/csHarmonicPlan")
|
||||||
|
@Api(tags = "稳态指标方案")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CsHarmonicPlanController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsHarmonicPlanService csHarmonicPlanService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增稳态指标方案(包含监测点关联)
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/save")
|
||||||
|
@ApiOperation("新增稳态指标方案")
|
||||||
|
public HttpResult<Boolean> save(@RequestBody @Validated CsHarmonicPlanParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("save");
|
||||||
|
csHarmonicPlanService.save(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改稳态指标方案(包含监测点关联)
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperation("修改稳态指标方案")
|
||||||
|
public HttpResult<Boolean> update(@RequestBody @Validated CsHarmonicPlanParam.UpdateCsHarmonicPlanParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("update");
|
||||||
|
csHarmonicPlanService.update(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除稳态指标方案(同时删除监测点关联)
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation("删除稳态指标方案")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "ID集合")
|
||||||
|
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
|
csHarmonicPlanService.deleteWithLines(ids);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询稳态指标方案(包含监测点列表)
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getById")
|
||||||
|
@ApiOperation("根据ID查询稳态指标方案")
|
||||||
|
@ApiImplicitParam(name = "id", value = "ID", required = true)
|
||||||
|
public HttpResult<CsHarmonicPlan> getById(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
|
CsHarmonicPlan plan = csHarmonicPlanService.getByIdWithLines(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, plan, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询稳态指标方案
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getPage")
|
||||||
|
@ApiOperation("分页查询稳态指标方案")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<CsHarmonicPlan>> getPage(@RequestBody CsHarmonicPlanParam.QueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getPage");
|
||||||
|
Page<CsHarmonicPlan> page = csHarmonicPlanService.getPage(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有稳态指标方案
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("查询所有稳态指标方案")
|
||||||
|
public HttpResult<List<CsHarmonicPlan>> list() {
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
List<CsHarmonicPlan> list = csHarmonicPlanService.listAllOrderBySort();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlanLine;
|
||||||
|
import com.njcn.csharmonic.service.ICsHarmonicPlanLineService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
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 2026-04-15
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/csHarmonicPlanLine")
|
||||||
|
@Api(tags = "稳态指标方案与测点关系")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CsHarmonicPlanLineController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsHarmonicPlanLineService csHarmonicPlanLineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据方案ID查询关联的监测点
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getByPlanId")
|
||||||
|
@ApiOperation("根据方案ID查询关联的监测点")
|
||||||
|
@ApiImplicitParam(name = "id", value = "方案ID", required = true)
|
||||||
|
public HttpResult<List<CsHarmonicPlanLine>> getByPlanId(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getByPlanId");
|
||||||
|
List<CsHarmonicPlanLine> list = csHarmonicPlanLineService.getByPlanId(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增方案与监测点关联
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/savePlanLines")
|
||||||
|
@ApiOperation("新增方案与监测点关联")
|
||||||
|
public HttpResult<Boolean> savePlanLines(@RequestBody @Validated CsHarmonicPlanLineParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("savePlanLines");
|
||||||
|
csHarmonicPlanLineService.savePlanLines(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点ID集合删除关联
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
|
@PostMapping("/deleteByLineIds")
|
||||||
|
@ApiOperation("根据监测点ID集合删除关联")
|
||||||
|
@ApiImplicitParam(name = "lineIds", value = "监测点ID集合")
|
||||||
|
public HttpResult<Boolean> deleteByLineIds(@RequestBody List<String> lineIds) {
|
||||||
|
String methodDescribe = getMethodDescribe("deleteByLineIds");
|
||||||
|
csHarmonicPlanLineService.deleteByLineIds(lineIds);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点ID查询方案ID
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getPlanIdByLineId")
|
||||||
|
@ApiOperation("根据监测点ID查询方案ID")
|
||||||
|
@ApiImplicitParam(name = "lineId", value = "监测点ID", required = true)
|
||||||
|
public HttpResult<String> getPlanIdByLineId(@RequestParam("lineId") String lineId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getPlanIdByLineId");
|
||||||
|
String planId = csHarmonicPlanLineService.getPlanIdByLineId(lineId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, planId, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -135,6 +135,16 @@ public class EventUserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryTempEventDetail")
|
||||||
|
@ApiOperation("查询暂态事件详细信息(未读)")
|
||||||
|
@ApiImplicitParam(name = "param", value = "暂降事件查询参数", required = true)
|
||||||
|
public HttpResult<List<CsEventPO>> queryTempEventDetail(@RequestBody CsEventUserQueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("queryTempEventDetail");
|
||||||
|
List<CsEventPO> result = csEventUserPOMapper.queryTempEventDetail(param.getUserId(), param.getStartTime(), param.getEndTime(), param.getEventIds());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryTempHarmonic")
|
@PostMapping("/queryTempHarmonic")
|
||||||
@ApiOperation("查询稳态事件(未读)")
|
@ApiOperation("查询稳态事件(未读)")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.dto.UnReadEventDto;
|
import com.njcn.csharmonic.pojo.dto.UnReadEventDto;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
||||||
@@ -40,6 +41,9 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
|
|||||||
//查询暂态事件(未读)
|
//查询暂态事件(未读)
|
||||||
List<String> queryTempEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
List<String> queryTempEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
//查询暂态事件详细信息(未读)
|
||||||
|
List<CsEventPO> queryTempEventDetail(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||||
|
|
||||||
//查询稳态事件(未读)
|
//查询稳态事件(未读)
|
||||||
List<String> queryTempHarmonic(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
List<String> queryTempHarmonic(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.csharmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlanLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
public interface CsHarmonicPlanLineMapper extends BaseMapper<CsHarmonicPlanLine> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.csharmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
public interface CsHarmonicPlanMapper extends BaseMapper<CsHarmonicPlan> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -150,10 +150,35 @@
|
|||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
|
|
||||||
<select id="queryEventpage" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
<select id="queryEventpage" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
||||||
select DISTINCT b.id,b.device_id deviceId,b.line_id lineId,b.code code,b.start_time startTime,b.amplitude,b.persist_time,
|
SELECT DISTINCT b.id,
|
||||||
round(b.amplitude,2) evtParamVVaDepth,round(b.persist_time,2) evtParamTm,b.phase evtParamPhase,b.location evtParamPosition,
|
b.device_id deviceId,
|
||||||
b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,d.name lineName
|
b.line_id lineId,
|
||||||
from cs_event b inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did where 1=1
|
b.CODE CODE,
|
||||||
|
b.start_time startTime,
|
||||||
|
b.amplitude,
|
||||||
|
b.persist_time,
|
||||||
|
round(b.amplitude, 2) evtParamVVaDepth,
|
||||||
|
round(b.persist_time, 2) evtParamTm,
|
||||||
|
b.phase evtParamPhase,
|
||||||
|
b.location evtParamPosition,
|
||||||
|
b.tag tag,
|
||||||
|
b.wave_path wavePath,
|
||||||
|
b.instant_pics,
|
||||||
|
b.rms_pics,
|
||||||
|
b.type type,
|
||||||
|
b.LEVEL LEVEL,
|
||||||
|
b.location location,
|
||||||
|
c.dev_type devType
|
||||||
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||||
|
,d.NAME lineName
|
||||||
|
</if>
|
||||||
|
from
|
||||||
|
cs_event b
|
||||||
|
inner join cs_equipment_delivery c on b.device_id=c.id
|
||||||
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||||
|
inner join cs_line d on d.device_id=b.device_id
|
||||||
|
</if>
|
||||||
|
where 1=1
|
||||||
and b.process=c.process
|
and b.process=c.process
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||||
@@ -174,8 +199,11 @@
|
|||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.lineId != null and csEventUserQueryPage.lineId !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.lineId != null and csEventUserQueryPage.lineId !=''">
|
||||||
AND b.line_id = #{csEventUserQueryPage.lineId}
|
AND b.line_id = #{csEventUserQueryPage.lineId}
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != ''">
|
||||||
AND b.type =#{ csEventUserQueryPage.type}
|
AND b.type = #{csEventUserQueryPage.type}
|
||||||
|
<if test="csEventUserQueryPage.type == '0'">
|
||||||
|
AND d.clDid = b.cl_did
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||||
AND b.level IN
|
AND b.level IN
|
||||||
@@ -183,22 +211,27 @@
|
|||||||
#{level}
|
#{level}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.sortField != null">
|
<choose>
|
||||||
<choose>
|
<when test="csEventUserQueryPage!=null and csEventUserQueryPage.sortField != null">
|
||||||
<when test="csEventUserQueryPage.sortField == 0">
|
<choose>
|
||||||
order by b.start_time desc
|
<when test="csEventUserQueryPage.sortField == 0">
|
||||||
</when>
|
order by b.start_time desc
|
||||||
<when test="csEventUserQueryPage.sortField == 1">
|
</when>
|
||||||
order by b.amplitude desc
|
<when test="csEventUserQueryPage.sortField == 1">
|
||||||
</when>
|
order by b.amplitude desc
|
||||||
<when test="csEventUserQueryPage.sortField == 2">
|
</when>
|
||||||
order by b.persist_time desc
|
<when test="csEventUserQueryPage.sortField == 2">
|
||||||
</when>
|
order by b.persist_time desc
|
||||||
<otherwise>
|
</when>
|
||||||
order by b.start_time desc
|
<otherwise>
|
||||||
</otherwise>
|
order by b.start_time desc
|
||||||
</choose>
|
</otherwise>
|
||||||
</if>
|
</choose>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
order by b.start_time desc
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -268,6 +301,24 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryTempEventDetail" resultType="com.njcn.csharmonic.pojo.po.CsEventPO">
|
||||||
|
SELECT
|
||||||
|
t2.*
|
||||||
|
FROM
|
||||||
|
cs_event_user t1 right join cs_event t2 on t1.event_id = t2.id
|
||||||
|
WHERE
|
||||||
|
t1.user_id = #{userId}
|
||||||
|
and t1.`status`= 0
|
||||||
|
and t2.type = 0
|
||||||
|
<if test="ids != null and ids.size > 0">
|
||||||
|
and t2.line_id in
|
||||||
|
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
and t2.start_time between #{startTime} and #{endTime}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="queryAlarmEvent" resultType="java.lang.String">
|
<select id="queryAlarmEvent" resultType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
t1.event_id
|
t1.event_id
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?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.csharmonic.mapper.CsHarmonicPlanLineMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?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.csharmonic.mapper.CsHarmonicPlanMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlanLine;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
public interface ICsHarmonicPlanLineService extends IService<CsHarmonicPlanLine> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据方案ID查询关联的监测点
|
||||||
|
*
|
||||||
|
* @param id 方案ID
|
||||||
|
* @return 关联列表
|
||||||
|
*/
|
||||||
|
List<CsHarmonicPlanLine> getByPlanId(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增方案与监测点关联
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
*/
|
||||||
|
void savePlanLines(CsHarmonicPlanLineParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点ID集合删除关联
|
||||||
|
*
|
||||||
|
* @param lineIds 监测点ID集合
|
||||||
|
*/
|
||||||
|
void deleteByLineIds(List<String> lineIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点ID查询方案ID
|
||||||
|
*
|
||||||
|
* @param lineId 监测点ID
|
||||||
|
* @return 方案ID
|
||||||
|
*/
|
||||||
|
String getPlanIdByLineId(String lineId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
public interface ICsHarmonicPlanService extends IService<CsHarmonicPlan> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增稳态指标方案(包含监测点关联)
|
||||||
|
*
|
||||||
|
* @param param 稳态指标方案参数
|
||||||
|
*/
|
||||||
|
void save(CsHarmonicPlanParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改稳态指标方案(包含监测点关联)
|
||||||
|
*
|
||||||
|
* @param param 稳态指标方案参数
|
||||||
|
*/
|
||||||
|
void update(CsHarmonicPlanParam.UpdateCsHarmonicPlanParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除稳态指标方案(同时删除监测点关联)
|
||||||
|
*
|
||||||
|
* @param ids 方案ID集合
|
||||||
|
*/
|
||||||
|
void deleteWithLines(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询稳态指标方案
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
Page<CsHarmonicPlan> getPage(CsHarmonicPlanParam.QueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有稳态指标方案(按sort降序)
|
||||||
|
*
|
||||||
|
* @return 稳态指标方案列表
|
||||||
|
*/
|
||||||
|
List<CsHarmonicPlan> listAllOrderBySort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据方案ID查询详情(包含监测点列表)
|
||||||
|
*
|
||||||
|
* @param id 方案ID
|
||||||
|
* @return 方案详情
|
||||||
|
*/
|
||||||
|
CsHarmonicPlan getByIdWithLines(String id);
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
@@ -23,8 +25,10 @@ import com.njcn.csharmonic.pojo.vo.AlarmVO;
|
|||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||||
import com.njcn.csharmonic.service.ICsAlarmService;
|
import com.njcn.csharmonic.service.ICsAlarmService;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -53,6 +57,8 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
private final CsEventPOService csEventPOService;
|
private final CsEventPOService csEventPOService;
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AlarmVO> queryAlarmList(LineParamDTO param) {
|
public Page<AlarmVO> queryAlarmList(LineParamDTO param) {
|
||||||
@@ -93,7 +99,6 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
List<CsAlarm> list = csAlarmPage.getRecords();
|
List<CsAlarm> list = csAlarmPage.getRecords();
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
//获取用户推送事件
|
|
||||||
List<CsEventUserPO> userEvents = csEventUserPOService.queryEventListByUserId(RequestUtil.getUserIndex(), list.stream().map(CsAlarm::getId).collect(Collectors.toList()));
|
List<CsEventUserPO> userEvents = csEventUserPOService.queryEventListByUserId(RequestUtil.getUserIndex(), list.stream().map(CsAlarm::getId).collect(Collectors.toList()));
|
||||||
|
|
||||||
List<String> finalDevList = devList;
|
List<String> finalDevList = devList;
|
||||||
@@ -112,6 +117,29 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
alarmVO.setWarnNums(matchedDevIds.size());
|
alarmVO.setWarnNums(matchedDevIds.size());
|
||||||
alarmVO.setDevIds(matchedDevIds);
|
alarmVO.setDevIds(matchedDevIds);
|
||||||
alarmVO.setIsRead(userEvents.stream().filter(item1->item1.getEventId().equals(alarm.getId())).findFirst().map(CsEventUserPO::getStatus).orElse(1));
|
alarmVO.setIsRead(userEvents.stream().filter(item1->item1.getEventId().equals(alarm.getId())).findFirst().map(CsEventUserPO::getStatus).orElse(1));
|
||||||
|
|
||||||
|
int interruptCounts = 0;
|
||||||
|
int warnCounts = 0;
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
List<List<String>> resultList;
|
||||||
|
List<List<String>> resultList2;
|
||||||
|
try {
|
||||||
|
resultList = objectMapper.readValue(alarm.getInterruptEvent(), new TypeReference<List<List<String>>>() {});
|
||||||
|
resultList2 = objectMapper.readValue(alarm.getAlarmEvent(), new TypeReference<List<List<String>>>() {});
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String matchedDevId : matchedDevIds) {
|
||||||
|
for (int j = 0; j < devIds.length; j++) {
|
||||||
|
if (Objects.equals(matchedDevId, devIds[j])) {
|
||||||
|
interruptCounts = interruptCounts + (Objects.isNull(resultList.get(j)) ? 0 : resultList.get(j).get(0).split(",").length);
|
||||||
|
warnCounts = warnCounts + (Objects.isNull(resultList2.get(j)) ? 0 : resultList2.get(j).size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alarmVO.setInterruptCounts(interruptCounts);
|
||||||
|
alarmVO.setWarnCounts(warnCounts);
|
||||||
return alarmVO;
|
return alarmVO;
|
||||||
})
|
})
|
||||||
.filter(alarmVO -> alarmVO.getWarnNums() > 0)
|
.filter(alarmVO -> alarmVO.getWarnNums() > 0)
|
||||||
@@ -119,6 +147,35 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
page1.setRecords(result);
|
page1.setRecords(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
// //获取用户推送事件
|
||||||
|
// List<CsEventUserPO> userEvents = csEventUserPOService.queryEventListByUserId(RequestUtil.getUserIndex(), list.stream().map(CsAlarm::getId).collect(Collectors.toList()));
|
||||||
|
//
|
||||||
|
// List<String> finalDevList = devList;
|
||||||
|
// List<AlarmVO> result = list.stream()
|
||||||
|
// .map(alarm -> {
|
||||||
|
// AlarmVO alarmVO = new AlarmVO();
|
||||||
|
// alarmVO.setEventId(alarm.getId());
|
||||||
|
// alarmVO.setDate(alarm.getTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||||
|
//
|
||||||
|
// String devListStr = alarm.getDevList();
|
||||||
|
// String[] devIds = devListStr.split(",");
|
||||||
|
// List<String> matchedDevIds = Arrays.stream(devIds)
|
||||||
|
// .filter(devId -> StrUtil.isNotBlank(devId.trim()))
|
||||||
|
// .filter(finalDevList::contains)
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// alarmVO.setWarnNums(matchedDevIds.size());
|
||||||
|
// alarmVO.setDevIds(matchedDevIds);
|
||||||
|
// alarmVO.setIsRead(userEvents.stream().filter(item1->item1.getEventId().equals(alarm.getId())).findFirst().map(CsEventUserPO::getStatus).orElse(1));
|
||||||
|
// return alarmVO;
|
||||||
|
// })
|
||||||
|
// .filter(alarmVO -> alarmVO.getWarnNums() > 0)
|
||||||
|
// .sorted((a1, a2) -> a2.getDate().compareTo(a1.getDate()))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// page1.setRecords(result);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return page1;
|
return page1;
|
||||||
@@ -148,6 +205,10 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsAlarmMapper, CsAlarm> impl
|
|||||||
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
alarmDetail.setEngineeringName(ledgerMap.get(csLedgerVO.getPids().split(",")[1]).getName());
|
||||||
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
alarmDetail.setProjectName(ledgerMap.get(csLedgerVO.getPids().split(",")[2]).getName());
|
||||||
alarmDetail.setDevName(csLedgerVO.getName());
|
alarmDetail.setDevName(csLedgerVO.getName());
|
||||||
|
//添加设备类型
|
||||||
|
CsEquipmentDeliveryDTO dto = equipmentFeignClient.queryDeviceById(Collections.singletonList(csLedgerVO.getId())).getData().get(0);
|
||||||
|
SysDicTreePO po = dictTreeFeignClient.queryById(dto.getDevType()).getData();
|
||||||
|
alarmDetail.setDevType(Objects.isNull(po)?null:po.getCode());
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(alarm.getInterruptEvent())) {
|
if (ObjectUtil.isNotNull(alarm.getInterruptEvent())) {
|
||||||
String interruptEvent = alarm.getInterruptEvent();
|
String interruptEvent = alarm.getInterruptEvent();
|
||||||
|
|||||||
@@ -32,10 +32,12 @@ import com.njcn.csharmonic.service.CsEventUserPOService;
|
|||||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||||
import com.njcn.influx.service.EvtDataService;
|
import com.njcn.influx.service.EvtDataService;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.po.EleEvtParm;
|
import com.njcn.system.pojo.po.EleEvtParm;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -61,6 +63,7 @@ import java.util.stream.Collectors;
|
|||||||
public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, CsEventUserPO> implements CsEventUserPOService{
|
public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, CsEventUserPO> implements CsEventUserPOService{
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
private final EvtDataService evtDataService;
|
private final EvtDataService evtDataService;
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
@@ -354,6 +357,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
temp.setProjectName(devDetail.getProjectName());
|
temp.setProjectName(devDetail.getProjectName());
|
||||||
temp.setEngineeringid(devDetail.getEngineeringid());
|
temp.setEngineeringid(devDetail.getEngineeringid());
|
||||||
temp.setEngineeringName(devDetail.getEngineeringName());
|
temp.setEngineeringName(devDetail.getEngineeringName());
|
||||||
|
//设备类型
|
||||||
|
SysDicTreePO po = dictTreeFeignClient.queryById(temp.getDevType()).getData();
|
||||||
|
temp.setDevType(Objects.isNull(po)?null:po.getCode());
|
||||||
//监测位置
|
//监测位置
|
||||||
temp.setEvtParamPosition(Objects.equals(temp.getLocation(), "grid") ? "电网侧" : "负载侧");
|
temp.setEvtParamPosition(Objects.equals(temp.getLocation(), "grid") ? "电网侧" : "负载侧");
|
||||||
//暂态事件类型
|
//暂态事件类型
|
||||||
@@ -367,218 +373,6 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage) {
|
|
||||||
// Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
|
|
||||||
//
|
|
||||||
// csEventUserQueryPage.setUserId(RequestUtil.getUserIndex());
|
|
||||||
// String role = RequestUtil.getUserRole();
|
|
||||||
// if(Objects.equals(role, LogInfo.UNKNOWN_ROLE)){
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
// List<String> strings = JSONArray.parseArray(role, String.class);
|
|
||||||
// if(CollectionUtils.isEmpty(strings)){
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
// role=strings.get(0);
|
|
||||||
// if( Objects.equals(role, AppRoleEnum.APP_VIP_USER.getCode())&&Objects.equals(csEventUserQueryPage.getType(),"3")){
|
|
||||||
// csEventUserQueryPage.setLevel("3");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<CsLedgerVO> data = csLedgerFeignClient.lineTree().getData();
|
|
||||||
// if (CollectionUtils.isEmpty(data)) {
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 获取第一层节点(根节点),从第二层开始才是真正的工程
|
|
||||||
// List<CsLedgerVO> firstLevelNodes = new ArrayList<>();
|
|
||||||
// for (CsLedgerVO rootNode : data) {
|
|
||||||
// List<CsLedgerVO> children = rootNode.getChildren();
|
|
||||||
// if (CollectionUtil.isNotEmpty(children)) {
|
|
||||||
// firstLevelNodes.addAll(children);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (CollectionUtils.isEmpty(firstLevelNodes)) {
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 缓存查询条件到局部变量
|
|
||||||
// String engineeringId = csEventUserQueryPage.getEngineeringid();
|
|
||||||
// String projectId = csEventUserQueryPage.getProjectId();
|
|
||||||
// String deviceId = csEventUserQueryPage.getDeviceId();
|
|
||||||
// String lineId = csEventUserQueryPage.getLineId();
|
|
||||||
//
|
|
||||||
// // 从第二层开始遍历:工程 -> 项目 -> 设备 -> 监测点
|
|
||||||
// List<String> collect = new ArrayList<>();
|
|
||||||
// for (CsLedgerVO engineering : firstLevelNodes) {
|
|
||||||
// // 过滤工程
|
|
||||||
// if (StringUtil.isNotBlank(engineeringId)
|
|
||||||
// && !Objects.equals(engineering.getId(), engineeringId)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<CsLedgerVO> projects = engineering.getChildren();
|
|
||||||
// if (CollectionUtils.isEmpty(projects)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (CsLedgerVO project : projects) {
|
|
||||||
// // 过滤项目
|
|
||||||
// if (StringUtil.isNotBlank(projectId)
|
|
||||||
// && !Objects.equals(project.getId(), projectId)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<CsLedgerVO> devices = project.getChildren();
|
|
||||||
// if (CollectionUtils.isEmpty(devices)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (CsLedgerVO device : devices) {
|
|
||||||
// // 过滤设备
|
|
||||||
// if (StringUtil.isNotBlank(deviceId)
|
|
||||||
// && !Objects.equals(device.getId(), deviceId)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 如果传了监测点 ID,需要进一步过滤
|
|
||||||
// if (StringUtil.isNotBlank(lineId)) {
|
|
||||||
// List<CsLedgerVO> lines = device.getChildren();
|
|
||||||
// if (CollectionUtil.isNotEmpty(lines)) {
|
|
||||||
// boolean hasLine = lines.stream()
|
|
||||||
// .anyMatch(line -> Objects.equals(line.getId(), lineId));
|
|
||||||
// if (hasLine) {
|
|
||||||
// collect.add(device.getId());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 没有传监测点 ID,直接添加设备 ID
|
|
||||||
// collect.add(device.getId());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (CollectionUtils.isEmpty(collect)) {
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
// //如果是游客用户,没有消息推送的数据,展示设备的所有数据
|
|
||||||
// if(strings.contains(AppRoleEnum.TOURIST.getCode())){
|
|
||||||
// returnpage = this.getBaseMapper().queryTouristEvent(returnpage, csEventUserQueryPage, collect, false);
|
|
||||||
// } else {
|
|
||||||
// returnpage = this.getBaseMapper().queryEventpage(returnpage, csEventUserQueryPage, collect, true);
|
|
||||||
// }
|
|
||||||
// // 先获取原始记录
|
|
||||||
// List<EventDetailVO> originalRecords = returnpage.getRecords();
|
|
||||||
// if (CollectionUtil.isNotEmpty(originalRecords)) {
|
|
||||||
// // 过滤出满足 lineId 条件的记录
|
|
||||||
// List<EventDetailVO> filteredRecords = new ArrayList<>();
|
|
||||||
// for (EventDetailVO temp : originalRecords) {
|
|
||||||
// // 如果没有传 lineId 或者 lineId 匹配,则处理该记录
|
|
||||||
// if (StringUtil.isBlank(csEventUserQueryPage.getLineId())
|
|
||||||
// || Objects.equals(temp.getLineId(), csEventUserQueryPage.getLineId())) {
|
|
||||||
//
|
|
||||||
// DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
|
||||||
// temp.setEquipmentName(devDetail.getEquipmentName());
|
|
||||||
// temp.setProjectId(devDetail.getProjectId());
|
|
||||||
// temp.setProjectName(devDetail.getProjectName());
|
|
||||||
// temp.setEngineeringid(devDetail.getEngineeringid());
|
|
||||||
// temp.setEngineeringName(devDetail.getEngineeringName());
|
|
||||||
//
|
|
||||||
// EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
|
||||||
// temp.setShowName(Objects.isNull(ele) ? temp.getTag() : ele.getShowName());
|
|
||||||
// temp.setCode(Objects.isNull(ele) ? null : ele.getDefaultValue());
|
|
||||||
//
|
|
||||||
// if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
|
||||||
// List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
|
||||||
// List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
|
||||||
// for (EleEvtParm eleEvtParm : data1) {
|
|
||||||
// EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
|
||||||
// BeanUtils.copyProperties(eleEvtParm, eventDataSetDTO);
|
|
||||||
// if (Objects.equals(eventDataSetDTO.getName(), "Evt_Param_Position")) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
|
||||||
// if (evtData == null) {
|
|
||||||
// eventDataSetDTO.setValue("-");
|
|
||||||
// } else {
|
|
||||||
// if (Objects.equals(eleEvtParm.getName(), "Evt_Param_VVaDepth") || Objects.equals(eleEvtParm.getName(), "Evt_Param_Tm")) {
|
|
||||||
// BigDecimal bd = new BigDecimal(evtData.getValue());
|
|
||||||
// bd = bd.setScale(2, RoundingMode.HALF_UP);
|
|
||||||
// eventDataSetDTO.setValue(Optional.ofNullable(bd.toString()).orElse("-"));
|
|
||||||
// } else {
|
|
||||||
// eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// eventDataSetDTOS.add(eventDataSetDTO);
|
|
||||||
// }
|
|
||||||
// temp.setDataSet(eventDataSetDTOS);
|
|
||||||
//
|
|
||||||
// List<EventDataSetDTO> evtParamVVaDepth = eventDataSetDTOS.stream()
|
|
||||||
// .filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_VVaDepth"))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// if (CollectionUtil.isEmpty(evtParamVVaDepth)) {
|
|
||||||
// temp.setEvtParamVVaDepth("-");
|
|
||||||
// } else {
|
|
||||||
// if (Objects.equals(evtParamVVaDepth.get(0).getValue(),"-")) {
|
|
||||||
// temp.setEvtParamVVaDepth("-");
|
|
||||||
// } else {
|
|
||||||
// BigDecimal bd = new BigDecimal(evtParamVVaDepth.get(0).getValue());
|
|
||||||
// bd = bd.setScale(2, RoundingMode.HALF_UP);
|
|
||||||
// temp.setEvtParamVVaDepth(bd + (Objects.isNull(evtParamVVaDepth.get(0).getUnit()) ? "" : evtParamVVaDepth.get(0).getUnit()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<EventDataSetDTO> evtParamPosition = eventDataSetDTOS.stream()
|
|
||||||
// .filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Position"))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// if (CollectionUtil.isEmpty(evtParamPosition)) {
|
|
||||||
// temp.setEvtParamPosition("-");
|
|
||||||
// } else {
|
|
||||||
// temp.setEvtParamPosition(evtParamPosition.get(0).getValue());
|
|
||||||
// }
|
|
||||||
// if (Objects.equals(temp.getEvtParamPosition(), "-")) {
|
|
||||||
// if (!Objects.isNull(temp.getLocation())) {
|
|
||||||
// temp.setEvtParamPosition(Objects.equals(temp.getLocation(), "grid") ? "电网侧" : "负载侧");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<EventDataSetDTO> evtParamTm = eventDataSetDTOS.stream()
|
|
||||||
// .filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Tm"))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// if (CollectionUtil.isEmpty(evtParamTm)) {
|
|
||||||
// temp.setEvtParamTm("-");
|
|
||||||
// } else {
|
|
||||||
// if (Objects.equals(evtParamTm.get(0).getValue(),"-")) {
|
|
||||||
// temp.setEvtParamTm("-");
|
|
||||||
// } else {
|
|
||||||
// BigDecimal bd = new BigDecimal(evtParamTm.get(0).getValue());
|
|
||||||
// bd = bd.setScale(2, RoundingMode.HALF_UP);
|
|
||||||
// temp.setEvtParamTm(bd + (Objects.isNull(evtParamTm.get(0).getUnit()) ? "" : evtParamTm.get(0).getUnit()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream()
|
|
||||||
// .filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Phase"))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// if (CollectionUtil.isEmpty(evtParamPhase)) {
|
|
||||||
// temp.setEvtParamPhase("-");
|
|
||||||
// } else {
|
|
||||||
// temp.setEvtParamPhase(evtParamPhase.get(0).getValue()
|
|
||||||
// + (Objects.isNull(evtParamPhase.get(0).getUnit()) ? "" : evtParamPhase.get(0).getUnit()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // 将处理后的记录添加到结果列表
|
|
||||||
// filteredRecords.add(temp);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // 清空原来的记录,加入过滤后的记录
|
|
||||||
// returnpage.setRecords(filteredRecords);
|
|
||||||
// }
|
|
||||||
// return returnpage;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
|
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
|
||||||
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
|
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csharmonic.mapper.CsHarmonicPlanLineMapper;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlanLine;
|
||||||
|
import com.njcn.csharmonic.service.ICsHarmonicPlanLineService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsHarmonicPlanLineServiceImpl extends ServiceImpl<CsHarmonicPlanLineMapper, CsHarmonicPlanLine> implements ICsHarmonicPlanLineService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsHarmonicPlanLine> getByPlanId(String id) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsHarmonicPlanLine::getId, id);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void savePlanLines(CsHarmonicPlanLineParam param) {
|
||||||
|
List<CsHarmonicPlanLine> planLineList = new ArrayList<>();
|
||||||
|
for (String lineId : param.getLineIds()) {
|
||||||
|
CsHarmonicPlanLine planLine = new CsHarmonicPlanLine();
|
||||||
|
planLine.setId(param.getId());
|
||||||
|
planLine.setLineId(lineId);
|
||||||
|
planLineList.add(planLine);
|
||||||
|
}
|
||||||
|
this.saveBatch(planLineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteByLineIds(List<String> lineIds) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(CsHarmonicPlanLine::getLineId, lineIds);
|
||||||
|
this.remove(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPlanIdByLineId(String lineId) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsHarmonicPlanLine::getLineId, lineId)
|
||||||
|
.last("LIMIT 1");
|
||||||
|
CsHarmonicPlanLine planLine = this.getOne(wrapper);
|
||||||
|
return planLine != null ? planLine.getId() : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csharmonic.mapper.CsHarmonicPlanMapper;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlanLine;
|
||||||
|
import com.njcn.csharmonic.service.ICsHarmonicPlanLineService;
|
||||||
|
import com.njcn.csharmonic.service.ICsHarmonicPlanService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2026-04-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsHarmonicPlanServiceImpl extends ServiceImpl<CsHarmonicPlanMapper, CsHarmonicPlan> implements ICsHarmonicPlanService {
|
||||||
|
|
||||||
|
private final ICsHarmonicPlanLineService csHarmonicPlanLineService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void save(CsHarmonicPlanParam param) {
|
||||||
|
CsHarmonicPlan plan = new CsHarmonicPlan();
|
||||||
|
plan.setName(param.getName());
|
||||||
|
plan.setHarmonicTarget(param.getHarmonicTarget());
|
||||||
|
plan.setSort(param.getSort() != null ? param.getSort() : 0);
|
||||||
|
this.save(plan);
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(param.getLineList())) {
|
||||||
|
for (String lineId : param.getLineList()) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsHarmonicPlanLine::getLineId, lineId);
|
||||||
|
csHarmonicPlanLineService.remove(wrapper);
|
||||||
|
|
||||||
|
CsHarmonicPlanLine planLine = new CsHarmonicPlanLine();
|
||||||
|
planLine.setId(plan.getId());
|
||||||
|
planLine.setLineId(lineId);
|
||||||
|
csHarmonicPlanLineService.save(planLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(CsHarmonicPlanParam.UpdateCsHarmonicPlanParam param) {
|
||||||
|
CsHarmonicPlan plan = this.getById(param.getId());
|
||||||
|
if (plan == null) {
|
||||||
|
throw new RuntimeException("稳态指标方案不存在");
|
||||||
|
}
|
||||||
|
plan.setName(param.getName());
|
||||||
|
plan.setHarmonicTarget(param.getHarmonicTarget());
|
||||||
|
plan.setSort(param.getSort() != null ? param.getSort() : plan.getSort());
|
||||||
|
this.updateById(plan);
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(param.getLineList())) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> oldWrapper = new LambdaQueryWrapper<>();
|
||||||
|
oldWrapper.eq(CsHarmonicPlanLine::getId, param.getId());
|
||||||
|
csHarmonicPlanLineService.remove(oldWrapper);
|
||||||
|
|
||||||
|
for (String lineId : param.getLineList()) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsHarmonicPlanLine::getLineId, lineId);
|
||||||
|
csHarmonicPlanLineService.remove(wrapper);
|
||||||
|
|
||||||
|
CsHarmonicPlanLine planLine = new CsHarmonicPlanLine();
|
||||||
|
planLine.setId(param.getId());
|
||||||
|
planLine.setLineId(lineId);
|
||||||
|
csHarmonicPlanLineService.save(planLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteWithLines(List<String> ids) {
|
||||||
|
this.removeByIds(ids);
|
||||||
|
if (CollUtil.isNotEmpty(ids)) {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlanLine> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(CsHarmonicPlanLine::getId, ids);
|
||||||
|
List<CsHarmonicPlanLine> list = csHarmonicPlanLineService.list();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
throw new BusinessException("该方案下存在监测点,重新分配后再尝试删除!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<CsHarmonicPlan> getPage(CsHarmonicPlanParam.QueryParam param) {
|
||||||
|
Page<CsHarmonicPlan> page = new Page<>(param.getPageNum(), param.getPageSize());
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlan> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.like(StrUtil.isNotBlank(param.getName()), CsHarmonicPlan::getName, param.getName())
|
||||||
|
.orderByAsc(CsHarmonicPlan::getSort)
|
||||||
|
.orderByAsc(CsHarmonicPlan::getCreateTime);
|
||||||
|
return this.page(page, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsHarmonicPlan> listAllOrderBySort() {
|
||||||
|
LambdaQueryWrapper<CsHarmonicPlan> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.orderByAsc(CsHarmonicPlan::getSort);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsHarmonicPlan getByIdWithLines(String id) {
|
||||||
|
CsHarmonicPlan plan = this.getById(id);
|
||||||
|
if (plan != null) {
|
||||||
|
List<CsHarmonicPlanLine> planLines = csHarmonicPlanLineService.getByPlanId(id);
|
||||||
|
if (CollUtil.isNotEmpty(planLines)) {
|
||||||
|
List<String> lineIds = planLines.stream()
|
||||||
|
.map(CsHarmonicPlanLine::getLineId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
plan.setLineList(lineIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return plan;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,8 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
private final AppInfoSetFeignClient appInfoSetFeignClient;
|
private final AppInfoSetFeignClient appInfoSetFeignClient;
|
||||||
private final SendMessageUtil sendMessageUtil;
|
private final SendMessageUtil sendMessageUtil;
|
||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
|
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||||
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -629,52 +631,253 @@ public class DataTaskServiceImpl implements IDataTaskService {
|
|||||||
* @return 越限标签
|
* @return 越限标签
|
||||||
*/
|
*/
|
||||||
private String buildOverlimitTag(RStatLimitRateDPO item) {
|
private String buildOverlimitTag(RStatLimitRateDPO item) {
|
||||||
String tag = "";
|
StringBuilder tagBuilder = new StringBuilder();
|
||||||
|
|
||||||
// 基础越限项
|
String planId = csHarmonicPlanLineFeignClient.getPlanIdByLineId(item.getLineId()).getData();
|
||||||
Integer freqDevOvertime = item.getFreqDevOvertime();
|
Set<String> targetSet = null;
|
||||||
if (freqDevOvertime > 0) {
|
|
||||||
tag = tag + "频率偏差越限" + freqDevOvertime + "次,";
|
if (planId != null) {
|
||||||
|
CsHarmonicPlan csHarmonicPlan = csHarmonicPlanFeignClient.getById(planId).getData();
|
||||||
|
if (csHarmonicPlan != null) {
|
||||||
|
String harmonicTarget = csHarmonicPlan.getHarmonicTarget();
|
||||||
|
if (StrUtil.isNotBlank(harmonicTarget)) {
|
||||||
|
targetSet = new HashSet<>(Arrays.asList(harmonicTarget.split(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer voltageDevOvertime = item.getVoltageDevOvertime();
|
if (targetSet != null) {
|
||||||
if (voltageDevOvertime > 0) {
|
Integer freqDevOvertime = item.getFreqDevOvertime();
|
||||||
tag = tag + "电压偏差越限" + voltageDevOvertime + "次,";
|
if (freqDevOvertime != null && freqDevOvertime > 0 && targetSet.contains("频率偏差")) {
|
||||||
|
tagBuilder.append("频率偏差越限").append(freqDevOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer voltageDevOvertime = item.getVoltageDevOvertime();
|
||||||
|
if (voltageDevOvertime != null && voltageDevOvertime > 0 && targetSet.contains("电压偏差")) {
|
||||||
|
tagBuilder.append("电压偏差越限").append(voltageDevOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer ubalanceOvertime = item.getUbalanceOvertime();
|
||||||
|
if (ubalanceOvertime != null && ubalanceOvertime > 0 && targetSet.contains("三相电压不平衡度")) {
|
||||||
|
tagBuilder.append("三相电压不平衡度越限").append(ubalanceOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer flickerOvertime = item.getFlickerOvertime();
|
||||||
|
if (flickerOvertime != null && flickerOvertime > 0 && targetSet.contains("闪变")) {
|
||||||
|
tagBuilder.append("闪变越限").append(flickerOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer uaberranceOvertime = item.getUaberranceOvertime();
|
||||||
|
if (uaberranceOvertime != null && uaberranceOvertime > 0 && targetSet.contains("电压总谐波畸变率")) {
|
||||||
|
tagBuilder.append("电压总谐波畸变率越限").append(uaberranceOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer iNegOvertime = item.getINegOvertime();
|
||||||
|
if (iNegOvertime != null && iNegOvertime > 0 && targetSet.contains("负序电流")) {
|
||||||
|
tagBuilder.append("负序电流越限").append(iNegOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 2; i <= 25; i++) {
|
||||||
|
String fieldName = "uharm" + i + "Overtime";
|
||||||
|
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
if (value != null && value > 0) {
|
||||||
|
String targetName = i + "次谐波电压含有率";
|
||||||
|
if (targetSet.contains(targetName)) {
|
||||||
|
tagBuilder.append(i).append("次谐波电压含有率越限").append(value).append("次,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 2; i <= 25; i++) {
|
||||||
|
String fieldName = "iharm" + i + "Overtime";
|
||||||
|
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
if (value != null && value > 0) {
|
||||||
|
String targetName = i + "次谐波电流有效值";
|
||||||
|
if (targetSet.contains(targetName)) {
|
||||||
|
tagBuilder.append(i).append("次谐波电流有效值越限").append(value).append("次,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 16; i++) {
|
||||||
|
String fieldName = "inuharm" + i + "Overtime";
|
||||||
|
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
if (value != null && value > 0) {
|
||||||
|
double harmonicOrder = i * 1.0 - 0.5;
|
||||||
|
String targetName = harmonicOrder + "次间谐波电压含有率";
|
||||||
|
if (targetSet.contains(targetName)) {
|
||||||
|
tagBuilder.append(harmonicOrder).append("次间谐波电压含有率越限").append(value).append("次,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Integer freqDevOvertime = item.getFreqDevOvertime();
|
||||||
|
if (freqDevOvertime != null && freqDevOvertime > 0) {
|
||||||
|
tagBuilder.append("频率偏差越限").append(freqDevOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer voltageDevOvertime = item.getVoltageDevOvertime();
|
||||||
|
if (voltageDevOvertime != null && voltageDevOvertime > 0) {
|
||||||
|
tagBuilder.append("电压偏差越限").append(voltageDevOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer ubalanceOvertime = item.getUbalanceOvertime();
|
||||||
|
if (ubalanceOvertime != null && ubalanceOvertime > 0) {
|
||||||
|
tagBuilder.append("三相电压不平衡度越限").append(ubalanceOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer flickerOvertime = item.getFlickerOvertime();
|
||||||
|
if (flickerOvertime != null && flickerOvertime > 0) {
|
||||||
|
tagBuilder.append("闪变越限").append(flickerOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer uaberranceOvertime = item.getUaberranceOvertime();
|
||||||
|
if (uaberranceOvertime != null && uaberranceOvertime > 0) {
|
||||||
|
tagBuilder.append("电压总谐波畸变率越限").append(uaberranceOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer iNegOvertime = item.getINegOvertime();
|
||||||
|
if (iNegOvertime != null && iNegOvertime > 0) {
|
||||||
|
tagBuilder.append("负序电流越限").append(iNegOvertime).append("次,");
|
||||||
|
}
|
||||||
|
|
||||||
|
String harmonicVoltageTag = buildHarmonicVoltageTags(item, "");
|
||||||
|
if (StrUtil.isNotBlank(harmonicVoltageTag)) {
|
||||||
|
tagBuilder.append(harmonicVoltageTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
String harmonicCurrentTag = buildHarmonicCurrentTags(item, "");
|
||||||
|
if (StrUtil.isNotBlank(harmonicCurrentTag)) {
|
||||||
|
tagBuilder.append(harmonicCurrentTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
String interharmonicTag = buildInterharmonicVoltageTags(item, "");
|
||||||
|
if (StrUtil.isNotBlank(interharmonicTag)) {
|
||||||
|
tagBuilder.append(interharmonicTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer ubalanceOvertime = item.getUbalanceOvertime();
|
return trimTrailingComma(tagBuilder.toString());
|
||||||
if (ubalanceOvertime > 0) {
|
|
||||||
tag = tag + "三相电压不平衡度越限" + ubalanceOvertime + "次,";
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer flickerOvertime = item.getFlickerOvertime();
|
|
||||||
if (flickerOvertime > 0) {
|
|
||||||
tag = tag + "闪变越限" + flickerOvertime + "次,";
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer uaberranceOvertime = item.getUaberranceOvertime();
|
|
||||||
if (uaberranceOvertime > 0) {
|
|
||||||
tag = tag + "电压总谐波畸变率越限" + uaberranceOvertime + "次,";
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer iNegOvertime = item.getINegOvertime();
|
|
||||||
if (iNegOvertime > 0) {
|
|
||||||
tag = tag + "负序电流越限" + iNegOvertime + "次,";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 谐波电压含有率(2-25 次)
|
|
||||||
tag = buildHarmonicVoltageTags(item, tag);
|
|
||||||
|
|
||||||
// 谐波电流有效值(2-25 次)
|
|
||||||
tag = buildHarmonicCurrentTags(item, tag);
|
|
||||||
|
|
||||||
// 间谐波电压含有率(0.5-15.5 次)
|
|
||||||
tag = buildInterharmonicVoltageTags(item, tag);
|
|
||||||
|
|
||||||
// 去除末尾逗号
|
|
||||||
return trimTrailingComma(tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private String buildOverlimitTag(RStatLimitRateDPO item) {
|
||||||
|
// String tag = "";
|
||||||
|
//
|
||||||
|
// //获取监测点配置的稳态指标,如果没有配置则查询所有指标
|
||||||
|
// String planId = csHarmonicPlanLineFeignClient.getPlanIdByLineId(item.getLineId()).getData();
|
||||||
|
// if (planId != null) {
|
||||||
|
// CsHarmonicPlan csHarmonicPlan = csHarmonicPlanFeignClient.getById(planId).getData();
|
||||||
|
// String harmonicTarget = csHarmonicPlan.getHarmonicTarget();
|
||||||
|
// List<String> targetList = Arrays.asList(harmonicTarget.split(","));
|
||||||
|
//
|
||||||
|
// Integer freqDevOvertime = item.getFreqDevOvertime();
|
||||||
|
// if (freqDevOvertime > 0 && targetList.contains("频率偏差")) {
|
||||||
|
// tag = tag + "频率偏差越限" + freqDevOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer voltageDevOvertime = item.getVoltageDevOvertime();
|
||||||
|
// if (voltageDevOvertime > 0 && targetList.contains("电压偏差")) {
|
||||||
|
// tag = tag + "电压偏差越限" + voltageDevOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer ubalanceOvertime = item.getUbalanceOvertime();
|
||||||
|
// if (ubalanceOvertime > 0 && targetList.contains("三相电压不平衡度")) {
|
||||||
|
// tag = tag + "三相电压不平衡度越限" + ubalanceOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer flickerOvertime = item.getFlickerOvertime();
|
||||||
|
// if (flickerOvertime > 0 && targetList.contains("闪变")) {
|
||||||
|
// tag = tag + "闪变越限" + flickerOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer uaberranceOvertime = item.getUaberranceOvertime();
|
||||||
|
// if (uaberranceOvertime > 0 && targetList.contains("电压总谐波畸变率")) {
|
||||||
|
// tag = tag + "电压总谐波畸变率越限" + uaberranceOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer iNegOvertime = item.getINegOvertime();
|
||||||
|
// if (iNegOvertime > 0 && targetList.contains("负序电流")) {
|
||||||
|
// tag = tag + "负序电流越限" + iNegOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (int i = 2; i <= 25; i++) {
|
||||||
|
// String fieldName = "uharm" + i + "Overtime";
|
||||||
|
// Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
// if (value != null && value > 0) {
|
||||||
|
// String targetName = i + "次谐波电压含有率";
|
||||||
|
// if (targetList.contains(targetName)) {
|
||||||
|
// tag = tag + i + "次谐波电压含有率越限" + value + "次,";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (int i = 2; i <= 25; i++) {
|
||||||
|
// String fieldName = "iharm" + i + "Overtime";
|
||||||
|
// Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
// if (value != null && value > 0) {
|
||||||
|
// String targetName = i + "次谐波电流有效值";
|
||||||
|
// if (targetList.contains(targetName)) {
|
||||||
|
// tag = tag + i + "次谐波电流有效值越限" + value + "次,";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (int i = 1; i <= 16; i++) {
|
||||||
|
// String fieldName = "inuharm" + i + "Overtime";
|
||||||
|
// Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
|
||||||
|
// if (value != null && value > 0) {
|
||||||
|
// double harmonicOrder = i * 1.0 - 0.5;
|
||||||
|
// String targetName = harmonicOrder + "次间谐波电压含有率";
|
||||||
|
// if (targetList.contains(targetName)) {
|
||||||
|
// tag = tag + harmonicOrder + "次间谐波电压含有率越限" + value + "次,";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 基础越限项
|
||||||
|
// Integer freqDevOvertime = item.getFreqDevOvertime();
|
||||||
|
// if (freqDevOvertime > 0) {
|
||||||
|
// tag = tag + "频率偏差越限" + freqDevOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer voltageDevOvertime = item.getVoltageDevOvertime();
|
||||||
|
// if (voltageDevOvertime > 0) {
|
||||||
|
// tag = tag + "电压偏差越限" + voltageDevOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer ubalanceOvertime = item.getUbalanceOvertime();
|
||||||
|
// if (ubalanceOvertime > 0) {
|
||||||
|
// tag = tag + "三相电压不平衡度越限" + ubalanceOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer flickerOvertime = item.getFlickerOvertime();
|
||||||
|
// if (flickerOvertime > 0) {
|
||||||
|
// tag = tag + "闪变越限" + flickerOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer uaberranceOvertime = item.getUaberranceOvertime();
|
||||||
|
// if (uaberranceOvertime > 0) {
|
||||||
|
// tag = tag + "电压总谐波畸变率越限" + uaberranceOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer iNegOvertime = item.getINegOvertime();
|
||||||
|
// if (iNegOvertime > 0) {
|
||||||
|
// tag = tag + "负序电流越限" + iNegOvertime + "次,";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 谐波电压含有率(2-25 次)
|
||||||
|
// tag = buildHarmonicVoltageTags(item, tag);
|
||||||
|
//
|
||||||
|
// // 谐波电流有效值(2-25 次)
|
||||||
|
// tag = buildHarmonicCurrentTags(item, tag);
|
||||||
|
//
|
||||||
|
// // 间谐波电压含有率(0.5-15.5 次)
|
||||||
|
// tag = buildInterharmonicVoltageTags(item, tag);
|
||||||
|
// }
|
||||||
|
// // 去除末尾逗号
|
||||||
|
// return trimTrailingComma(tag);
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量构建谐波电压含有率 tag(2-25 次)
|
* 批量构建谐波电压含有率 tag(2-25 次)
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user