Browse Source

修改方法

master
liu_li 2 years ago
parent
commit
1c0e3adad2
  1. 89
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java
  2. 2
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java

89
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java

@ -17,6 +17,7 @@ import com.storeroom.utils.ValidationUtil;
import lombok.RequiredArgsConstructor;
import org.apache.poi.util.LittleEndian;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -51,7 +52,12 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
}
//如果类型为模版
if (archivesType.getIsType() == 6) {
createProject(archivesType, tableName);
if (archivesType.getChildren().size() != 0) {
String cnName = archivesType.getCnName();
archivesType.getChildren().forEach(item -> {
});
}
return archivesType;
}
@ -64,82 +70,27 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
} else {
throw new BaseException("门类名称不能重复");
}
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 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();
}

2
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java

@ -49,7 +49,7 @@ public class DynamicTableImpl implements DynamicTableService {
DynamicInsert(fieldList, archiveTypeId);
//生成表和表名创建表名
DynamicCreateFileTable(fieldList, tableName);
//数组
//数组
integerList.clear();
//查询类型为3的字段
integerList.add(3);

Loading…
Cancel
Save