修改bug

This commit is contained in:
chenxudong 2025-04-25 11:09:37 +08:00
parent 3dc82bdea3
commit dbba7ea178
2 changed files with 5 additions and 7 deletions

View File

@ -112,6 +112,7 @@ public class ChatService {
} }
case "xls", "xlsx" -> { case "xls", "xlsx" -> {
String filePath = elePropertyConfig.getEleTmpPath() + File.separator + fileMd5 + "." + fileType; String filePath = elePropertyConfig.getEleTmpPath() + File.separator + fileMd5 + "." + fileType;
FileUtil.writeFromStream(file.getInputStream(), filePath);
List<PageFile> pageInfo = StrUtil.equals("xlsx", filePath) ? List<PageFile> pageInfo = StrUtil.equals("xlsx", filePath) ?
OfficeFileUtil.parseXlsxByPage(filePath) : OfficeFileUtil.parseXlsxByPage(filePath) :
OfficeFileUtil.parseXlsByPage(filePath); OfficeFileUtil.parseXlsByPage(filePath);

View File

@ -137,14 +137,13 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName, int dataOwnCode) { public ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName, int dataOwnCode) {
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class) EdFileInfo fileInfo = this.baseMapper.selectById(prjId);
.select(EdFileInfo::getFileName)
.eq(EdFileInfo::getId, prjId));
String oldPrjName = fileInfo.getFileName(); String oldPrjName = fileInfo.getFileName();
try { try {
Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {}{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName)); Assert.isTrue(EleCommonUtil.isFileNameValid(newPrjName), StrFormatter.format("{} {}{} 修改失败。", newPrjName, NAME_VALID_MSG, oldPrjName));
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class) Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID) .eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getDataOwn, dataOwnCode)
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code) .eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
.eq(EdFileInfo::getFileName, newPrjName)); .eq(EdFileInfo::getFileName, newPrjName));
if (count > 0) { if (count > 0) {
@ -152,10 +151,8 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
log.info(info); log.info(info);
return ElectromagneticResultUtil.fail("-1", info); return ElectromagneticResultUtil.fail("-1", info);
} }
fileInfo.setFileName(newPrjName);
this.baseMapper.update(new EdFileInfo(), Wrappers.lambdaUpdate(EdFileInfo.class) this.baseMapper.updateById(fileInfo);
.eq(EdFileInfo::getId, prjId)
.set(EdFileInfo::getFileName, newPrjName));
UserThreadLocal.setSuccessInfo("", prjId, "修改工层名 {} 为 {} 成功。", oldPrjName, newPrjName); UserThreadLocal.setSuccessInfo("", prjId, "修改工层名 {} 为 {} 成功。", oldPrjName, newPrjName);
} catch (Exception e) { } catch (Exception e) {
String info = StrFormatter.format("修改工程名异常--->{}{}", newPrjName, e.getMessage()); String info = StrFormatter.format("修改工程名异常--->{}{}", newPrjName, e.getMessage());