Browse Source

#离线巡检&检修列表查询

zhongwei
yang_shj 7 months ago
parent
commit
81c2c110bb
  1. 92
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml

92
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}") @Value(value = "${hzims.inspect.offline.upload.path}")
public String upload_path; public String upload_path;
public List<String> fileList;
/** /**
* 下载离线文件 * 下载离线文件
*/ */
@ -326,7 +324,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
* @param download * @param download
*/ */
private void tableDateMethod(Long taskId,List<String> tableNames, String download) { private void tableDateMethod(Long taskId,List<String> tableNames, String download) {
fileList = new ArrayList<>(); List<String> fileList = new ArrayList<>();
// 获取用户信息 // 获取用户信息
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
if(ObjectUtil.isEmpty(user)){ if(ObjectUtil.isEmpty(user)){
@ -345,48 +343,48 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
List<Long> taskIds = taskUsers.stream().map(TaskUserEntity::getTaskId).collect(Collectors.toList()); List<Long> taskIds = taskUsers.stream().map(TaskUserEntity::getTaskId).collect(Collectors.toList());
// 巡检任务 // 巡检任务
List<TaskOfflineVO> tasks = this.taskData(taskIds,currentDate); List<TaskOfflineVO> tasks = this.taskData(taskIds,currentDate,fileList);
if(CollectionUtil.isEmpty(tasks)){ if(CollectionUtil.isEmpty(tasks)){
throw new ServiceException("巡检任务数据不存在!"); throw new ServiceException("巡检任务数据不存在!");
} }
// 巡检任务用户 // 巡检任务用户
List<TaskUserEntity> users = this.taskUserData(tasks.stream().map(TaskOfflineVO::getId).collect(Collectors.toList())); List<TaskUserEntity> users = this.taskUserData(tasks.stream().map(TaskOfflineVO::getId).collect(Collectors.toList()),fileList);
fileJson.add(JsonUtil.toJson(users)); fileJson.add(JsonUtil.toJson(users));
fileJson.add(JsonUtil.toJson(tasks)); fileJson.add(JsonUtil.toJson(tasks));
taskIds = tasks.stream().map(BaseEntity::getId).collect(Collectors.toList()); taskIds = tasks.stream().map(BaseEntity::getId).collect(Collectors.toList());
// 巡检计划 // 巡检计划
List<PlanOfflineVO> plans = this.getPlans(tasks.stream().map(TaskOfflineVO::getPlanId).collect(Collectors.toList())); List<PlanOfflineVO> plans = this.getPlans(tasks.stream().map(TaskOfflineVO::getPlanId).collect(Collectors.toList()),fileList);
fileJson.add(JsonUtil.toJson(plans)); fileJson.add(JsonUtil.toJson(plans));
// 巡检事件 // 巡检事件
List<EventEntity> events = this.eventData(taskIds); List<EventEntity> events = this.eventData(taskIds,fileList);
fileJson.add(JsonUtil.toJson(events)); fileJson.add(JsonUtil.toJson(events));
List<Long> eventIds = events.stream().map(EventEntity::getId).collect(Collectors.toList()); List<Long> eventIds = events.stream().map(EventEntity::getId).collect(Collectors.toList());
// 巡检情况事件附件 // 巡检情况事件附件
List<EventAttachmentEntity> eventAttachments = this.attachmentData(eventIds); List<EventAttachmentEntity> eventAttachments = this.attachmentData(eventIds,fileList);
fileJson.add(JsonUtil.toJson(eventAttachments)); fileJson.add(JsonUtil.toJson(eventAttachments));
// 巡检情况 // 巡检情况
List<EventRecordEntity> eventRecords = this.eventRecordData(eventIds); List<EventRecordEntity> eventRecords = this.eventRecordData(eventIds,fileList);
fileJson.add(JsonUtil.toJson(eventRecords)); fileJson.add(JsonUtil.toJson(eventRecords));
// 巡检任务对象 // 巡检任务对象
List<TaskObjectOfflineVO> taskObjects = this.exObjectData(taskIds); List<TaskObjectOfflineVO> taskObjects = this.exObjectData(taskIds,fileList);
fileJson.add(JsonUtil.toJson(taskObjects)); fileJson.add(JsonUtil.toJson(taskObjects));
// 巡检任务项目 // 巡检任务项目
List<TaskObjectProjectOfflineVO> taskObjectProjects = this.objectProjectData(taskIds); List<TaskObjectProjectOfflineVO> taskObjectProjects = this.objectProjectData(taskIds,fileList);
fileJson.add(JsonUtil.toJson(taskObjectProjects)); fileJson.add(JsonUtil.toJson(taskObjectProjects));
// 巡检任务内容 // 巡检任务内容
List<TaskObjectProjectContentEntity> taskContents = this.objectProjectContentData(taskIds); List<TaskObjectProjectContentEntity> taskContents = this.objectProjectContentData(taskIds,fileList);
fileJson.add(JsonUtil.toJson(taskContents)); fileJson.add(JsonUtil.toJson(taskContents));
// 巡检对象 // 巡检对象
List<ObjectOfflineVO> objects = this.reDbjectData(user.getTenantId()); List<ObjectOfflineVO> objects = this.reDbjectData(user.getTenantId(),fileList);
fileJson.add(JsonUtil.toJson(objects)); fileJson.add(JsonUtil.toJson(objects));
// 巡检项目 // 巡检项目
List<ProjectOfflineVO> projects = this.projectData(user.getTenantId()); List<ProjectOfflineVO> projects = this.projectData(user.getTenantId(),fileList);
fileJson.add(JsonUtil.toJson(projects)); fileJson.add(JsonUtil.toJson(projects));
// 巡检内容 // 巡检内容
List<ContentEntity> contents = this.contentData(user.getTenantId()); List<ContentEntity> contents = this.contentData(user.getTenantId(),fileList);
fileJson.add(JsonUtil.toJson(contents)); fileJson.add(JsonUtil.toJson(contents));
// 危险点 // 危险点
List<ObjectDangerEntity> dangers = this.dangerData(user.getTenantId()); List<ObjectDangerEntity> dangers = this.dangerData(user.getTenantId(),fileList);
fileJson.add(JsonUtil.toJson(dangers)); fileJson.add(JsonUtil.toJson(dangers));
// 危险源数据 // 危险源数据
List<SourceVO> sources = dangerSourceClient.listByTenantId(user.getTenantId()); List<SourceVO> sources = dangerSourceClient.listByTenantId(user.getTenantId());
@ -398,9 +396,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<FaultVO> faults = faultClient.listByTenantId(user.getTenantId()); List<FaultVO> faults = faultClient.listByTenantId(user.getTenantId());
fileJson.add(JsonUtil.toJson(faults)); fileJson.add(JsonUtil.toJson(faults));
// 离线任务任务 // 离线任务任务
List<OfflineTaskEntity> offlines = this.tasksData(taskId); List<OfflineTaskEntity> offlines = this.tasksData(taskId,fileList);
fileJson.add(JsonUtil.toJson(offlines)); fileJson.add(JsonUtil.toJson(offlines));
if(fileJson.size() <= 0){ if(fileJson.isEmpty()){
return; return;
} }
// 文件写入 // 文件写入
@ -421,7 +419,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
* @param tenantId * @param tenantId
* @return * @return
*/ */
private List<ContentEntity> contentData(String tenantId) { private List<ContentEntity> contentData(String tenantId,List<String> fileList) {
if(StringUtil.isBlank(tenantId)){ if(StringUtil.isBlank(tenantId)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -430,7 +428,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(ContentEntity::getTenantId, tenantId); 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 * @param tenantId
* @return * @return
*/ */
private List<ObjectDangerEntity> dangerData(String tenantId) { private List<ObjectDangerEntity> dangerData(String tenantId,List<String> fileList) {
if(StringUtil.isBlank(tenantId)){ if(StringUtil.isBlank(tenantId)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -447,7 +445,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(ObjectDangerEntity::getTenantId, tenantId); 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 * @param taskId
* @return * @return
*/ */
private List<OfflineTaskEntity> tasksData(Long taskId) { private List<OfflineTaskEntity> tasksData(Long taskId,List<String> fileList) {
if(ObjectUtil.isEmpty(taskId)){ if(ObjectUtil.isEmpty(taskId)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -466,7 +464,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(OfflineTaskEntity::getId, taskId); 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 * @return
*/ */
private List<TaskUserEntity> taskUserData(List<Long> taskIds) { private List<TaskUserEntity> taskUserData(List<Long> taskIds,List<String> fileList) {
if(CollectionUtil.isEmpty(taskIds)){ if(CollectionUtil.isEmpty(taskIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -482,21 +480,21 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<TaskUserEntity> taskUsers = this.taskUserService.getOfflineTaskUser(taskIds); List<TaskUserEntity> 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 * @return
*/ */
private List<TaskOfflineVO> taskData(List<Long> taskId,String currentDate) { private List<TaskOfflineVO> taskData(List<Long> taskId,String currentDate,List<String> fileList) {
if(CollectionUtil.isEmpty(taskId)){ if(CollectionUtil.isEmpty(taskId)){
return new ArrayList<>(); return new ArrayList<>();
} }
// 查询巡检任务 // 查询巡检任务
List<TaskOfflineVO> tasks = taskService.getTaskData(taskId,currentDate); List<TaskOfflineVO> 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 * @param planIds
* @return * @return
*/ */
private List<PlanOfflineVO> getPlans(List<Long> planIds) { private List<PlanOfflineVO> getPlans(List<Long> planIds,List<String> fileList) {
if(CollectionUtil.isEmpty(planIds)){ if(CollectionUtil.isEmpty(planIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
List<PlanOfflineVO> tasks = planService.getPlans(planIds); List<PlanOfflineVO> 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 * @param taskIds
* @return * @return
*/ */
private List<EventEntity> eventData(List<Long> taskIds) { private List<EventEntity> eventData(List<Long> taskIds,List<String> fileList) {
if(CollectionUtil.isEmpty(taskIds)){ if(CollectionUtil.isEmpty(taskIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -527,7 +525,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<EventEntity> events = eventService.list(new LambdaQueryWrapper<EventEntity>() {{ List<EventEntity> events = eventService.list(new LambdaQueryWrapper<EventEntity>() {{
in(EventEntity::getTaskId, taskIds); 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 * @param eventIds
* @return * @return
*/ */
private List<EventAttachmentEntity> attachmentData(List<Long> eventIds) { private List<EventAttachmentEntity> attachmentData(List<Long> eventIds,List<String> fileList) {
if(CollectionUtil.isEmpty(eventIds)){ if(CollectionUtil.isEmpty(eventIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -543,7 +541,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<EventAttachmentEntity> eventAttachments = eventAttachmentService.list(new LambdaQueryWrapper<EventAttachmentEntity>() {{ List<EventAttachmentEntity> eventAttachments = eventAttachmentService.list(new LambdaQueryWrapper<EventAttachmentEntity>() {{
in(EventAttachmentEntity::getEventId, eventIds); 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 * @param eventIds
* @return * @return
*/ */
private List<EventRecordEntity> eventRecordData(List<Long> eventIds) { private List<EventRecordEntity> eventRecordData(List<Long> eventIds,List<String> fileList) {
if(CollectionUtil.isEmpty(eventIds)){ if(CollectionUtil.isEmpty(eventIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -559,7 +557,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
in(EventRecordEntity::getEventId, eventIds); 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 * @param taskIds
* @return * @return
*/ */
private List<TaskObjectOfflineVO> exObjectData(List<Long> taskIds) { private List<TaskObjectOfflineVO> exObjectData(List<Long> taskIds,List<String> fileList) {
if(CollectionUtil.isEmpty(taskIds)){ if(CollectionUtil.isEmpty(taskIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
// 查询巡检任务对象 // 查询巡检任务对象
List<TaskObjectOfflineVO> taskObjects = taskObjectService.getExObjectData(taskIds); List<TaskObjectOfflineVO> 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 * @param taskIds
* @return * @return
*/ */
private List<TaskObjectProjectOfflineVO> objectProjectData(List<Long> taskIds) { private List<TaskObjectProjectOfflineVO> objectProjectData(List<Long> taskIds,List<String> fileList) {
if(CollectionUtil.isEmpty(taskIds)){ if(CollectionUtil.isEmpty(taskIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
// 查询巡检任务项目 // 查询巡检任务项目
List<TaskObjectProjectOfflineVO> taskObjectProjects = taskObjectProjectService.getObjectProjectData(taskIds); List<TaskObjectProjectOfflineVO> 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 * @param taskIds
* @return * @return
*/ */
private List<TaskObjectProjectContentEntity> objectProjectContentData(List<Long> taskIds) { private List<TaskObjectProjectContentEntity> objectProjectContentData(List<Long> taskIds,List<String> fileList) {
if(CollectionUtil.isEmpty(taskIds)){ if(CollectionUtil.isEmpty(taskIds)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -607,7 +605,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
in(TaskObjectProjectContentEntity::getTaskId, taskIds); 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 * @param tenantId
* @return * @return
*/ */
private List<ObjectOfflineVO> reDbjectData(String tenantId) { private List<ObjectOfflineVO> reDbjectData(String tenantId,List<String> fileList) {
if(StringUtil.isBlank(tenantId)){ if(StringUtil.isBlank(tenantId)){
return new ArrayList<>(); return new ArrayList<>();
} }
// 查询巡检对象 // 查询巡检对象
List<ObjectOfflineVO> objects = objectService.getReDbjectData(tenantId); List<ObjectOfflineVO> 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 * @param tenantId
* @return * @return
*/ */
private List<ProjectOfflineVO> projectData(String tenantId) { private List<ProjectOfflineVO> projectData(String tenantId,List<String> fileList) {
if(StringUtil.isBlank(tenantId)){ if(StringUtil.isBlank(tenantId)){
return new ArrayList<>(); return new ArrayList<>();
} }
// 查询巡检项目 // 查询巡检项目
List<ProjectOfflineVO> projects = projectService.getProjectData(tenantId); List<ProjectOfflineVO> 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> T convertFileOrVideo(T entity) { private <T> T convertFileOrVideo(T entity,List<String> fileList) {
try { try {
if (entity == null) { if (entity == null) {
return entity; return entity;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml

@ -31,7 +31,7 @@
</collection> </collection>
</resultMap> </resultMap>
<select id="selectPageList" resultMap="BaseResultMap"> <select id="selectPageList" resultMap="BaseResultMap">
SELECT OT.`NAME` AS taskName, OT.PLAN_HOURS, OT.EM_NAME, OS.* FROM hzims_oper_access_statistics OS SELECT OT.`NAME` AS taskName, OT.PLAN_HOURS AS planHours, OT.EM_NAME as emName, OS.* FROM hzims_oper_access_statistics OS
JOIN hzims_oper_access_task OT JOIN hzims_oper_access_task OT
ON OS.`TASK_ID` = OT.`ID` ON OS.`TASK_ID` = OT.`ID`
WHERE OS.IS_DELETED = 0 WHERE OS.IS_DELETED = 0

Loading…
Cancel
Save