|
|
@@ -5747,7 +5747,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
updateIds.add(archivesAuto.getId());
|
|
|
if(!dto.getList().isEmpty()){
|
|
|
archivesAuto.setIsVolume(1);
|
|
|
- archivesAuto.setVolumeIds("");
|
|
|
int x=1;
|
|
|
for (SaveVolumeDto1 saveVolumeDto1 : dto.getList()) {
|
|
|
Long archiveId;
|
|
|
@@ -5757,8 +5756,40 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
auto.setId(SnowFlakeUtil.getId());
|
|
|
auto.setName(saveVolumeDto1.getArchiveName());
|
|
|
auto.setIsVolume(2);
|
|
|
- auto.setTreeSort(archivesAuto.getTreeSort()+x);
|
|
|
- auto.setAutoFileSort(archivesAuto.getAutoFileSort()+x);
|
|
|
+ String treeSort = archivesAuto.getTreeSort();
|
|
|
+ if (treeSort == null) {
|
|
|
+ auto.setTreeSort("");
|
|
|
+ } else {
|
|
|
+ // 确保字符串至少有2位
|
|
|
+ if (treeSort.length() >= 2) {
|
|
|
+ // 截取最后两位
|
|
|
+ String lastTwoDigits = treeSort.substring(treeSort.length() - 2);
|
|
|
+ try {
|
|
|
+ // 转换为数字并加上x
|
|
|
+ int lastNumber = Integer.parseInt(lastTwoDigits);
|
|
|
+ int newNumber = lastNumber + x;
|
|
|
+ // 格式化为两位数字符串
|
|
|
+ String newLastDigits = String.format("%02d", newNumber);
|
|
|
+ // 替换最后两位
|
|
|
+ String newTreeSort = treeSort.substring(0, treeSort.length() - 2) + newLastDigits;
|
|
|
+ auto.setTreeSort(newTreeSort);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ // 如果转换失败,保持原值
|
|
|
+ auto.setTreeSort(treeSort);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果字符串长度不足2位,直接加上x
|
|
|
+ try {
|
|
|
+ int number = Integer.parseInt(treeSort) + x;
|
|
|
+ auto.setTreeSort(String.valueOf(number));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ auto.setTreeSort(treeSort);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(archivesAuto.getAutoFileSort()!=null){
|
|
|
+ auto.setAutoFileSort(archivesAuto.getAutoFileSort()+x);
|
|
|
+ }
|
|
|
x++;
|
|
|
archiveId= auto.getId();
|
|
|
baseMapper.insert(auto);
|