From 81c2c110bb8b36995fd6e75da394a7d2bd238ef2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 18 Apr 2024 09:21:25 +0800 Subject: [PATCH] =?UTF-8?q?#=E7=A6=BB=E7=BA=BF=E5=B7=A1=E6=A3=80&=E6=A3=80?= =?UTF-8?q?=E4=BF=AE=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/InspectOfflineServiceImpl.java | 92 +++++++++++----------- .../access/mapper/OperAccessStatisticsMapper.xml | 2 +- 2 files changed, 46 insertions(+), 48 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 052dd15..378ce44 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 @@ -132,8 +132,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { @Value(value = "${hzims.inspect.offline.upload.path}") public String upload_path; - public List fileList; - /** * 下载离线文件 */ @@ -326,7 +324,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param download */ private void tableDateMethod(Long taskId,List tableNames, String download) { - fileList = new ArrayList<>(); + List fileList = new ArrayList<>(); // 获取用户信息 BladeUser user = AuthUtil.getUser(); if(ObjectUtil.isEmpty(user)){ @@ -345,48 +343,48 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { } List taskIds = taskUsers.stream().map(TaskUserEntity::getTaskId).collect(Collectors.toList()); // 巡检任务 - List tasks = this.taskData(taskIds,currentDate); + List tasks = this.taskData(taskIds,currentDate,fileList); if(CollectionUtil.isEmpty(tasks)){ throw new ServiceException("巡检任务数据不存在!"); } // 巡检任务用户 - List users = this.taskUserData(tasks.stream().map(TaskOfflineVO::getId).collect(Collectors.toList())); + List users = this.taskUserData(tasks.stream().map(TaskOfflineVO::getId).collect(Collectors.toList()),fileList); fileJson.add(JsonUtil.toJson(users)); fileJson.add(JsonUtil.toJson(tasks)); taskIds = tasks.stream().map(BaseEntity::getId).collect(Collectors.toList()); // 巡检计划 - List plans = this.getPlans(tasks.stream().map(TaskOfflineVO::getPlanId).collect(Collectors.toList())); + List plans = this.getPlans(tasks.stream().map(TaskOfflineVO::getPlanId).collect(Collectors.toList()),fileList); fileJson.add(JsonUtil.toJson(plans)); // 巡检事件 - List events = this.eventData(taskIds); + List events = this.eventData(taskIds,fileList); fileJson.add(JsonUtil.toJson(events)); List eventIds = events.stream().map(EventEntity::getId).collect(Collectors.toList()); // 巡检情况事件附件 - List eventAttachments = this.attachmentData(eventIds); + List eventAttachments = this.attachmentData(eventIds,fileList); fileJson.add(JsonUtil.toJson(eventAttachments)); // 巡检情况 - List eventRecords = this.eventRecordData(eventIds); + List eventRecords = this.eventRecordData(eventIds,fileList); fileJson.add(JsonUtil.toJson(eventRecords)); // 巡检任务对象 - List taskObjects = this.exObjectData(taskIds); + List taskObjects = this.exObjectData(taskIds,fileList); fileJson.add(JsonUtil.toJson(taskObjects)); // 巡检任务项目 - List taskObjectProjects = this.objectProjectData(taskIds); + List taskObjectProjects = this.objectProjectData(taskIds,fileList); fileJson.add(JsonUtil.toJson(taskObjectProjects)); // 巡检任务内容 - List taskContents = this.objectProjectContentData(taskIds); + List taskContents = this.objectProjectContentData(taskIds,fileList); fileJson.add(JsonUtil.toJson(taskContents)); // 巡检对象 - List objects = this.reDbjectData(user.getTenantId()); + List objects = this.reDbjectData(user.getTenantId(),fileList); fileJson.add(JsonUtil.toJson(objects)); // 巡检项目 - List projects = this.projectData(user.getTenantId()); + List projects = this.projectData(user.getTenantId(),fileList); fileJson.add(JsonUtil.toJson(projects)); // 巡检内容 - List contents = this.contentData(user.getTenantId()); + List contents = this.contentData(user.getTenantId(),fileList); fileJson.add(JsonUtil.toJson(contents)); // 危险点 - List dangers = this.dangerData(user.getTenantId()); + List dangers = this.dangerData(user.getTenantId(),fileList); fileJson.add(JsonUtil.toJson(dangers)); // 危险源数据 List sources = dangerSourceClient.listByTenantId(user.getTenantId()); @@ -398,9 +396,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { List faults = faultClient.listByTenantId(user.getTenantId()); fileJson.add(JsonUtil.toJson(faults)); // 离线任务任务 - List offlines = this.tasksData(taskId); + List offlines = this.tasksData(taskId,fileList); fileJson.add(JsonUtil.toJson(offlines)); - if(fileJson.size() <= 0){ + if(fileJson.isEmpty()){ return; } // 文件写入 @@ -421,7 +419,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param tenantId * @return */ - private List contentData(String tenantId) { + private List contentData(String tenantId,List fileList) { if(StringUtil.isBlank(tenantId)){ return new ArrayList<>(); } @@ -430,7 +428,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -438,7 +436,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param tenantId * @return */ - private List dangerData(String tenantId) { + private List dangerData(String tenantId,List fileList) { if(StringUtil.isBlank(tenantId)){ return new ArrayList<>(); } @@ -447,7 +445,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } @@ -457,7 +455,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param taskId * @return */ - private List tasksData(Long taskId) { + private List tasksData(Long taskId,List fileList) { if(ObjectUtil.isEmpty(taskId)){ return new ArrayList<>(); } @@ -466,7 +464,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } @@ -474,7 +472,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * 巡检任务用户表数据 * @return */ - private List taskUserData(List taskIds) { + private List taskUserData(List taskIds,List fileList) { if(CollectionUtil.isEmpty(taskIds)){ return new ArrayList<>(); } @@ -482,21 +480,21 @@ 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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** * 巡检任务 * @return */ - private List taskData(List taskId,String currentDate) { + private List taskData(List taskId,String currentDate,List fileList) { if(CollectionUtil.isEmpty(taskId)){ return new ArrayList<>(); } // 查询巡检任务 List tasks = taskService.getTaskData(taskId,currentDate); // 返回数据 - return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return tasks.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -504,13 +502,13 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param planIds * @return */ - private List getPlans(List planIds) { + private List getPlans(List planIds,List fileList) { if(CollectionUtil.isEmpty(planIds)){ return new ArrayList<>(); } List tasks = planService.getPlans(planIds); // 返回数据 - return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return tasks.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } @@ -519,7 +517,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param taskIds * @return */ - private List eventData(List taskIds) { + private List eventData(List taskIds,List fileList) { if(CollectionUtil.isEmpty(taskIds)){ return new ArrayList<>(); } @@ -527,7 +525,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -535,7 +533,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param eventIds * @return */ - private List attachmentData(List eventIds) { + private List attachmentData(List eventIds,List fileList) { if(CollectionUtil.isEmpty(eventIds)){ return new ArrayList<>(); } @@ -543,7 +541,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -551,7 +549,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param eventIds * @return */ - private List eventRecordData(List eventIds) { + private List eventRecordData(List eventIds,List fileList) { if(CollectionUtil.isEmpty(eventIds)){ return new ArrayList<>(); } @@ -559,7 +557,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(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -567,14 +565,14 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param taskIds * @return */ - private List exObjectData(List taskIds) { + private List exObjectData(List taskIds,List fileList) { if(CollectionUtil.isEmpty(taskIds)){ return new ArrayList<>(); } // 查询巡检任务对象 List taskObjects = taskObjectService.getExObjectData(taskIds); // 返回数据 - return taskObjects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); + return taskObjects.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -582,14 +580,14 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param taskIds * @return */ - private List objectProjectData(List taskIds) { + private List objectProjectData(List taskIds,List fileList) { if(CollectionUtil.isEmpty(taskIds)){ return new ArrayList<>(); } // 查询巡检任务项目 List taskObjectProjects = taskObjectProjectService.getObjectProjectData(taskIds); // 返回数据 - return taskObjectProjects.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); + return taskObjectProjects.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -597,7 +595,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param taskIds * @return */ - private List objectProjectContentData(List taskIds) { + private List objectProjectContentData(List taskIds,List fileList) { if(CollectionUtil.isEmpty(taskIds)){ return new ArrayList<>(); } @@ -607,7 +605,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { in(TaskObjectProjectContentEntity::getTaskId, taskIds); }}); // 返回数据 - return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); + return contents.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -615,14 +613,14 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param tenantId * @return */ - private List reDbjectData(String tenantId) { + private List reDbjectData(String tenantId,List fileList) { if(StringUtil.isBlank(tenantId)){ return new ArrayList<>(); } // 查询巡检对象 List objects = objectService.getReDbjectData(tenantId); // 返回数据 - return objects.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); + return objects.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** @@ -630,20 +628,20 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { * @param tenantId * @return */ - private List projectData(String tenantId) { + private List projectData(String tenantId,List fileList) { if(StringUtil.isBlank(tenantId)){ return new ArrayList<>(); } // 查询巡检项目 List projects = projectService.getProjectData(tenantId); // 返回数据 - return projects.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); + return projects.stream().map(o->this.convertFileOrVideo(o,fileList)).collect(Collectors.toList()); } /** * 通过反射处理视频、图片等 */ - private T convertFileOrVideo(T entity) { + private T convertFileOrVideo(T entity,List fileList) { try { if (entity == null) { return entity; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml index 0e12613..1a76d25 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml @@ -31,7 +31,7 @@