Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
211fbfdc
Commit
211fbfdc
authored
Jan 06, 2022
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.云盘-我的文件业务代码
parent
20bba76f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
+1
-0
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
+7
-11
No files found.
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
View file @
211fbfdc
...
@@ -71,6 +71,7 @@ public class DiskCatalogueController {
...
@@ -71,6 +71,7 @@ public class DiskCatalogueController {
}
}
diskCatalogue
.
setCreateUserId
(
empNum
);
diskCatalogue
.
setCreateUserId
(
empNum
);
diskCatalogue
.
setOrgId
(
orgCode
);
diskCatalogue
.
setOrgId
(
orgCode
);
diskCatalogue
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskCatalogue
.
setUpdateUserId
(
empNum
);
diskCatalogue
.
setUpdateUserId
(
empNum
);
Boolean
count
=
diskCatalogue
.
insertOrUpdate
();
Boolean
count
=
diskCatalogue
.
insertOrUpdate
();
if
(
count
)
{
if
(
count
)
{
...
...
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
View file @
211fbfdc
...
@@ -71,8 +71,6 @@ public class DiskFilesController {
...
@@ -71,8 +71,6 @@ public class DiskFilesController {
if
(
file
==
null
||
file
.
length
==
0
)
{
if
(
file
==
null
||
file
.
length
==
0
)
{
return
ResultUtil
.
error
(
"上传失败,请选择上传文件"
);
return
ResultUtil
.
error
(
"上传失败,请选择上传文件"
);
}
}
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
DiskFiles
diskFiles
=
new
DiskFiles
();
DiskFiles
diskFiles
=
new
DiskFiles
();
DiskCatalogueFiles
diskCatalogueFiles
=
new
DiskCatalogueFiles
();
DiskCatalogueFiles
diskCatalogueFiles
=
new
DiskCatalogueFiles
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
...
@@ -82,7 +80,7 @@ public class DiskFilesController {
...
@@ -82,7 +80,7 @@ public class DiskFilesController {
imageUrls
=
ftpService
.
uploadFile
(
targetPath
,
file
,
reservedName
);
imageUrls
=
ftpService
.
uploadFile
(
targetPath
,
file
,
reservedName
);
for
(
FileInfoDto
dto
:
imageUrls
)
{
for
(
FileInfoDto
dto
:
imageUrls
)
{
//新增资源上传文件
//新增资源上传文件
diskFiles
.
setCreateUserId
(
empNum
);
diskFiles
.
setCreateUserId
(
userBean
.
getEmpNum
()
);
diskFiles
.
setFileType
(
dto
.
getFileSuffix
());
diskFiles
.
setFileType
(
dto
.
getFileSuffix
());
//"/home/disk/123456.jpg"
//"/home/disk/123456.jpg"
diskFiles
.
setDiskPath
(
root
+
targetPath
+
"/"
+
dto
.
getFileName
());
diskFiles
.
setDiskPath
(
root
+
targetPath
+
"/"
+
dto
.
getFileName
());
...
@@ -91,6 +89,7 @@ public class DiskFilesController {
...
@@ -91,6 +89,7 @@ public class DiskFilesController {
diskFiles
.
setFileSize
(
dto
.
getFileSize
());
diskFiles
.
setFileSize
(
dto
.
getFileSize
());
// 显示大小:10KB,5M,2G 后续优化
// 显示大小:10KB,5M,2G 后续优化
diskFiles
.
setShowSize
(
dto
.
getFileSize
()
+
"B"
);
diskFiles
.
setShowSize
(
dto
.
getFileSize
()
+
"B"
);
diskFiles
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFiles
.
insert
();
diskFiles
.
insert
();
//新增中间关系
//新增中间关系
...
@@ -104,7 +103,7 @@ public class DiskFilesController {
...
@@ -104,7 +103,7 @@ public class DiskFilesController {
diskFilesLog
.
setFileSize
(
dto
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setFileSize
(
dto
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setTitle
(
dto
.
getResourceFileName
());
diskFilesLog
.
setTitle
(
dto
.
getResourceFileName
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
CREATE_LOG
.
getType
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
CREATE_LOG
.
getType
());
diskFilesLog
.
setUserId
(
empNum
);
diskFilesLog
.
setUserId
(
userBean
.
getEmpNum
()
);
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
insert
();
diskFilesLog
.
insert
();
...
@@ -124,8 +123,6 @@ public class DiskFilesController {
...
@@ -124,8 +123,6 @@ public class DiskFilesController {
if
(
fileId
==
null
||
fileId
<=
0
)
{
if
(
fileId
==
null
||
fileId
<=
0
)
{
return
ResultUtil
.
error
(
"下载失败,请选择文件下载"
);
return
ResultUtil
.
error
(
"下载失败,请选择文件下载"
);
}
}
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
if
(
StringUtils
.
isEmpty
(
diskFiles
)){
if
(
StringUtils
.
isEmpty
(
diskFiles
)){
return
ResultUtil
.
error
(
"下载失败,文件不存在"
);
return
ResultUtil
.
error
(
"下载失败,文件不存在"
);
...
@@ -140,7 +137,7 @@ public class DiskFilesController {
...
@@ -140,7 +137,7 @@ public class DiskFilesController {
diskFilesLog
.
setFileSize
(
diskFiles
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setFileSize
(
diskFiles
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setTitle
(
diskFiles
.
getTitle
());
diskFilesLog
.
setTitle
(
diskFiles
.
getTitle
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
DOWN_LOAD_LOG
.
getType
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
DOWN_LOAD_LOG
.
getType
());
diskFilesLog
.
setUserId
(
empNum
);
diskFilesLog
.
setUserId
(
userBean
.
getEmpNum
()
);
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
insert
();
diskFilesLog
.
insert
();
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
...
@@ -162,15 +159,14 @@ public class DiskFilesController {
...
@@ -162,15 +159,14 @@ public class DiskFilesController {
@ApiOperation
(
value
=
"文件重命名"
,
httpMethod
=
"POST"
,
notes
=
"文件重命名"
)
@ApiOperation
(
value
=
"文件重命名"
,
httpMethod
=
"POST"
,
notes
=
"文件重命名"
)
public
Result
<
Object
>
updateFileName
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskFilesParam
diskFilesParam
)
{
public
Result
<
Object
>
updateFileName
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskFilesParam
diskFilesParam
)
{
try
{
try
{
Integer
empNum
=
userBean
.
getEmpNum
();
DiskFiles
entity
=
new
DiskFiles
();
DiskFiles
entity
=
new
DiskFiles
();
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
diskFilesParam
.
getId
()).
build
().
selectById
();
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
(
"操作失败!"
);
return
ResultUtil
.
error
(
"操作失败!"
);
}
}
entity
.
setId
(
diskFiles
.
getId
());
entity
.
setId
(
diskFiles
.
getId
());
entity
.
setTitle
(
diskFilesParam
.
getName
());
entity
.
setTitle
(
diskFilesParam
.
getName
());
entity
.
setUpdateUserId
(
empNum
);
entity
.
setUpdateUserId
(
userBean
.
getEmpNum
()
);
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
UPDATE_LOG
.
getType
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
UPDATE_LOG
.
getType
());
if
(!
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())){
if
(!
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())){
...
@@ -184,7 +180,7 @@ public class DiskFilesController {
...
@@ -184,7 +180,7 @@ public class DiskFilesController {
diskFilesLog
.
setFilesId
(
diskFiles
.
getId
());
diskFilesLog
.
setFilesId
(
diskFiles
.
getId
());
diskFilesLog
.
setFileSize
(
diskFiles
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setFileSize
(
diskFiles
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setTitle
(
diskFiles
.
getTitle
());
diskFilesLog
.
setTitle
(
diskFiles
.
getTitle
());
diskFilesLog
.
setUserId
(
empNum
);
diskFilesLog
.
setUserId
(
userBean
.
getEmpNum
()
);
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
diskFilesLog
.
insert
();
diskFilesLog
.
insert
();
return
ResultUtil
.
data
(
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())?
"文件重命名成功"
:
"删除文件成功"
);
return
ResultUtil
.
data
(
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())?
"文件重命名成功"
:
"删除文件成功"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment