|
|
@ -27,7 +27,7 @@ import com.hnac.hzinfo.inspect.plan.vo.PlanOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.entity.*; |
|
|
|
import com.hnac.hzinfo.inspect.task.entity.*; |
|
|
|
import com.hnac.hzinfo.inspect.task.service.*; |
|
|
|
import com.hnac.hzinfo.inspect.task.service.*; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskObjectProjectOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.utils.JsonFileUtil; |
|
|
|
import com.hnac.hzinfo.inspect.utils.JsonFileUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -430,7 +430,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
eq(ContentEntity::getTenantId, tenantId); |
|
|
|
eq(ContentEntity::getTenantId, tenantId); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return contents.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -447,7 +447,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
eq(ObjectDangerEntity::getTenantId, tenantId); |
|
|
|
eq(ObjectDangerEntity::getTenantId, tenantId); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return dangers.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return dangers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -466,7 +466,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
eq(OfflineTaskEntity::getId, taskId); |
|
|
|
eq(OfflineTaskEntity::getId, taskId); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -482,7 +482,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
List<TaskUserEntity> taskUsers = this.taskUserService.getOfflineTaskUser(taskIds); |
|
|
|
List<TaskUserEntity> taskUsers = this.taskUserService.getOfflineTaskUser(taskIds); |
|
|
|
|
|
|
|
|
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return taskUsers.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return taskUsers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -496,7 +496,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
// 查询巡检任务
|
|
|
|
// 查询巡检任务
|
|
|
|
List<TaskOfflineVO> tasks = taskService.getTaskData(taskId,currentDate); |
|
|
|
List<TaskOfflineVO> tasks = taskService.getTaskData(taskId,currentDate); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -510,7 +510,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
List<PlanOfflineVO> tasks = planService.getPlans(planIds); |
|
|
|
List<PlanOfflineVO> tasks = planService.getPlans(planIds); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -527,7 +527,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(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return events.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -543,7 +543,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(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return eventAttachments.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -559,7 +559,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
in(EventRecordEntity::getEventId, eventIds); |
|
|
|
in(EventRecordEntity::getEventId, eventIds); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return eventRecords.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return eventRecords.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -574,7 +574,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
// 查询巡检任务对象
|
|
|
|
// 查询巡检任务对象
|
|
|
|
List<TaskObjectOfflineVO> taskObjects = taskObjectService.getExObjectData(taskIds); |
|
|
|
List<TaskObjectOfflineVO> taskObjects = taskObjectService.getExObjectData(taskIds); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return taskObjects.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return taskObjects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -603,9 +603,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询巡检任务内容
|
|
|
|
// 查询巡检任务内容
|
|
|
|
List<TaskObjectProjectContentEntity> contents = taskObjectProjectContentService.list( |
|
|
|
List<TaskObjectProjectContentEntity> contents = taskObjectProjectContentService.list( |
|
|
|
new LambdaQueryWrapper<TaskObjectProjectContentEntity>() {{ |
|
|
|
new LambdaQueryWrapper<TaskObjectProjectContentEntity>() {{ |
|
|
|
in(TaskObjectProjectContentEntity::getTaskId, taskIds); |
|
|
|
in(TaskObjectProjectContentEntity::getTaskId, taskIds); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
@ -687,12 +687,12 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 下载文件 |
|
|
|
* 下载文件 |
|
|
|
* @param fileUrl |
|
|
|
* @param fileUrl |
|
|
|
* @param downloadFileDir |
|
|
|
* @param downloadFileDir |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String downloadFileByUrl(String fileUrl, String downloadFileDir){ |
|
|
|
private String downloadFileByUrl(String fileUrl, String downloadFileDir){ |
|
|
|
URL url = null; |
|
|
|
URL url = null; |
|
|
|
String fileName = null; |
|
|
|
String fileName = null; |
|
|
@ -832,6 +832,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
List<TaskObjectSyncBO> taskObjects = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT.json", TaskObjectSyncBO.class); |
|
|
|
List<TaskObjectSyncBO> taskObjects = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT.json", TaskObjectSyncBO.class); |
|
|
|
List<TaskObjectProjectContentBO> projectContents = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT_PROJECT_CONTENT.json", TaskObjectProjectContentBO.class); |
|
|
|
List<TaskObjectProjectContentBO> projectContents = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT_PROJECT_CONTENT.json", TaskObjectProjectContentBO.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 内容图片
|
|
|
|
|
|
|
|
this.batchCurrentImg(upload, eventRecords); |
|
|
|
|
|
|
|
|
|
|
|
// 文件上传
|
|
|
|
// 文件上传
|
|
|
|
this.batchUploadImg(upload, eventRecords); |
|
|
|
this.batchUploadImg(upload, eventRecords); |
|
|
|
this.batchUploadImg(upload, eventAttachments); |
|
|
|
this.batchUploadImg(upload, eventAttachments); |
|
|
@ -873,6 +876,49 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 上传内容文件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param sourceDir |
|
|
|
|
|
|
|
* @param data |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void batchCurrentImg(String sourceDir, List<? extends SyncBO> data) { |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(data)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.forEach(bo -> { |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(bo.getCurrentValues())) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> urls = bo.getCurrentValues().stream().map(o -> { |
|
|
|
|
|
|
|
if (StringUtils.isBlank(o) || !o.contains("file:")) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/**wxq begin**/ |
|
|
|
|
|
|
|
String fileName = o.substring(o.lastIndexOf("/") >= 0 ? o.lastIndexOf("/") + 1 : 0); |
|
|
|
|
|
|
|
File file = new File(sourceDir + "/" + fileName); |
|
|
|
|
|
|
|
if (!file.exists()) { |
|
|
|
|
|
|
|
throw new RuntimeException("文件名称为:" + fileName + "不存在,上传失败!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
R<BladeFile> r = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
MultipartFile multipartFile = this.getMultipartFile(file); |
|
|
|
|
|
|
|
r = ossClient.putFile(multipartFile); |
|
|
|
|
|
|
|
if (!r.isSuccess()) { |
|
|
|
|
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BladeFile bladeFile = r.getData(); |
|
|
|
|
|
|
|
return bladeFile != null ? bladeFile.getLink() : null; |
|
|
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).filter(StringUtils::isNotBlank).collect(Collectors.toList()); |
|
|
|
|
|
|
|
bo.setCurrentValues(urls); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 上传文件 |
|
|
|
* 上传文件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param sourceDir |
|
|
|
* @param sourceDir |
|
|
@ -909,10 +955,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} catch (Exception ex) { |
|
|
|
} catch (Exception ex) { |
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex); |
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex); |
|
|
|
} |
|
|
|
} |
|
|
|
}).filter(o -> StringUtils.isNotBlank(o)).collect(Collectors.toList()); |
|
|
|
}).filter(StringUtils::isNotBlank).collect(Collectors.toList()); |
|
|
|
bo.setFiles(urls); |
|
|
|
bo.setFiles(urls); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private MultipartFile getMultipartFile(File file) { |
|
|
|
private MultipartFile getMultipartFile(File file) { |
|
|
@ -926,7 +971,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
FileItemFactory factory = new DiskFileItemFactory(16, null); |
|
|
|
FileItemFactory factory = new DiskFileItemFactory(16, null); |
|
|
|
String textFieldName = "file"; |
|
|
|
String textFieldName = "file"; |
|
|
|
FileItem item = factory.createItem(textFieldName, "text/plain", false, |
|
|
|
FileItem item = factory.createItem(textFieldName, "text/plain", false, |
|
|
|
file.getName()); |
|
|
|
file.getName()); |
|
|
|
int bytesRead = 0; |
|
|
|
int bytesRead = 0; |
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
FileInputStream fis = null; |
|
|
|
FileInputStream fis = null; |
|
|
@ -958,3 +1003,4 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|