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
e7243de1
Commit
e7243de1
authored
Jan 13, 2022
by
龙于生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
云盘 查询文件是否存在、新增文件查看记录 接口
parent
daf83d2f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
+28
-5
No files found.
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
View file @
e7243de1
...
@@ -226,16 +226,17 @@ public class DiskFilesController {
...
@@ -226,16 +226,17 @@ public class DiskFilesController {
@GetMapping
(
value
=
"/exportContract"
)
@GetMapping
(
value
=
"/exportContract"
)
public
void
exportContract
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件ID"
)
@RequestParam
(
required
=
true
)
Integer
fileId
,
public
void
exportContract
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件ID"
)
@RequestParam
(
required
=
true
)
Integer
fileId
,
@ApiParam
(
"下载通道默认不传:我收到的列表下载传type=1"
)
@RequestParam
(
required
=
false
)
Integer
type
,
HttpServletResponse
resp
)
{
@ApiParam
(
"下载通道默认不传:我收到的列表下载传type=1"
)
@RequestParam
(
required
=
false
)
Integer
type
,
HttpServletResponse
resp
)
{
if
(
fileId
==
null
||
fileId
<=
0
)
{
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
/*if (fileId == null || fileId <= 0) {
throw new CustomException("下载失败,请选择文件下载");
throw new CustomException("下载失败,请选择文件下载");
}
}
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
if(StringUtils.isEmpty(diskFiles)){
if(StringUtils.isEmpty(diskFiles)){
throw new CustomException("下载失败,文件不存在");
throw new CustomException("下载失败,文件不存在");
}
}
if(diskFiles.getDeleteFlag() == 1 && StringUtils.isEmpty(type)){
if(diskFiles.getDeleteFlag() == 1 && StringUtils.isEmpty(type)){
throw new CustomException("下载失败,该文件已删除");
throw new CustomException("下载失败,该文件已删除");
}
}
*/
InputStream
fis
=
null
;
InputStream
fis
=
null
;
BufferedInputStream
bis
=
null
;
BufferedInputStream
bis
=
null
;
OutputStream
os
;
OutputStream
os
;
...
@@ -285,10 +286,17 @@ public class DiskFilesController {
...
@@ -285,10 +286,17 @@ public class DiskFilesController {
@ApiOperation
(
value
=
"新增文件查看记录"
,
httpMethod
=
"GET"
,
notes
=
"新增文件查看记录"
)
@ApiOperation
(
value
=
"新增文件查看记录"
,
httpMethod
=
"GET"
,
notes
=
"新增文件查看记录"
)
@GetMapping
(
value
=
"/look_log/{fileId}"
)
@GetMapping
(
value
=
"/add_look_log"
)
public
Result
<
Object
>
lookLog
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件ID"
)
@PathVariable
Integer
fileId
){
public
Result
<
Object
>
lookLog
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件ID"
)
@RequestParam
(
required
=
true
)
Integer
fileId
,
@ApiParam
(
"默认不传,我收到的列表查看传type=1"
)
@RequestParam
(
required
=
false
)
Integer
type
){
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
DiskFilesLog
diskFilesLog
=
DiskFilesLog
.
builder
().
build
();
DiskFilesLog
diskFilesLog
=
DiskFilesLog
.
builder
().
build
();
if
(
StringUtils
.
isEmpty
(
diskFiles
)){
throw
new
CustomException
(
"查看失败,文件不存在"
);
}
if
(
diskFiles
.
getDeleteFlag
()
==
1
&&
StringUtils
.
isEmpty
(
type
)){
throw
new
CustomException
(
"查看失败,该文件已删除"
);
}
//新增 文件浏览记录
//新增 文件浏览记录
diskFilesLog
.
setFilePath
(
diskFiles
.
getUrlPath
());
diskFilesLog
.
setFilePath
(
diskFiles
.
getUrlPath
());
diskFilesLog
.
setFilesId
(
diskFiles
.
getId
());
diskFilesLog
.
setFilesId
(
diskFiles
.
getId
());
...
@@ -301,4 +309,19 @@ public class DiskFilesController {
...
@@ -301,4 +309,19 @@ public class DiskFilesController {
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
}
}
@ApiOperation
(
value
=
"查询文件是否存在"
,
httpMethod
=
"GET"
,
notes
=
"查询文件是否存在"
)
@GetMapping
(
value
=
"/query_file_isExist"
)
public
Result
<
Object
>
queryFileIsExist
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件ID"
)
@RequestParam
(
required
=
true
)
Integer
fileId
,
@ApiParam
(
"默认不传,我收到的列表查询传type=1"
)
@RequestParam
(
required
=
false
)
Integer
type
){
DiskFiles
diskFiles
=
DiskFiles
.
builder
().
id
(
fileId
).
build
().
selectById
();
DiskFilesLog
diskFilesLog
=
DiskFilesLog
.
builder
().
build
();
if
(
StringUtils
.
isEmpty
(
diskFiles
)){
throw
new
CustomException
(
"文件不存在"
);
}
if
(
diskFiles
.
getDeleteFlag
()
==
1
&&
StringUtils
.
isEmpty
(
type
)){
throw
new
CustomException
(
"该文件已删除"
);
}
return
ResultUtil
.
success
();
}
}
}
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