Merge branch 'develop' of http://139.196.179.195:3000/chenxudong/electromagnetic-data-new into develop
This commit is contained in:
commit
8eb4d76f29
|
|
@ -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")
|
||||||
|
|
@ -36,7 +37,7 @@ public class EdFileInfoController {
|
||||||
return edFileInfoService.delete(id);
|
return edFileInfoService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("info")
|
@RequestMapping("getFileInfoList")
|
||||||
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO);
|
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO);
|
||||||
}
|
}
|
||||||
|
|
@ -103,4 +104,9 @@ public class EdFileInfoController {
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
||||||
|
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||||
|
return edFileInfoService.uploadRecord(pageNum, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.other;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UploadRecordDTO {
|
||||||
|
private String id;
|
||||||
|
private String fileName;
|
||||||
|
private Integer saveStatus;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -26,15 +26,31 @@ public class FileInfoQueryDTO {
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件类型 (0-文件夹 1-文件)
|
* 文件名排序 (0-升序,1-降序)
|
||||||
*/
|
*/
|
||||||
private Integer dataType;
|
private Integer fileNameSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型 (0-升序,1-降序)
|
||||||
|
*/
|
||||||
|
private Integer fileTypeSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型过滤
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传时间(0-升序,1-降序)
|
* 上传时间(0-升序,1-降序)
|
||||||
*/
|
*/
|
||||||
private Integer createdTime;
|
private Integer createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间(0-升序,1-降序)
|
||||||
|
*/
|
||||||
|
private Integer updatedTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版本号(0-升序,1-降序
|
* 版本号(0-升序,1-降序
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@FieldNameConstants
|
||||||
|
@Data
|
||||||
|
public class FileProjectVO {
|
||||||
|
private String categoryId;
|
||||||
|
private String categoryName;
|
||||||
|
private String parentId;
|
||||||
|
private Integer dataStatus;
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private List<FileProjectVO> children = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
@ -15,5 +15,4 @@ public class ProjectVO {
|
||||||
private Integer dataStatus;
|
private Integer dataStatus;
|
||||||
|
|
||||||
private List<ProjectVO> children = new ArrayList<>();
|
private List<ProjectVO> children = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UploadRecordVO {
|
||||||
|
|
||||||
|
private long total;
|
||||||
|
List<UploadRecordDTO> records = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目层级结构查询
|
* 项目层级结构查询
|
||||||
|
|
@ -138,4 +137,10 @@ public interface EdFileInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> copyFile(String id, String targetFolderId, Integer strategy);
|
ElectromagneticResult<?> copyFile(String id, String targetFolderId, Integer strategy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布管理
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.electromagnetic.industry.software.common.util.ElectromagneticResultUt
|
||||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
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.resp.FileProjectVO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
||||||
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -145,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);
|
||||||
|
|
@ -192,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)
|
||||||
|
|
@ -208,7 +210,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElectromagneticResult<?> queryAllPrjInfo(boolean isAdminQuery) {
|
public List<ProjectVO> queryAllPrjInfo(boolean isAdminQuery) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
|
@ -220,7 +222,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<ProjectVO> projectVOS = new ArrayList<>();
|
List projectVOS = new ArrayList<>();
|
||||||
|
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id);
|
List<EdFileInfo> edFileInfos = selectAllAdminFolder(id);
|
||||||
|
|
@ -228,23 +230,39 @@ public class CommonService {
|
||||||
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());
|
||||||
}
|
}
|
||||||
// 转换为树
|
// 转换为树
|
||||||
TreeNodeConfig config = new TreeNodeConfig();
|
if (isAdminQuery) {
|
||||||
config.setIdKey(EdFileInfo.Fields.id);
|
TreeNodeConfig config = new TreeNodeConfig();
|
||||||
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
config.setIdKey(EdFileInfo.Fields.id);
|
||||||
config.setWeightKey(EdFileInfo.Fields.sort);
|
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
||||||
|
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(EdFileInfo.Fields.id, obj.getId());
|
treeNode.putExtra("id", obj.getId());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.parentId, obj.getParentId());
|
treeNode.putExtra(EdFileInfo.Fields.parentId, obj.getParentId());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.sort, obj.getSort());
|
treeNode.putExtra(EdFileInfo.Fields.sort, obj.getSort());
|
||||||
treeNode.putExtra(EdFileInfo.Fields.fileName, obj.getFileName());
|
treeNode.putExtra(EdFileInfo.Fields.fileName, obj.getFileName());
|
||||||
}));
|
treeNode.putExtra(EdFileInfo.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);
|
||||||
projectVOS.add(projectVO);
|
projectVOS.add(projectVO);
|
||||||
|
} else {
|
||||||
|
TreeNodeConfig config = new TreeNodeConfig();
|
||||||
|
config.setIdKey(FileProjectVO.Fields.categoryId);
|
||||||
|
config.setParentIdKey(FileProjectVO.Fields.parentId);
|
||||||
|
config.setWeightKey(FileProjectVO.Fields.sort);
|
||||||
|
List<Tree<String>> trees = TreeUtil.build(edFileInfos, PRJ_PARENT_ID, config, ((obj, treeNode) -> {
|
||||||
|
treeNode.putExtra(FileProjectVO.Fields.categoryId, obj.getId());
|
||||||
|
treeNode.putExtra(FileProjectVO.Fields.parentId, obj.getParentId());
|
||||||
|
treeNode.putExtra(FileProjectVO.Fields.sort, obj.getSort());
|
||||||
|
treeNode.putExtra(FileProjectVO.Fields.categoryName, obj.getFileName());
|
||||||
|
treeNode.putExtra(FileProjectVO.Fields.dataStatus, obj.getDataStatus());
|
||||||
|
}));
|
||||||
|
String jsonStr = JSONUtil.toJsonStr(trees);
|
||||||
|
FileProjectVO fileProjectVO = JSONUtil.toList(jsonStr, FileProjectVO.class).get(0);
|
||||||
|
projectVOS.add(fileProjectVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ElectromagneticResultUtil.success(projectVOS);
|
return projectVOS;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = "查询项目失败";
|
String info = "查询项目失败";
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.codec.Base64;
|
import cn.hutool.core.codec.Base64;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
|
@ -17,7 +18,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.electromagnetic.industry.software.common.cons.ElectromagneticConstants;
|
|
||||||
import com.electromagnetic.industry.software.common.enums.*;
|
import com.electromagnetic.industry.software.common.enums.*;
|
||||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
|
@ -25,12 +25,12 @@ 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.FileInfoDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkResultDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.*;
|
||||||
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.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 org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -93,16 +93,16 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select()
|
.select()
|
||||||
|
.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.getDataType(), EleDataTypeEnum.FOLDER.code), EdFileInfo::getFileType, EleDataTypeEnum.FOLDER.code)
|
|
||||||
.eq(Objects.equals(fileInfoQueryDTO.getDataType(), EleDataTypeEnum.FILE.code), EdFileInfo::getFileType, EleDataTypeEnum.FILE.code)
|
|
||||||
|
|
||||||
.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())
|
||||||
|
|
||||||
|
.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)
|
||||||
|
|
@ -113,6 +113,15 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.orderByAsc(Objects.equals(fileInfoQueryDTO.getFileSize(), 0), EdFileInfo::getFileSize)
|
.orderByAsc(Objects.equals(fileInfoQueryDTO.getFileSize(), 0), EdFileInfo::getFileSize)
|
||||||
.orderByDesc(Objects.equals(fileInfoQueryDTO.getFileSize(), 1), EdFileInfo::getFileSize)
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getFileSize(), 1), EdFileInfo::getFileSize)
|
||||||
|
|
||||||
|
.orderByAsc(Objects.equals(fileInfoQueryDTO.getFileNameSort(), 0), EdFileInfo::getFileName)
|
||||||
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getFileNameSort(), 1), EdFileInfo::getFileName)
|
||||||
|
|
||||||
|
.orderByAsc(Objects.equals(fileInfoQueryDTO.getUpdatedTime(), 0), EdFileInfo::getUpdatedTime)
|
||||||
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getUpdatedTime(), 1), EdFileInfo::getUpdatedTime)
|
||||||
|
|
||||||
|
.orderByAsc(Objects.equals(fileInfoQueryDTO.getFileTypeSort(), 0), EdFileInfo::getFileType)
|
||||||
|
.orderByDesc(Objects.equals(fileInfoQueryDTO.getFileTypeSort(), 1), EdFileInfo::getFileType)
|
||||||
|
|
||||||
.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);
|
||||||
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);
|
||||||
|
|
@ -138,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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -157,7 +163,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> tree() {
|
public ElectromagneticResult<?> tree() {
|
||||||
return commonService.queryAllPrjInfo(false);
|
return ElectromagneticResultUtil.success(commonService.queryAllPrjInfo(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -614,11 +620,14 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG);
|
||||||
EdFileInfo fileInfo = this.baseMapper.selectById(parentId);
|
EdFileInfo fileInfo = this.baseMapper.selectById(parentId);
|
||||||
Assert.isTrue(fileInfo.getDataType().equals(EleDataTypeEnum.FOLDER.code) && !fileInfo.getPrjDir(), "层级目录不允许上传文件");
|
Assert.isTrue(fileInfo.getDataType().equals(EleDataTypeEnum.FOLDER.code) && !fileInfo.getPrjDir(), "层级目录不允许上传文件");
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
String mainName = FileUtil.mainName(fileName);
|
||||||
|
String suffix = FileUtil.getSuffix(fileName);
|
||||||
|
EdFileInfo newEdFileInfo = new EdFileInfo();
|
||||||
|
newEdFileInfo.newInit();
|
||||||
// 首先检查是否是同名文件
|
// 首先检查是否是同名文件
|
||||||
try {
|
try {
|
||||||
String fileName = file.getOriginalFilename();
|
|
||||||
String mainName = FileUtil.mainName(fileName);
|
|
||||||
String suffix = FileUtil.getSuffix(fileName);
|
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), NAME_VALID_MSG);
|
||||||
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getParentId, parentId)
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
|
|
@ -631,8 +640,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
EdFileInfo parentFolderInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
EdFileInfo parentFolderInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getId, parentId)
|
.eq(EdFileInfo::getId, parentId)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||||
EdFileInfo newEdFileInfo = new EdFileInfo();
|
|
||||||
newEdFileInfo.newInit();
|
|
||||||
String codePathByDbPath = commonService.getCodePathByDbPath(parentFolderInfo.getFilePath());
|
String codePathByDbPath = commonService.getCodePathByDbPath(parentFolderInfo.getFilePath());
|
||||||
String fileCode = commonService.createFileCode(codePathByDbPath, suffix, FILE_START_VERSION, newEdFileInfo.getFileTime());
|
String fileCode = commonService.createFileCode(codePathByDbPath, suffix, FILE_START_VERSION, newEdFileInfo.getFileTime());
|
||||||
newEdFileInfo.setParentId(parentId)
|
newEdFileInfo.setParentId(parentId)
|
||||||
|
|
@ -648,11 +656,21 @@ 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)
|
||||||
|
.setFileName(mainName)
|
||||||
|
.setFileType(suffix)
|
||||||
|
.setFileSize(file.getSize())
|
||||||
|
.setDataType(EleDataTypeEnum.FILE.code)
|
||||||
|
.setDataStatus(PublishEnum.PUBLISHED.getCode())
|
||||||
|
.setEffectFlag(EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||||
|
.setSaveStatus(EleDataSaveStatusEnum.FAIL.code)
|
||||||
|
.setPrjDir(false);
|
||||||
|
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);
|
||||||
|
|
@ -822,6 +840,29 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布管理
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize) {
|
||||||
|
|
||||||
|
List<String> prjIds = ListUtil.list(false, "100001", "100002"); //TODO 从权限处获取该用户有哪些工程的权限,这里先写静态,方便调试
|
||||||
|
LambdaQueryWrapper<EdFileInfo> lambdaQuery = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getSaveStatus, EdFileInfo::getCreatedTime)
|
||||||
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code)
|
||||||
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
|
.likeRight(EdFileInfo::getFilePath, prjIds.get(0));
|
||||||
|
for (int i = 1; i < pageSize; i++) {
|
||||||
|
lambdaQuery.or().likeRight(EdFileInfo::getFilePath, prjIds.get(i));
|
||||||
|
}
|
||||||
|
Page<EdFileInfo> edFileInfoPage = this.baseMapper.selectPage(new Page<>(pageNum, pageSize), lambdaQuery);
|
||||||
|
long total = edFileInfoPage.getTotal();
|
||||||
|
List<UploadRecordDTO> uploadRecordDTOS = BeanUtil.copyToList(edFileInfoPage.getRecords(), UploadRecordDTO.class);
|
||||||
|
return ElectromagneticResultUtil.success(new UploadRecordVO(total, uploadRecordDTOS));
|
||||||
|
}
|
||||||
|
|
||||||
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())) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -221,7 +215,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> queryAllPrjInfo() {
|
public ElectromagneticResult<?> queryAllPrjInfo() {
|
||||||
return commonService.queryAllPrjInfo(true);
|
return ElectromagneticResultUtil.success(commonService.queryAllPrjInfo(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue