ci: 注释掉老法规导入文件对应关系问题

This commit is contained in:
2023-11-28 19:04:46 +08:00
parent ecfbb646b3
commit 86576fbbbc
@@ -287,19 +287,19 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
}
// 根据文件路径获取文件Id
String originPath = dto.getSclj();
if (StrUtil.isNotBlank(originPath)) {
String filePath = this.getFilePath(originPath);
if (MinioUtil.doesObjectExist(filePath)) {
// 存入关系表
OSSFile ossFile = new OSSFile();
ossFile.setUrl(filePath);
ossFile.setStandardNo(dto.getBzh());
ossFile.setFileName(FileUtil.getName(filePath));
ossFile.setStandardFileType("publish_of_original");
ossFileList.add(ossFile);
}
}
// String originPath = dto.getSclj();
// if (StrUtil.isNotBlank(originPath)) {
// String filePath = this.getFilePath(originPath);
// if (MinioUtil.doesObjectExist(filePath)) {
// // 存入关系表
// OSSFile ossFile = new OSSFile();
// ossFile.setUrl(filePath);
// ossFile.setStandardNo(dto.getBzh());
// ossFile.setFileName(FileUtil.getName(filePath));
// ossFile.setStandardFileType("publish_of_original");
// ossFileList.add(ossFile);
// }
// }
gbList.add(gb);
} catch (Exception e) {
log.error("导入转换国标数据时发生错误:{}", e.getMessage());
@@ -318,7 +318,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
}
// 3. 将文件关系列表转为Map,用于快速查找
Map<String, List<OSSFile>> standardNumberToFileMap = ossFileList.stream().collect(Collectors.groupingBy(OSSFile::getStandardNo));
// Map<String, List<OSSFile>> standardNumberToFileMap = ossFileList.stream().collect(Collectors.groupingBy(OSSFile::getStandardNo));
// 4. 遍历待保存或更新的列表,设置ID
StringBuilder oldIds = new StringBuilder();
@@ -355,11 +355,11 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
entity.setReplacedByStandardNumber(null);
domesticStandardService.saveOrUpdate(entity);
String standardId = entity.getId();
// 保存文件关联
OSSFile ossFile = standardNumberToFileMap.get(entity.getStandardNumber()).get(0);
ossFile.setStandardId(standardId);
ossFileService.save(ossFile);
entity.setId(standardId);
// 保存文件关联 //TODO 处理空指针
// OSSFile ossFile = standardNumberToFileMap.get(entity.getStandardNumber()).get(0);
// ossFile.setStandardId(standardId);
// ossFileService.save(ossFile);
// entity.setId(standardId);
}
log.info("老法规国标覆盖导入完成");
// 获取当前时间戳(毫秒)
@@ -439,19 +439,19 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
es.setCategoryCode(excelUtils.translateDictValue("standard_category_code", categoryCode, listDict));
}
// 根据文件路径获取文件Id
String originPath = dto.getSclj();
if (StrUtil.isNotBlank(originPath)) {
String filePath = this.getFilePath(originPath);
if (MinioUtil.doesObjectExist(filePath)) {
// 存入关系表
OSSFile ossFile = new OSSFile();
ossFile.setUrl(filePath);
ossFile.setStandardNo(dto.getBzh());
ossFile.setFileName(FileUtil.getName(filePath));
ossFile.setStandardFileType("publish_of_original");
ossFileList.add(ossFile);
}
}
// String originPath = dto.getSclj();
// if (StrUtil.isNotBlank(originPath)) {
// String filePath = this.getFilePath(originPath);
// if (MinioUtil.doesObjectExist(filePath)) {
// // 存入关系表
// OSSFile ossFile = new OSSFile();
// ossFile.setUrl(filePath);
// ossFile.setStandardNo(dto.getBzh());
// ossFile.setFileName(FileUtil.getName(filePath));
// ossFile.setStandardFileType("publish_of_original");
// ossFileList.add(ossFile);
// }
// }
esList.add(es);
} catch (Exception e) {
log.error("导入转换企标数据时发生错误:{}", e.getMessage());
@@ -470,7 +470,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
}
// 3. 将文件关系列表转为Map,用于快速查找
Map<String, List<OSSFile>> standardNumberToFileMap = ossFileList.stream().collect(Collectors.groupingBy(OSSFile::getStandardNo));
// Map<String, List<OSSFile>> standardNumberToFileMap = ossFileList.stream().collect(Collectors.groupingBy(OSSFile::getStandardNo));
// 4. 遍历待保存或更新的列表,设置ID
StringBuilder oldIds = new StringBuilder();
@@ -511,12 +511,12 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
// 保存文件关联
String standardId = entity.getId();
// 保存文件关联
List<OSSFile> ossFiles = standardNumberToFileMap.get(entity.getStandardNumber());
if (ossFiles != null && !ossFiles.isEmpty()) {
OSSFile ossFile = ossFiles.get(0);
ossFile.setStandardId(standardId);
ossFileService.save(ossFile);
}
// List<OSSFile> ossFiles = standardNumberToFileMap.get(entity.getStandardNumber());
// if (ossFiles != null && !ossFiles.isEmpty()) {
// OSSFile ossFile = ossFiles.get(0);
// ossFile.setStandardId(standardId);
// ossFileService.save(ossFile);
// }
entity.setId(standardId);
// 拼接新id
newIds.append(standardId).append(",");