|
|
@@ -27,7 +27,9 @@ import org.springblade.archive.vo.ArchiveExaminingSocketVo;
|
|
|
import org.springblade.archive.vo.ArchiveExaminingVo;
|
|
|
import org.springblade.archive.vo.ArchivesAutoVO;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
|
+import org.springblade.business.entity.MetadataClassification;
|
|
|
import org.springblade.business.feign.ArchiveFileClient;
|
|
|
+import org.springblade.business.feign.MetadataClassificationClient;
|
|
|
import org.springblade.common.constant.ArchiveConstant;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
@@ -35,6 +37,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.evisa.feign.EVisaClient;
|
|
|
import org.springblade.evisa.vo.CertBeanVO;
|
|
|
+import org.springblade.manager.entity.ArchiveTreeContract;
|
|
|
import org.springblade.manager.feign.ArchiveTreeContractClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
@@ -67,6 +70,7 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
|
|
|
private final ArchivesAutoServiceImpl archivesAutoService;
|
|
|
|
|
|
private final ArchiveTreeContractClient archiveTreeContractClient;
|
|
|
+ private final MetadataClassificationClient metadataClassificationClient;
|
|
|
|
|
|
/**
|
|
|
* 推送状态到前端
|
|
|
@@ -166,15 +170,48 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
|
|
|
int unqualifiedCount = 0;
|
|
|
//1-2 一致性检测
|
|
|
int consistency = 0;
|
|
|
+ //1-5 对设定值域的元数据项值域符合度检测
|
|
|
+ int metadataCompliance = 0;
|
|
|
+ //1-6 对元数据项数据重复性检测
|
|
|
+ int metadataRepeat = 0;
|
|
|
+ //2-3 对元数据项完整性检测
|
|
|
+ int metadataComplete = 0;
|
|
|
+ //2-4 对元数据项必填项
|
|
|
+ int metadataRequiredField = 0;
|
|
|
|
|
|
//3-1 文件格式
|
|
|
int fileType = 0;
|
|
|
//3-2 文件是否能够访问
|
|
|
int fileIsAccess = 0;
|
|
|
- //检测中
|
|
|
- //文件为空,不允许检测
|
|
|
+ //检测中 文件为空,不允许检测
|
|
|
if(CollectionUtil.isNotEmpty(files)){
|
|
|
+ Map<Integer,String> storageTypeMap = new HashMap<>();
|
|
|
+ storageTypeMap.put(1,"a");
|
|
|
+ storageTypeMap.put(2,"b");
|
|
|
+ storageTypeMap.put(3,"c");
|
|
|
+ storageTypeMap.put(4,"d");
|
|
|
+ storageTypeMap.put(5,"e");
|
|
|
+ storageTypeMap.put(7,"f");
|
|
|
+ storageTypeMap.put(6,"g");
|
|
|
+ storageTypeMap.put(8,"h");
|
|
|
+ storageTypeMap.put(9,"i");
|
|
|
+ //获取nodeId 查询节点信息
|
|
|
+ Map<String, List<ArchiveFile>> collect2 = files.stream().collect(Collectors.groupingBy(ArchiveFile::getNodeId));
|
|
|
+ List<Long> collect11 = collect2.keySet().stream().map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
|
|
+ List<ArchiveTreeContract> archiveTreeContractListByList = archiveTreeContractClient.getArchiveTreeContractListByList(collect11);
|
|
|
+ //获取所有的元数据配置项
|
|
|
+ List<MetadataClassification> metadataClassification = metadataClassificationClient.getMetadataClassification();
|
|
|
+ //组装数据,节点与元数据配置型的映射关系
|
|
|
+ HashMap<Long, List<MetadataClassification>> longStringHashMap = new HashMap<>();
|
|
|
+ archiveTreeContractListByList.forEach(f -> {
|
|
|
+ List<MetadataClassification> collect1 = metadataClassification.stream().filter(e -> e.getFileStorageType().contains(storageTypeMap.get(f.getStorageType()))).collect(Collectors.toList());
|
|
|
+ longStringHashMap.put(f.getId(),collect1);
|
|
|
+ });
|
|
|
for (ArchiveFile file : files) {
|
|
|
+ //当前文件父节点对应的元数据配置项
|
|
|
+ List<MetadataClassification> metadataClassifications = longStringHashMap.get(Long.valueOf(file.getNodeId()));
|
|
|
+ //获取文件元数据项
|
|
|
+ List<HashMap<String, Object>> list = metadataClassificationClient.getMetadaFileByFileId(file.getId());
|
|
|
//优先检查文件是否可读
|
|
|
if(StringUtils.isEmpty(file.getPdfFileUrl()) || !validateWithHead(file.getPdfFileUrl())){
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
@@ -223,17 +260,50 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
|
|
|
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("5")){
|
|
|
+ //获取元数据
|
|
|
+ if(CollectionUtil.isEmpty(list) ){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataCompliance++;
|
|
|
+ }
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
|
|
|
- ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测", 0, "无", 0));
|
|
|
+ ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测", metadataCompliance, metadataCompliance == 0 ? "无" : "详见附件", metadataCompliance == 0 ? 0 : 1));
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("6")){
|
|
|
+ //获取元数据
|
|
|
+ if(CollectionUtil.isEmpty(list)){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataRepeat++;
|
|
|
+ }else{
|
|
|
+ List<String> data = new ArrayList<>();
|
|
|
+ HashMap<String, Object> stringObjectHashMap = list.get(0);
|
|
|
+ for (MetadataClassification classification : metadataClassifications) {
|
|
|
+ String fieldKey = classification.getFieldKey();
|
|
|
+ data.add(stringObjectHashMap.get(fieldKey).toString());
|
|
|
+ }
|
|
|
+ HashSet<String> strings1 = new HashSet<>(data);
|
|
|
+ //存在重复数据
|
|
|
+ if(data.size() != strings1.size()){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataRepeat++;
|
|
|
+ }
|
|
|
+ }
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
|
|
|
- ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测", 0, "无", 0));
|
|
|
+ ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测", metadataRepeat, metadataRepeat == 0 ? "无" : "详见附件", metadataRepeat == 0 ? 0 : 1));
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("7")){
|
|
|
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("8")){
|
|
|
+ //TODO
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
|
|
|
ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包一致性检测", 0, "无", 0));
|
|
|
}
|
|
|
@@ -256,12 +326,59 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
|
|
|
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("3")){
|
|
|
+ //获取元数据
|
|
|
+ if(CollectionUtil.isEmpty(list)){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataComplete++;
|
|
|
+ }else{
|
|
|
+ //元数据
|
|
|
+ HashMap<String, Object> stringObjectHashMap = list.get(0);
|
|
|
+ //元数据项
|
|
|
+ List<String> collect1 = metadataClassifications.stream().map(MetadataClassification::getFieldKey).collect(Collectors.toList());
|
|
|
+ Set<String> strings2 = stringObjectHashMap.keySet();
|
|
|
+ //元数据项是否缺失
|
|
|
+ if(!strings2.containsAll(collect1)){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataComplete++;
|
|
|
+ }
|
|
|
+ }
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
|
|
|
- ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测", 0, "无", 0));
|
|
|
+ ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测", metadataComplete, metadataComplete == 0 ? "无" : "详见附件", metadataComplete == 0 ? 0 : 1));
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("4")){
|
|
|
+ //获取元数据
|
|
|
+ if(CollectionUtil.isEmpty(list)){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataRequiredField++;
|
|
|
+ }else{
|
|
|
+ //元数据
|
|
|
+ HashMap<String, Object> stringObjectHashMap = list.get(0);
|
|
|
+ //元数据项-必选项
|
|
|
+ List<String> collect1 = metadataClassifications.stream().filter(f -> f.getMandatoryType() == 1).map(MetadataClassification::getFieldKey).collect(Collectors.toList());
|
|
|
+ for (String s : collect1) {
|
|
|
+ Object o = stringObjectHashMap.get(s);
|
|
|
+ //必选项没有值
|
|
|
+ if(o == null){
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测");
|
|
|
+ map.put("unqualifiedObject", file.getFileName());
|
|
|
+ mapList.add(map);
|
|
|
+ metadataRequiredField++;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
|
|
|
- ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测", 0, "无", 0));
|
|
|
+ ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测", metadataRequiredField, metadataRequiredField == 0 ? "无" : "详见附件", metadataRequiredField == 0 ? 0 : 1));
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("5")){
|
|
|
|
|
|
@@ -304,6 +421,7 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
|
|
|
ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中元数据可读性检测", 0, "无", 0));
|
|
|
}
|
|
|
if(vo.getAuthenticityList().contains("5")){
|
|
|
+ //TODO
|
|
|
detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
|
|
|
ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中包含的内容数据合规性检测", 0, "无", 0));
|
|
|
}
|