Compare commits
No commits in common. "6a5ad927c2226985f6be5cde25ea4285b1347d10" and "f59031bd5ca9c07d2cd8605d2b5f4b7cbf760db2" have entirely different histories.
6a5ad927c2
...
f59031bd5c
|
|
@ -8,6 +8,7 @@ import org.aspectj.lang.annotation.Around;
|
|||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
public class RoleCheckAspect {
|
||||
|
|
|
|||
|
|
@ -116,16 +116,6 @@ public class EdFileInfo extends BaseModel {
|
|||
@TableField(value = "prj_dir")
|
||||
private Boolean prjDir;
|
||||
|
||||
/** 当一个文件作废时,其所有的历史文件也会跟着作废,此时该文件及其历史文件的all_deleted=true**/
|
||||
@TableField(value = "all_deleted")
|
||||
private Boolean allDeleted;
|
||||
|
||||
/**
|
||||
* 当文件被管理员永久物理删除,此时为true
|
||||
*/
|
||||
@TableField(value = "permanent_deleted")
|
||||
private Boolean permanentDeleted;
|
||||
|
||||
public void newInit() {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
||||
|
|
|
|||
|
|
@ -209,8 +209,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
.set(EdFileInfo::getUpdatedBy, currentUserId)
|
||||
.set(EdFileInfo::getUpdatedTime, now)
|
||||
.set(EdFileInfo::getEffectFlag, false)
|
||||
.set(EdFileInfo::getAllDeleted, true)
|
||||
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
|
||||
.eq(EdFileInfo::getId, id));
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
}
|
||||
|
||||
|
|
@ -413,7 +412,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
AES aes = SecureUtil.aes(FILE_SEC_PASSWD.getBytes());
|
||||
try (
|
||||
InputStream inputStream = Files.newInputStream(Paths.get(destColibPath));
|
||||
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath))
|
||||
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath));
|
||||
) {
|
||||
aes.decrypt(inputStream, outputStream, true);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1142,10 +1141,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
// 合并分片
|
||||
String destColibPath = uploadDataDir + File.separator + currentUserId + File.separator + fileName;
|
||||
String path = uploadDataDir + File.separator + currentUserId + File.separator + identifier;
|
||||
BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
|
||||
for (int i = 1; i <= totalChunks; i++) {
|
||||
try (BufferedInputStream inputStream = FileUtil.getInputStream(path + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX)) {
|
||||
File[] partFiles = FileUtil.ls(uploadDataDir + File.separator + currentUserId + File.separator + identifier);
|
||||
|
||||
for (File partFile : partFiles) {
|
||||
try (BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
|
||||
BufferedInputStream inputStream = FileUtil.getInputStream(partFile)) {
|
||||
IoUtil.copy(inputStream, outputStream);
|
||||
} catch (Exception e) {
|
||||
FileUtil.del(destColibPath);
|
||||
|
|
@ -1154,7 +1154,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
throw new BizException(info);
|
||||
}
|
||||
}
|
||||
FileUtil.del(path);
|
||||
Arrays.stream(partFiles).forEach(e -> FileUtil.del(e.getAbsolutePath()));
|
||||
return destColibPath;
|
||||
}
|
||||
|
||||
|
|
@ -1171,9 +1171,6 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
if(file.getId().length()<6){
|
||||
throw new StringIndexOutOfBoundsException("此文件的FILE_CODE小于六位:"+id);
|
||||
}
|
||||
if(file.getPrjDir().equals(Boolean.TRUE)){
|
||||
return id;
|
||||
}
|
||||
return file.getFileCode().substring(0, 6);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
|||
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), NAME_VALID_MSG);
|
||||
// 检查当前目录下有文件,如果有则不允许添加
|
||||
long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getFileType, EleDataTypeEnum.FILE.code)
|
||||
.eq(EdFileInfo::getDataStatus, EleDataTypeEnum.FILE.code)
|
||||
.eq(EdFileInfo::getParentId, parentId)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||
Assert.isTrue(count == 0, "该层级目录下存在文件,不允许再定义层级目录");
|
||||
|
|
|
|||
Loading…
Reference in New Issue