【update】ASMS 发布稿上传文件逻辑的调整
This commit is contained in:
+14
-13
@@ -583,6 +583,19 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
||||
paramMap.put("lawCode", code);
|
||||
Map<String, Object> objectMap = asmsPostUtil.sendGetReq2(lawsAsmsOpenApi.getApiUrl(), paramMap);
|
||||
if (Objects.isNull(objectMap)) return;
|
||||
|
||||
// 判断是否有文件信息, 存在则将现有的发布稿信息直接删除?
|
||||
LambdaQueryWrapper<OSSFile> wrapperOss = new LambdaQueryWrapper<>();
|
||||
wrapperOss.eq(OSSFile::getStandardFileType, "publish_of_original"); // 发布稿
|
||||
wrapperOss.eq(OSSFile::getStandardId, id); // 当前标准的id
|
||||
List<OSSFile> fileList = ossFileService.list(wrapperOss);
|
||||
if (fileList.size() > 0){
|
||||
// 很多个的话 删除后重新上传。
|
||||
for (OSSFile file : fileList) {
|
||||
ossFileService.removeById(file.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> standardTextPdf = (Map<String, String>) objectMap.get("standardTextPdf");
|
||||
if (!Objects.isNull(standardTextPdf)){
|
||||
String fileName = standardTextPdf.get("fileName");
|
||||
@@ -1007,19 +1020,7 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
||||
ossFile.setStandardId(id);
|
||||
ossFile.setStandardNo(code);
|
||||
ossFile.setStandardFileType("publish_of_original");
|
||||
// 需要先判断原系统中是否存在该文件地址的相关链接,存在则不进行上传了,不存在再上传。
|
||||
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OSSFile::getUrl, filePath + url);
|
||||
List<OSSFile> list = ossFileService.list(wrapper);
|
||||
if (list.isEmpty()){
|
||||
ossFileService.save(ossFile);
|
||||
}else if (list.size() > 1){
|
||||
// 很多个的话 删除后重新上传。
|
||||
for (OSSFile file : list) {
|
||||
ossFileService.removeById(file.getId());
|
||||
}
|
||||
ossFileService.save(ossFile);
|
||||
}
|
||||
ossFileService.save(ossFile);
|
||||
log.info("存储文件:{},url:{}", fileName, url);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user