09-22-报修任务支持多上传

This commit is contained in:
2025-09-22 15:27:33 +08:00
parent 772b610bec
commit 959030fdb1
5 changed files with 32 additions and 12 deletions

View File

@ -104,4 +104,14 @@ public class OpsInspectionReportController extends BaseController {
@PathVariable("ids") Long[] ids) {
return toAjax(opsInspectionReportService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 生成纪录
*/
@SaCheckPermission("inspection:report:record")
public R<Object> record(){
return null;
}
}

View File

@ -68,9 +68,9 @@ public class OpsInspectionReport extends BaseEntity {
private String position;
/**
* 文件ID
* 文件ID 多个用逗号分隔
*/
private Long fileId;
private String fileId;
/**
* 文件路径

View File

@ -76,7 +76,7 @@ public class OpsInspectionReportBo extends BaseEntity {
* 文件ID
*/
// @NotBlank(message = "文件不能为空", groups = {AddGroup.class, EditGroup.class})
private Long fileId;
private String fileId;
/**
* 文件路径

View File

@ -87,7 +87,7 @@ public class OpsInspectionReportVo implements Serializable {
* 文件ID
*/
@ExcelProperty(value = "文件ID")
private Long fileId;
private String fileId;
/**
* 文件路径

View File

@ -24,10 +24,7 @@ import org.dromara.inspection.mapper.OpsInspectionReportMapper;
import org.dromara.inspection.service.IOpsInspectionReportService;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 运维-巡检-报修Service业务层处理
@ -123,13 +120,23 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
return false;
}
String s = remoteFileService.selectUrlByIds(String.valueOf(add.getFileId()));
add.setFileUrl(s);
if (add.getFileId() != null){
String[] split = add.getFileId().split(",");
List<String> urls = new ArrayList<>();
for (String s : split) {
String ossUrl = remoteFileService.selectUrlByIds(s);
if (ossUrl != null){
urls.add(ossUrl);
}
}
String join = String.join(",", urls);
add.setFileUrl(join);
bo.setFileUrl(join);
}
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
bo.setFileUrl(s);
}
return flag;
}
@ -179,7 +186,10 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
}
if (!urls.isEmpty()) {
remoteFileService.deleteFile(urls);
for (String url : urls) {
List<String> list = Arrays.asList(url.split(","));
remoteFileService.deleteFile(list);
}
}
return baseMapper.deleteByIds(ids) > 0;