|
@ -17,6 +17,7 @@ import com.storeroom.utils.ValidationUtil; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.util.LittleEndian; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
@ -51,7 +52,12 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { |
|
|
} |
|
|
} |
|
|
//如果类型为模版 |
|
|
//如果类型为模版 |
|
|
if (archivesType.getIsType() == 6) { |
|
|
if (archivesType.getIsType() == 6) { |
|
|
createProject(archivesType, tableName); |
|
|
|
|
|
|
|
|
if (archivesType.getChildren().size() != 0) { |
|
|
|
|
|
String cnName = archivesType.getCnName(); |
|
|
|
|
|
archivesType.getChildren().forEach(item -> { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
return archivesType; |
|
|
return archivesType; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -64,82 +70,27 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { |
|
|
} else { |
|
|
} else { |
|
|
throw new BaseException("门类名称不能重复"); |
|
|
throw new BaseException("门类名称不能重复"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return archivesType; |
|
|
return archivesType; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 创建项目级门类 |
|
|
|
|
|
*/ |
|
|
|
|
|
private void createProject(ArchivesType archivesType, String tableName) { |
|
|
|
|
|
String cnName = archivesType.getCnName(); |
|
|
|
|
|
tableName += DateUtils.getNowDateTime(); |
|
|
|
|
|
archivesType.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
archivesType.setEnName(tableName); |
|
|
|
|
|
archivesType = archivesTypeRepository.save(archivesType); |
|
|
|
|
|
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); |
|
|
|
|
|
|
|
|
|
|
|
//获取项目级ID |
|
|
|
|
|
String pid = archivesType.getId(); |
|
|
|
|
|
//重新赋值表名 |
|
|
|
|
|
tableName = "tb_"; |
|
|
|
|
|
tableName += DateUtils.getNowDateTime(); |
|
|
|
|
|
|
|
|
|
|
|
archivesType.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
archivesType.setCnName(cnName + "(案卷)"); |
|
|
|
|
|
archivesType.setEnName(tableName); |
|
|
|
|
|
archivesType.setPid(pid); |
|
|
|
|
|
//修改门类类型为案卷 |
|
|
|
|
|
archivesType.setIsType(3); |
|
|
|
|
|
//保存案卷级 |
|
|
|
|
|
archivesTypeRepository.save(archivesType); |
|
|
|
|
|
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); |
|
|
|
|
|
|
|
|
|
|
|
//重新赋值表名 |
|
|
|
|
|
tableName = "tb_"; |
|
|
|
|
|
tableName += DateUtils.getNowDateTime(); |
|
|
|
|
|
|
|
|
|
|
|
archivesType.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
archivesType.setCnName(cnName + "(卷内)"); |
|
|
|
|
|
archivesType.setEnName(tableName); |
|
|
|
|
|
archivesType.setPid(pid); |
|
|
|
|
|
//修改门类类型为案卷 |
|
|
|
|
|
archivesType.setIsType(4); |
|
|
|
|
|
//保存案卷级 |
|
|
|
|
|
archivesTypeRepository.save(archivesType); |
|
|
|
|
|
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 创建案卷级门类 |
|
|
|
|
|
|
|
|
* 创建模版门类 |
|
|
* |
|
|
* |
|
|
* @param archivesType |
|
|
* @param archivesType |
|
|
* @param tableName |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void createArchives(ArchivesType archivesType, String tableName) { |
|
|
|
|
|
//获取门类名称方便创建子集门类 |
|
|
|
|
|
String cnName = archivesType.getCnName(); |
|
|
|
|
|
|
|
|
|
|
|
tableName += DateUtils.getNowDateTime(); |
|
|
|
|
|
archivesType.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
archivesType.setEnName(tableName); |
|
|
|
|
|
archivesType = archivesTypeRepository.save(archivesType); |
|
|
|
|
|
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); |
|
|
|
|
|
|
|
|
|
|
|
//获取项目级ID |
|
|
|
|
|
String pid = archivesType.getId(); |
|
|
|
|
|
//重新赋值表名 |
|
|
|
|
|
tableName = "tb_"; |
|
|
|
|
|
tableName += DateUtils.getNowDateTime(); |
|
|
|
|
|
|
|
|
|
|
|
archivesType.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
archivesType.setCnName(cnName + "(卷内)"); |
|
|
|
|
|
archivesType.setEnName(tableName); |
|
|
|
|
|
archivesType.setPid(pid); |
|
|
|
|
|
//修改门类类型为案卷 |
|
|
|
|
|
archivesType.setIsType(4); |
|
|
|
|
|
//保存案卷级 |
|
|
|
|
|
archivesTypeRepository.save(archivesType); |
|
|
|
|
|
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); |
|
|
|
|
|
|
|
|
private void createTemplate(String pid,String cnName,ArchivesType archivesType) { |
|
|
|
|
|
|
|
|
|
|
|
archivesType.getChildren().forEach(item -> { |
|
|
|
|
|
ArchivesType archivesType1=new ArchivesType(); |
|
|
|
|
|
archivesType1.setId(NanoIdUtils.randomNanoId()); |
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|