feat: ossFile表和minio数据有效性检测接口

This commit is contained in:
2024-03-15 10:46:38 +08:00
parent 6bb0b1d056
commit 9677266fad
5 changed files with 57 additions and 9 deletions
@@ -192,4 +192,12 @@ public class OldSystemController {
return Result.OK(oldSystemDeptRelationService.esAuthDeptDataFix());
}
@GetMapping("/dataFileFix")
@AutoLog(value = "老法规系统-上线后检测ossFile表中的数据和minio中的数据是否一致/找到minio中不存在的数据")
@ApiOperation(value="老法规系统-上线后检测ossFile表中的数据和minio中的数据是否一致/找到minio中不存在的数据", notes="老法规系统-上线后检测ossFile表中的数据和minio中的数据是否一致/找到minio中不存在的数据")
@ApiOperationSupport(order = 15)
public void dataFileFix(HttpServletResponse response) {
oldSystemService.dataFileFix(response);
}
}
@@ -176,6 +176,10 @@ public class OldSystemImportDTO {
@TableField(exist = false)
private String errorInfo;
@Excel(name = "OssFileID", width = 15, orderNum = "53")
@TableField(exist = false)
private String ossFileId;
/**
* 判断是否是空行
* @return 如果所有字段都为null或空字符串,返回true,否则返回false
@@ -113,4 +113,10 @@ public interface OldSystemService {
* @param response
*/
void importOldSystemFileFixDocPath(MultipartFile file, String type, HttpServletResponse response);
/**
* 上线后检测ossFile表中的数据和minio中的数据是否一致/找到minio中不存在的数据
* @param response
*/
void dataFileFix(HttpServletResponse response);
}
@@ -419,6 +419,36 @@ public class OldSystemServiceImpl implements OldSystemService {
}
}
@Override
public void dataFileFix(HttpServletResponse response) {
List<OldSystemImportDTO> errImportList = new ArrayList<>();
List<OSSFile> ossFileList = ossFileService.list();
for (OSSFile ossFile : ossFileList) {
String url = ossFile.getUrl();
if (StrUtil.isBlank(url)) {
OldSystemImportDTO dto = new OldSystemImportDTO();
dto.setBzh(ossFile.getStandardNo());
log.error("文件路径为空");
dto.setErrorInfo("文件路径为空");
dto.setOssFileId(ossFile.getId());
errImportList.add(dto);
continue;
}
if (!MinioUtil.doesObjectExist(url)) {
OldSystemImportDTO dto = new OldSystemImportDTO();
dto.setBzh(ossFile.getStandardNo());
log.error("文件不存在,路径是:" + url);
dto.setErrorInfo("文件不存在,路径是:" + url);
dto.setOssFileId(ossFile.getId());
errImportList.add(dto);
}
}
if (!errImportList.isEmpty()) {
this.exportWithExcel(response, errImportList, "OldSystemStandardErrorData.xls");
}
}
private void oldSysFBDataFileDocPath(List<OldSystemImportDTO> allDatalist, List<OldSystemImportDTO> errImportList) {
List<OldSystemImportDTO> fbDatalist = allDatalist.stream().filter(o -> o.getBzfl().contains("ISO") ||
o.getBzfl().contains("引进") ||