Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
f6651da2
提交
f6651da2
authored
4月 07, 2020
作者:
LJJ
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of…
Merge branch 'develop' of
https://git.yfzx.zjtys.com.cn/zhuangshuang/EncryptedFileSystem
into develop
上级
c0073dd0
6e01184e
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
70 行增加
和
60 行删除
+70
-60
NoticeController.java
...in/java/com/zjty/efs/bus/controller/NoticeController.java
+3
-4
Notice.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
+2
-1
NoticeServiceImpl.java
...java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
+21
-12
Job.java
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
+16
-25
FileSave.java
efs-ftp/src/main/java/com/zjty/efs/ftp/entity/FileSave.java
+1
-1
DownLoadService.java
...c/main/java/com/zjty/efs/ftp/service/DownLoadService.java
+5
-0
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-bus/src/main/java/com/zjty/efs/bus/controller/NoticeController.java
浏览文件 @
f6651da2
...
...
@@ -4,10 +4,7 @@ import com.zjty.efs.bus.entity.Notice;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.service.NoticeService
;
import
com.zjty.efs.misc.config.AutoDocument
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -95,6 +92,8 @@ public class NoticeController {
}
@GetMapping
(
"/unreadNum"
)
@ApiOperation
(
value
=
"已接收通知未读数量"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前登录用户"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)
public
ResponseEntity
unreadNum
(
String
userId
){
log
.
info
(
"已接收未读数量"
);
return
ResponseEntity
.
ok
(
noticeService
.
unreadNum
(
userId
));
...
...
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
浏览文件 @
f6651da2
...
...
@@ -58,8 +58,9 @@ public class Notice {
/**
* 留言
*/
@Lob
@ApiModelProperty
(
value
=
"message"
,
example
=
"尽快完成"
,
dataType
=
"String"
,
name
=
"留言"
)
@Column
(
name
=
"message"
)
@Column
(
name
=
"message"
,
columnDefinition
=
"TEXT"
)
private
String
message
;
/**
...
...
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
浏览文件 @
f6651da2
...
...
@@ -2,6 +2,7 @@ package com.zjty.efs.bus.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.zjty.efs.bus.Dao.NoticeDao
;
import
com.zjty.efs.bus.entity.Addressee
;
import
com.zjty.efs.bus.entity.Attention
;
...
...
@@ -54,7 +55,7 @@ public class NoticeServiceImpl implements NoticeService {
if
(
notice
.
getType
()
==
2
){
//保存为草稿
//保存为草稿
、、、
List
<
Addressee
>
addresseeList
=
new
ArrayList
<>();
for
(
String
addressee:
strings
){
UserDo
userDo1
=
userService
.
findById
(
addressee
);
...
...
@@ -71,7 +72,8 @@ public class NoticeServiceImpl implements NoticeService {
}
else
{
List
<
Addressee
>
addresseeList2
=
new
ArrayList
<>();
//接受者显示的接收列表
Notice
notice1
=
transform
(
notice
);
//发送通知
// Notice notice1 = transform(notice); //发送通知
// notice1.setId(notice.getId());
String
dataList
=
""
;
List
<
UserDo
>
stringList
=
new
ArrayList
<>();
//收件人列表
for
(
String
addressee:
strings
){
...
...
@@ -88,8 +90,7 @@ public class NoticeServiceImpl implements NoticeService {
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
+
"]关于["
+
notice
.
getTitle
()
+
"]的通知"
;
dataList
=
dataList
+
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"] "
;
...
...
@@ -100,36 +101,43 @@ public class NoticeServiceImpl implements NoticeService {
String
add2
=
JSONObject
.
toJSONString
(
addresseeList2
);
for
(
UserDo
add:
stringList
){
Notice
notice2
=
transform
(
notice
);
// 接收通知
notice2
.
setAddressee
(
add2
);
notice2
.
setType
(
0
);
notice2
.
setReceiver
(
add
.
getId
());
noticeDao
.
save
(
notice2
);
String
data2
=
"["
+
add
.
getUnit
()
+
"]["
+
add
.
getDepartment
()
+
"]的["
+
add
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
// String data2 = "[" +add.getUnit() + "][" + add.getDepartment() + "]的[" + add.getName()
// + "]收到了来自[" + userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName()
// + "]关于[" + notice.getTitle() + "]的通知";
String
data2
=
"您收到了["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getName
()
+
"]的《"
+
notice
.
getTitle
()
+
"》,"
+
"请注意查看。"
;
Attention
attention
=
new
Attention
();
attention
.
setStatus
(
0
);
attention
.
setUpdateTime
(
new
Date
());
attention
.
setData
(
data2
);
attention
.
setUserId
(
add
.
getId
());
attention
.
setNoticeId
(
notice2
.
getId
());
attentionService
.
addAttention
(
attention
);
}
notice
1
.
setAddressee
(
add2
);
noticeDao
.
save
(
notice
1
);
notice
.
setAddressee
(
add2
);
noticeDao
.
save
(
notice
);
String
data1
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]给"
+
dataList
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
String
data3
=
"您给"
+
dataList
+
"发送了《"
+
notice
.
getTitle
()
+
"》,发送成功!"
;
Attention
attention
=
new
Attention
();
attention
.
setStatus
(
0
);
attention
.
setNoticeId
(
notice
1
.
getId
());
attention
.
setNoticeId
(
notice
.
getId
());
attention
.
setUpdateTime
(
new
Date
());
attention
.
setData
(
data
1
);
attention
.
setData
(
data
3
);
attention
.
setUserId
(
userDo
.
getId
());
attentionService
.
addAttention
(
attention
);
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
...
...
@@ -145,7 +153,7 @@ public class NoticeServiceImpl implements NoticeService {
private
Notice
transform
(
Notice
notice
){
Notice
notice1
=
new
Notice
();
notice1
.
setId
(
notice
.
getId
());
//
notice1.setId(notice.getId());
notice1
.
setTitle
(
notice
.
getTitle
());
notice1
.
setAddressee
(
notice
.
getAddressee
());
notice1
.
setDeadline
(
notice
.
getDeadline
());
...
...
@@ -159,6 +167,7 @@ public class NoticeServiceImpl implements NoticeService {
notice1
.
setUnit
(
notice
.
getUnit
());
notice1
.
setName
(
notice
.
getName
());
notice1
.
setLabel
(
notice
.
getLabel
());
notice1
.
setReceiver
(
notice
.
getReceiver
());
return
notice1
;
}
...
...
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
浏览文件 @
f6651da2
package
com
.
zjty
.
efs
.
bus
.
util
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.zjty.efs.bus.entity.Addressee
;
import
com.zjty.efs.bus.entity.Attention
;
import
com.zjty.efs.bus.entity.Notice
;
import
com.zjty.efs.bus.service.AttentionService
;
import
com.zjty.efs.bus.service.NoticeService
;
import
com.zjty.efs.ftp.base.response.ServerResponse
;
import
com.zjty.efs.ftp.entity.DownLoadCount
;
import
com.zjty.efs.ftp.entity.DownLoadRequest
;
import
com.zjty.efs.ftp.service.DownLoadService
;
...
...
@@ -16,11 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.Period
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -42,16 +33,16 @@ public class Job {
for
(
Notice
notice:
noticeList
){
Date
endTime
=
notice
.
getDeadline
();
//失效天数
double
days
=
(
endTime
.
getTime
()-
now
.
getTime
())/(
1000
*
3600
*
24.0
);
// System.out.println(days);
// updateAtt(notice, days, 1);
if
(
days
<=
3.001
&&
days
>
2.998
&&
notice
.
getLabel
()
!=
1
){
updateAtt
(
notice
,
days
,
1
);
updateAtt
(
notice
,
3
,
1
);
}
if
(
days
<=
1.001
&&
days
>
0.998
&&
notice
.
getLabel
()
!=
2
){
updateAtt
(
notice
,
days
,
2
);
updateAtt
(
notice
,
1
,
2
);
}
}
...
...
@@ -67,12 +58,11 @@ public class Job {
* @param label 修改通知label 1为提醒过一次,2为提醒过两次
*/
private
void
updateAtt
(
Notice
notice
,
double
days
,
int
label
){
// System.out.println("--------------------定时------------------");
String
data
=
""
;
Attention
attention
=
new
Attention
();
data
=
"您收到来自["
+
notice
.
getUnit
()
+
"]["
+
notice
.
getName
()
+
"]标题为["
+
notice
.
getTitle
()
+
"]的通知,没有查看"
;
if
(
notice
.
getStatus
()
==
1
&&
!
""
.
equals
(
notice
.
getFileList
())){
//
通知为已读,且
文件列表不为空
//
data = "您收到来自["+ notice.getUnit() + "][" + notice.getName() +"]标题为[" + notice.getTitle() + "]的通知,没有查看";
if
(!
""
.
equals
(
notice
.
getFileList
())){
//文件列表不为空
String
file
=
notice
.
getFileList
();
String
[]
files
=
file
.
split
(
","
);
List
<
Integer
>
fileList
=
new
ArrayList
<>();
...
...
@@ -88,15 +78,16 @@ public class Job {
// System.out.println(downLoadCounts);
for
(
DownLoadCount
downLoadCount:
downLoadCounts
){
if
(
downLoadCount
.
getCount
()
==
0
){
data
=
"您收到
来自["
+
notice
.
getUnit
()
+
"]["
+
notice
.
getName
()
+
"]标题为["
+
notice
.
getTitle
()
+
"]的通知
,有文件没有下载"
;
data
=
"您收到
["
+
notice
.
getUnit
()
+
"]["
+
notice
.
getName
()
+
"]的《"
+
notice
.
getTitle
()
+
"》
,有文件没有下载"
;
add
(
days
,
attention
,
data
,
notice
,
label
);
}
}
}
else
{
add
(
days
,
attention
,
data
,
notice
,
label
);
}
// else {
// add(days, attention, data, notice, label);
// }
}
...
...
@@ -109,15 +100,15 @@ public class Job {
* @param label 该通知提醒过几次
*/
private
void
add
(
double
days
,
Attention
attention
,
String
data
,
Notice
notice
,
int
label
){
int
d
=
(
int
)
Math
.
ceil
(
days
);
data
=
data
+
",还有"
+
d
+
"天失效
。"
;
//
int d = (int)Math.ceil(days);
data
=
data
+
",还有"
+
d
ays
+
"天失效。请尽快下载
。"
;
attention
.
setData
(
data
);
attention
.
setNoticeId
(
notice
.
getId
());
String
str
=
notice
.
getAddressee
();
List
<
Addressee
>
addresseeList
=
JSONArray
.
parseArray
(
str
,
Addressee
.
class
);
String
userId
=
addresseeList
.
get
(
0
).
getId
();
attention
.
setUserId
(
userId
);
//
String str = notice.getAddressee();
//
List<Addressee> addresseeList = JSONArray.parseArray(str,Addressee.class);
//
String userId = addresseeList.get(0).getId();
attention
.
setUserId
(
notice
.
getReceiver
()
);
attention
.
setStatus
(
0
);
attention
.
setUpdateTime
(
new
Date
());
attentionService
.
addAttention
(
attention
);
...
...
efs-ftp/src/main/java/com/zjty/efs/ftp/entity/FileSave.java
浏览文件 @
f6651da2
...
...
@@ -20,7 +20,7 @@ import javax.persistence.Id;
@ApiModel
(
value
=
"FileSave"
,
description
=
"将文件信息存储在数据库中"
)
public
class
FileSave
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
name
=
"id"
,
value
=
"文件id"
,
notes
=
"文件id"
,
example
=
"1"
)
private
Integer
id
;
//文件id
@ApiModelProperty
(
name
=
"realName"
,
value
=
"文件真正存储名称"
,
notes
=
"文件真正存储名称"
,
example
=
"1(1).zip"
)
...
...
efs-ftp/src/main/java/com/zjty/efs/ftp/service/DownLoadService.java
浏览文件 @
f6651da2
...
...
@@ -15,5 +15,10 @@ public interface DownLoadService {
*/
List
<
DownLoadCount
>
findCount
(
DownLoadRequest
downLoadRequest
);
/**
* 保存或修改下载次数
* @param downLoadCount
* @return
*/
ServerResponse
downloadCount
(
DownLoadCount
downLoadCount
);
}
efs-ftp/src/main/java/com/zjty/efs/ftp/service/impl/DownLoadServiceImpl.java
浏览文件 @
f6651da2
...
...
@@ -18,23 +18,27 @@ public class DownLoadServiceImpl implements DownLoadService {
@Override
public
List
<
DownLoadCount
>
findCount
(
DownLoadRequest
downLoadRequest
)
{
List
<
Integer
>
fileIdList
=
downLoadRequest
.
getFileIds
();
//请求的id集合
List
<
DownLoadCount
>
loadCounts
=
new
ArrayList
<>();
if
(
fileIdList
!=
null
&&
fileIdList
.
size
()
!=
0
){
loadCounts
=
downLoadCountDao
.
findCount
(
downLoadRequest
.
getUserId
(),
fileIdList
);
if
(
loadCounts
.
size
()
!=
fileIdList
.
size
()){
//没有文件id
List
<
Integer
>
idList
=
new
ArrayList
<>();
//数据库id集合
for
(
DownLoadCount
downLoadCount:
loadCounts
){
idList
.
add
(
downLoadCount
.
getFileId
());
}
for
(
Integer
i:
fileIdList
){
if
(!
idList
.
contains
(
i
)){
DownLoadCount
downLoadCount
=
new
DownLoadCount
();
downLoadCount
.
setUserId
(
downLoadRequest
.
getUserId
());
downLoadCount
.
setFileId
(
i
);
downLoadCount
.
setCount
(
0
);
loadCounts
.
add
(
downLoadCount
);
if
(!
downLoadRequest
.
getUserId
().
isEmpty
()){
List
<
Integer
>
fileIdList
=
downLoadRequest
.
getFileIds
();
//请求的id集合
if
(
fileIdList
!=
null
&&
fileIdList
.
size
()
!=
0
){
loadCounts
=
downLoadCountDao
.
findCount
(
downLoadRequest
.
getUserId
(),
fileIdList
);
//如果传入的文件id不存在,视为没有下载过的查询,下载过的次数为0
if
(
loadCounts
.
size
()
!=
fileIdList
.
size
()){
//没有文件id
List
<
Integer
>
idList
=
new
ArrayList
<>();
//数据库id集合
for
(
DownLoadCount
downLoadCount:
loadCounts
){
idList
.
add
(
downLoadCount
.
getFileId
());
}
//将不存在的文件下载次数设置为0
for
(
Integer
i:
fileIdList
){
if
(!
idList
.
contains
(
i
)){
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
浏览文件 @
f6651da2
...
...
@@ -71,7 +71,8 @@ public class FileDownLoadServiceImpl implements FileDownLoadService {
log
.
error
(
file
.
getAbsolutePath
()
+
"文件不存在"
);
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
log
.
error
(
file
.
getAbsolutePath
()
+
"文件读取异常"
);
//log.error(file.getAbsolutePath() + "文件读取异常");
log
.
error
(
file
.
getAbsolutePath
()
+
"文件用户终止下载"
);
e
.
printStackTrace
();
}
finally
{
try
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论