Compare commits

..

No commits in common. "6a5ad927c2226985f6be5cde25ea4285b1347d10" and "f59031bd5ca9c07d2cd8605d2b5f4b7cbf760db2" have entirely different histories.

4 changed files with 10 additions and 22 deletions

View File

@ -8,6 +8,7 @@ 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 {

View File

@ -116,16 +116,6 @@ 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();

View File

@ -209,8 +209,7 @@ 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)
.set(EdFileInfo::getAllDeleted, true) .eq(EdFileInfo::getId, id));
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
return ElectromagneticResultUtil.success(true); return ElectromagneticResultUtil.success(true);
} }
@ -413,7 +412,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) {
@ -1142,10 +1141,11 @@ 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;
String path = uploadDataDir + File.separator + currentUserId + File.separator + identifier; File[] partFiles = FileUtil.ls(uploadDataDir + File.separator + currentUserId + File.separator + identifier);
BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
for (int i = 1; i <= totalChunks; i++) { for (File partFile : partFiles) {
try (BufferedInputStream inputStream = FileUtil.getInputStream(path + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX)) { try (BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
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);
} }
} }
FileUtil.del(path); Arrays.stream(partFiles).forEach(e -> FileUtil.del(e.getAbsolutePath()));
return destColibPath; return destColibPath;
} }
@ -1171,9 +1171,6 @@ 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);
} }

View File

@ -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::getFileType, EleDataTypeEnum.FILE.code) .eq(EdFileInfo::getDataStatus, 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, "该层级目录下存在文件,不允许再定义层级目录");