Browse Source

#集中监控消息bug解决

zhongwei
yang_shj 1 year ago
parent
commit
610c68605c
  1. 23
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/BusinessQueryVo.java
  2. 35
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/controller/ScheduledController.java
  3. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  4. 26
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  5. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
  6. 25
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java
  7. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java
  8. 101
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

23
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/BusinessQueryVo.java

@ -0,0 +1,23 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class BusinessQueryVo {
@ApiModelProperty("开始时间")
private String startTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("查询机构")
private String deptIds;
@ApiModelProperty("类型: 0-全部 1-完成")
private String type;
}

35
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/controller/ScheduledController.java

@ -0,0 +1,35 @@
package com.hnac.hzims.scheduled.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.scheduled.service.operation.monitor.MonitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/scheduled")
@Api(value = "定时任务", tags = "定时任务")
public class ScheduledController {
private final MonitorService service;
@ApiLog
@ApiOperation("集中监控数据加载")
@GetMapping("/loadMonitoring")
@ApiOperationSupport(order = 1)
public R duty(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) {
service.loadMonitoring("2023-10-19");
return R.status(true);
}
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -672,9 +672,9 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return
*/
public List<ActivePowerVo> getActivePowerVoList(EminfoAndEmParamVo device) {
String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER);
String startTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(startTime,endTime,6,2,device.getEmCode(),HomePageConstant.ACTIVE_POWER);
if(CollectionUtil.isEmpty(datas)){
return new ArrayList<>();
}
@ -697,10 +697,10 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return
*/
private List<UsrPowerVo> getUsrPowerVoList(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-29);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DATE,-29);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();

26
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -309,12 +309,10 @@ public class MonitorServiceImpl implements MonitorService {
RealStationVo station = new RealStationVo();
// 站点编码
station.setStationCode(key);
// 设置站点状态
this.setStationStatus(alarmList,station,key);
// 名称、限制水位、服务类型、机构、排序
this.stationParam(stationEntityList,station,deptAll.getData());
// 根据设备名称分组
Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName));
Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !StringUtil.isEmpty(o.getEmName()) && !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName));
List<RealDeviceVo> deviceList = new ArrayList<>();
// device - 设备,arrbt - 设备重点属性
deviceAttbtMap.forEach((device, attbt) -> {
@ -330,6 +328,8 @@ public class MonitorServiceImpl implements MonitorService {
this.getDeviceParam(devices, deviceClassifyMap, deviceList);
// 运行设备状态设置
this.deviceState(deviceList);
// 设置站点状态
this.setStationStatus(alarmList,station,key,deviceList);
station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList()));
stationList.add(station);
});
@ -394,14 +394,17 @@ public class MonitorServiceImpl implements MonitorService {
// 设备属性列表
List<RealAttributeVo> attbts = device.getAttbtList();
if(CollectionUtil.isEmpty(attbts)){
device.setState(-1);
return;
}
// 功率属性记录
List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(powers)){
device.setState(-1);
return;
}
if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){
device.setState(-1);
return;
}
device.setState(1);
@ -675,8 +678,23 @@ public class MonitorServiceImpl implements MonitorService {
* @param station
* @param key
*/
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) {
private void setStationStatus(List<String> alarmList, RealStationVo station, String key,List<RealDeviceVo> deviceList) {
// 站点功率大于0为正常上送数据
for(RealDeviceVo item : deviceList){
if(!CollectionUtil.isEmpty(item.getAttbtList())){
List<RealAttributeVo> powers = item.getAttbtList().stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(powers)){
for(RealAttributeVo attr : powers){
if(!"-".equals(attr.getValue())){
if(Double.parseDouble(attr.getValue()) > 0){
station.setStatus(0);
return;
}
}
}
}
}
}
if(alarmList.contains(key)){
station.setStatus(1);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

@ -92,11 +92,12 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
if(CollectionUtil.isNotEmpty(history)){
soes = result.getData().getRecords().stream().filter(soe-> !history.stream().map(HistoryAbnormalAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(soe.getId())).collect(Collectors.toList());
}
if(CollectionUtil.isEmpty(soes)){
return;
}
// 遍历告警信息
soes.forEach(item -> {
// 告警内容站点名称包含处理
List<StationEntity> soeStation = stations.stream().filter(o->o.getCode().equals(item.getStation())).collect(Collectors.toList());
if(!AbnormalAlarmConstant.INTERRUPT_LIST.contains(item.getSoeType())){
return;
}

25
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java

@ -6,8 +6,11 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
@ -179,4 +182,26 @@ public class TargetController {
@RequestParam(value = "type") Long type) {
return R.data(service.dutyGroup(Condition.getPage(query),areaName,type));
}
@ApiOperation("日常维护-数据关联")
@PostMapping("/maintenance")
@ApiOperationSupport(order = 15)
public R<IPage<MaintenanceTaskVo>> maintenance(BusinessQueryVo business,Query query) {
return R.data(service.maintenance(Condition.getPage(query),business));
}
@ApiOperation("缺陷-数据关联")
@PostMapping("/phenomenon")
@ApiOperationSupport(order = 17)
public R<IPage<OperPhenomenonVO>> phenomenon(BusinessQueryVo business, Query query) {
return R.data(service.phenomenon(Condition.getPage(query),business));
}
@ApiOperation("检修任务-数据关联")
@PostMapping("/access")
@ApiOperationSupport(order = 17)
public R<IPage<OperAccessTaskVO>> access(BusinessQueryVo business,Query query) {
return R.data(service.access(Condition.getPage(query),business));
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java

@ -2,10 +2,16 @@ package com.hnac.hzims.operational.census.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -59,4 +65,10 @@ public interface TargetService {
// 集团工作牌/操作票
IPage<DutyGroupVo> dutyGroup(IPage<DutyGroupVo> page,String areaName, Long type);
IPage<MaintenanceTaskVo> maintenance(IPage<OperMaintenanceTaskEntity> page, BusinessQueryVo business);
IPage<OperPhenomenonVO> phenomenon(IPage<OperPhenomenonEntity> page, BusinessQueryVo business);
IPage<OperAccessTaskVO> access(IPage<OperAccessTaskEntity> page, BusinessQueryVo business);
}

101
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.census.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -10,13 +11,19 @@ import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessTaskWrapper;
import com.hnac.hzims.operational.census.constants.CensusConstant;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.census.vo.WaterTargetVo;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.defect.service.impl.OperPhenomenonServiceImpl;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.defect.wrapper.OperPhenomenonWrapper;
import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
@ -24,22 +31,22 @@ import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.maintenance.wrapper.OperMaintenanceTaskWrapper;
import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.*;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
@ -800,7 +807,7 @@ public class TargetServiceImpl implements TargetService {
return page;
}
// 获取设备集合
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EmInfoEntity::getCreateDept)).map(device -> {
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept()) && "1".equals(device.getHomePageDisplay())).sorted(Comparator.comparing(EmInfoEntity::getCreateDept)).map(device -> {
DeviceClassifyVo deviceClassify = new DeviceClassifyVo();
deviceClassify.setStationName(stations.stream().filter(o-> o.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList()).get(0).getName());
deviceClassify.setDeviceName(device.getName());
@ -1090,4 +1097,88 @@ public class TargetServiceImpl implements TargetService {
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
return DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
}
/**
* 日常维护-数据关联
* @param page
* @param business
* @return
*/
@Override
public IPage<MaintenanceTaskVo> maintenance(IPage<OperMaintenanceTaskEntity> page, BusinessQueryVo business) {
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
orderByDesc(OperMaintenanceTaskEntity::getDisposeTime);
if (!StringUtil.isEmpty(business.getStartTime())) {
ge(OperMaintenanceTaskEntity::getDisposeTime,business.getStartTime());
}
if (!StringUtil.isEmpty(business.getEndTime())) {
le(OperMaintenanceTaskEntity::getDisposeTime,business.getEndTime());
}
if(!StringUtil.isEmpty(business.getType()) && "1".equals(business.getType())){
eq(OperMaintenanceTaskEntity::getFlowTaskName,"结束");
}
if(!StringUtil.isEmpty(business.getDeptIds())){
in(OperMaintenanceTaskEntity::getCreateDept, Func.toLongList(business.getDeptIds(),","));
}
}};
IPage pages = maintenanceTaskService.page(page,queryWrapper);
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords()));
return pages;
}
/**
* 现象任务-数据关联
* @param page
* @param business
* @return
*/
@Override
public IPage<OperPhenomenonVO> phenomenon(IPage<OperPhenomenonEntity> page, BusinessQueryVo business) {
Wrapper<OperPhenomenonEntity> queryWrapper = new LambdaQueryWrapper<OperPhenomenonEntity>() {{
orderByDesc(OperPhenomenonEntity::getCreateTime);
if (!StringUtil.isEmpty(business.getStartTime())) {
ge(OperPhenomenonEntity::getCreateTime,business.getStartTime());
}
if (!StringUtil.isEmpty(business.getEndTime())) {
le(OperPhenomenonEntity::getCreateTime,business.getEndTime());
}
if(!StringUtil.isEmpty(business.getType()) && "1".equals(business.getType())){
isNotNull(OperPhenomenonEntity::getHandleTaskId);
}
if(!StringUtil.isEmpty(business.getDeptIds())){
in(OperPhenomenonEntity::getCreateDept, Func.toLongList(business.getDeptIds(),","));
}
}};
IPage pages = phenomenonService.page(page, queryWrapper);
pages.setRecords(OperPhenomenonWrapper.build().listVO(pages.getRecords()));
return pages;
}
/**
* 检修任务-数据关联
* @param page
* @param business
* @return
*/
@Override
public IPage<OperAccessTaskVO> access(IPage<OperAccessTaskEntity> page, BusinessQueryVo business) {
Wrapper<OperAccessTaskEntity> queryWrapper = new LambdaQueryWrapper<OperAccessTaskEntity>() {{
orderByDesc(OperAccessTaskEntity::getPlanStartTime);
if (!StringUtil.isEmpty(business.getStartTime())) {
ge(OperAccessTaskEntity::getPlanStartTime,business.getStartTime());
}
if (!StringUtil.isEmpty(business.getEndTime())) {
le(OperAccessTaskEntity::getPlanStartTime,business.getEndTime());
}
if(!StringUtil.isEmpty(business.getType()) && "1".equals(business.getType())){
eq(OperAccessTaskEntity::getStatus,4);
}
if(!StringUtil.isEmpty(business.getDeptIds())){
in(OperAccessTaskEntity::getCreateDept, Func.toLongList(business.getDeptIds(),","));
}
}};
IPage pages = accessTaskService.page(page, queryWrapper);
pages.setRecords(OperAccessTaskWrapper.build().listVOExtras(pages.getRecords()));
return pages;
}
}

Loading…
Cancel
Save