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