Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
77559e40
提交
77559e40
authored
4月 01, 2020
作者:
zhangshuang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of git.yfzx.zjtys.com.cn:zhuangshuang/EncryptedFileSystem into develop
上级
267bec57
f22ffcd7
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
117 行增加
和
35 行删除
+117
-35
NoticeDao.java
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
+2
-1
AttentionController.java
...java/com/zjty/efs/bus/controller/AttentionController.java
+5
-0
NoticeController.java
...in/java/com/zjty/efs/bus/controller/NoticeController.java
+19
-5
Attention.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Attention.java
+2
-1
Notice.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
+10
-3
NoticeService.java
...src/main/java/com/zjty/efs/bus/service/NoticeService.java
+13
-0
NoticeServiceImpl.java
...java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
+49
-18
Job.java
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
+17
-7
没有找到文件。
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
浏览文件 @
77559e40
...
@@ -14,5 +14,6 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> {
...
@@ -14,5 +14,6 @@ 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
>
findOutByAddresseeLikeAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutByAddresseeLikeAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
List
<
Notice
>
findOutByStatusAndType
(
int
status
,
int
type
);
List
<
Notice
>
findOutByStatusAndTypeAndLabel
(
int
status
,
int
type
,
int
label
);
Page
<
Notice
>
findOutByAddresseeLikeAndTypeAndStatus
(
String
addressee
,
int
type
,
Pageable
pageable
,
int
status
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/controller/AttentionController.java
浏览文件 @
77559e40
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageImpl
;
...
@@ -22,6 +23,7 @@ import java.util.List;
...
@@ -22,6 +23,7 @@ import java.util.List;
@Api
(
tags
=
"提醒接口"
)
@Api
(
tags
=
"提醒接口"
)
@RestController
@RestController
@RequestMapping
(
"/attention"
)
@RequestMapping
(
"/attention"
)
@Slf4j
public
class
AttentionController
{
public
class
AttentionController
{
@Autowired
@Autowired
AttentionService
attentionService
;
AttentionService
attentionService
;
...
@@ -33,6 +35,7 @@ public class AttentionController {
...
@@ -33,6 +35,7 @@ public class AttentionController {
})
})
@GetMapping
(
"/getAttention"
)
@GetMapping
(
"/getAttention"
)
public
ResponseEntity
<
Paging
<
Attention
>>
getAttentionList
(
@RequestParam
String
userId
,
int
pageNum
,
int
pageSize
){
public
ResponseEntity
<
Paging
<
Attention
>>
getAttentionList
(
@RequestParam
String
userId
,
int
pageNum
,
int
pageSize
){
log
.
info
(
"获取提醒列表:{}"
,
userId
);
return
ResponseEntity
.
ok
(
attentionService
.
getAttentionList
(
userId
,
pageNum
,
pageSize
));
return
ResponseEntity
.
ok
(
attentionService
.
getAttentionList
(
userId
,
pageNum
,
pageSize
));
}
}
...
@@ -43,6 +46,7 @@ public class AttentionController {
...
@@ -43,6 +46,7 @@ public class AttentionController {
})
})
@PutMapping
(
"/updateStatus"
)
@PutMapping
(
"/updateStatus"
)
public
ResponseEntity
updateStatus
(
@RequestBody
@Valid
List
<
Attention
>
attentions
){
public
ResponseEntity
updateStatus
(
@RequestBody
@Valid
List
<
Attention
>
attentions
){
log
.
info
(
"修改提醒为已读"
);
return
ResponseEntity
.
ok
(
attentionService
.
updateStatus
(
attentions
));
return
ResponseEntity
.
ok
(
attentionService
.
updateStatus
(
attentions
));
}
}
...
@@ -52,6 +56,7 @@ public class AttentionController {
...
@@ -52,6 +56,7 @@ public class AttentionController {
})
})
@GetMapping
(
"/redDot"
)
@GetMapping
(
"/redDot"
)
public
ResponseEntity
getRedDot
(
@RequestParam
String
userId
){
public
ResponseEntity
getRedDot
(
@RequestParam
String
userId
){
log
.
info
(
"消息提醒小红点"
);
return
ResponseEntity
.
ok
(
attentionService
.
getRedDot
(
userId
));
return
ResponseEntity
.
ok
(
attentionService
.
getRedDot
(
userId
));
}
}
...
...
efs-bus/src/main/java/com/zjty/efs/bus/controller/NoticeController.java
浏览文件 @
77559e40
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -19,6 +20,7 @@ import java.util.List;
...
@@ -19,6 +20,7 @@ import java.util.List;
@Api
(
tags
=
"通知接口"
)
@Api
(
tags
=
"通知接口"
)
@RestController
@RestController
@RequestMapping
(
"/notice"
)
@RequestMapping
(
"/notice"
)
@Slf4j
public
class
NoticeController
{
public
class
NoticeController
{
@Autowired
@Autowired
private
NoticeService
noticeService
;
private
NoticeService
noticeService
;
...
@@ -33,6 +35,7 @@ public class NoticeController {
...
@@ -33,6 +35,7 @@ public class NoticeController {
@ApiImplicitParam
(
name
=
"notice"
,
value
=
"通知实体"
,
dataType
=
"Notice"
,
paramType
=
"body"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"notice"
,
value
=
"通知实体"
,
dataType
=
"Notice"
,
paramType
=
"body"
,
required
=
true
)
@PostMapping
(
"/addNotice"
)
@PostMapping
(
"/addNotice"
)
public
ResponseEntity
addNotice
(
@RequestBody
@Valid
Notice
notice
){
public
ResponseEntity
addNotice
(
@RequestBody
@Valid
Notice
notice
){
log
.
info
(
"新增通知:{}"
,
notice
);
return
ResponseEntity
.
ok
(
noticeService
.
addNotice
(
notice
));
return
ResponseEntity
.
ok
(
noticeService
.
addNotice
(
notice
));
}
}
...
@@ -45,7 +48,7 @@ public class NoticeController {
...
@@ -45,7 +48,7 @@ public class NoticeController {
@ApiImplicitParam
(
name
=
"notice"
,
value
=
"通知实体"
,
dataType
=
"Notice"
,
paramType
=
"body"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"notice"
,
value
=
"通知实体"
,
dataType
=
"Notice"
,
paramType
=
"body"
,
required
=
true
)
@PutMapping
(
"/updateNotice"
)
@PutMapping
(
"/updateNotice"
)
public
ResponseEntity
updateNotice
(
@RequestBody
@Valid
Notice
notice
){
public
ResponseEntity
updateNotice
(
@RequestBody
@Valid
Notice
notice
){
log
.
info
(
"修改通知接口:{}"
,
notice
);
return
ResponseEntity
.
ok
(
noticeService
.
updateNotice
(
notice
));
return
ResponseEntity
.
ok
(
noticeService
.
updateNotice
(
notice
));
}
}
...
@@ -60,13 +63,23 @@ public class NoticeController {
...
@@ -60,13 +63,23 @@ public class NoticeController {
}
}
@GetMapping
(
"/getNoticeList"
)
@GetMapping
(
"/getNoticeList"
)
@ApiOperation
(
value
=
"获取通知列表接口"
,
notes
=
"获取列表,type为通知类型,接收 0,发送 1,草稿 2"
)
@ApiOperation
(
value
=
"获取通知列表接口"
,
notes
=
"获取列表,type为通知类型,接收 0,发送 1,草稿 2
,status为状态,0 未读,1已读,2 全部
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"user"
,
value
=
"当前用户名称"
,
paramType
=
"query"
,
required
=
true
,
example
=
"account"
,
dataType
=
"String"
),
@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"
),
public
ResponseEntity
<
Paging
<
Notice
>>
getNoticeList
(
@RequestParam
String
user
,
int
type
,
int
pageNum
,
int
pageSize
){
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)})
Paging
<
Notice
>
data
=
noticeService
.
getReceiveList
(
user
,
type
,
pageNum
,
pageSize
);
public
ResponseEntity
<
Paging
<
Notice
>>
getNoticeList
(
@RequestParam
String
user
,
int
type
,
int
pageNum
,
int
pageSize
,
int
status
){
log
.
info
(
"获取通知列表接口:{},{}"
,
user
,
type
);
Paging
<
Notice
>
data
=
new
Paging
<>();
if
(
status
==
2
){
//全部
data
=
noticeService
.
getReceiveList
(
user
,
type
,
pageNum
,
pageSize
);
}
else
{
data
=
noticeService
.
getListByStatus
(
user
,
status
,
pageNum
,
pageSize
);
}
return
ResponseEntity
.
ok
(
data
);
return
ResponseEntity
.
ok
(
data
);
}
}
...
@@ -76,6 +89,7 @@ public class NoticeController {
...
@@ -76,6 +89,7 @@ public class NoticeController {
allowMultiple
=
true
,
dataType
=
"Notice"
),
allowMultiple
=
true
,
dataType
=
"Notice"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前登录用户"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)})
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前登录用户"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)})
public
ResponseEntity
updateStatus
(
@RequestBody
List
<
Notice
>
notices
,
@RequestParam
String
userId
){
public
ResponseEntity
updateStatus
(
@RequestBody
List
<
Notice
>
notices
,
@RequestParam
String
userId
){
log
.
info
(
"修改通知为已读:{}"
,
userId
);
return
ResponseEntity
.
ok
(
noticeService
.
updateStatus
(
notices
,
userId
));
return
ResponseEntity
.
ok
(
noticeService
.
updateStatus
(
notices
,
userId
));
}
}
...
...
efs-bus/src/main/java/com/zjty/efs/bus/entity/Attention.java
浏览文件 @
77559e40
...
@@ -59,7 +59,8 @@ public class Attention {
...
@@ -59,7 +59,8 @@ public class Attention {
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"更新时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"更新时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@Column
(
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-
HH
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-
MM
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
private
Date
updateTime
;
}
}
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
浏览文件 @
77559e40
...
@@ -68,7 +68,7 @@ public class Notice {
...
@@ -68,7 +68,7 @@ public class Notice {
@ApiModelProperty
(
value
=
"status"
,
example
=
"0"
,
dataType
=
"int"
,
name
=
"通知状态"
,
@ApiModelProperty
(
value
=
"status"
,
example
=
"0"
,
dataType
=
"int"
,
name
=
"通知状态"
,
notes
=
"未查看 0,已查看 1,已下载 2,默认 0"
)
notes
=
"未查看 0,已查看 1,已下载 2,默认 0"
)
@Column
(
name
=
"status"
)
@Column
(
name
=
"status"
)
private
int
status
;
private
Integer
status
;
/**
/**
* 通知类型 接受 0,发送 1,草稿 2
* 通知类型 接受 0,发送 1,草稿 2
...
@@ -83,7 +83,7 @@ public class Notice {
...
@@ -83,7 +83,7 @@ public class Notice {
*/
*/
@ApiModelProperty
(
value
=
"deadline"
,
name
=
"通知失效时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@ApiModelProperty
(
value
=
"deadline"
,
name
=
"通知失效时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@Column
(
name
=
"deadline"
)
@Column
(
name
=
"deadline"
)
@JsonFormat
(
pattern
=
"yyyy-
HH
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-
MM
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
deadline
;
private
Date
deadline
;
/**
/**
...
@@ -92,7 +92,7 @@ public class Notice {
...
@@ -92,7 +92,7 @@ public class Notice {
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"通知更新时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"通知更新时间"
,
example
=
"2019-01-01 00:00:00.000"
)
@Column
(
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-
HH
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-
MM
-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
private
Date
updateTime
;
/**
/**
...
@@ -121,6 +121,13 @@ public class Notice {
...
@@ -121,6 +121,13 @@ public class Notice {
@ApiModelProperty
(
value
=
"name"
,
example
=
""
,
dataType
=
"String"
,
name
=
"发件人名称"
)
@ApiModelProperty
(
value
=
"name"
,
example
=
""
,
dataType
=
"String"
,
name
=
"发件人名称"
)
@Column
(
name
=
"name"
)
@Column
(
name
=
"name"
)
private
String
name
;
private
String
name
;
/**
* 是否提醒 没提醒 0,提醒 1
*/
@ApiModelProperty
(
value
=
"label"
,
example
=
"1"
,
dataType
=
"int"
,
name
=
"是否提醒"
)
@Column
(
name
=
"label"
)
private
int
label
;
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/NoticeService.java
浏览文件 @
77559e40
...
@@ -54,6 +54,19 @@ public interface NoticeService {
...
@@ -54,6 +54,19 @@ public interface NoticeService {
* @return
* @return
*/
*/
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
);
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
);
void
saveNotice
(
Notice
notice
);
/**
* 获取已查看/未查看
* @param user 当前用户id
* @param status 通知状态
* @param pageNum
* @param pageSize
* @return
*/
Paging
<
Notice
>
getListByStatus
(
String
user
,
int
status
,
int
pageNum
,
int
pageSize
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
浏览文件 @
77559e40
...
@@ -11,6 +11,7 @@ import com.zjty.efs.log.subject.entity.EfsLog;
...
@@ -11,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
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
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
;
...
@@ -24,6 +25,7 @@ import java.lang.reflect.Array;
...
@@ -24,6 +25,7 @@ import java.lang.reflect.Array;
import
java.util.*
;
import
java.util.*
;
@Service
@Service
@Slf4j
public
class
NoticeServiceImpl
implements
NoticeService
{
public
class
NoticeServiceImpl
implements
NoticeService
{
@Autowired
@Autowired
NoticeDao
noticeDao
;
NoticeDao
noticeDao
;
...
@@ -45,6 +47,7 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -45,6 +47,7 @@ public class NoticeServiceImpl implements NoticeService {
notice
.
setUnit
(
userDo
.
getUnit
());
notice
.
setUnit
(
userDo
.
getUnit
());
notice
.
setStatus
(
0
);
notice
.
setStatus
(
0
);
notice
.
setName
(
userDo
.
getName
());
notice
.
setName
(
userDo
.
getName
());
notice
.
setLabel
(
0
);
...
@@ -65,39 +68,42 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -65,39 +68,42 @@ public class NoticeServiceImpl implements NoticeService {
}
else
{
}
else
{
List
<
Addressee
>
addresseeList2
=
new
ArrayList
<>();
//接受者显示的接收列表
List
<
Addressee
>
addresseeList2
=
new
ArrayList
<>();
//接受者显示的接收列表
Notice
notice1
=
transform
(
notice
);
//发送通知
String
dataList
=
""
;
for
(
String
addressee:
strings
){
for
(
String
addressee:
strings
){
List
<
Addressee
>
addresseeList
=
new
ArrayList
<>();
UserDo
userDo1
=
userService
.
findById
(
addressee
);
//收件人用户
UserDo
userDo1
=
userService
.
findById
(
addressee
);
//收件人用户
Addressee
addressee1
=
new
Addressee
();
Addressee
addressee1
=
new
Addressee
();
addressee1
.
setId
(
userDo1
.
getId
());
addressee1
.
setId
(
userDo1
.
getId
());
addressee1
.
setName
(
userDo1
.
getName
());
addressee1
.
setName
(
userDo1
.
getName
());
addressee1
.
setUnit
(
userDo1
.
getUnit
());
addressee1
.
setUnit
(
userDo1
.
getUnit
());
addresseeList
.
add
(
addressee1
);
addresseeList2
.
add
(
addressee1
);
addresseeList2
.
add
(
addressee1
);
Notice
notice1
=
transform
(
notice
);
//发送通知
Notice
notice2
=
transform
(
notice
);
// 接收通知
String
add
=
JSONObject
.
toJSONString
(
addresseeList
);
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
dataList
=
dataList
+
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"] "
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo1
.
getId
(),
data2
,
new
Date
()));
}
String
add2
=
JSONObject
.
toJSONString
(
addresseeList2
);
String
add2
=
JSONObject
.
toJSONString
(
addresseeList2
);
notice1
.
setAddressee
(
add
);
for
(
String
addressee:
strings
){
Notice
notice2
=
transform
(
notice
);
// 接收通知
notice2
.
setAddressee
(
add2
);
notice2
.
setAddressee
(
add2
);
notice2
.
setUnit
(
userDo1
.
getUnit
());
notice2
.
setType
(
0
);
notice2
.
setType
(
0
);
noticeDao
.
save
(
notice1
);
noticeDao
.
save
(
notice2
);
noticeDao
.
save
(
notice2
);
}
notice1
.
setAddressee
(
add2
);
noticeDao
.
save
(
notice1
);
String
data1
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
String
data1
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]给["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]给"
+
dataList
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
String
data2
=
"["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"]收到了来自["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]关于["
+
notice
.
getTitle
()
+
"的通知"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data1
,
new
Date
()));
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo1
.
getId
(),
data2
,
new
Date
()));
}
...
@@ -123,6 +129,8 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -123,6 +129,8 @@ public class NoticeServiceImpl implements NoticeService {
notice1
.
setUpdateTime
(
notice
.
getUpdateTime
());
notice1
.
setUpdateTime
(
notice
.
getUpdateTime
());
notice1
.
setType
(
notice
.
getType
());
notice1
.
setType
(
notice
.
getType
());
notice1
.
setUnit
(
notice
.
getUnit
());
notice1
.
setUnit
(
notice
.
getUnit
());
notice1
.
setName
(
notice
.
getName
());
notice1
.
setLabel
(
notice
.
getLabel
());
return
notice1
;
return
notice1
;
}
}
...
@@ -265,12 +273,35 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -265,12 +273,35 @@ public class NoticeServiceImpl implements NoticeService {
@Override
@Override
public
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
)
{
public
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
)
{
try
{
try
{
return
noticeDao
.
findOutByStatusAndType
(
status
,
type
);
return
noticeDao
.
findOutByStatusAndType
AndLabel
(
status
,
type
,
0
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
return
null
;
return
null
;
}
}
}
}
@Override
public
void
saveNotice
(
Notice
notice
)
{
noticeDao
.
save
(
notice
);
}
@Override
public
Paging
<
Notice
>
getListByStatus
(
String
user
,
int
status
,
int
pageNum
,
int
pageSize
)
{
try
{
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Page
<
Notice
>
p
=
noticeDao
.
findOutByAddresseeLikeAndTypeAndStatus
(
user
,
0
,
pageable
,
status
);
Paging
<
Notice
>
paging
=
new
Paging
<>();
paging
.
setData
(
p
.
getContent
());
paging
.
setPageSize
(
pageSize
);
paging
.
setPageNum
(
pageNum
);
paging
.
setTotal
((
int
)
p
.
getTotalElements
());
return
paging
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
null
;
}
}
}
}
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
浏览文件 @
77559e40
...
@@ -10,6 +10,9 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -10,6 +10,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.Period
;
import
java.time.ZoneId
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,10 +26,9 @@ public class Job {
...
@@ -23,10 +26,9 @@ public class Job {
@Scheduled
(
cron
=
"0 */1 * * * ?"
)
@Scheduled
(
cron
=
"0 */1 * * * ?"
)
public
void
cronJob
()
{
public
void
cronJob
()
{
try
{
Date
now
=
new
Date
();
Date
now
=
new
Date
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
add
(
Calendar
.
DATE
,
7
);
Date
time
=
calendar
.
getTime
();
List
<
Notice
>
noticeList
=
noticeService
.
findBySender
(
""
,
0
,
0
);
List
<
Notice
>
noticeList
=
noticeService
.
findBySender
(
""
,
0
,
0
);
String
data
=
""
;
String
data
=
""
;
...
@@ -34,10 +36,11 @@ public class Job {
...
@@ -34,10 +36,11 @@ public class Job {
Attention
attention
=
new
Attention
();
Attention
attention
=
new
Attention
();
Date
endTime
=
notice
.
getDeadline
();
Date
endTime
=
notice
.
getDeadline
();
long
days
=
(
endTime
.
getTime
()-
now
.
getTime
())/(
1000
*
3600
*
24
);
double
days
=
(
endTime
.
getTime
()-
now
.
getTime
())/(
1000
*
3600
*
24.0
);
System
.
out
.
println
(
days
);
// System.out.println(days);
if
(
days
==
3
||
days
==
1
){
if
(
days
<=
3.001
||
days
<=
1.001
){
data
=
"您收到来自["
+
notice
.
getName
()
+
"]的["
+
notice
.
getTitle
()
+
"],还有"
+
days
+
"天失效。"
;
int
d
=
(
int
)
days
;
data
=
"您收到来自["
+
notice
.
getName
()
+
"]的["
+
notice
.
getTitle
()
+
"],还有"
+
d
+
"天失效。"
;
attention
.
setData
(
data
);
attention
.
setData
(
data
);
attention
.
setNoticeId
(
notice
.
getId
());
attention
.
setNoticeId
(
notice
.
getId
());
...
@@ -48,9 +51,16 @@ public class Job {
...
@@ -48,9 +51,16 @@ public class Job {
attention
.
setStatus
(
0
);
attention
.
setStatus
(
0
);
attention
.
setUpdateTime
(
new
Date
());
attention
.
setUpdateTime
(
new
Date
());
attentionService
.
addAttention
(
attention
);
attentionService
.
addAttention
(
attention
);
notice
.
setLabel
(
1
);
noticeService
.
saveNotice
(
notice
);
}
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论