Compare commits
No commits in common. "eb973e59c03413b4adf89d610716f7d93104956f" and "8eb4d76f2934100e5cd5164f2fa9c1cfa03f7d21" have entirely different histories.
eb973e59c0
...
8eb4d76f29
|
|
@ -109,9 +109,4 @@ 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 FileInfoVO {
|
public class FileInfoDTO {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
@ -10,7 +10,6 @@ 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.FileInfoVO;
|
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoDTO;
|
||||||
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<FileInfoVO> records = new ArrayList<>();
|
private List<FileInfoDTO> records = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,4 @@ 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,12 +1,10 @@
|
||||||
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 {
|
||||||
|
|
||||||
|
|
@ -15,7 +13,6 @@ 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,11 +143,4 @@ 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,8 +228,6 @@ 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) {
|
||||||
|
|
@ -238,12 +236,11 @@ 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(ProjectVO.Fields.id, obj.getId());
|
treeNode.putExtra("id", obj.getId());
|
||||||
treeNode.putExtra(ProjectVO.Fields.parentId, obj.getParentId());
|
treeNode.putExtra(EdFileInfo.Fields.parentId, obj.getParentId());
|
||||||
treeNode.putExtra(ProjectVO.Fields.sort, obj.getSort());
|
treeNode.putExtra(EdFileInfo.Fields.sort, obj.getSort());
|
||||||
treeNode.putExtra(ProjectVO.Fields.fileName, obj.getFileName());
|
treeNode.putExtra(EdFileInfo.Fields.fileName, obj.getFileName());
|
||||||
treeNode.putExtra(ProjectVO.Fields.title, obj.getFileName());
|
treeNode.putExtra(EdFileInfo.Fields.dataStatus, obj.getDataStatus());
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -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.FileInfoVO;
|
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.*;
|
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;
|
||||||
|
|
@ -63,12 +63,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
private EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
private EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||||
@Resource
|
@Autowired
|
||||||
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 = "";
|
||||||
|
|
@ -128,13 +126,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<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
List<FileInfoDTO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoDTO.class);
|
||||||
resetFileSize(records);
|
resetFileSize(records);
|
||||||
return ElectromagneticResultUtil.success(new FileInfoQueryPageVO(total, records));
|
return ElectromagneticResultUtil.success(new FileInfoQueryPageVO(total, records));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetFileSize(List<FileInfoVO> records) {
|
private void resetFileSize(List<FileInfoDTO> records) {
|
||||||
for (FileInfoVO fileInfoDTO : records) {
|
for (FileInfoDTO 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) {
|
||||||
|
|
@ -198,7 +196,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.selectById(id);
|
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, 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);
|
||||||
|
|
@ -689,7 +687,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::getParentId, EdFileInfo::getId, EdFileInfo::getFileId, EdFileInfo::getFileVersion, EdFileInfo::getPreVersion, EdFileInfo::getFileCode, EdFileInfo::getEffectFlag, EdFileInfo::getFileName)
|
.select(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);
|
||||||
|
|
@ -850,9 +848,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 = permissionService.getAccessibleTree(); //TODO 从权限处获取该用户有哪些工程的权限,这里先写静态,方便调试
|
List<String> prjIds = ListUtil.list(false, "100001", "100002"); //TODO 从权限处获取该用户有哪些工程的权限,这里先写静态,方便调试
|
||||||
LambdaQueryWrapper<EdFileInfo> lambdaQuery = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> lambdaQuery = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getSaveStatus, EdFileInfo::getCreatedTime, EdFileInfo::getFileType)
|
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getSaveStatus, EdFileInfo::getCreatedTime)
|
||||||
.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));
|
||||||
|
|
@ -865,19 +863,6 @@ 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())) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public enum EffectFlagEnum {
|
||||||
*/
|
*/
|
||||||
EFFECT(1, "有效"),
|
EFFECT(1, "有效"),
|
||||||
/**
|
/**
|
||||||
* 无效PermisionService
|
* 无效
|
||||||
*/
|
*/
|
||||||
NOT_EFFECTIVE(0, "无效");
|
NOT_EFFECTIVE(0, "无效");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue