Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
650ca320
提交
650ca320
authored
3月 31, 2020
作者:
zhangshuang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of git.yfzx.zjtys.com.cn:zhuangshuang/EncryptedFileSystem into develop
上级
0145791c
5cb3fd3d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
186 行增加
和
58 行删除
+186
-58
NoticeDao.java
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
+1
-1
NoticeController.java
...in/java/com/zjty/efs/bus/controller/NoticeController.java
+1
-1
Addressee.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Addressee.java
+2
-2
NoticeServiceImpl.java
...java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
+182
-54
没有找到文件。
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
浏览文件 @
650ca320
...
@@ -13,6 +13,6 @@ import java.util.List;
...
@@ -13,6 +13,6 @@ import java.util.List;
public
interface
NoticeDao
extends
JpaRepository
<
Notice
,
Integer
>
{
public
interface
NoticeDao
extends
JpaRepository
<
Notice
,
Integer
>
{
Notice
findById
(
int
id
);
Notice
findById
(
int
id
);
Page
<
Notice
>
findOutBySenderAndType
(
String
sender
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutBySenderAndType
(
String
sender
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutByAddresseeAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutByAddressee
Like
AndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
List
<
Notice
>
findOutByStatusAndType
(
int
status
,
int
type
);
List
<
Notice
>
findOutByStatusAndType
(
int
status
,
int
type
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/controller/NoticeController.java
浏览文件 @
650ca320
...
@@ -61,7 +61,7 @@ public class NoticeController {
...
@@ -61,7 +61,7 @@ public class NoticeController {
@GetMapping
(
"/getNoticeList"
)
@GetMapping
(
"/getNoticeList"
)
@ApiOperation
(
value
=
"获取通知列表接口"
,
notes
=
"获取列表,type为通知类型,接收 0,发送 1,草稿 2"
)
@ApiOperation
(
value
=
"获取通知列表接口"
,
notes
=
"获取列表,type为通知类型,接收 0,发送 1,草稿 2"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"user"
,
value
=
"当前用户名称"
,
paramType
=
"query"
,
required
=
true
,
example
=
"account"
,
dataType
=
"
int
"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"user"
,
value
=
"当前用户名称"
,
paramType
=
"query"
,
required
=
true
,
example
=
"account"
,
dataType
=
"
String
"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"通知类型"
,
paramType
=
"query"
,
required
=
true
,
example
=
"0"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"通知类型"
,
paramType
=
"query"
,
required
=
true
,
example
=
"0"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"页码"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"页码"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"条数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)})
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"条数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)})
...
...
efs-bus/src/main/java/com/zjty/efs/bus/entity/
FileList
.java
→
efs-bus/src/main/java/com/zjty/efs/bus/entity/
Addressee
.java
浏览文件 @
650ca320
...
@@ -10,8 +10,8 @@ import java.lang.annotation.Documented;
...
@@ -10,8 +10,8 @@ import java.lang.annotation.Documented;
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
@Data
@Data
public
class
FileList
{
public
class
Addressee
{
private
String
id
;
private
String
id
;
private
String
address
;
private
String
name
;
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
浏览文件 @
650ca320
package
com
.
zjty
.
efs
.
bus
.
service
.
impl
;
package
com
.
zjty
.
efs
.
bus
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zjty.efs.bus.Dao.NoticeDao
;
import
com.zjty.efs.bus.Dao.NoticeDao
;
import
com.zjty.efs.bus.entity.Addressee
;
import
com.zjty.efs.bus.entity.Notice
;
import
com.zjty.efs.bus.entity.Notice
;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.service.NoticeService
;
import
com.zjty.efs.bus.service.NoticeService
;
...
@@ -8,6 +11,7 @@ import com.zjty.efs.log.subject.entity.EfsLog;
...
@@ -8,6 +11,7 @@ import com.zjty.efs.log.subject.entity.EfsLog;
import
com.zjty.efs.log.tool.EfsLogUtil
;
import
com.zjty.efs.log.tool.EfsLogUtil
;
import
com.zjty.efs.user.subject.entity.UserDo
;
import
com.zjty.efs.user.subject.entity.UserDo
;
import
com.zjty.efs.user.subject.service.UserService
;
import
com.zjty.efs.user.subject.service.UserService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.domain.*
;
...
@@ -16,10 +20,8 @@ import org.springframework.stereotype.Service;
...
@@ -16,10 +20,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.lang.reflect.Array
;
import
java.util.Calendar
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
@Service
@Service
public
class
NoticeServiceImpl
implements
NoticeService
{
public
class
NoticeServiceImpl
implements
NoticeService
{
...
@@ -29,64 +31,69 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -29,64 +31,69 @@ public class NoticeServiceImpl implements NoticeService {
EfsLogUtil
efsLogUtil
;
EfsLogUtil
efsLogUtil
;
@Autowired
@Autowired
UserService
userService
;
UserService
userService
;
@Override
@Override
@Transactional
@Transactional
public
boolean
addNotice
(
Notice
notice
)
{
public
boolean
addNotice
(
Notice
notice
){
try
{
try
{
UserDo
userDo
=
userService
.
findById
(
notice
.
getSender
());
// 发送人
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
add
(
Calendar
.
DATE
,
7
);
calendar
.
add
(
Calendar
.
DATE
,
7
);
UserDo
userDo
=
userService
.
findById
(
notice
.
getSender
());
// 发送人
String
[]
strings
=
notice
.
getAddressee
().
split
(
","
);
notice
.
setUpdateTime
(
new
Date
());
notice
.
setUpdateTime
(
new
Date
());
notice
.
setDeadline
(
calendar
.
getTime
());
notice
.
setDeadline
(
calendar
.
getTime
());
notice
.
setUnit
(
userDo
.
getUnit
());
notice
.
setUnit
(
userDo
.
getUnit
());
notice
.
setStatus
(
0
);
notice
.
setStatus
(
0
);
String
data
=
""
;
if
(
notice
.
getType
()
==
2
){
//保存为草稿
if
(
notice
.
getType
()
==
2
){
List
<
Addressee
>
addresseeList
=
new
ArrayList
<>();
//如果是草稿
for
(
String
addressee:
strings
){
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
UserDo
userDo1
=
userService
.
findById
(
addressee
);
+
"]新增关于["
+
notice
.
getTitle
()
+
"草稿"
;
Addressee
addressee1
=
new
Addressee
();
addressee1
.
setId
(
userDo1
.
getId
());
addressee1
.
setName
(
userDo1
.
getName
());
addresseeList
.
add
(
addressee1
);
}
notice
.
setAddressee
(
JSONObject
.
toJSONString
(
addresseeList
));
noticeDao
.
save
(
notice
);
noticeDao
.
save
(
notice
);
}
else
{
}
else
{
//如果是发送,就新增接收
for
(
String
addressee:
strings
){
List
<
Addressee
>
addresseeList
=
new
ArrayList
<>();
UserDo
userDo1
=
userService
.
findById
(
addressee
);
Addressee
addressee1
=
new
Addressee
();
addressee1
.
setId
(
userDo1
.
getId
());
addressee1
.
setName
(
userDo1
.
getName
());
addresseeList
.
add
(
addressee1
);
Notice
notice1
=
transform
(
notice
);
//发送通知
Notice
notice2
=
transform
(
notice
);
// 接收通知
String
[]
addressees
=
notice
.
getAddressee
().
split
(
","
);
String
add
=
JSONObject
.
toJSONString
(
addresseeList
);
for
(
String
addressee:
addressees
){
notice1
.
setAddressee
(
add
);
Notice
notice2
=
notice
;
notice2
.
setAddressee
(
add
);
notice2
.
setAddressee
(
addressee
);
notice2
.
setUnit
(
userDo1
.
getUnit
());
notice2
.
setType
(
0
);
noticeDao
.
save
(
notice1
);
noticeDao
.
save
(
notice2
);
noticeDao
.
save
(
notice2
);
UserDo
userDo1
=
userService
.
findById
(
addressee
);
//接收人
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
String
data1
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]给["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]给["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
Notice
notice1
=
new
Notice
();
notice1
.
setType
(
0
);
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
notice1
.
setTitle
(
notice
.
getTitle
());
notice1
.
setAddressee
(
addressee
);
notice1
.
setDeadline
(
notice
.
getDeadline
());
notice1
.
setFileList
(
notice
.
getFileList
());
notice1
.
setMessage
(
notice
.
getMessage
());
notice1
.
setNote
(
notice
.
getNote
());
notice1
.
setSender
(
notice
.
getSender
());
notice1
.
setStatus
(
notice
.
getStatus
());
notice1
.
setUpdateTime
(
notice
.
getUpdateTime
());
notice1
.
setUnit
(
userDo1
.
getUnit
());
noticeDao
.
save
(
notice1
);
String
data1
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo1
.
getId
(),
data1
,
new
Date
()));
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo1
.
getId
(),
data2
,
new
Date
()));
}
}
}
}
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data
,
new
Date
()));
return
true
;
return
true
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
...
@@ -94,6 +101,85 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -94,6 +101,85 @@ public class NoticeServiceImpl implements NoticeService {
}
}
// @Override
// @Transactional
// public boolean addNotice(Notice notice) {
// try{
//
// Calendar calendar = Calendar.getInstance();
// calendar.add(Calendar.DATE, 7);
// UserDo userDo = userService.findById(notice.getSender()); // 发送人
//
// notice.setUpdateTime(new Date());
// notice.setDeadline(calendar.getTime());
// notice.setUnit(userDo.getUnit());
// notice.setStatus(0);
//
//
// String data = "";
//
// if(notice.getType() == 2){
// //如果是草稿
// data = "[" +userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName()
// + "]新增关于[" + notice.getTitle() + "草稿";
// noticeDao.save(notice);
// }else {
// //如果是发送,就新增接收
//
// String[] addressees = notice.getAddressee().split(",");
// List<Notice> noticeList = new ArrayList<>();
// for (String addressee:addressees){
// Notice notice2 = transform(notice);
// notice2.setAddressee(addressee);
// noticeList.add(notice2); //已发送保存
//
// UserDo userDo1 = userService.findById(addressee); //接收人
//
// data = "[" +userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName()
// + "]给[" + userDo1.getUnit() + "][" + userDo1.getDepartment() + "]的[" + userDo1.getName()
// + "发送了关于[" + notice.getTitle() + "]的通知";
//// Notice notice1 = new Notice();
// Notice notice1 = transform(notice);//已接收
// notice1.setType(0);
// notice1.setTitle(notice.getTitle());
// notice1.setAddressee(addressee);
// notice1.setUnit(userDo1.getUnit());
// noticeDao.save(notice1);
// String data1 = "[" +userDo1.getUnit() + "][" + userDo1.getDepartment() + "]的[" + userDo1.getName()
// + "]收到了来自[" + userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName()
// + "]关于[" + notice.getTitle() + "的通知";
// efsLogUtil.addLog(new EfsLog(null, userDo1.getId(), data1, new Date()));
// }
// System.out.println(noticeList);
// noticeDao.saveAll(noticeList);
//
// }
// efsLogUtil.addLog(new EfsLog(null, userDo.getId(), data, new Date()));
// return true;
//
// }catch (Exception e){
// e.printStackTrace();
// return false;
// }
//
// }
private
Notice
transform
(
Notice
notice
){
Notice
notice1
=
new
Notice
();
notice1
.
setTitle
(
notice
.
getTitle
());
notice1
.
setAddressee
(
notice
.
getAddressee
());
notice1
.
setDeadline
(
notice
.
getDeadline
());
notice1
.
setFileList
(
notice
.
getFileList
());
notice1
.
setMessage
(
notice
.
getMessage
());
notice1
.
setNote
(
notice
.
getNote
());
notice1
.
setSender
(
notice
.
getSender
());
notice1
.
setStatus
(
notice
.
getStatus
());
notice1
.
setUpdateTime
(
notice
.
getUpdateTime
());
notice1
.
setType
(
notice
.
getType
());
notice1
.
setUnit
(
notice
.
getUnit
());
return
notice1
;
}
@Override
@Override
@Transactional
@Transactional
public
boolean
updateNotice
(
Notice
notice
)
{
public
boolean
updateNotice
(
Notice
notice
)
{
...
@@ -127,6 +213,14 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -127,6 +213,14 @@ public class NoticeServiceImpl implements NoticeService {
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"查看了关于["
+
notice
.
getTitle
()
+
"的通知"
;
+
"查看了关于["
+
notice
.
getTitle
()
+
"的通知"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data
,
new
Date
()));
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
;
return
notice
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -137,24 +231,56 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -137,24 +231,56 @@ public class NoticeServiceImpl implements NoticeService {
@Override
@Override
public
Paging
<
Notice
>
getReceiveList
(
String
user
,
int
type
,
int
pageNum
,
int
pageSize
)
{
public
Paging
<
Notice
>
getReceiveList
(
String
user
,
int
type
,
int
pageNum
,
int
pageSize
)
{
try
{
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Page
<
Notice
>
p
;
if
(
type
==
0
){
//已接收
p
=
noticeDao
.
findOutByAddresseeLikeAndType
(
"%"
+
user
+
"%"
,
type
,
pageable
);
}
else
{
//已发送,草稿
p
=
noticeDao
.
findOutBySenderAndType
(
user
,
type
,
pageable
);
}
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
// for (Notice notice:p.getContent()){
Page
<
Notice
>
p
;
// String addresseeId = "";//收件人编号
// UserDo addressee = new UserDo();//收件人实体
// for (int i = 0; i < p.getContent().size(); i++){
// List<Addressee> addressees = new ArrayList<>();
// Notice notice = p.getContent().get(i);
// if (i == 0) {
// addresseeId = notice.getAddressee().split(",")[0];
// addressee = userService.findById(addresseeId);
// }else {
// String addresseeId1 = notice.getAddressee().split(",")[0];
// if (!addresseeId.equals(addresseeId1)){
// //如果两个收件人不一样,重新获取user
// addressee = userService.findById(addresseeId1);
// }
// }
//
// Addressee addressee1 = new Addressee();
// addressee1.setId(addressee.getId());
// addressee1.setName(addressee.getName());
// addressees.add(addressee1);
// String json = JSONObject.toJSONString(addressees);
// notice.setAddressee(json);
// }
if
(
type
==
0
){
//已接收
Paging
<
Notice
>
paging
=
new
Paging
<>();
p
=
noticeDao
.
findOutByAddresseeAndType
(
user
,
type
,
pageable
);
paging
.
setData
(
p
.
getContent
());
}
else
{
paging
.
setPageSize
(
pageSize
);
//已发送,草稿
paging
.
setPageNum
(
pageNum
);
p
=
noticeDao
.
findOutBySenderAndType
(
user
,
type
,
pageable
);
paging
.
setTotal
((
int
)
p
.
getTotalElements
());
return
paging
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
null
;
}
}
Paging
<
Notice
>
paging
=
new
Paging
<>();
paging
.
setData
(
p
.
getContent
());
paging
.
setPageSize
(
pageSize
);
paging
.
setPageNum
(
pageNum
);
paging
.
setTotal
((
int
)
p
.
getTotalElements
());
return
paging
;
}
}
@Override
@Override
...
@@ -163,11 +289,13 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -163,11 +289,13 @@ public class NoticeServiceImpl implements NoticeService {
try
{
try
{
String
userId
=
""
;
String
userId
=
""
;
if
(
notices
.
get
(
0
).
getType
()
==
0
){
if
(
notices
.
get
(
0
).
getType
()
==
0
){
userId
=
notices
.
get
(
0
).
getAddressee
();
String
str
=
notices
.
get
(
0
).
getAddressee
();
List
<
Addressee
>
addresseeList
=
JSONArray
.
parseArray
(
str
,
Addressee
.
class
);
userId
=
addresseeList
.
get
(
0
).
getId
();
}
else
{
}
else
{
userId
=
notices
.
get
(
0
).
getSender
();
userId
=
notices
.
get
(
0
).
getSender
();
}
}
UserDo
userDo
=
userService
.
findById
(
userId
);
//
发送
人
UserDo
userDo
=
userService
.
findById
(
userId
);
//
当前登录
人
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"修改"
;
+
"修改"
;
for
(
Notice
notice:
notices
){
for
(
Notice
notice:
notices
){
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论