Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
f0a1fe9a
提交
f0a1fe9a
authored
4月 01, 2020
作者:
xc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xc
上级
a227d90f
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
53 行增加
和
30 行删除
+53
-30
NoticeDao.java
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
+2
-1
NoticeController.java
...in/java/com/zjty/efs/bus/controller/NoticeController.java
+5
-4
Notice.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
+7
-0
NoticeService.java
...src/main/java/com/zjty/efs/bus/service/NoticeService.java
+2
-2
NoticeServiceImpl.java
...java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
+37
-23
没有找到文件。
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
浏览文件 @
f0a1fe9a
...
...
@@ -16,6 +16,7 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> {
Page
<
Notice
>
findOutByAddresseeLikeAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
List
<
Notice
>
findOutByStatusAndTypeAndLabel
(
int
status
,
int
type
,
int
label
);
Page
<
Notice
>
findOutByAddresseeLikeAndTypeAndStatus
(
String
addressee
,
int
type
,
int
status
,
Pageable
pageable
);
Page
<
Notice
>
findOutByReceiverAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutByReceiverAndTypeAndStatus
(
String
addressee
,
int
type
,
int
status
,
Pageable
pageable
);
}
efs-bus/src/main/java/com/zjty/efs/bus/controller/NoticeController.java
浏览文件 @
f0a1fe9a
...
...
@@ -25,7 +25,6 @@ public class NoticeController {
@Autowired
private
NoticeService
noticeService
;
/**
* 新增通知
* @param notice
...
...
@@ -55,11 +54,13 @@ public class NoticeController {
@ApiOperation
(
value
=
"查看通知接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"通知id"
,
paramType
=
"query"
,
required
=
true
,
example
=
"1"
,
dataType
=
"int"
)
required
=
true
,
example
=
"1"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前用户"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)
})
@GetMapping
(
"/getNotice"
)
public
ResponseEntity
<
Notice
>
getNotice
(
@RequestParam
int
id
){
return
ResponseEntity
.
ok
(
noticeService
.
getNotice
(
id
));
public
ResponseEntity
<
Notice
>
getNotice
(
@RequestParam
int
id
,
String
userId
){
return
ResponseEntity
.
ok
(
noticeService
.
getNotice
(
id
,
userId
));
}
@GetMapping
(
"/getNoticeList"
)
...
...
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
浏览文件 @
f0a1fe9a
...
...
@@ -128,6 +128,13 @@ public class Notice {
@Column
(
name
=
"label"
)
private
int
label
;
/**
* 发收件人姓名
*/
@ApiModelProperty
(
value
=
"receiver"
,
example
=
""
,
dataType
=
"String"
,
name
=
"发件人名称"
)
@Column
(
name
=
"receiver"
)
private
String
receiver
;
}
efs-bus/src/main/java/com/zjty/efs/bus/service/NoticeService.java
浏览文件 @
f0a1fe9a
...
...
@@ -24,10 +24,10 @@ public interface NoticeService {
/**
* 查看通知
* @param id 通知id
*
*
@param userId 当前用户
* @return
*/
Notice
getNotice
(
int
id
);
Notice
getNotice
(
int
id
,
String
userId
);
/**
* 获取通知列表
...
...
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
浏览文件 @
f0a1fe9a
...
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.zjty.efs.bus.Dao.NoticeDao
;
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.entity.Paging
;
import
com.zjty.efs.bus.service.AttentionService
;
import
com.zjty.efs.bus.service.NoticeService
;
import
com.zjty.efs.log.subject.entity.EfsLog
;
import
com.zjty.efs.log.tool.EfsLogUtil
;
...
...
@@ -33,6 +35,8 @@ public class NoticeServiceImpl implements NoticeService {
EfsLogUtil
efsLogUtil
;
@Autowired
UserService
userService
;
@Autowired
AttentionService
attentionService
;
@Override
@Transactional
...
...
@@ -70,6 +74,7 @@ public class NoticeServiceImpl implements NoticeService {
List
<
Addressee
>
addresseeList2
=
new
ArrayList
<>();
//接受者显示的接收列表
Notice
notice1
=
transform
(
notice
);
//发送通知
String
dataList
=
""
;
List
<
String
>
stringList
=
new
ArrayList
<>();
for
(
String
addressee:
strings
){
UserDo
userDo1
=
userService
.
findById
(
addressee
);
//收件人用户
...
...
@@ -82,20 +87,36 @@ public class NoticeServiceImpl implements NoticeService {
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
stringList
.
add
(
addressee
);
dataList
=
dataList
+
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"] "
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo1
.
getId
(),
data2
,
new
Date
()));
}
String
add2
=
JSONObject
.
toJSONString
(
addresseeList2
);
for
(
String
add
ressee:
strings
){
for
(
String
add
:
stringList
){
Notice
notice2
=
transform
(
notice
);
// 接收通知
notice2
.
setAddressee
(
add2
);
notice2
.
setType
(
0
);
notice2
.
setReceiver
(
add
);
noticeDao
.
save
(
notice2
);
UserDo
userDo1
=
userService
.
findById
(
add
);
//收件人用户
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
Attention
attention
=
new
Attention
();
attention
.
setStatus
(
0
);
attention
.
setUpdateTime
(
new
Date
());
attention
.
setData
(
data2
);
attention
.
setUserId
(
add
);
attentionService
.
addAttention
(
attention
);
}
notice1
.
setAddressee
(
add2
);
...
...
@@ -103,9 +124,15 @@ public class NoticeServiceImpl implements NoticeService {
String
data1
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]给"
+
dataList
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
Attention
attention
=
new
Attention
();
attention
.
setStatus
(
0
);
attention
.
setNoticeId
(
notice1
.
getId
());
attention
.
setUpdateTime
(
new
Date
());
attention
.
setData
(
data1
);
attention
.
setUserId
(
userDo
.
getId
());
attentionService
.
addAttention
(
attention
);
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
}
return
true
;
...
...
@@ -151,31 +178,16 @@ public class NoticeServiceImpl implements NoticeService {
@Override
@Transactional
public
Notice
getNotice
(
int
id
)
{
public
Notice
getNotice
(
int
id
,
String
userId
)
{
try
{
Notice
notice
=
noticeDao
.
findById
(
id
);
notice
.
setStatus
(
1
);
noticeDao
.
save
(
notice
);
String
userId
=
""
;
if
(
notice
.
getType
()
==
0
){
//已接收
userId
=
notice
.
getAddressee
();
}
else
{
userId
=
notice
.
getSender
();
}
UserDo
userDo
=
userService
.
findById
(
userId
);
// 发送人
UserDo
userDo
=
userService
.
findById
(
userId
);
// 当前用户
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"查看了关于["
+
notice
.
getTitle
()
+
"的通知"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data
,
new
Date
()));
UserDo
addressee
=
userService
.
findById
(
notice
.
getAddressee
());
Addressee
addressee1
=
new
Addressee
();
addressee1
.
setId
(
addressee
.
getId
());
addressee1
.
setName
(
addressee
.
getName
());
String
json
=
JSONObject
.
toJSONString
(
addressee1
);
notice
.
setAddressee
(
json
);
return
notice
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
@@ -192,7 +204,8 @@ public class NoticeServiceImpl implements NoticeService {
if
(
type
==
0
){
//已接收
p
=
noticeDao
.
findOutByAddresseeLikeAndType
(
"%"
+
user
+
"%"
,
type
,
pageable
);
// p = noticeDao.findOutByAddresseeLikeAndType("%"+user+"%", type, pageable);
p
=
noticeDao
.
findOutByReceiverAndType
(
user
,
type
,
pageable
);
}
else
{
//已发送,草稿
p
=
noticeDao
.
findOutBySenderAndType
(
user
,
type
,
pageable
);
...
...
@@ -290,7 +303,8 @@ public class NoticeServiceImpl implements NoticeService {
public
Paging
<
Notice
>
getListByStatus
(
String
user
,
int
status
,
int
pageNum
,
int
pageSize
,
int
type
)
{
try
{
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Page
<
Notice
>
p
=
noticeDao
.
findOutByAddresseeLikeAndTypeAndStatus
(
"%"
+
user
+
"%"
,
type
,
status
,
pageable
);
Page
<
Notice
>
p
=
noticeDao
.
findOutByReceiverAndTypeAndStatus
(
user
,
type
,
status
,
pageable
);
// Page<Notice> p = noticeDao.findOutByAddresseeLikeAndTypeAndStatus("%"+user+"%",type, status, pageable);
Paging
<
Notice
>
paging
=
new
Paging
<>();
paging
.
setData
(
p
.
getContent
());
paging
.
setPageSize
(
pageSize
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论