新建文件夹增加文件夹备注
This commit is contained in:
parent
396abe435a
commit
fe723a7061
|
|
@ -1,6 +1,7 @@
|
||||||
package com.electromagnetic.industry.software.manage.controller;
|
package com.electromagnetic.industry.software.manage.controller;
|
||||||
|
|
||||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||||
|
|
@ -27,8 +28,8 @@ public class EdFileInfoController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("createFolder")
|
@RequestMapping("createFolder")
|
||||||
public ElectromagneticResult<?> createFolder(@RequestParam String parentId, @RequestParam String newFolderName) {
|
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
||||||
return edFileInfoService.createFolder(parentId, newFolderName);
|
return edFileInfoService.createFolder(createFolderDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("delete")
|
@RequestMapping("delete")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateFolderDTO {
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String newFolderName;
|
||||||
|
|
||||||
|
private String fileNote;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.electromagnetic.industry.software.manage.service;
|
package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||||
|
|
@ -24,11 +25,9 @@ public interface EdFileInfoService {
|
||||||
/**
|
/**
|
||||||
* 新建文件夹
|
* 新建文件夹
|
||||||
*
|
*
|
||||||
* @param parentId
|
|
||||||
* @param newFolderName
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> createFolder(String parentId, String newFolderName);
|
ElectromagneticResult<?> createFolder(CreateFolderDTO createFolderDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目层级结构查询
|
* 项目层级结构查询
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> addFolder(String parentId, String folderName, boolean maxLengthCheck, boolean isPrjDir, String folderId) {
|
public ElectromagneticResult<?> addFolder(String parentId, String folderName, boolean maxLengthCheck, boolean isPrjDir, String folderId, String fileNote) {
|
||||||
|
|
||||||
// 验证名称是否合法
|
// 验证名称是否合法
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), NAME_VALID_MSG);
|
||||||
|
|
@ -193,6 +193,7 @@ public class CommonService {
|
||||||
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
.setFilePath(path)
|
.setFilePath(path)
|
||||||
.setSort(names.size() + 1)
|
.setSort(names.size() + 1)
|
||||||
|
.setFileNote(fileNote)
|
||||||
.setCreatedTime(now)
|
.setCreatedTime(now)
|
||||||
.setUpdatedTime(now)
|
.setUpdatedTime(now)
|
||||||
.setCreatedBy(currentUserId)
|
.setCreatedBy(currentUserId)
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,7 @@ import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoDTO;
|
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
|
import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.*;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkResultDTO;
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileInfoQueryPageVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.FileInfoQueryPageVO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileVersionViewVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.FileVersionViewVO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
||||||
|
|
@ -99,15 +96,14 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getParentId, fileInfoQueryDTO.getParentId())
|
.eq(EdFileInfo::getParentId, fileInfoQueryDTO.getParentId())
|
||||||
.like(StrUtil.isNotEmpty(fileInfoQueryDTO.getKeyword()), EdFileInfo::getFileName, fileInfoQueryDTO.getKeyword())
|
|
||||||
.like(StrUtil.isNotEmpty(fileInfoQueryDTO.getKeyword()), EdFileInfo::getFileNote, fileInfoQueryDTO.getKeyword())
|
|
||||||
|
|
||||||
|
|
||||||
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.NOT_PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.NOT_PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||||
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.PUBLISHED.code), EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||||
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.OCCUPY.code), EdFileInfo::getDataStatus, EleDataStatusEnum.OCCUPY.code)
|
.eq(Objects.equals(fileInfoQueryDTO.getDataStatus(), EleDataStatusEnum.OCCUPY.code), EdFileInfo::getDataStatus, EleDataStatusEnum.OCCUPY.code)
|
||||||
.eq(StrUtil.isNotEmpty(fileInfoQueryDTO.getFileType()), EdFileInfo::getFileType, fileInfoQueryDTO.getFileType())
|
.eq(StrUtil.isNotEmpty(fileInfoQueryDTO.getFileType()), EdFileInfo::getFileType, fileInfoQueryDTO.getFileType())
|
||||||
|
|
||||||
|
.like(StrUtil.isNotEmpty(fileInfoQueryDTO.getKeyword()), EdFileInfo::getFileName, fileInfoQueryDTO.getKeyword())
|
||||||
|
.like(StrUtil.isNotEmpty(fileInfoQueryDTO.getKeyword()), EdFileInfo::getFileNote, fileInfoQueryDTO.getKeyword())
|
||||||
|
|
||||||
.orderByAsc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 0), EdFileInfo::getCreatedTime)
|
.orderByAsc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 0), EdFileInfo::getCreatedTime)
|
||||||
.orderByDesc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 1), EdFileInfo::getCreatedTime)
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 1), EdFileInfo::getCreatedTime)
|
||||||
|
|
||||||
|
|
@ -151,16 +147,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建文件夹
|
* 新建文件夹
|
||||||
*
|
|
||||||
* @param parentId
|
|
||||||
* @param newFolderName
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> createFolder(String parentId, String newFolderName) {
|
public ElectromagneticResult<?> createFolder(CreateFolderDTO createFolderDTO) {
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(newFolderName), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(createFolderDTO.getNewFolderName()), NAME_VALID_MSG);
|
||||||
String folderId = IdWorker.getSnowFlakeIdString();
|
String folderId = IdWorker.getSnowFlakeIdString();
|
||||||
return commonService.addFolder(parentId, newFolderName, false, false, folderId);
|
return commonService.addFolder(createFolderDTO.getParentId(), createFolderDTO.getNewFolderName(), false, false, folderId, createFolderDTO.getFileNote());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -663,12 +656,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.setFileCode(fileCode)
|
.setFileCode(fileCode)
|
||||||
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
.setPrjDir(false);
|
.setPrjDir(false);
|
||||||
this.baseMapper.insert(newEdFileInfo);
|
this.saveOrUpdate(newEdFileInfo);
|
||||||
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
||||||
fileSystemService.save(file.getInputStream(), fileDestPath);
|
fileSystemService.save(file.getInputStream(), fileDestPath);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
newEdFileInfo.setParentId(parentId)
|
newEdFileInfo.setParentId(parentId)
|
||||||
.setFileName(mainName)
|
.setFileName(mainName)
|
||||||
.setFileType(suffix)
|
.setFileType(suffix)
|
||||||
|
|
@ -678,8 +670,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.setEffectFlag(EffectFlagEnum.NOT_EFFECTIVE.code)
|
.setEffectFlag(EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||||
.setSaveStatus(EleDataSaveStatusEnum.FAIL.code)
|
.setSaveStatus(EleDataSaveStatusEnum.FAIL.code)
|
||||||
.setPrjDir(false);
|
.setPrjDir(false);
|
||||||
this.baseMapper.insert(newEdFileInfo);
|
this.saveOrUpdate(newEdFileInfo);
|
||||||
|
|
||||||
String info = "上传文件失败";
|
String info = "上传文件失败";
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
throw new BizException(-1, info);
|
throw new BizException(-1, info);
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
public ElectromagneticResult<?> createNewPrj(String prjName) {
|
public ElectromagneticResult<?> createNewPrj(String prjName) {
|
||||||
|
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(prjName), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(prjName), NAME_VALID_MSG);
|
||||||
// if (!EleCommonUtil.isFileNameValid(prjName)) {
|
|
||||||
// String info = StrFormatter.format("工程名称{}不符合要求", prjName);
|
|
||||||
// log.error(info);
|
|
||||||
// return ElectromagneticResultUtil.fail("-1", info);
|
|
||||||
// }
|
|
||||||
// 首先检查工程是否存在
|
// 首先检查工程是否存在
|
||||||
// TODO 一个项目如果被废除了,然后又新建了一个同名工程,这种情况怎么处理,需要产品确认。当前这里先按照同名如果存在则抛出异常处理。
|
|
||||||
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::getFileName, prjName));
|
.eq(EdFileInfo::getFileName, prjName));
|
||||||
|
|
@ -211,7 +205,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), NAME_VALID_MSG);
|
||||||
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
||||||
String folderId = String.valueOf(id + 1);
|
String folderId = String.valueOf(id + 1);
|
||||||
return commonService.addFolder(parentId, folderName, true, true, folderId);
|
return commonService.addFolder(parentId, folderName, true, true, folderId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue