Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
48979a78
提交
48979a78
authored
4月 03, 2020
作者:
zhangshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
文件下载次数修改
上级
a671bad6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
23 行增加
和
18 行删除
+23
-18
FileSave.java
efs-ftp/src/main/java/com/zjty/efs/ftp/entity/FileSave.java
+1
-1
DownLoadServiceImpl.java
...va/com/zjty/efs/ftp/service/impl/DownLoadServiceImpl.java
+20
-16
FileDownLoadServiceImpl.java
...om/zjty/efs/ftp/service/impl/FileDownLoadServiceImpl.java
+2
-1
没有找到文件。
efs-ftp/src/main/java/com/zjty/efs/ftp/entity/FileSave.java
浏览文件 @
48979a78
...
@@ -20,7 +20,7 @@ import javax.persistence.Id;
...
@@ -20,7 +20,7 @@ import javax.persistence.Id;
@ApiModel
(
value
=
"FileSave"
,
description
=
"将文件信息存储在数据库中"
)
@ApiModel
(
value
=
"FileSave"
,
description
=
"将文件信息存储在数据库中"
)
public
class
FileSave
{
public
class
FileSave
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
name
=
"id"
,
value
=
"文件id"
,
notes
=
"文件id"
,
example
=
"1"
)
@ApiModelProperty
(
name
=
"id"
,
value
=
"文件id"
,
notes
=
"文件id"
,
example
=
"1"
)
private
Integer
id
;
//文件id
private
Integer
id
;
//文件id
@ApiModelProperty
(
name
=
"realName"
,
value
=
"文件真正存储名称"
,
notes
=
"文件真正存储名称"
,
example
=
"1(1).zip"
)
@ApiModelProperty
(
name
=
"realName"
,
value
=
"文件真正存储名称"
,
notes
=
"文件真正存储名称"
,
example
=
"1(1).zip"
)
...
...
efs-ftp/src/main/java/com/zjty/efs/ftp/service/impl/DownLoadServiceImpl.java
浏览文件 @
48979a78
...
@@ -18,23 +18,27 @@ public class DownLoadServiceImpl implements DownLoadService {
...
@@ -18,23 +18,27 @@ public class DownLoadServiceImpl implements DownLoadService {
@Override
@Override
public
List
<
DownLoadCount
>
findCount
(
DownLoadRequest
downLoadRequest
)
{
public
List
<
DownLoadCount
>
findCount
(
DownLoadRequest
downLoadRequest
)
{
List
<
Integer
>
fileIdList
=
downLoadRequest
.
getFileIds
();
//请求的id集合
List
<
DownLoadCount
>
loadCounts
=
new
ArrayList
<>();
List
<
DownLoadCount
>
loadCounts
=
new
ArrayList
<>();
if
(
fileIdList
!=
null
&&
fileIdList
.
size
()
!=
0
){
if
(!
downLoadRequest
.
getUserId
().
isEmpty
()){
loadCounts
=
downLoadCountDao
.
findCount
(
downLoadRequest
.
getUserId
(),
fileIdList
);
List
<
Integer
>
fileIdList
=
downLoadRequest
.
getFileIds
();
//请求的id集合
if
(
loadCounts
.
size
()
!=
fileIdList
.
size
()){
if
(
fileIdList
!=
null
&&
fileIdList
.
size
()
!=
0
){
//没有文件id
loadCounts
=
downLoadCountDao
.
findCount
(
downLoadRequest
.
getUserId
(),
fileIdList
);
List
<
Integer
>
idList
=
new
ArrayList
<>();
//数据库id集合
//如果传入的文件id不存在,视为没有下载过的查询,下载过的次数为0
for
(
DownLoadCount
downLoadCount:
loadCounts
){
if
(
loadCounts
.
size
()
!=
fileIdList
.
size
()){
idList
.
add
(
downLoadCount
.
getFileId
());
//没有文件id
}
List
<
Integer
>
idList
=
new
ArrayList
<>();
//数据库id集合
for
(
Integer
i:
fileIdList
){
for
(
DownLoadCount
downLoadCount:
loadCounts
){
if
(!
idList
.
contains
(
i
)){
idList
.
add
(
downLoadCount
.
getFileId
());
DownLoadCount
downLoadCount
=
new
DownLoadCount
();
}
downLoadCount
.
setUserId
(
downLoadRequest
.
getUserId
());
//将不存在的文件下载次数设置为0
downLoadCount
.
setFileId
(
i
);
for
(
Integer
i:
fileIdList
){
downLoadCount
.
setCount
(
0
);
if
(!
idList
.
contains
(
i
)){
loadCounts
.
add
(
downLoadCount
);
DownLoadCount
downLoadCount
=
new
DownLoadCount
();
downLoadCount
.
setUserId
(
downLoadRequest
.
getUserId
());
downLoadCount
.
setFileId
(
i
);
downLoadCount
.
setCount
(
0
);
loadCounts
.
add
(
downLoadCount
);
}
}
}
}
}
}
}
...
...
efs-ftp/src/main/java/com/zjty/efs/ftp/service/impl/FileDownLoadServiceImpl.java
浏览文件 @
48979a78
...
@@ -71,7 +71,8 @@ public class FileDownLoadServiceImpl implements FileDownLoadService {
...
@@ -71,7 +71,8 @@ public class FileDownLoadServiceImpl implements FileDownLoadService {
log
.
error
(
file
.
getAbsolutePath
()
+
"文件不存在"
);
log
.
error
(
file
.
getAbsolutePath
()
+
"文件不存在"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
file
.
getAbsolutePath
()
+
"文件读取异常"
);
//log.error(file.getAbsolutePath() + "文件读取异常");
log
.
error
(
file
.
getAbsolutePath
()
+
"文件用户终止下载"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
try
{
try
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论