|
|
@ -53,9 +53,23 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { |
|
|
|
//如果类型为模版 |
|
|
|
if (archivesType.getIsType() == 6) { |
|
|
|
if (archivesType.getChildren().size() != 0) { |
|
|
|
//获取名称 |
|
|
|
String cnName = archivesType.getCnName(); |
|
|
|
archivesType.getChildren().forEach(item -> { |
|
|
|
|
|
|
|
//如果模板类型为项目 |
|
|
|
if (item.getIsType() == 2) { |
|
|
|
ArchivesType arcProject = new ArchivesType(); |
|
|
|
arcProject.setId(NanoIdUtils.randomNanoId()); |
|
|
|
arcProject.setIsType(item.getIsType()); |
|
|
|
arcProject.setPid(item.getPid()); |
|
|
|
arcProject.setCategorySeq(item.getCategorySeq()); |
|
|
|
arcProject.setCnName(cnName); |
|
|
|
arcProject.setRemark(item.getRemark()); |
|
|
|
arcProject.setEnName(item.getEnName()); |
|
|
|
arcProject.setTypeMetic(item.isTypeMetic()); |
|
|
|
archivesTypeRepository.save(arcProject); |
|
|
|
createArchives(arcProject.getId(), cnName, item.getChildren()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return archivesType; |
|
|
@ -76,22 +90,49 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 创建模版门类 |
|
|
|
* 创建模版案卷 |
|
|
|
* |
|
|
|
* @param archivesType |
|
|
|
*/ |
|
|
|
private void createTemplate(String pid,String cnName,ArchivesType archivesType) { |
|
|
|
|
|
|
|
archivesType.getChildren().forEach(item -> { |
|
|
|
ArchivesType archivesType1=new ArchivesType(); |
|
|
|
private void createArchives(String pid, String cnName, List<ArchivesType> archivesType) { |
|
|
|
for (ArchivesType arc : archivesType) { |
|
|
|
//如果还有子集菜单 |
|
|
|
if (arc.getChildren().size() != 0) { |
|
|
|
ArchivesType archivesType1 = new ArchivesType(); |
|
|
|
archivesType1.setId(NanoIdUtils.randomNanoId()); |
|
|
|
archivesType1.setIsType(arc.getIsType()); |
|
|
|
archivesType1.setTypeMetic(arc.isTypeMetic()); |
|
|
|
archivesType1.setPid(pid); |
|
|
|
archivesType1.setCnName(cnName+"案卷"); |
|
|
|
getChildren(item.getId(), item.getChildren()); |
|
|
|
}); |
|
|
|
List<ArchivesType> list = archivesType.getChildren().stream().map(item -> item.setChildren(getChildren(item.getId(), item.getChildren()))) |
|
|
|
.sorted(Comparator.comparingInt(menu -> (menu.getCategorySeq() == null ? 0 : menu.getCategorySeq()))).toList(); |
|
|
|
archivesType1.setCnName(cnName + "案卷"); |
|
|
|
archivesType1.setRemark(arc.getRemark()); |
|
|
|
archivesType1.setCategorySeq(arc.getCategorySeq()); |
|
|
|
archivesType1.setTypeMetic(arc.isTypeMetic()); |
|
|
|
archivesType1.setEnName(archivesType1.getEnName()); |
|
|
|
archivesTypeRepository.save(archivesType1); |
|
|
|
createInChive(archivesType1.getId(), cnName, archivesType1.getChildren()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建卷内 |
|
|
|
*/ |
|
|
|
private void createInChive(String pid, String cnName, List<ArchivesType> archivesType) { |
|
|
|
|
|
|
|
for (ArchivesType arc : archivesType) { |
|
|
|
//如果还有子集菜单 |
|
|
|
ArchivesType archivesType1 = new ArchivesType(); |
|
|
|
archivesType1.setId(NanoIdUtils.randomNanoId()); |
|
|
|
archivesType1.setIsType(arc.getIsType()); |
|
|
|
archivesType1.setTypeMetic(arc.isTypeMetic()); |
|
|
|
archivesType1.setPid(pid); |
|
|
|
archivesType1.setCnName(cnName + "卷内"); |
|
|
|
archivesType1.setRemark(arc.getRemark()); |
|
|
|
archivesType1.setCategorySeq(arc.getCategorySeq()); |
|
|
|
archivesType1.setTypeMetic(arc.isTypeMetic()); |
|
|
|
archivesType1.setEnName(archivesType1.getEnName()); |
|
|
|
archivesTypeRepository.save(archivesType1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|