Commit 417a7ad6 by 284718418@qq.com

1.云盘-我的文件业务代码

parent 9a142539
......@@ -71,6 +71,7 @@ public class DiskCatalogueController {
}
diskCatalogue.setCreateUserId(empNum);
diskCatalogue.setOrgId(orgCode);
diskCatalogue.setUserName(userBean.getUserInfo().getName());
diskCatalogue.setUpdateUserId(empNum);
Boolean count = diskCatalogue.insertOrUpdate();
if (count) {
......
......@@ -71,8 +71,6 @@ public class DiskFilesController {
if (file == null || file.length == 0) {
return ResultUtil.error("上传失败,请选择上传文件");
}
Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode();
DiskFiles diskFiles = new DiskFiles();
DiskCatalogueFiles diskCatalogueFiles = new DiskCatalogueFiles();
DiskFilesLog diskFilesLog = new DiskFilesLog();
......@@ -82,7 +80,7 @@ public class DiskFilesController {
imageUrls = ftpService.uploadFile(targetPath, file, reservedName);
for (FileInfoDto dto : imageUrls) {
//新增资源上传文件
diskFiles.setCreateUserId(empNum);
diskFiles.setCreateUserId(userBean.getEmpNum());
diskFiles.setFileType(dto.getFileSuffix());
//"/home/disk/123456.jpg"
diskFiles.setDiskPath(root + targetPath + "/" + dto.getFileName());
......@@ -91,6 +89,7 @@ public class DiskFilesController {
diskFiles.setFileSize(dto.getFileSize());
// 显示大小:10KB,5M,2G 后续优化
diskFiles.setShowSize(dto.getFileSize() + "B");
diskFiles.setUserName(userBean.getUserInfo().getName());
diskFiles.insert();
//新增中间关系
......@@ -104,7 +103,7 @@ public class DiskFilesController {
diskFilesLog.setFileSize(dto.getFileSize() + "B");
diskFilesLog.setTitle(dto.getResourceFileName());
diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.CREATE_LOG.getType());
diskFilesLog.setUserId(empNum);
diskFilesLog.setUserId(userBean.getEmpNum());
diskFilesLog.setUserName(userBean.getUserInfo().getName());
diskFilesLog.insert();
......@@ -124,8 +123,6 @@ public class DiskFilesController {
if (fileId == null || fileId <= 0) {
return ResultUtil.error("下载失败,请选择文件下载");
}
Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode();
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
if(StringUtils.isEmpty(diskFiles)){
return ResultUtil.error("下载失败,文件不存在");
......@@ -140,7 +137,7 @@ public class DiskFilesController {
diskFilesLog.setFileSize(diskFiles.getFileSize() + "B");
diskFilesLog.setTitle(diskFiles.getTitle());
diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.DOWN_LOAD_LOG.getType());
diskFilesLog.setUserId(empNum);
diskFilesLog.setUserId(userBean.getEmpNum());
diskFilesLog.setUserName(userBean.getUserInfo().getName());
diskFilesLog.insert();
return ResultUtil.success();
......@@ -162,15 +159,14 @@ public class DiskFilesController {
@ApiOperation(value = "文件重命名", httpMethod = "POST", notes = "文件重命名")
public Result<Object> updateFileName(@CurrentUser UserBean userBean, @Validated @RequestBody DiskFilesParam diskFilesParam) {
try{
Integer empNum = userBean.getEmpNum();
DiskFiles entity = new DiskFiles();
DiskFiles diskFiles = DiskFiles.builder().id(diskFilesParam.getId()).build().selectById();
if (StringUtils.isEmpty(diskFiles) || !diskFiles.getCreateUserId().equals(empNum)) {
if (StringUtils.isEmpty(diskFiles) || !diskFiles.getCreateUserId().equals(userBean.getEmpNum())) {
return ResultUtil.error("操作失败!");
}
entity.setId(diskFiles.getId());
entity.setTitle(diskFilesParam.getName());
entity.setUpdateUserId(empNum);
entity.setUpdateUserId(userBean.getEmpNum());
DiskFilesLog diskFilesLog = new DiskFilesLog();
diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.UPDATE_LOG.getType());
if(!StringUtils.isEmpty(diskFilesParam.getDeleteFlag())){
......@@ -184,7 +180,7 @@ public class DiskFilesController {
diskFilesLog.setFilesId(diskFiles.getId());
diskFilesLog.setFileSize(diskFiles.getFileSize() + "B");
diskFilesLog.setTitle(diskFiles.getTitle());
diskFilesLog.setUserId(empNum);
diskFilesLog.setUserId(userBean.getEmpNum());
diskFilesLog.setUserName(userBean.getUserInfo().getName());
diskFilesLog.insert();
return ResultUtil.data(StringUtils.isEmpty(diskFilesParam.getDeleteFlag())?"文件重命名成功":"删除文件成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment