解决层级沿用相关的问题

This commit is contained in:
chenxudong 2025-02-18 17:35:55 +08:00
parent 6ec4c66dd2
commit d0551b3094
2 changed files with 9 additions and 3 deletions

View File

@ -297,7 +297,7 @@ public class CommonService {
} else {
// 先设置dataStatus状态为删除状态
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
.eq(EdFileInfo::getId, id)
.like(EdFileInfo::getFilePath, id)
.set(EdFileInfo::getSort, -1)
.set(EdFileInfo::getUpdatedBy, currentUserId)
.set(EdFileInfo::getUpdatedTime, now)
@ -308,7 +308,6 @@ public class CommonService {
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
.eq(EdFileInfo::getParentId, parentId)
.orderByAsc(EdFileInfo::getSort));
for (int i = 0; i < edFileInfos1.size(); i++) {

View File

@ -63,6 +63,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
// 首先检查工程是否存在
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
.eq(EdFileInfo::getFileName, prjName));
if (count > 0) {
@ -351,6 +352,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
EdFileInfo sourceFile = sourceFileNameMap.get(sourceFileName);
EdFileInfo targetFile = new EdFileInfo();
int maxFolderId = Integer.parseInt(this.baseMapper.maxPrjId());
String newFolderId = String.valueOf(maxFolderId + 1);
String nowTimeStr = EleCommonUtil.getNowTimeStr();
String fileCode = commonService.createFileCode(targetParentFile.getId(), EleDataTypeEnum.FOLDER.desc, FILE_START_VERSION, nowTimeStr);
@ -389,7 +391,12 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
}
return ElectromagneticResultUtil.success(true);
} catch (Exception e) {
String info = StrFormatter.format("层级沿用失败");
String info;
if (e instanceof BizException) {
info = StrFormatter.format("层级沿用失败,{}", e.getMessage());
} else {
info = "层级沿用失败";
}
log.error(info, e);
throw new BizException(info);
}