Commit e0388d33 by HlQ

[add] 预工单确认为工单后,预工单文件同步一份到工单

1 parent ce684107
......@@ -70,14 +70,16 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.leftJoin(ServiceOrder.class, ServiceOrder::getTaskId, Task::getId)
.between(ArrayUtil.isAllNotNull(data.getStartdate(), data.getEnddate()), Task::getRepairTime, data.getStartdate(), data.getEnddate())
.lt(data.getCurDate() != null, Task::getExpDate, data.getCurDate());
// todo 优化
if (taskIdSet.size() == 1 && CollUtil.get(taskIdSet, 0).equals(-99L)) {
// 不是管理员,并且第一次处理工单,但当前处理人是他
} else if (taskIdSet.size() == 1 && CollUtil.get(taskIdSet, 0).equals(0L)) {
// 管理员逻辑
} else {
wrapper.in(Task::getId, taskIdSet);
if (taskIdSet.size() == 1) {
Long taskId = CollUtil.get(taskIdSet, 0);
// 不是管理员,并且第一次处理工单,但当前处理人是他 || 管理员逻辑
if (taskId.equals(-99L) || taskId.equals(0L)) {
return this.selectJoinListPage(Page.of(data.getPageNum(), data.getPageSize()), TaskVO.class, wrapper);
}
}
wrapper.in(Task::getId, taskIdSet);
return this.selectJoinListPage(Page.of(data.getPageNum(), data.getPageSize()), TaskVO.class, wrapper);
}
......@@ -175,6 +177,32 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
task.setCreateUser(user.getId());
task.setUuid(IdUtil.nanoId());
this.save(task);
// 预工单文件在工单创建时,复制一份到工单文件夹下
Opt.ofNullable(data.getTaskTempId())
.map(taskTempId -> fileService.lambdaQuery()
.eq(FileInfo::getSourceId, taskTempId)
.eq(FileInfo::getSourceType, 2)
.eq(FileInfo::getStoreId, 0L)
.list()
)
.filter(CollUtil::isNotEmpty)
.ifPresent(fileInfoList -> fileInfoList.forEach(fileInfo -> {
String path = fileUrl + FileUtil.FILE_SEPARATOR + task.getStoreId() + FileUtil.FILE_SEPARATOR + task.getId() + FileUtil.FILE_SEPARATOR + fileInfo.getName();
File tarFile = FileUtil.copy(fileInfo.getUrl(), path, true);
FileInfo newFileInfo = new FileInfo();
newFileInfo.setStoreId(task.getStoreId());
newFileInfo.setSourceId(task.getId());
newFileInfo.setSourceType(3);
newFileInfo.setName(fileInfo.getName());
newFileInfo.setUrl(path);
newFileInfo.setType(fileInfo.getType());
newFileInfo.setSha256(fileInfo.getSha256());
newFileInfo.setUploader(fileInfo.getUploader());
fileService.save(newFileInfo);
}));
List<FaultLog> saveList = new ArrayList<>();
// 预工单提交,客户名称不在系统用户表内。单独处理客户提交的预工单日志
FaultLog faultLog = new FaultLog();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!