diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java index a81f12d..f7dffa0 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java +++ b/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.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.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; 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; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; /** * @author ysj @@ -31,4 +33,11 @@ public class AlarmConfigDetailController extends BladeController { public R details(@ApiParam(value = "主键集合", required = true) @RequestParam Long configId) { return R.data(detailService.details(configId)); } + + @PostMapping("/updateBatch") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "批量新增或修改", notes = "传入list") + public R updateBatch(@Valid @RequestBody List entitys) { + return R.status(detailService.updateBatch(entitys)); + } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java index d5b6bbc..dc3548f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java +++ b/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.vo.AlarmConfigSourceVo; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; import java.util.List; @@ -16,5 +17,8 @@ public interface AlarmConfigDetailService extends BaseService details(Long configId); + boolean updateBatch(List entitys); + AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type); + } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java index 8fa344d..1760be1 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java +++ b/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 batchs = new ArrayList<>(); - List sources = DictCache.getList("alarm_source"); - if(CollectionUtil.isEmpty(sources)){ - return false; - } - sources.forEach(source->{ + AlarmConstants.ALARAM_SOURCE.forEach(source->{ // HZ3000告警 - if(AlarmConstants.HZ3000_ALARM.toString().equals(source.getDictValue())){ - AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),type))); + if(AlarmConstants.HZ3000_ALARM.equals(source)){ + AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type))); // 等级告警 - }else if(AlarmConstants.LEVEL_ALARM.toString().equals(source.getDictValue())){ - AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),type))); + }else if(AlarmConstants.LEVEL_ALARM.equals(source)){ + AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type))); // 条件告警 - }else if(AlarmConstants.CONDITION_ALARM.toString().equals(source.getDictValue())){ - batchs.add(this.superposition(entity, Integer.valueOf(source.getDictValue()),AlarmConstants.CONDITION)); + }else if(AlarmConstants.CONDITION_ALARM.equals(source)){ + batchs.add(this.superposition(entity, source,AlarmConstants.CONDITION)); // 智能预警 - }else if(AlarmConstants.EARLY_WARNING.toString().equals(source.getDictValue())){ - batchs.add(this.superposition(entity,Integer.valueOf(source.getDictValue()),AlarmConstants.EARLY)); + }else if(AlarmConstants.EARLY_WARNING.equals(source)){ + batchs.add(this.superposition(entity, source,AlarmConstants.EARLY)); } }); if(CollectionUtil.isEmpty(batchs)){ @@ -115,6 +111,16 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl entitys) { + return super.saveOrUpdateBatch(entitys); + } + /** * 查询告警配置对象 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 4da2a15..83aac67 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/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.toolkit.Wrappers; 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.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; @@ -86,6 +88,8 @@ public class TargetServiceImpl implements TargetService { private final ISysClient sysClient; + private final IEmInfoClient emInfoClient; + private final IPlanGenertionClient planClient; private final ITicketInfoAllClient ticketInfoAllClient; @@ -782,20 +786,20 @@ public class TargetServiceImpl implements TargetService { return page; } // 设备 - List devices = maintenanceService.getEmInfoList(); + List devices = emInfoClient.list(); if(CollectionUtils.isEmpty(devices)){ return page; } // 获取设备集合 - List deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EminfoAndEmParamVo::getCreateDept)).map(device -> { + List deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).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()); - if(faultList.contains(device.getEmCode())){ + if(faultList.contains(device.getNumber())){ deviceClassify.setDeviceStatus(4); - }else if(overhaultList.contains(device.getEmCode())){ + }else if(overhaultList.contains(device.getNumber())){ deviceClassify.setDeviceStatus(0); - }else if(runtList.contains(device.getEmCode())){ + }else if(runtList.contains(device.getNumber())){ deviceClassify.setDeviceStatus(1); }else{ deviceClassify.setDeviceStatus(2); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/RunMonthReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/RunMonthReportController.java index e3ce0e3..bb47407 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/RunMonthReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/RunMonthReportController.java @@ -189,7 +189,7 @@ public class RunMonthReportController extends BladeController { // 文件名外的双引号处理firefox的空格截断问题 try { - response.setContentType("application/octet-stream "); + response.setContentType("application/octet-stream"); response.setHeader("Connection", "close"); // 表示不能用浏览器直接打开 response.setHeader("Accept-Ranges", "bytes");// 告诉客户端允许断点续传多线程连接下载 //response.setContentType("application/*");