|
@@ -20,23 +20,18 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
-import org.springblade.manager.entity.ArchiveTreeContract;
|
|
|
-import org.springblade.manager.entity.ContractInfo;
|
|
|
-import org.springblade.manager.entity.ContractRelationJlyz;
|
|
|
-import org.springblade.manager.entity.ProjectInfo;
|
|
|
+import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.enums.StorageTypeEnum;
|
|
|
import org.springblade.manager.enums.TreeStructureEnum;
|
|
|
import org.springblade.manager.mapper.ArchiveTreeContractMapper;
|
|
|
import org.springblade.manager.service.IContractInfoService;
|
|
|
+import org.springblade.manager.service.IImageClassificationConfigService;
|
|
|
import org.springblade.manager.service.IProjectInfoService;
|
|
|
+import org.springblade.manager.service.IWbsTreeContractService;
|
|
|
import org.springblade.manager.utils.ForestNodeMerger;
|
|
|
-import org.springblade.manager.utils.YearTreeUtils;
|
|
|
-import org.springblade.manager.vo.ArchiveTreeContractVO;
|
|
|
-import org.springblade.manager.vo.ArchiveTreeContractVO2;
|
|
|
-import org.springblade.manager.vo.ArchiveTreeVO2;
|
|
|
-import org.springblade.manager.vo.WbsTreeContractVO6;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
+import org.springblade.manager.vo.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
@@ -70,6 +65,12 @@ public class ArchiveTreeContractSyncImpl {
|
|
|
|
|
|
private final ImageClassificationFileClient imageClassificationFileClient;
|
|
|
|
|
|
+ private final IImageClassificationConfigService imageClassificationConfigService;
|
|
|
+
|
|
|
+ private final IWbsTreeContractService wbsTreeContractService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 普通同步
|
|
|
*
|
|
@@ -800,58 +801,275 @@ public class ArchiveTreeContractSyncImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// /**
|
|
|
+// * 同步某个合同段的声像资料到归档
|
|
|
+// */
|
|
|
+// public void syncSoundImageData(Long projectId, ContractInfo contractInfo, ArchiveTreeContract archiveTreeContract) {
|
|
|
+// Long contractId = contractInfo.getId();
|
|
|
+//
|
|
|
+// log.info("同步声像文件,projectId:"+projectId+",contractId:"+contractId+",nodeId:"+archiveTreeContract.getId());
|
|
|
+//
|
|
|
+// //项目信息
|
|
|
+// ProjectInfo projectInfo = projectInfoService.getOne(projectId);
|
|
|
+//
|
|
|
+// //项目使用的wbs模板
|
|
|
+// Long lWbsId = projectInfo.getReferenceWbsTemplateId();
|
|
|
+//
|
|
|
+// //获取合同段wbs划分树,用来组织树
|
|
|
+// List<WbsTreeContractVO6> wbsTrees = contractInfoService.tree8(lWbsId.toString(), projectId.toString(), contractId.toString());
|
|
|
+// if (CollectionUtil.isEmpty(wbsTrees)) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// // wbs转换archive树形集合
|
|
|
+// List<ArchiveTreeContract> wbsCovertArchiveTreeContractList = new ArrayList<>();
|
|
|
+//
|
|
|
+// // wbs转换archive,并初始化值
|
|
|
+// getTreeList(AuthUtil.getTenantId(), wbsTrees.get(0), wbsCovertArchiveTreeContractList, archiveTreeContract, archiveTreeContract.getId());
|
|
|
+//
|
|
|
+// log.info("同步声像文件树 imageClassificationFileList :"+wbsCovertArchiveTreeContractList.size());
|
|
|
+//
|
|
|
+// //同步质检关联节点
|
|
|
+// syncNodes(wbsCovertArchiveTreeContractList, contractInfo, archiveTreeContract);
|
|
|
+// }
|
|
|
+
|
|
|
+ private void buildWbsContractTree(List<ArchiveSyncWbsVO> parentNode, Long parentId,String ancestors,Map<Long, List<ArchiveSyncWbsVO>> childMap,List<ArchiveSyncWbsVO> wbsRealList) {
|
|
|
+ if (parentNode != null && parentNode.size() > 0){
|
|
|
+ for (ArchiveSyncWbsVO parent : parentNode) {
|
|
|
+ List<ArchiveSyncWbsVO> childList = childMap.get(parent.getId());
|
|
|
+ parent.setId(parent.getPKeyId());
|
|
|
+ parent.setParentId(parentId);
|
|
|
+ parent.setAncestors(ancestors);
|
|
|
+ wbsRealList.add(parent);
|
|
|
+ if (childList != null && childList.size() > 0){
|
|
|
+ parent.setChildren(childList);
|
|
|
+ buildWbsContractTree(childList,parent.getPKeyId(),ancestors+","+parent.getPKeyId(),childMap,wbsRealList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 同步某个合同段的声像资料到归档
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
public void syncSoundImageData(Long projectId, ContractInfo contractInfo, ArchiveTreeContract archiveTreeContract) {
|
|
|
Long contractId = contractInfo.getId();
|
|
|
-
|
|
|
+ String tenantId = AuthUtil.getTenantId();
|
|
|
log.info("同步声像文件,projectId:"+projectId+",contractId:"+contractId+",nodeId:"+archiveTreeContract.getId());
|
|
|
-
|
|
|
- //项目信息
|
|
|
- ProjectInfo projectInfo = projectInfoService.getOne(projectId);
|
|
|
-
|
|
|
- //项目使用的wbs模板
|
|
|
- Long lWbsId = projectInfo.getReferenceWbsTemplateId();
|
|
|
-
|
|
|
- //获取合同段wbs划分树,用来组织树
|
|
|
- List<WbsTreeContractVO6> wbsTrees = contractInfoService.tree8(lWbsId.toString(), projectId.toString(), contractId.toString());
|
|
|
- if (CollectionUtil.isEmpty(wbsTrees)) {
|
|
|
- return;
|
|
|
+ //先删除声像资料节点下的所有节点与文件
|
|
|
+ archiveTreeContractMapper.removeImageNodeFile(archiveTreeContract.getContractId(),archiveTreeContract.getId());
|
|
|
+ archiveTreeContractMapper.removeImageNodeChild(archiveTreeContract.getContractId(),archiveTreeContract.getId());
|
|
|
+
|
|
|
+ //获取合同段下所有WBS节点
|
|
|
+ List<ArchiveSyncWbsVO> wbsAllList = wbsTreeContractService.getContractAllNode(contractId);
|
|
|
+ //按照父id分组
|
|
|
+ Map<Long, List<ArchiveSyncWbsVO>> childMap = wbsAllList.stream().collect(Collectors.groupingBy(ArchiveSyncWbsVO::getParentId));
|
|
|
+ List<ArchiveSyncWbsVO> rootNode = childMap.get(0L);
|
|
|
+ //合同段重置后实际的数据
|
|
|
+ List<ArchiveSyncWbsVO> wbsRealList = new ArrayList<>();
|
|
|
+ //递归生成树,生成树的同时,重置父节点和祖级节点
|
|
|
+ long start1 = System.currentTimeMillis();
|
|
|
+ buildWbsContractTree(rootNode,0L,"0",childMap,wbsRealList);
|
|
|
+ long start2 = System.currentTimeMillis();
|
|
|
+ System.out.println("递归时间"+(start2 - start1));
|
|
|
+ Map<Long,ArchiveSyncWbsVO> keyMap = new HashMap<>();
|
|
|
+ for (ArchiveSyncWbsVO vo : wbsRealList) {
|
|
|
+ keyMap.put(vo.getPKeyId(),vo);
|
|
|
}
|
|
|
|
|
|
- // wbs转换archive树形集合
|
|
|
- List<ArchiveTreeContract> wbsCovertArchiveTreeContractList = new ArrayList<>();
|
|
|
-
|
|
|
- // wbs转换archive,并初始化值
|
|
|
- getTreeList(AuthUtil.getTenantId(), wbsTrees.get(0), wbsCovertArchiveTreeContractList, archiveTreeContract, archiveTreeContract.getId());
|
|
|
+ //获取合同下声像资料所有文件
|
|
|
+ List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
|
|
|
+ Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
|
|
|
+
|
|
|
+ //获取声像资料分类,生成声像资料下级节点
|
|
|
+ List<ImageClassificationConfig> imageTypes = imageClassificationConfigService.selectByContractType(contractId,contractInfo.getContractType());
|
|
|
+
|
|
|
+ List<ArchiveTreeContract> addNode = new ArrayList<>();
|
|
|
+ List<ArchiveFile> addFile = new ArrayList<>();
|
|
|
+ //循环下级节点
|
|
|
+ for (ImageClassificationConfig imageType : imageTypes) {
|
|
|
+ //把分类生成为影像资料的下级节点
|
|
|
+ ArchiveTreeContract imageNode = createImageTypeNode(imageType,archiveTreeContract);
|
|
|
+ addNode.add(imageNode);
|
|
|
+ //如果当前分类下存在文件,则根据类型生成树,还是日期
|
|
|
+ List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
|
|
|
+ if (CollectionUtil.isEmpty(files)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (imageType.getStorageDirectoryFormat() == 1){
|
|
|
+ /**部位存储,获取分类下面的文件,只生成必要的树,没有则跳过 */
|
|
|
+ //获取出文件对应的WBS节点,查询出所有节点
|
|
|
+ List<Long> wbsPIds = files.stream().filter(l-> l.getWbsId() != null).map(l -> l.getWbsId()).distinct().collect(Collectors.toList());
|
|
|
+ Set<Long> wbsIds = new HashSet<>();
|
|
|
+ for (Long wbsId : wbsPIds) {
|
|
|
+ ArchiveSyncWbsVO vo = keyMap.get(wbsId);
|
|
|
+ if (vo != null){
|
|
|
+ wbsIds.add(vo.getId());
|
|
|
+ String[] ids = vo.getAncestors().split(",");
|
|
|
+ for (String id : ids) {
|
|
|
+ wbsIds.add(Long.valueOf(id));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ArchiveSyncWbsVO> currentNodes = new ArrayList<>();
|
|
|
+ for (Long wbsId : wbsIds) {
|
|
|
+ ArchiveSyncWbsVO vo = keyMap.get(wbsId);
|
|
|
+ if (vo != null) {
|
|
|
+ vo.setChildren(null);
|
|
|
+ currentNodes.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArchiveSyncWbsVO root = ForestNodeMerger.merge(currentNodes).stream()
|
|
|
+ .filter(f -> f.getParentId() == 0L).collect(Collectors.toList()).get(0);
|
|
|
+ //从根节点递归,递归过程中,同步生成档案树, 并且生成档案树id和wbsPid的映射,后面单独为文件设置
|
|
|
+ List<ArchiveTreeContract> currentTypeAdd = new ArrayList<>();
|
|
|
+ recursionCreateArchiveTree(root,currentTypeAdd,imageNode);
|
|
|
+ //转换影像文件为档案文件,并挂到档案树下面
|
|
|
+ Map<Long, Long> wbsPidMapArchiveId = currentTypeAdd.stream().collect(Collectors.toMap(l -> l.getExtKeyId(), l -> l.getId()));
|
|
|
+ addNode.addAll(currentTypeAdd);
|
|
|
+ List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
|
|
|
+ ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
|
|
|
+ return archiveFile;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ addFile.addAll(newArchiveFileList);
|
|
|
+ log.info("同步声像文件树-"+imageType.getClassfName()+": 节点"+currentNodes.size()+"个,节点下文件"+files.size()+"个");
|
|
|
+
|
|
|
+ }else if (imageType.getStorageDirectoryFormat() == 2){
|
|
|
+ /**日期存储,获取分类下面的文件,获取出所有的年,生成年节点,文件归到年节点下 */
|
|
|
+ //文件按照年份分组
|
|
|
+ Map<Integer, List<ImageClassificationFileDTO>> yearMap = files.stream().collect(Collectors.groupingBy(l -> l.getShootingTime().getYear()));
|
|
|
+ List<Integer> years = yearMap.keySet().stream().sorted().collect(Collectors.toList());
|
|
|
+ for (Integer year : years) {
|
|
|
+ //生成年份节点,并添加进集合
|
|
|
+ ArchiveTreeContract dateNode = createImageDateNode(imageNode, year);
|
|
|
+ addNode.add(dateNode);
|
|
|
+ //把文件设置进指定年份下
|
|
|
+ List<ImageClassificationFileDTO> fileDTOS = yearMap.get(year);
|
|
|
+ Map<Long, Long> wbsPidMapArchiveId = new HashMap<>();
|
|
|
+ for (ImageClassificationFileDTO fileDTO : fileDTOS) {
|
|
|
+ wbsPidMapArchiveId.put(fileDTO.getWbsId(),dateNode.getId());
|
|
|
+ }
|
|
|
+ List<ArchiveFile> newArchiveFileList = fileDTOS.stream().map(file -> {
|
|
|
+ ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
|
|
|
+ return archiveFile;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ addFile.addAll(newArchiveFileList);
|
|
|
|
|
|
- log.info("同步声像文件树 imageClassificationFileList :"+wbsCovertArchiveTreeContractList.size());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ log.error("同步声像文件:影像资料存储类型不在范围中");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- //同步质检关联节点
|
|
|
- syncNodes(wbsCovertArchiveTreeContractList, contractInfo, archiveTreeContract);
|
|
|
+ }
|
|
|
+ if (addNode.size() > 0){
|
|
|
+ addNode.stream().forEach(l->l.setTenantId(tenantId));
|
|
|
+ archiveTreeContractMapper.batchInsertArchiveTreeContract(addNode);
|
|
|
+ }
|
|
|
+ if (addFile.size() > 0){
|
|
|
+ archiveFileClient.addArchiveFile(addFile);
|
|
|
+ }
|
|
|
+// if (1==1){
|
|
|
+// throw new org.springblade.core.log.exception.ServiceException("111");
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * 将树形节点对象转换为普通的list集合
|
|
|
+ * 质检影像资料 转换为 档案文件
|
|
|
*/
|
|
|
- public void getTreeList(String tenantId, WbsTreeContractVO6 tree, List<ArchiveTreeContract> wbsCovertArchiveTreeContractList, ArchiveTreeContract archiveTreeContract, Long archiveTreeContractId) {
|
|
|
- if (ObjectUtil.isEmpty(tree)) {
|
|
|
- return;
|
|
|
+ private ArchiveFile imageFileCovertArchiveFile(ImageClassificationFileDTO file,Map<Long, Long> wbsPidMapArchiveId)
|
|
|
+ {
|
|
|
+ ArchiveFile archiveFile = new ArchiveFile();
|
|
|
+ archiveFile.setId(SnowFlakeUtil.getId());
|
|
|
+ archiveFile.setProjectId(String.valueOf(file.getProjectId()));
|
|
|
+ archiveFile.setContractId(String.valueOf(file.getContractId()));
|
|
|
+ archiveFile.setNodeId(String.valueOf(wbsPidMapArchiveId.get(file.getWbsId())));
|
|
|
+ archiveFile.setFileName(file.getTitle());
|
|
|
+ archiveFile.setFileTime(file.getUploadTime());
|
|
|
+ archiveFile.setFileUrl(file.getImageUrl());
|
|
|
+ // 根据type判断,设置pdfUrl, 1=视频格式,取原本的视频地址就好,2=图片格式,就取合并后的pdfUrl
|
|
|
+ if(file.getType() == 1){
|
|
|
+ archiveFile.setPdfFileUrl(file.getImageUrl());
|
|
|
+ }else{
|
|
|
+ archiveFile.setPdfFileUrl(StringUtils.isNotEmpty(file.getMargePdfUrl()) ? file.getMargePdfUrl() : file.getPdfUrl());
|
|
|
+ }
|
|
|
+ archiveFile.setFilePage(file.getFilePage());
|
|
|
+ archiveFile.setIsApproval(0);
|
|
|
+ archiveFile.setIsCertification(1);
|
|
|
+ archiveFile.setIsNeedCertification(0);
|
|
|
+ archiveFile.setDutyUser(file.getShootingUser());
|
|
|
+ archiveFile.setCreateUser(file.getCreateUser());
|
|
|
+ archiveFile.setCreateDept(file.getCreateDept());
|
|
|
+ archiveFile.setCreateTime(file.getCreateTime());
|
|
|
+ archiveFile.setUpdateUser(file.getUpdateUser());
|
|
|
+ archiveFile.setUpdateTime(file.getUpdateTime());
|
|
|
+ archiveFile.setStatus(0);
|
|
|
+ archiveFile.setIsDeleted(0);
|
|
|
+ archiveFile.setFileType(Long.valueOf(file.getType()));
|
|
|
+ archiveFile.setFilmingTime(file.getShootingTime());
|
|
|
+ archiveFile.setFilmingorTime(file.getShootingTime());
|
|
|
+ archiveFile.setPicCode(file.getPhotoCode());
|
|
|
+ archiveFile.setFilmCode(file.getFilmCode());
|
|
|
+ archiveFile.setReferCode(file.getSeeAlsoCode());
|
|
|
+ archiveFile.setWidth(file.getFileWidth());
|
|
|
+ archiveFile.setHeight(file.getFileHeight());
|
|
|
+ // 创建 LocalDateTime 时间爱你
|
|
|
+ LocalDateTime localDateTime = new Date().toInstant()
|
|
|
+ .atZone(ZoneId.systemDefault())
|
|
|
+ .toLocalDateTime();
|
|
|
+ archiveFile.setFtime(localDateTime);
|
|
|
+ archiveFile.setUtime(localDateTime);
|
|
|
+ archiveFile.setSort(0);
|
|
|
+ archiveFile.setPageNum(String.valueOf(file.getFilePage()));
|
|
|
+ if (StringUtils.isNotBlank(file.getFileSize())) {
|
|
|
+ archiveFile.setFileSize(convertSizeToBytes(file.getFileSize()));
|
|
|
}
|
|
|
- // wbs树转archive树
|
|
|
- ArchiveTreeContract archiveTreeContractTemp = wbsTreeContractCovertArchiveTreeContract(tenantId, tree, archiveTreeContract, archiveTreeContractId);
|
|
|
- wbsCovertArchiveTreeContractList.add(archiveTreeContractTemp);
|
|
|
+ archiveFile.setSourceType(1);
|
|
|
+ archiveFile.setIsElement(0);
|
|
|
+ archiveFile.setRectification(0);
|
|
|
+ archiveFile.setMWbsTreeContractPKeyId(file.getWbsId());
|
|
|
+ archiveFile.setUImageClassificationFileId(file.getId());
|
|
|
+ archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
|
|
|
+ archiveFile.setNodeTreeStructure(file.getStorageDirectoryFormat());
|
|
|
+ archiveFile.setDateName(DateFormatUtils.format(file.getCreateTime(), "yyyyMMdd"));
|
|
|
+ return archiveFile;
|
|
|
+ }
|
|
|
|
|
|
+ private void recursionCreateArchiveTree(ArchiveSyncWbsVO rootNode, List<ArchiveTreeContract> addNode, ArchiveTreeContract archiveTreeContract) {
|
|
|
+ ArchiveTreeContract node = createImageWbsNode(rootNode, archiveTreeContract);
|
|
|
+ addNode.add(node);
|
|
|
// 循环遍历,转换树对象
|
|
|
- List<WbsTreeContractVO6> childrenList = tree.getChildren();
|
|
|
+ List<ArchiveSyncWbsVO> childrenList = rootNode.getChildren();
|
|
|
if (childrenList != null) {
|
|
|
- for (WbsTreeContractVO6 child : childrenList) {
|
|
|
- getTreeList(tenantId, child, wbsCovertArchiveTreeContractList, archiveTreeContractTemp, archiveTreeContractId);
|
|
|
+ for (ArchiveSyncWbsVO child : childrenList) {
|
|
|
+ recursionCreateArchiveTree(child, addNode, node);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// /**
|
|
|
+// * 将树形节点对象转换为普通的list集合
|
|
|
+// */
|
|
|
+// public void getTreeList(String tenantId, WbsTreeContractVO6 tree, List<ArchiveTreeContract> wbsCovertArchiveTreeContractList, ArchiveTreeContract archiveTreeContract, Long archiveTreeContractId) {
|
|
|
+// if (ObjectUtil.isEmpty(tree)) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// // wbs树转archive树
|
|
|
+// ArchiveTreeContract archiveTreeContractTemp = wbsTreeContractCovertArchiveTreeContract(tenantId, tree, archiveTreeContract, archiveTreeContractId);
|
|
|
+// wbsCovertArchiveTreeContractList.add(archiveTreeContractTemp);
|
|
|
+//
|
|
|
+// // 循环遍历,转换树对象
|
|
|
+// List<WbsTreeContractVO6> childrenList = tree.getChildren();
|
|
|
+// if (childrenList != null) {
|
|
|
+// for (WbsTreeContractVO6 child : childrenList) {
|
|
|
+// getTreeList(tenantId, child, wbsCovertArchiveTreeContractList, archiveTreeContractTemp, archiveTreeContractId);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
* 将wbs树初始化为归档树
|
|
|
*/
|
|
@@ -893,192 +1111,280 @@ public class ArchiveTreeContractSyncImpl {
|
|
|
return archiveTreeContractTemp;
|
|
|
}
|
|
|
|
|
|
- private void syncNodes(List<ArchiveTreeContract> wbsCovertArchiveTreeContractList,
|
|
|
- ContractInfo contractInfo, ArchiveTreeContract archiveTreeContract) {
|
|
|
- Long contractId = contractInfo.getId();
|
|
|
-
|
|
|
- // 获取关联节点
|
|
|
- List<ArchiveTreeContract> associatedNodes = Arrays.asList(archiveTreeContract);
|
|
|
-
|
|
|
- log.info("同步声像文件树节点 syncNodes:"+associatedNodes.size());
|
|
|
-
|
|
|
- // 新增的归档树聚合
|
|
|
- List<ArchiveTreeContract> saveArchiveTreeContractList = new ArrayList<>();
|
|
|
- // 新增的归档文件集合
|
|
|
- List<ArchiveFile> saveArchiveFileList = new ArrayList<>();
|
|
|
- // 修改的归档树聚合
|
|
|
- List<Map> updateArchiveTreeContractList = new ArrayList<>();
|
|
|
- // 修改的归档文件集合
|
|
|
- List<ArchiveFile> updateArchiveFileList = new ArrayList<>();
|
|
|
- // 删除的归档树聚合
|
|
|
- List<ArchiveTreeContract> deleteArchiveTreeContractList = new ArrayList<>();
|
|
|
- // 删除的归档文件集合
|
|
|
- List<ArchiveFile> deleteArchiveFileList = new ArrayList<>();
|
|
|
-
|
|
|
- for (ArchiveTreeContract node : associatedNodes) {
|
|
|
- log.info("同步声像文件树节点 syncNode:" + node.getId() + "-" + node.getNodeName());
|
|
|
-
|
|
|
- /***同步树-开始*/
|
|
|
- // 获取该合同段下的wbs节点
|
|
|
- List<ArchiveTreeContract> originalArchiveTreeContractList = getArchiveTreeContractsWbs(contractId, node.getId(),null);
|
|
|
-
|
|
|
- // 树形map
|
|
|
- Map<Long, ArchiveTreeContract> originalArchiveTreeContractMap = buildNodeMap(originalArchiveTreeContractList);
|
|
|
-
|
|
|
- // 转换类型
|
|
|
- List<ArchiveTreeContractVO> archiveTreeContractVOList = wbsCovertArchiveTreeContractList.stream().map(tree -> {
|
|
|
- ArchiveTreeContractVO vo = new ArchiveTreeContractVO();
|
|
|
- BeanUtils.copyProperties(tree, vo);
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // list转换为树形
|
|
|
- List<ArchiveTreeContractVO> mergeList = org.springblade.core.tool.node.ForestNodeMerger.merge(archiveTreeContractVOList);
|
|
|
-
|
|
|
- // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
- archiveAndOldTreeMergeData(mergeList, originalArchiveTreeContractMap, TreeStructureEnum.ORDINARY_TREE);
|
|
|
-
|
|
|
- // 重新刷新整个树结构(刷新整个树的父子节点id)
|
|
|
- for (ArchiveTreeContractVO archiveTreeContractVO : mergeList) {
|
|
|
- refreshTreeStructure(archiveTreeContractVO, node.getId(), node.getAncestors());
|
|
|
- }
|
|
|
-
|
|
|
- // 将树转换为list
|
|
|
- List<ArchiveTreeContractVO> archiveTreeContractVOTempList = new ArrayList<>();
|
|
|
- ForestNodeMerger.getTreeList(mergeList.get(0), archiveTreeContractVOTempList);
|
|
|
-
|
|
|
- List<ArchiveTreeContract> newArchiveTreeContractList = archiveTreeContractVOTempList.stream().map(vo -> {
|
|
|
- ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
- BeanUtils.copyProperties(vo, archiveTreeContractTemp);
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 树形map
|
|
|
- Map<Long, ArchiveTreeContract> newArchiveTreeContractMap = buildNodeMap(newArchiveTreeContractList);
|
|
|
-
|
|
|
- // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
- diffTrees(originalArchiveTreeContractList, newArchiveTreeContractList, originalArchiveTreeContractMap,
|
|
|
- newArchiveTreeContractMap, saveArchiveTreeContractList, deleteArchiveTreeContractList, updateArchiveTreeContractList);
|
|
|
- /***同步树-结束*/
|
|
|
-
|
|
|
- /***同步树型文件数据准备-开始*/
|
|
|
- // 根据合同段id查询声像文件
|
|
|
- List<ImageClassificationFileDTO> imageClassificationFileList = getImageClassificationFileListByContractId(contractId);
|
|
|
-
|
|
|
- // 声像文件转换
|
|
|
- List<ArchiveFile> newArchiveFileList = imageClassificationFileList.stream().map(file -> {
|
|
|
- ArchiveFile archiveFile = imageClassificationFileCovertArchiveFile(file, node, newArchiveTreeContractMap);
|
|
|
- return archiveFile;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 查询合同段下的声像文件
|
|
|
- List<ArchiveFile> originalArchiveFileList = archiveFileClient.getListByContractIdAndArchiveFileStorageType(contractId, StorageTypeEnum.SOUND_IMAGE.getCode());
|
|
|
-
|
|
|
- // 构件原始文件TreeMap
|
|
|
- Map<Long, ArchiveFile> originalArchiveFileMap = buildArchiveFileMap(originalArchiveFileList);
|
|
|
-
|
|
|
- // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
- originalAndNewArchiveFileMergeData(newArchiveFileList, originalArchiveFileMap);
|
|
|
-
|
|
|
- // 构件新文件TreeMap
|
|
|
- Map<Long, ArchiveFile> newArchiveFileMap = buildArchiveFileMap(newArchiveFileList);
|
|
|
-
|
|
|
- // 将声像文件集合遍历,分为时间储存和树形储存两个集合
|
|
|
- List<ArchiveFile> newArchiveFileTreeList = new ArrayList<>();
|
|
|
- List<ArchiveFile> newArchiveFileDateList = new ArrayList<>();
|
|
|
- for (ArchiveFile archiveFile : newArchiveFileList) {
|
|
|
- if(archiveFile.getNodeTreeStructure() == 1) {
|
|
|
- newArchiveFileTreeList.add(archiveFile);
|
|
|
- }else if(archiveFile.getNodeTreeStructure() == 2) {
|
|
|
- newArchiveFileDateList.add(archiveFile);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 将声像文件集合遍历,分为时间储存和树形储存两个集合
|
|
|
- List<ArchiveFile> originalArchiveFileTreeList = new ArrayList<>();
|
|
|
- List<ArchiveFile> originalArchiveFileDateList = new ArrayList<>();
|
|
|
- for (ArchiveFile archiveFile : originalArchiveFileList) {
|
|
|
- if(archiveFile.getNodeTreeStructure() == 1) {
|
|
|
- originalArchiveFileTreeList.add(archiveFile);
|
|
|
- }else if(archiveFile.getNodeTreeStructure() == 2) {
|
|
|
- originalArchiveFileDateList.add(archiveFile);
|
|
|
- }
|
|
|
- }
|
|
|
- /***同步树型文件数据准备-结束*/
|
|
|
-
|
|
|
- /**同步树形文件-开始**/
|
|
|
- // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
- diffFiles(originalArchiveFileTreeList, newArchiveFileTreeList, originalArchiveFileMap, newArchiveFileMap,
|
|
|
- saveArchiveFileList, deleteArchiveFileList, updateArchiveFileList, newArchiveTreeContractMap, TreeStructureEnum.ORDINARY_TREE);
|
|
|
- /**同步树形文件-结束**/
|
|
|
-
|
|
|
- /**同步时间树-开始**/
|
|
|
- // 获取该合同段下的时间型节点
|
|
|
- List<ArchiveTreeContract> originalDateArchiveTreeContractList = getArchiveTreeContractsByTreeStructure(contractId, node.getId(), TreeStructureEnum.DATE_TREE);
|
|
|
-
|
|
|
- // 树形map
|
|
|
- Map<Long, ArchiveTreeContract> originalDateArchiveTreeContractMap = buildDateMap(originalDateArchiveTreeContractList);
|
|
|
-
|
|
|
- // 将最新文件的时间取出,创建时间树
|
|
|
- List<String> dateList = newArchiveFileDateList.stream().map(archiveFile -> {
|
|
|
- String format = DateFormatUtils.format(archiveFile.getCreateTime(), "yyyy-MM-dd");
|
|
|
- return format;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ /**
|
|
|
+ * 档案同步质检影像资料时,为影像资料节点下级分类节点,创建日期节点
|
|
|
+ * 传入年份名称
|
|
|
+ */
|
|
|
+ public ArchiveTreeContract createImageDateNode(ArchiveTreeContract archiveTreeContract,Integer year){
|
|
|
+ ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
+ //设置基本信息
|
|
|
+ archiveTreeContractTemp.setId(SnowFlakeUtil.getId());
|
|
|
+ archiveTreeContractTemp.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archiveTreeContractTemp.setProjectId(archiveTreeContract.getProjectId());
|
|
|
+ archiveTreeContractTemp.setContractId(archiveTreeContract.getContractId());
|
|
|
+ archiveTreeContractTemp.setParentId(archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setAncestors(archiveTreeContract.getAncestors()+","+archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setNodeName(year+"");
|
|
|
+ archiveTreeContractTemp.setNodeType(1);
|
|
|
+ archiveTreeContractTemp.setFullName(year+"");
|
|
|
+ archiveTreeContractTemp.setStatus(1);
|
|
|
+ archiveTreeContractTemp.setIsDeleted(0);
|
|
|
+ //设置关联
|
|
|
+ archiveTreeContractTemp.setExtType(1);
|
|
|
+ archiveTreeContractTemp.setIsStorageNode(0);
|
|
|
+ archiveTreeContractTemp.setPostType(archiveTreeContract.getPostType());
|
|
|
+ archiveTreeContractTemp.setProjectType(archiveTreeContract.getProjectType());
|
|
|
+ archiveTreeContractTemp.setStorageType(archiveTreeContract.getStorageType());
|
|
|
+ archiveTreeContractTemp.setTreeStructure(TreeStructureEnum.ORDINARY_TREE.getCode());
|
|
|
+ return archiveTreeContractTemp;
|
|
|
+ }
|
|
|
|
|
|
- // 转时间树
|
|
|
- List<TreeVoTwo> dateTreeList = YearTreeUtils.yearMonthDayTree(dateList, "DESC");
|
|
|
+ /**
|
|
|
+ * 档案同步质检影像资料时,为影像资料节点下级创建分类节点
|
|
|
+ * 传入分类名称
|
|
|
+ */
|
|
|
+ public ArchiveTreeContract createImageTypeNode(ImageClassificationConfig imageType,ArchiveTreeContract archiveTreeContract){
|
|
|
+ ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
+ //设置基本信息
|
|
|
+ archiveTreeContractTemp.setId(SnowFlakeUtil.getId());
|
|
|
+ archiveTreeContractTemp.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archiveTreeContractTemp.setProjectId(archiveTreeContract.getProjectId());
|
|
|
+ archiveTreeContractTemp.setContractId(archiveTreeContract.getContractId());
|
|
|
+ archiveTreeContractTemp.setParentId(archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setAncestors(archiveTreeContract.getAncestors()+","+archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setNodeName(imageType.getClassfName());
|
|
|
+ archiveTreeContractTemp.setNodeType(1);
|
|
|
+ archiveTreeContractTemp.setFullName(imageType.getClassfName());
|
|
|
+ archiveTreeContractTemp.setStatus(1);
|
|
|
+ archiveTreeContractTemp.setIsDeleted(0);
|
|
|
+ //设置关联
|
|
|
+ archiveTreeContractTemp.setExtType(1);
|
|
|
+ archiveTreeContractTemp.setIsStorageNode(0);
|
|
|
+ archiveTreeContractTemp.setPostType(archiveTreeContract.getPostType());
|
|
|
+ archiveTreeContractTemp.setProjectType(archiveTreeContract.getProjectType());
|
|
|
+ archiveTreeContractTemp.setStorageType(archiveTreeContract.getStorageType());
|
|
|
+ archiveTreeContractTemp.setTreeStructure(TreeStructureEnum.ORDINARY_TREE.getCode());
|
|
|
+ return archiveTreeContractTemp;
|
|
|
+ }
|
|
|
|
|
|
- // date转换archive树形集合
|
|
|
- List<ArchiveTreeContractVO> dateCovertArchiveTreeContractVoList = new ArrayList<>();
|
|
|
+ /**
|
|
|
+ * 档案同步质检影像资料时,为影像资料节点下分类节点创建WBS树
|
|
|
+ */
|
|
|
+ public ArchiveTreeContract createImageWbsNode(ArchiveSyncWbsVO rootNode,ArchiveTreeContract archiveTreeContract){
|
|
|
+ ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
+ //设置基本信息
|
|
|
+ archiveTreeContractTemp.setId(SnowFlakeUtil.getId());
|
|
|
+ archiveTreeContractTemp.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archiveTreeContractTemp.setProjectId(archiveTreeContract.getProjectId());
|
|
|
+ archiveTreeContractTemp.setContractId(archiveTreeContract.getContractId());
|
|
|
+ archiveTreeContractTemp.setParentId(archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setAncestors(archiveTreeContract.getAncestors()+","+archiveTreeContract.getId());
|
|
|
+ archiveTreeContractTemp.setNodeName(rootNode.getNodeName());
|
|
|
+ archiveTreeContractTemp.setNodeType(1);
|
|
|
+ archiveTreeContractTemp.setFullName(rootNode.getFullName());
|
|
|
+ archiveTreeContractTemp.setStatus(1);
|
|
|
+ archiveTreeContractTemp.setIsDeleted(0);
|
|
|
+ //设置关联
|
|
|
+ archiveTreeContractTemp.setExtType(1);
|
|
|
+ archiveTreeContractTemp.setExtKeyId(rootNode.getPKeyId());
|
|
|
+ archiveTreeContractTemp.setSort(rootNode.getSort());
|
|
|
+ archiveTreeContractTemp.setPostType(archiveTreeContract.getPostType());
|
|
|
+ archiveTreeContractTemp.setProjectType(archiveTreeContract.getProjectType());
|
|
|
+ archiveTreeContractTemp.setStorageType(archiveTreeContract.getStorageType());
|
|
|
+ archiveTreeContractTemp.setTreeStructure(TreeStructureEnum.ORDINARY_TREE.getCode());
|
|
|
+ return archiveTreeContractTemp;
|
|
|
+ }
|
|
|
|
|
|
- // date转换archive,并初始化值
|
|
|
- getTreeList(AuthUtil.getTenantId(), dateTreeList, dateCovertArchiveTreeContractVoList, archiveTreeContract, archiveTreeContract.getId());
|
|
|
|
|
|
- // list转换为树形
|
|
|
- List<ArchiveTreeContractVO> mergeDateList = org.springblade.core.tool.node.ForestNodeMerger.merge(dateCovertArchiveTreeContractVoList);
|
|
|
|
|
|
- // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
- archiveAndOldTreeMergeData(mergeDateList, originalDateArchiveTreeContractMap, TreeStructureEnum.DATE_TREE);
|
|
|
|
|
|
- // 重新刷新整个树结构(刷新整个树的父子节点id)
|
|
|
- for (ArchiveTreeContractVO dateArchiveTreeContractVO : mergeDateList) {
|
|
|
- refreshTreeStructure(dateArchiveTreeContractVO, node.getId(), node.getAncestors());
|
|
|
- }
|
|
|
|
|
|
- // 将树转换为list
|
|
|
- List<ArchiveTreeContractVO> dateArchiveTreeContractVOTempList = new ArrayList<>();
|
|
|
- for (ArchiveTreeContractVO archiveTreeContractVO : mergeDateList) {
|
|
|
- ForestNodeMerger.getTreeList(archiveTreeContractVO, dateArchiveTreeContractVOTempList);
|
|
|
- }
|
|
|
- // 转实体类
|
|
|
- List<ArchiveTreeContract> newDateArchiveTreeContractList = dateArchiveTreeContractVOTempList.stream().map(vo -> {
|
|
|
- ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
- BeanUtils.copyProperties(vo, archiveTreeContractTemp);
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 树形map
|
|
|
- Map<Long, ArchiveTreeContract> newDateArchiveTreeContractMap = buildDateMap(newDateArchiveTreeContractList);
|
|
|
-
|
|
|
- // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
- diffDateTrees(originalDateArchiveTreeContractList, newDateArchiveTreeContractList, originalDateArchiveTreeContractMap,
|
|
|
- newDateArchiveTreeContractMap, saveArchiveTreeContractList, deleteArchiveTreeContractList, updateArchiveTreeContractList);
|
|
|
- /**同步时间树-结束**/
|
|
|
-
|
|
|
- /**同步时间树形文件-开始**/
|
|
|
- // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
- diffFiles(originalArchiveFileDateList, newArchiveFileDateList, originalArchiveFileMap, newArchiveFileMap,
|
|
|
- saveArchiveFileList, deleteArchiveFileList, updateArchiveFileList, newDateArchiveTreeContractMap, TreeStructureEnum.DATE_TREE);
|
|
|
- /**同步时间树形文件-结束**/
|
|
|
-
|
|
|
- /**统一刷新树与文件**/
|
|
|
- // 刷新树
|
|
|
- refreshArchiveTreeContract(saveArchiveTreeContractList, updateArchiveTreeContractList, deleteArchiveTreeContractList);
|
|
|
-
|
|
|
- // 刷新文件
|
|
|
- refreshArchiveFile(saveArchiveFileList, updateArchiveFileList, deleteArchiveFileList);
|
|
|
- }
|
|
|
- }
|
|
|
+// private void syncNodes(List<ArchiveTreeContract> wbsCovertArchiveTreeContractList,
|
|
|
+// ContractInfo contractInfo, ArchiveTreeContract archiveTreeContract) {
|
|
|
+// Long contractId = contractInfo.getId();
|
|
|
+//
|
|
|
+// // 获取关联节点
|
|
|
+// List<ArchiveTreeContract> associatedNodes = Arrays.asList(archiveTreeContract);
|
|
|
+//
|
|
|
+// log.info("同步声像文件树节点 syncNodes:"+associatedNodes.size());
|
|
|
+//
|
|
|
+// // 新增的归档树聚合
|
|
|
+// List<ArchiveTreeContract> saveArchiveTreeContractList = new ArrayList<>();
|
|
|
+// // 新增的归档文件集合
|
|
|
+// List<ArchiveFile> saveArchiveFileList = new ArrayList<>();
|
|
|
+// // 修改的归档树聚合
|
|
|
+// List<Map> updateArchiveTreeContractList = new ArrayList<>();
|
|
|
+// // 修改的归档文件集合
|
|
|
+// List<ArchiveFile> updateArchiveFileList = new ArrayList<>();
|
|
|
+// // 删除的归档树聚合
|
|
|
+// List<ArchiveTreeContract> deleteArchiveTreeContractList = new ArrayList<>();
|
|
|
+// // 删除的归档文件集合
|
|
|
+// List<ArchiveFile> deleteArchiveFileList = new ArrayList<>();
|
|
|
+//
|
|
|
+// for (ArchiveTreeContract node : associatedNodes) {
|
|
|
+// log.info("同步声像文件树节点 syncNode:" + node.getId() + "-" + node.getNodeName());
|
|
|
+//
|
|
|
+// /***同步树-开始*/
|
|
|
+// // 获取该合同段下的wbs节点
|
|
|
+// List<ArchiveTreeContract> originalArchiveTreeContractList = getArchiveTreeContractsWbs(contractId, node.getId(),null);
|
|
|
+//
|
|
|
+// // 树形map
|
|
|
+// Map<Long, ArchiveTreeContract> originalArchiveTreeContractMap = buildNodeMap(originalArchiveTreeContractList);
|
|
|
+//
|
|
|
+// // 转换类型
|
|
|
+// List<ArchiveTreeContractVO> archiveTreeContractVOList = wbsCovertArchiveTreeContractList.stream().map(tree -> {
|
|
|
+// ArchiveTreeContractVO vo = new ArchiveTreeContractVO();
|
|
|
+// BeanUtils.copyProperties(tree, vo);
|
|
|
+// return vo;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // list转换为树形
|
|
|
+// List<ArchiveTreeContractVO> mergeList = org.springblade.core.tool.node.ForestNodeMerger.merge(archiveTreeContractVOList);
|
|
|
+//
|
|
|
+// // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
+// archiveAndOldTreeMergeData(mergeList, originalArchiveTreeContractMap, TreeStructureEnum.ORDINARY_TREE);
|
|
|
+//
|
|
|
+// // 重新刷新整个树结构(刷新整个树的父子节点id)
|
|
|
+// for (ArchiveTreeContractVO archiveTreeContractVO : mergeList) {
|
|
|
+// refreshTreeStructure(archiveTreeContractVO, node.getId(), node.getAncestors());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 将树转换为list
|
|
|
+// List<ArchiveTreeContractVO> archiveTreeContractVOTempList = new ArrayList<>();
|
|
|
+// ForestNodeMerger.getTreeList(mergeList.get(0), archiveTreeContractVOTempList);
|
|
|
+//
|
|
|
+// List<ArchiveTreeContract> newArchiveTreeContractList = archiveTreeContractVOTempList.stream().map(vo -> {
|
|
|
+// ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
+// BeanUtils.copyProperties(vo, archiveTreeContractTemp);
|
|
|
+// return vo;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 树形map
|
|
|
+// Map<Long, ArchiveTreeContract> newArchiveTreeContractMap = buildNodeMap(newArchiveTreeContractList);
|
|
|
+//
|
|
|
+// // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
+// diffTrees(originalArchiveTreeContractList, newArchiveTreeContractList, originalArchiveTreeContractMap,
|
|
|
+// newArchiveTreeContractMap, saveArchiveTreeContractList, deleteArchiveTreeContractList, updateArchiveTreeContractList);
|
|
|
+// /***同步树-结束*/
|
|
|
+//
|
|
|
+// /***同步树型文件数据准备-开始*/
|
|
|
+// // 根据合同段id查询声像文件
|
|
|
+// List<ImageClassificationFileDTO> imageClassificationFileList = getImageClassificationFileListByContractId(contractId);
|
|
|
+//
|
|
|
+// // 声像文件转换
|
|
|
+// List<ArchiveFile> newArchiveFileList = imageClassificationFileList.stream().map(file -> {
|
|
|
+// ArchiveFile archiveFile = imageClassificationFileCovertArchiveFile(file, node, newArchiveTreeContractMap);
|
|
|
+// return archiveFile;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 查询合同段下的声像文件
|
|
|
+// List<ArchiveFile> originalArchiveFileList = archiveFileClient.getListByContractIdAndArchiveFileStorageType(contractId, StorageTypeEnum.SOUND_IMAGE.getCode());
|
|
|
+//
|
|
|
+// // 构件原始文件TreeMap
|
|
|
+// Map<Long, ArchiveFile> originalArchiveFileMap = buildArchiveFileMap(originalArchiveFileList);
|
|
|
+//
|
|
|
+// // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
+// originalAndNewArchiveFileMergeData(newArchiveFileList, originalArchiveFileMap);
|
|
|
+//
|
|
|
+// // 构件新文件TreeMap
|
|
|
+// Map<Long, ArchiveFile> newArchiveFileMap = buildArchiveFileMap(newArchiveFileList);
|
|
|
+//
|
|
|
+// // 将声像文件集合遍历,分为时间储存和树形储存两个集合
|
|
|
+// List<ArchiveFile> newArchiveFileTreeList = new ArrayList<>();
|
|
|
+// List<ArchiveFile> newArchiveFileDateList = new ArrayList<>();
|
|
|
+// for (ArchiveFile archiveFile : newArchiveFileList) {
|
|
|
+// if(archiveFile.getNodeTreeStructure() == 1) {
|
|
|
+// newArchiveFileTreeList.add(archiveFile);
|
|
|
+// }else if(archiveFile.getNodeTreeStructure() == 2) {
|
|
|
+// newArchiveFileDateList.add(archiveFile);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 将声像文件集合遍历,分为时间储存和树形储存两个集合
|
|
|
+// List<ArchiveFile> originalArchiveFileTreeList = new ArrayList<>();
|
|
|
+// List<ArchiveFile> originalArchiveFileDateList = new ArrayList<>();
|
|
|
+// for (ArchiveFile archiveFile : originalArchiveFileList) {
|
|
|
+// if(archiveFile.getNodeTreeStructure() == 1) {
|
|
|
+// originalArchiveFileTreeList.add(archiveFile);
|
|
|
+// }else if(archiveFile.getNodeTreeStructure() == 2) {
|
|
|
+// originalArchiveFileDateList.add(archiveFile);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// /***同步树型文件数据准备-结束*/
|
|
|
+//
|
|
|
+// /**同步树形文件-开始**/
|
|
|
+// // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
+// diffFiles(originalArchiveFileTreeList, newArchiveFileTreeList, originalArchiveFileMap, newArchiveFileMap,
|
|
|
+// saveArchiveFileList, deleteArchiveFileList, updateArchiveFileList, newArchiveTreeContractMap, TreeStructureEnum.ORDINARY_TREE);
|
|
|
+// /**同步树形文件-结束**/
|
|
|
+//
|
|
|
+// /**同步时间树-开始**/
|
|
|
+// // 获取该合同段下的时间型节点
|
|
|
+// List<ArchiveTreeContract> originalDateArchiveTreeContractList = getArchiveTreeContractsByTreeStructure(contractId, node.getId(), TreeStructureEnum.DATE_TREE);
|
|
|
+//
|
|
|
+// // 树形map
|
|
|
+// Map<Long, ArchiveTreeContract> originalDateArchiveTreeContractMap = buildDateMap(originalDateArchiveTreeContractList);
|
|
|
+//
|
|
|
+// // 将最新文件的时间取出,创建时间树
|
|
|
+// List<String> dateList = newArchiveFileDateList.stream().map(archiveFile -> {
|
|
|
+// String format = DateFormatUtils.format(archiveFile.getCreateTime(), "yyyy-MM-dd");
|
|
|
+// return format;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 转时间树
|
|
|
+// List<TreeVoTwo> dateTreeList = YearTreeUtils.yearMonthDayTree(dateList, "DESC");
|
|
|
+//
|
|
|
+// // date转换archive树形集合
|
|
|
+// List<ArchiveTreeContractVO> dateCovertArchiveTreeContractVoList = new ArrayList<>();
|
|
|
+//
|
|
|
+// // date转换archive,并初始化值
|
|
|
+// getTreeList(AuthUtil.getTenantId(), dateTreeList, dateCovertArchiveTreeContractVoList, archiveTreeContract, archiveTreeContract.getId());
|
|
|
+//
|
|
|
+// // list转换为树形
|
|
|
+// List<ArchiveTreeContractVO> mergeDateList = org.springblade.core.tool.node.ForestNodeMerger.merge(dateCovertArchiveTreeContractVoList);
|
|
|
+//
|
|
|
+// // 与已有数据做合并(目的是将已有的树信息复制到对应的树)
|
|
|
+// archiveAndOldTreeMergeData(mergeDateList, originalDateArchiveTreeContractMap, TreeStructureEnum.DATE_TREE);
|
|
|
+//
|
|
|
+// // 重新刷新整个树结构(刷新整个树的父子节点id)
|
|
|
+// for (ArchiveTreeContractVO dateArchiveTreeContractVO : mergeDateList) {
|
|
|
+// refreshTreeStructure(dateArchiveTreeContractVO, node.getId(), node.getAncestors());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 将树转换为list
|
|
|
+// List<ArchiveTreeContractVO> dateArchiveTreeContractVOTempList = new ArrayList<>();
|
|
|
+// for (ArchiveTreeContractVO archiveTreeContractVO : mergeDateList) {
|
|
|
+// ForestNodeMerger.getTreeList(archiveTreeContractVO, dateArchiveTreeContractVOTempList);
|
|
|
+// }
|
|
|
+// // 转实体类
|
|
|
+// List<ArchiveTreeContract> newDateArchiveTreeContractList = dateArchiveTreeContractVOTempList.stream().map(vo -> {
|
|
|
+// ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
|
|
|
+// BeanUtils.copyProperties(vo, archiveTreeContractTemp);
|
|
|
+// return vo;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 树形map
|
|
|
+// Map<Long, ArchiveTreeContract> newDateArchiveTreeContractMap = buildDateMap(newDateArchiveTreeContractList);
|
|
|
+//
|
|
|
+// // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
+// diffDateTrees(originalDateArchiveTreeContractList, newDateArchiveTreeContractList, originalDateArchiveTreeContractMap,
|
|
|
+// newDateArchiveTreeContractMap, saveArchiveTreeContractList, deleteArchiveTreeContractList, updateArchiveTreeContractList);
|
|
|
+// /**同步时间树-结束**/
|
|
|
+//
|
|
|
+// /**同步时间树形文件-开始**/
|
|
|
+// // 取两个树形集合中的差异,并输出新增、修改、删除三个集合
|
|
|
+// diffFiles(originalArchiveFileDateList, newArchiveFileDateList, originalArchiveFileMap, newArchiveFileMap,
|
|
|
+// saveArchiveFileList, deleteArchiveFileList, updateArchiveFileList, newDateArchiveTreeContractMap, TreeStructureEnum.DATE_TREE);
|
|
|
+// /**同步时间树形文件-结束**/
|
|
|
+//
|
|
|
+// /**统一刷新树与文件**/
|
|
|
+// // 刷新树
|
|
|
+// refreshArchiveTreeContract(saveArchiveTreeContractList, updateArchiveTreeContractList, deleteArchiveTreeContractList);
|
|
|
+//
|
|
|
+// // 刷新文件
|
|
|
+// refreshArchiveFile(saveArchiveFileList, updateArchiveFileList, deleteArchiveFileList);
|
|
|
+// }
|
|
|
+// }
|
|
|
/**
|
|
|
* 时间树中的差异
|
|
|
* 遍历循环,获取差异,并输出三个集合(归档树的fullName = 老树中的fullName)
|
|
@@ -1380,19 +1686,19 @@ public class ArchiveTreeContractSyncImpl {
|
|
|
/**
|
|
|
* 刷新归档树
|
|
|
*/
|
|
|
- void refreshArchiveTreeContract(List<ArchiveTreeContract> saveArchiveTreeContractList, List<Map> updateArchiveTreeContractList,
|
|
|
- List<ArchiveTreeContract> deleteArchiveTreeContractList) {
|
|
|
- if (CollectionUtil.isNotEmpty(saveArchiveTreeContractList)) {
|
|
|
- archiveTreeContractMapper.batchInsertArchiveTreeContract(saveArchiveTreeContractList);
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(updateArchiveTreeContractList)) {
|
|
|
- archiveTreeContractMapper.batchUpdateArchiveTreeContract(updateArchiveTreeContractList);
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(deleteArchiveTreeContractList)) {
|
|
|
- List<Long> idList = deleteArchiveTreeContractList.stream().map(ArchiveTreeContract::getId).collect(Collectors.toList());
|
|
|
- archiveTreeContractMapper.batchDeleteArchiveTreeContractByIdList(idList, 1);
|
|
|
- }
|
|
|
- }
|
|
|
+// void refreshArchiveTreeContract(List<ArchiveTreeContract> saveArchiveTreeContractList, List<Map> updateArchiveTreeContractList,
|
|
|
+// List<ArchiveTreeContract> deleteArchiveTreeContractList) {
|
|
|
+// if (CollectionUtil.isNotEmpty(saveArchiveTreeContractList)) {
|
|
|
+// archiveTreeContractMapper.batchInsertArchiveTreeContract(saveArchiveTreeContractList);
|
|
|
+// }
|
|
|
+// if (CollectionUtil.isNotEmpty(updateArchiveTreeContractList)) {
|
|
|
+// archiveTreeContractMapper.batchUpdateArchiveTreeContract(updateArchiveTreeContractList);
|
|
|
+// }
|
|
|
+// if (CollectionUtil.isNotEmpty(deleteArchiveTreeContractList)) {
|
|
|
+// List<Long> idList = deleteArchiveTreeContractList.stream().map(ArchiveTreeContract::getId).collect(Collectors.toList());
|
|
|
+// archiveTreeContractMapper.batchDeleteArchiveTreeContractByIdList(idList, 1);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 根据合同段id查询声像文件
|