Merge branch 'develop' of http://139.196.179.195:3000/chenxudong/electromagnetic-data-new into develop
This commit is contained in:
commit
7151243618
|
|
@ -109,4 +109,9 @@ public class EdFileInfoController {
|
||||||
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||||
return edFileInfoService.uploadRecord(pageNum, pageSize);
|
return edFileInfoService.uploadRecord(pageNum, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||||
|
public ElectromagneticResult<?> detail(@RequestParam String id) {
|
||||||
|
return edFileInfoService.detail(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileInfoDTO {
|
public class FileInfoVO {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
@ -10,6 +10,7 @@ public class UploadRecordDTO {
|
||||||
private String id;
|
private String id;
|
||||||
private String fileName;
|
private String fileName;
|
||||||
private Integer saveStatus;
|
private Integer saveStatus;
|
||||||
|
private String fileType;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||||
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoDTO;
|
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoVO;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
@ -15,5 +15,5 @@ public class FileInfoQueryPageVO {
|
||||||
|
|
||||||
private long total;
|
private long total;
|
||||||
|
|
||||||
private List<FileInfoDTO> records = new ArrayList<>();
|
private List<FileInfoVO> records = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,5 @@ public class FileVersionViewVO {
|
||||||
private Integer preVersion;
|
private Integer preVersion;
|
||||||
private String fileCode;
|
private String fileCode;
|
||||||
private Integer effectFlag;
|
private Integer effectFlag;
|
||||||
|
private String parentId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@FieldNameConstants
|
||||||
@Data
|
@Data
|
||||||
public class ProjectVO {
|
public class ProjectVO {
|
||||||
|
|
||||||
|
|
@ -13,6 +15,7 @@ public class ProjectVO {
|
||||||
private String parentId;
|
private String parentId;
|
||||||
private int sort;
|
private int sort;
|
||||||
private Integer dataStatus;
|
private Integer dataStatus;
|
||||||
|
private String title;
|
||||||
|
|
||||||
private List<ProjectVO> children = new ArrayList<>();
|
private List<ProjectVO> children = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,4 +143,11 @@ public interface EdFileInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize);
|
ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文件详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> detail(String id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,8 @@ public class CommonService {
|
||||||
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id);
|
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id);
|
||||||
if (!isAdminQuery) {
|
if (!isAdminQuery) {
|
||||||
edFileInfos = edFileInfos.stream().filter(e -> e.getDataStatus().equals(EleDataStatusEnum.PUBLISHED.code)).collect(Collectors.toList());
|
edFileInfos = edFileInfos.stream().filter(e -> e.getDataStatus().equals(EleDataStatusEnum.PUBLISHED.code)).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
edFileInfos = edFileInfos.stream().filter(e -> !e.getDataStatus().equals(EleDataStatusEnum.DELETED.code)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
// 转换为树
|
// 转换为树
|
||||||
if (isAdminQuery) {
|
if (isAdminQuery) {
|
||||||
|
|
@ -236,11 +238,12 @@ public class CommonService {
|
||||||
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
||||||
config.setWeightKey(EdFileInfo.Fields.sort);
|
config.setWeightKey(EdFileInfo.Fields.sort);
|
||||||
List<Tree<String>> trees = TreeUtil.build(edFileInfos, PRJ_PARENT_ID, config, ((obj, treeNode) -> {
|
List<Tree<String>> trees = TreeUtil.build(edFileInfos, PRJ_PARENT_ID, config, ((obj, treeNode) -> {
|
||||||
treeNode.putExtra("id", obj.getId());
|
treeNode.putExtra(ProjectVO.Fields.id, obj.getId());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.parentId, obj.getParentId());
|
treeNode.putExtra(ProjectVO.Fields.parentId, obj.getParentId());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.sort, obj.getSort());
|
treeNode.putExtra(ProjectVO.Fields.sort, obj.getSort());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.fileName, obj.getFileName());
|
treeNode.putExtra(ProjectVO.Fields.fileName, obj.getFileName());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.dataStatus, obj.getDataStatus());
|
treeNode.putExtra(ProjectVO.Fields.title, obj.getFileName());
|
||||||
|
treeNode.putExtra(ProjectVO.Fields.dataStatus, obj.getDataStatus());
|
||||||
}));
|
}));
|
||||||
String jsonStr = JSONUtil.toJsonStr(trees);
|
String jsonStr = JSONUtil.toJsonStr(trees);
|
||||||
ProjectVO projectVO = JSONUtil.toList(jsonStr, ProjectVO.class).get(0);
|
ProjectVO projectVO = JSONUtil.toList(jsonStr, ProjectVO.class).get(0);
|
||||||
|
|
@ -272,6 +275,8 @@ public class CommonService {
|
||||||
|
|
||||||
public ElectromagneticResult<?> deleteFolder(String id) {
|
public ElectromagneticResult<?> deleteFolder(String id) {
|
||||||
// 如果文件夹下存在文件(包括文件夹和已经逻辑删除的文件),则不允许删除。后面管理员选择会有物理删除文件夹和文件的功能,此时MySQL和文件系统则会进行物理删除该文件。
|
// 如果文件夹下存在文件(包括文件夹和已经逻辑删除的文件),则不允许删除。后面管理员选择会有物理删除文件夹和文件的功能,此时MySQL和文件系统则会进行物理删除该文件。
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
try {
|
try {
|
||||||
// 这里要分两种情况,1是删除层级目录,2是删除用户创建的文件夹
|
// 这里要分两种情况,1是删除层级目录,2是删除用户创建的文件夹
|
||||||
EdFileInfo fileInfo = edFileInfoMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, id));
|
EdFileInfo fileInfo = edFileInfoMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, id));
|
||||||
|
|
@ -290,6 +295,8 @@ public class CommonService {
|
||||||
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
||||||
.eq(EdFileInfo::getId, id)
|
.eq(EdFileInfo::getId, id)
|
||||||
.set(EdFileInfo::getSort, -1)
|
.set(EdFileInfo::getSort, -1)
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code));
|
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code));
|
||||||
// 层级文件夹重排序
|
// 层级文件夹重排序
|
||||||
List<EdFileInfo> edFileInfos1 = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> edFileInfos1 = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
|
@ -297,9 +304,9 @@ public class CommonService {
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
.ne(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||||
.eq(EdFileInfo::getParentId, parentId)
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
|
|
||||||
.orderByAsc(EdFileInfo::getSort));
|
.orderByAsc(EdFileInfo::getSort));
|
||||||
Date now = new Date();
|
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
|
||||||
for (int i = 0; i < edFileInfos1.size(); i++) {
|
for (int i = 0; i < edFileInfos1.size(); i++) {
|
||||||
String tmp = edFileInfos1.get(i).getId();
|
String tmp = edFileInfos1.get(i).getId();
|
||||||
edFileInfoMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
edFileInfoMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
|
@ -322,6 +329,8 @@ public class CommonService {
|
||||||
// 逻辑文件夹重排序
|
// 逻辑文件夹重排序
|
||||||
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
||||||
.eq(EdFileInfo::getId, id)
|
.eq(EdFileInfo::getId, id)
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,15 @@ import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
import com.electromagnetic.industry.software.common.util.*;
|
import com.electromagnetic.industry.software.common.util.*;
|
||||||
import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
|
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.FileInfoVO;
|
||||||
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.*;
|
import com.electromagnetic.industry.software.manage.pojo.req.*;
|
||||||
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.UploadRecordVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.UploadRecordVO;
|
||||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||||
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
|
@ -62,11 +62,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
private EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
private final EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||||
@Autowired
|
@Resource
|
||||||
private FileSystemService fileSystemService;
|
private FileSystemService fileSystemService;
|
||||||
@Resource
|
@Resource
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
|
@Resource
|
||||||
|
private PermissionService permissionService;
|
||||||
|
|
||||||
private String downloadDataDir = "";
|
private String downloadDataDir = "";
|
||||||
private String uploadDataDir = "";
|
private String uploadDataDir = "";
|
||||||
|
|
@ -126,13 +128,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.orderByDesc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 1), EdFileInfo::getCreatedTime);
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getCreatedTime(), 1), EdFileInfo::getCreatedTime);
|
||||||
Page<EdFileInfo> edFileInfoPage = this.baseMapper.selectPage(new Page<>(fileInfoQueryDTO.getPageNum(), fileInfoQueryDTO.getPageSize()), queryWrapper);
|
Page<EdFileInfo> edFileInfoPage = this.baseMapper.selectPage(new Page<>(fileInfoQueryDTO.getPageNum(), fileInfoQueryDTO.getPageSize()), queryWrapper);
|
||||||
long total = edFileInfoPage.getTotal();
|
long total = edFileInfoPage.getTotal();
|
||||||
List<FileInfoDTO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoDTO.class);
|
List<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
||||||
resetFileSize(records);
|
resetFileSize(records);
|
||||||
return ElectromagneticResultUtil.success(new FileInfoQueryPageVO(total, records));
|
return ElectromagneticResultUtil.success(new FileInfoQueryPageVO(total, records));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetFileSize(List<FileInfoDTO> records) {
|
private void resetFileSize(List<FileInfoVO> records) {
|
||||||
for (FileInfoDTO fileInfoDTO : records) {
|
for (FileInfoVO fileInfoDTO : records) {
|
||||||
if (fileInfoDTO.getFileSize() < 1024) {
|
if (fileInfoDTO.getFileSize() < 1024) {
|
||||||
fileInfoDTO.setFileSizeShow(fileInfoDTO.getFileSize() + "B");
|
fileInfoDTO.setFileSizeShow(fileInfoDTO.getFileSize() + "B");
|
||||||
} else if (fileInfoDTO.getFileSize() < 1024 * 1024) {
|
} else if (fileInfoDTO.getFileSize() < 1024 * 1024) {
|
||||||
|
|
@ -179,8 +181,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
if (fileInfo.getDataType() == EleDataTypeEnum.FOLDER.code) {
|
if (fileInfo.getDataType() == EleDataTypeEnum.FOLDER.code) {
|
||||||
return commonService.deleteFolder(id);
|
return commonService.deleteFolder(id);
|
||||||
}
|
}
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.set(EdFileInfo::getEffectFlag, false)
|
.set(EdFileInfo::getEffectFlag, false)
|
||||||
.eq(EdFileInfo::getId, id));
|
.eq(EdFileInfo::getId, id));
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
|
@ -196,7 +201,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
public ResponseEntity<InputStreamResource> download(String id, HttpServletResponse response) {
|
public ResponseEntity<InputStreamResource> download(String id, HttpServletResponse response) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, id));
|
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
||||||
String fileSysPath = commonService.getFileSysPath(fileInfo.getFilePath());
|
String fileSysPath = commonService.getFileSysPath(fileInfo.getFilePath());
|
||||||
Assert.isTrue(FileUtil.exist(fileSysPath), "下载文件不存在。");
|
Assert.isTrue(FileUtil.exist(fileSysPath), "下载文件不存在。");
|
||||||
FileSystemResource fileSystemResource = new FileSystemResource(fileSysPath);
|
FileSystemResource fileSystemResource = new FileSystemResource(fileSysPath);
|
||||||
|
|
@ -255,8 +260,12 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
Assert.isTrue(count == 0, "文件名已存在");
|
Assert.isTrue(count == 0, "文件名已存在");
|
||||||
|
|
||||||
String srcFilePath = commonService.getFileSysPath(fileInfo.getFilePath());
|
String srcFilePath = commonService.getFileSysPath(fileInfo.getFilePath());
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getId, updateFileInfoDTO.getId())
|
.eq(EdFileInfo::getId, updateFileInfoDTO.getId())
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
||||||
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
||||||
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
||||||
|
|
@ -687,7 +696,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> versionView(String fileId) {
|
public ElectromagneticResult<?> versionView(String fileId) {
|
||||||
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId, EdFileInfo::getFileId, EdFileInfo::getFileVersion, EdFileInfo::getPreVersion, EdFileInfo::getFileCode, EdFileInfo::getEffectFlag, EdFileInfo::getFileName)
|
.select(EdFileInfo::getParentId, EdFileInfo::getId, EdFileInfo::getFileId, EdFileInfo::getFileVersion, EdFileInfo::getPreVersion, EdFileInfo::getFileCode, EdFileInfo::getEffectFlag, EdFileInfo::getFileName)
|
||||||
.eq(EdFileInfo::getFileId, fileId));
|
.eq(EdFileInfo::getFileId, fileId));
|
||||||
List<FileVersionViewVO> fileVersionViewVOS = BeanUtil.copyToList(edFileInfos, FileVersionViewVO.class);
|
List<FileVersionViewVO> fileVersionViewVOS = BeanUtil.copyToList(edFileInfos, FileVersionViewVO.class);
|
||||||
return ElectromagneticResultUtil.success(fileVersionViewVOS);
|
return ElectromagneticResultUtil.success(fileVersionViewVOS);
|
||||||
|
|
@ -848,9 +857,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize) {
|
public ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize) {
|
||||||
|
|
||||||
List<String> prjIds = ListUtil.list(false, "100001", "100002"); //TODO 从权限处获取该用户有哪些工程的权限,这里先写静态,方便调试
|
List<String> prjIds = permissionService.getAccessibleTree(); //TODO 从权限处获取该用户有哪些工程的权限,这里先写静态,方便调试
|
||||||
LambdaQueryWrapper<EdFileInfo> lambdaQuery = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> lambdaQuery = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getSaveStatus, EdFileInfo::getCreatedTime)
|
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getSaveStatus, EdFileInfo::getCreatedTime, EdFileInfo::getFileType)
|
||||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code)
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.likeRight(EdFileInfo::getFilePath, prjIds.get(0));
|
.likeRight(EdFileInfo::getFilePath, prjIds.get(0));
|
||||||
|
|
@ -863,6 +872,19 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
return ElectromagneticResultUtil.success(new UploadRecordVO(total, uploadRecordDTOS));
|
return ElectromagneticResultUtil.success(new UploadRecordVO(total, uploadRecordDTOS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文件详情
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> detail(String id) {
|
||||||
|
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
||||||
|
FileInfoVO fileInfoVO = BeanUtil.copyProperties(fileInfo, FileInfoVO.class);
|
||||||
|
return ElectromagneticResultUtil.success(fileInfoVO);
|
||||||
|
}
|
||||||
|
|
||||||
private ElectromagneticResult<?> handCopyConflict(String targetFolderId, Integer strategy, EdFileInfo srcFileInfo, EdFileInfo destFolderInfo) {
|
private ElectromagneticResult<?> handCopyConflict(String targetFolderId, Integer strategy, EdFileInfo srcFileInfo, EdFileInfo destFolderInfo) {
|
||||||
// 禁止同目录下移动和复制
|
// 禁止同目录下移动和复制
|
||||||
if (srcFileInfo.getParentId().equals(destFolderInfo.getId())) {
|
if (srcFileInfo.getParentId().equals(destFolderInfo.getId())) {
|
||||||
|
|
|
||||||
|
|
@ -227,10 +227,14 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList) {
|
public ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList) {
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
try {
|
try {
|
||||||
for (FolderResortDTO folderResortDTO : folderResortDTOList) {
|
for (FolderResortDTO folderResortDTO : folderResortDTOList) {
|
||||||
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
.set(EdFileInfo::getSort, folderResortDTO.getSort())
|
.set(EdFileInfo::getSort, folderResortDTO.getSort())
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.eq(EdFileInfo::getId, folderResortDTO.getId());
|
.eq(EdFileInfo::getId, folderResortDTO.getId());
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
@ -252,16 +256,21 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> publish(String prjId) {
|
public ElectromagneticResult<?> publish(String prjId) {
|
||||||
try {
|
try {
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
// 将已经处于删除状态设置成逻辑删除
|
// 将已经处于删除状态设置成逻辑删除
|
||||||
this.update(Wrappers.lambdaUpdate(EdFileInfo.class)
|
this.update(Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.DELETED.code)
|
||||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.likeRight(EdFileInfo::getFilePath, prjId));
|
.likeRight(EdFileInfo::getFilePath, prjId));
|
||||||
// 其余置为发布状态
|
// 其余置为发布状态
|
||||||
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||||
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||||
|
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||||
|
.set(EdFileInfo::getUpdatedTime, now)
|
||||||
.likeRight(EdFileInfo::getFilePath, prjId);
|
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public enum EffectFlagEnum {
|
||||||
*/
|
*/
|
||||||
EFFECT(1, "有效"),
|
EFFECT(1, "有效"),
|
||||||
/**
|
/**
|
||||||
* 无效
|
* 无效PermisionService
|
||||||
*/
|
*/
|
||||||
NOT_EFFECTIVE(0, "无效");
|
NOT_EFFECTIVE(0, "无效");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue