Browse Source

#告警代码修改

zhongwei
yang_shj 1 year ago
parent
commit
a96e73a2b6
  1. 17
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java
  2. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java
  3. 32
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java
  4. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

17
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java

@ -2,16 +2,18 @@ package com.hnac.hzims.alarm.config.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService; import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService;
import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import javax.validation.Valid;
import org.springframework.web.bind.annotation.RestController; import java.util.List;
/** /**
* @author ysj * @author ysj
@ -31,4 +33,11 @@ public class AlarmConfigDetailController extends BladeController {
public R details(@ApiParam(value = "主键集合", required = true) @RequestParam Long configId) { public R details(@ApiParam(value = "主键集合", required = true) @RequestParam Long configId) {
return R.data(detailService.details(configId)); return R.data(detailService.details(configId));
} }
@PostMapping("/updateBatch")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "批量新增或修改", notes = "传入list")
public R updateBatch(@Valid @RequestBody List<AlarmConfigDetailEntity> entitys) {
return R.status(detailService.updateBatch(entitys));
}
} }

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java

@ -4,6 +4,7 @@ import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity; import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.vo.AlarmConfigSourceVo; import com.hnac.hzims.alarm.vo.AlarmConfigSourceVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import java.util.List; import java.util.List;
@ -16,5 +17,8 @@ public interface AlarmConfigDetailService extends BaseService<AlarmConfigDetailE
List<AlarmConfigSourceVo> details(Long configId); List<AlarmConfigSourceVo> details(Long configId);
boolean updateBatch(List<AlarmConfigDetailEntity> entitys);
AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type); AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type);
} }

32
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java

@ -38,23 +38,19 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDet
@Override @Override
public boolean defaults(AlarmConfigEntity entity) { public boolean defaults(AlarmConfigEntity entity) {
List<AlarmConfigDetailEntity> batchs = new ArrayList<>(); List<AlarmConfigDetailEntity> batchs = new ArrayList<>();
List<Dict> sources = DictCache.getList("alarm_source"); AlarmConstants.ALARAM_SOURCE.forEach(source->{
if(CollectionUtil.isEmpty(sources)){
return false;
}
sources.forEach(source->{
// HZ3000告警 // HZ3000告警
if(AlarmConstants.HZ3000_ALARM.toString().equals(source.getDictValue())){ if(AlarmConstants.HZ3000_ALARM.equals(source)){
AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),type))); AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type)));
// 等级告警 // 等级告警
}else if(AlarmConstants.LEVEL_ALARM.toString().equals(source.getDictValue())){ }else if(AlarmConstants.LEVEL_ALARM.equals(source)){
AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),type))); AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type)));
// 条件告警 // 条件告警
}else if(AlarmConstants.CONDITION_ALARM.toString().equals(source.getDictValue())){ }else if(AlarmConstants.CONDITION_ALARM.equals(source)){
batchs.add(this.superposition(entity, Integer.valueOf(source.getDictValue()),AlarmConstants.CONDITION)); batchs.add(this.superposition(entity, source,AlarmConstants.CONDITION));
// 智能预警 // 智能预警
}else if(AlarmConstants.EARLY_WARNING.toString().equals(source.getDictValue())){ }else if(AlarmConstants.EARLY_WARNING.equals(source)){
batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),AlarmConstants.EARLY)); batchs.add(this.superposition(entity, source,AlarmConstants.EARLY));
} }
}); });
if(CollectionUtil.isEmpty(batchs)){ if(CollectionUtil.isEmpty(batchs)){
@ -115,6 +111,16 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDet
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 批量修改
* @param entitys
* @return
*/
@Override
public boolean updateBatch(List<AlarmConfigDetailEntity> entitys) {
return super.saveOrUpdateBatch(entitys);
}
/** /**
* 查询告警配置对象 * 查询告警配置对象

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

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
@ -86,6 +88,8 @@ public class TargetServiceImpl implements TargetService {
private final ISysClient sysClient; private final ISysClient sysClient;
private final IEmInfoClient emInfoClient;
private final IPlanGenertionClient planClient; private final IPlanGenertionClient planClient;
private final ITicketInfoAllClient ticketInfoAllClient; private final ITicketInfoAllClient ticketInfoAllClient;
@ -782,20 +786,20 @@ public class TargetServiceImpl implements TargetService {
return page; return page;
} }
// 设备 // 设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList(); List<EmInfoEntity> devices = emInfoClient.list();
if(CollectionUtils.isEmpty(devices)){ if(CollectionUtils.isEmpty(devices)){
return page; return page;
} }
// 获取设备集合 // 获取设备集合
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EminfoAndEmParamVo::getCreateDept)).map(device -> { List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EmInfoEntity::getCreateDept)).map(device -> {
DeviceClassifyVo deviceClassify = new DeviceClassifyVo(); DeviceClassifyVo deviceClassify = new DeviceClassifyVo();
deviceClassify.setStationName(stations.stream().filter(o-> o.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList()).get(0).getName()); deviceClassify.setStationName(stations.stream().filter(o-> o.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList()).get(0).getName());
deviceClassify.setDeviceName(device.getName()); deviceClassify.setDeviceName(device.getName());
if(faultList.contains(device.getEmCode())){ if(faultList.contains(device.getNumber())){
deviceClassify.setDeviceStatus(4); deviceClassify.setDeviceStatus(4);
}else if(overhaultList.contains(device.getEmCode())){ }else if(overhaultList.contains(device.getNumber())){
deviceClassify.setDeviceStatus(0); deviceClassify.setDeviceStatus(0);
}else if(runtList.contains(device.getEmCode())){ }else if(runtList.contains(device.getNumber())){
deviceClassify.setDeviceStatus(1); deviceClassify.setDeviceStatus(1);
}else{ }else{
deviceClassify.setDeviceStatus(2); deviceClassify.setDeviceStatus(2);

Loading…
Cancel
Save