From 0efac9e1a29e765cf28bccc8398423326ba7c169 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 30 Aug 2023 10:23:54 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=B5=81=E7=A8=8Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/InspectOfflineServiceImpl.java | 20 ++--- .../service/impl/OperAccessTaskServiceImpl.java | 4 +- .../alert/controller/AbnormalAlarmController.java | 12 +++ .../alert/service/HistoryAbnormalAlarmService.java | 1 + .../impl/HistoryAbnormalAlarmServiceImpl.java | 86 ++++++++++++++-------- .../scheduled/MaintenanceTaskCreateTask.java | 14 +++- 6 files changed, 92 insertions(+), 45 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java index b90016b..2e73d9a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java @@ -435,7 +435,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { eq(ContentEntity::getTenantId, tenantId); }}); // 返回数据 - return contents.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -452,7 +452,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { eq(ObjectDangerEntity::getTenantId, tenantId); }}); // 返回数据 - return dangers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return dangers.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } @@ -471,7 +471,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { eq(OfflineTaskEntity::getId, taskId); }}); // 返回数据 - return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } @@ -487,7 +487,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { List taskUsers = this.taskUserService.getOfflineTaskUser(taskIds); // 返回数据 - return taskUsers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return taskUsers.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -501,7 +501,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { // 查询巡检任务 List tasks = taskService.getTaskData(taskId,currentDate); // 返回数据 - return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -515,7 +515,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { } List tasks = planService.getPlans(planIds); // 返回数据 - return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } @@ -532,7 +532,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { List events = eventService.list(new LambdaQueryWrapper() {{ in(EventEntity::getTaskId, taskIds); }}); - return events.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return events.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -548,7 +548,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { List eventAttachments = eventAttachmentService.list(new LambdaQueryWrapper() {{ in(EventAttachmentEntity::getEventId, eventIds); }}); - return eventAttachments.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return eventAttachments.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -564,7 +564,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { in(EventRecordEntity::getEventId, eventIds); }}); // 返回数据 - return eventRecords.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return eventRecords.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** @@ -579,7 +579,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { // 查询巡检任务对象 List taskObjects = taskObjectService.getExObjectData(taskIds); // 返回数据 - return taskObjects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return taskObjects.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java index 561085b..b95aca3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java @@ -340,13 +340,13 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl materials) { + public void updateMaterials(Long planId, Long taskId, List materials) { if (CollectionUtils.isEmpty(materials)) { materials = new ArrayList<>(); } //查询已经存在的检修库明细,并删除部分需要删除的 List existsDetails = materialService.list(new LambdaQueryWrapper() {{ - eq(OperAccessMaterialEntity::getPlanId, planId); + eq(Func.isNotEmpty(planId),OperAccessMaterialEntity::getPlanId, planId); eq(OperAccessMaterialEntity::getTaskId, taskId); eq(OperAccessMaterialEntity::getIsDeleted, 0L); }}); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java index 34e318e..7dcd02b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java @@ -131,6 +131,18 @@ public class AbnormalAlarmController extends BladeController { } /** + * + */ + @ApiLog + @ApiOperation(value = "站点") + @ApiOperationSupport(order = 7) + @RequestMapping(value = "/stations", method = {RequestMethod.GET, RequestMethod.POST}) + public R stations(){ + service.stations(); + return R.status(true); + } + + /** * 智能告警数量: 时间范围当天 */ @ApiLog diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java index 8ab23c1..7d41361 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java @@ -38,4 +38,5 @@ public interface HistoryAbnormalAlarmService extends BaseService queryStationName(); + void stations(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 71ba8b5..61854ca 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -35,6 +35,7 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.lang.reflect.Field; @@ -59,6 +60,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); - // 返回数据 AlarmReustVo response = new AlarmReustVo(); - List datas = result.getData().getRecords().stream().map(alarm -> { - AlarmDataVo record = new AlarmDataVo(); - // 继承类属性拷贝 - BeanUtil.copyProperties(alarm, record); - if(CollectionUtil.isEmpty(handles)){ - record.setIsHandle(false); - }else{ - record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); - } - record.setStationCode(alarm.getStation()); - record.setContent(alarm.getSoeExplain()); - record.setType(alarm.getSoeType()); - record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); - List filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); - if (CollectionUtil.isEmpty(filter)) { + if(types.size() > 1){ + response.setCount((int) result.getData().getTotal()); + response.setTotal(result.getData().getTotal()); + response.setSoeList(result.getData().getRecords().stream().map(alarm -> { + AlarmDataVo record = new AlarmDataVo(); + // 继承类属性拷贝 + BeanUtil.copyProperties(alarm, record); + record.setStationCode(alarm.getStation()); + record.setContent(alarm.getSoeExplain()); + record.setType(alarm.getSoeType()); + record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); + record.setStationName((String) redisTemplate.opsForValue().get("alarm:station:" + alarm.getStation())); + record.setServeType("2"); + record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); return record; - } - record.setStationName(filter.get(0).getName()); - record.setServeType(filter.get(0).getServeType()); - record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); - return record; - }).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) - .thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); - - response.setCount((int) (result.getData().getTotal() - handles.size())); - response.setSoeList(datas); - response.setTotal(result.getData().getTotal()); + }).sorted(Comparator.comparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList())); + }else{ + // 查询当天类型处理告警 + List handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); + + List datas = result.getData().getRecords().stream().map(alarm -> { + AlarmDataVo record = new AlarmDataVo(); + // 继承类属性拷贝 + BeanUtil.copyProperties(alarm, record); + if(CollectionUtil.isEmpty(handles)){ + record.setIsHandle(false); + }else{ + record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); + } + record.setStationCode(alarm.getStation()); + record.setContent(alarm.getSoeExplain()); + record.setType(alarm.getSoeType()); + record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); + List filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(filter)) { + return record; + } + record.setStationName(filter.get(0).getName()); + record.setServeType(filter.get(0).getServeType()); + record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); + return record; + }).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) + .thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); + + response.setCount((int) (result.getData().getTotal() - handles.size())); + response.setSoeList(datas); + response.setTotal(result.getData().getTotal()); + } return response; } + /** * 获取处理数据ID集合 * @return @@ -391,6 +412,11 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl stations = stationService.list(); + stations.forEach(item-> redisTemplate.opsForValue().set("alarm:station:" + item.getCode(),item.getName())); + } private Boolean entityIsNull(Object object) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java index 4bf6352..5ffefac 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java @@ -195,9 +195,17 @@ public class MaintenanceTaskCreateTask { Map params = new HashMap() {{ put("taskId", taskEntity.getId()); String userId = taskEntity.getDisposer(); - List userIdList = Stream.of(userId.split(",")).collect(Collectors.toList()); - String taskUsers = userIdList.stream().filter(o -> StringUtils.isNotBlank(o)).map(s -> "taskUser_".concat(s)).collect(Collectors.joining(",")); - put("initUserIds", taskUsers); + String[] userArr = taskEntity.getDisposer().split(","); + for(int index = 0; index < userArr.length ; index++){ + if(index > 4){ + continue; + } + if(index > 0){ + put("initUserIds" + index , "taskUser_".concat(userArr[index])); + }else{ + put("initUserIds", "taskUser_".concat(userArr[index])); + } + } put("operMaintenanceTaskEntityVo",vo); }}; R flowResult = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params);