Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EncryptedFileSystem
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhangshuang
EncryptedFileSystem
Commits
84808aca
提交
84808aca
authored
3月 27, 2020
作者:
zhangshuang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of 192.168.1.249:LJJ/encrypted-file-system into develop
上级
6cf1d933
f910d2e1
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
293 行增加
和
50 行删除
+293
-50
pom.xml
efs-bus/pom.xml
+18
-0
BusApplication.java
efs-bus/src/main/java/com/zjty/efs/bus/BusApplication.java
+5
-1
AttentionDao.java
efs-bus/src/main/java/com/zjty/efs/bus/Dao/AttentionDao.java
+4
-1
NoticeDao.java
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
+3
-2
AttentionController.java
...java/com/zjty/efs/bus/controller/AttentionController.java
+29
-7
NoticeController.java
...in/java/com/zjty/efs/bus/controller/NoticeController.java
+5
-3
Attention.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Attention.java
+15
-3
Notice.java
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
+13
-5
AttentionService.java
.../main/java/com/zjty/efs/bus/service/AttentionService.java
+6
-2
NoticeService.java
...src/main/java/com/zjty/efs/bus/service/NoticeService.java
+3
-2
AttentionServiceImpl.java
...a/com/zjty/efs/bus/service/impl/AttentionServiceImpl.java
+41
-3
NoticeServiceImpl.java
...java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
+107
-21
Job.java
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
+44
-0
没有找到文件。
efs-bus/pom.xml
浏览文件 @
84808aca
...
@@ -39,6 +39,24 @@
...
@@ -39,6 +39,24 @@
<artifactId>
swagger-annotations
</artifactId>
<artifactId>
swagger-annotations
</artifactId>
<version>
1.5.18
</version>
<version>
1.5.18
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot
</artifactId>
</dependency>
<dependency>
<groupId>
com.zjty
</groupId>
<artifactId>
efs-log
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.zjty
</groupId>
<artifactId>
efs-user
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
...
...
efs-bus/src/main/java/com/zjty/efs/bus/BusApplication.java
浏览文件 @
84808aca
...
@@ -3,15 +3,19 @@ package com.zjty.efs.bus;
...
@@ -3,15 +3,19 @@ package com.zjty.efs.bus;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@SpringBootApplication
@SpringBootApplication
@ComponentScan
(
basePackages
=
{
@ComponentScan
(
basePackages
=
{
"com.zjty.efs.misc"
,
"com.zjty.efs.misc"
,
"com.zjty.efs.bus"
"com.zjty.efs.bus"
,
"com.zjty.efs.log"
,
"com.zjty.efs.user"
})
})
@EnableSwagger2
@EnableSwagger2
@EnableScheduling
public
class
BusApplication
{
public
class
BusApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
BusApplication
.
class
,
args
);
SpringApplication
.
run
(
BusApplication
.
class
,
args
);
...
...
efs-bus/src/main/java/com/zjty/efs/bus/Dao/AttentionDao.java
浏览文件 @
84808aca
...
@@ -6,7 +6,10 @@ import org.springframework.data.domain.Pageable;
...
@@ -6,7 +6,10 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
AttentionDao
extends
JpaRepository
<
Attention
,
Integer
>
{
public
interface
AttentionDao
extends
JpaRepository
<
Attention
,
Integer
>
{
Page
<
Attention
>
findOutByUserId
(
int
sender
,
Pageable
pageable
);
Page
<
Attention
>
findOutByUserId
(
String
sender
,
Pageable
pageable
);
List
<
Attention
>
findOutByUserIdAndStatus
(
String
userId
,
int
status
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/Dao/NoticeDao.java
浏览文件 @
84808aca
...
@@ -12,6 +12,7 @@ import java.util.List;
...
@@ -12,6 +12,7 @@ import java.util.List;
@Repository
@Repository
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
(
int
sender
,
int
type
,
Pageable
pageable
);
Page
<
Notice
>
findOutBySenderAndType
(
String
sender
,
int
type
,
Pageable
pageable
);
List
<
Notice
>
findOutBySenderAndStatusAndType
(
int
sender
,
int
status
,
int
type
);
Page
<
Notice
>
findOutByAddresseeAndType
(
String
addressee
,
int
type
,
Pageable
pageable
);
List
<
Notice
>
findOutByStatusAndType
(
int
status
,
int
type
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/controller/AttentionController.java
浏览文件 @
84808aca
...
@@ -2,35 +2,57 @@ package com.zjty.efs.bus.controller;
...
@@ -2,35 +2,57 @@ package com.zjty.efs.bus.controller;
import
com.zjty.efs.bus.entity.Attention
;
import
com.zjty.efs.bus.entity.Attention
;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.service.AttentionService
;
import
com.zjty.efs.misc.config.AutoDocument
;
import
com.zjty.efs.misc.config.AutoDocument
;
import
io.swagger.annotations.Api
;
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
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
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
@AutoDocument
@AutoDocument
@Api
(
tags
=
"提醒接口"
)
@Api
(
tags
=
"提醒接口"
)
@RestController
@RestController
@RequestMapping
(
"/attention"
)
@RequestMapping
(
"/attention"
)
public
class
AttentionController
{
public
class
AttentionController
{
@Autowired
AttentionService
attentionService
;
@ApiOperation
(
value
=
"获取提醒列表"
)
@ApiOperation
(
value
=
"获取提醒列表"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前登录用户"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前登录用户"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"页码"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"页码"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"条数"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"条数"
,
dataType
=
"int"
,
paramType
=
"query"
,
required
=
true
)
})
})
@PostMapping
(
"/getAttention"
)
@GetMapping
(
"/getAttention"
)
public
ResponseEntity
<
Paging
<
Attention
>>
test
(
@RequestParam
int
userId
,
int
pageNum
,
int
pageSize
){
public
ResponseEntity
<
Paging
<
Attention
>>
getAttentionList
(
@RequestParam
String
userId
,
int
pageNum
,
int
pageSize
){
return
ResponseEntity
.
ok
(
new
Paging
<>());
return
ResponseEntity
.
ok
(
attentionService
.
getAttentionList
(
userId
,
pageNum
,
pageSize
));
}
@ApiOperation
(
value
=
"修改提醒为已读"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"attentions"
,
value
=
"提醒实体"
,
paramType
=
"body"
,
dataType
=
"Attention"
,
required
=
true
,
allowMultiple
=
true
)
})
@PutMapping
(
"/updateStatus"
)
public
ResponseEntity
updateStatus
(
@RequestBody
@Valid
List
<
Attention
>
attentions
){
return
ResponseEntity
.
ok
(
attentionService
.
updateStatus
(
attentions
));
}
@ApiOperation
(
value
=
"消息提醒小红点"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"当前用户"
,
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
)
})
@GetMapping
(
"/redDot"
)
public
ResponseEntity
getRedDot
(
@RequestParam
String
userId
){
return
ResponseEntity
.
ok
(
attentionService
.
getRedDot
(
userId
));
}
}
}
}
efs-bus/src/main/java/com/zjty/efs/bus/controller/NoticeController.java
浏览文件 @
84808aca
...
@@ -50,8 +50,10 @@ public class NoticeController {
...
@@ -50,8 +50,10 @@ public class NoticeController {
}
}
@ApiOperation
(
value
=
"查看通知接口"
)
@ApiOperation
(
value
=
"查看通知接口"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"通知id"
,
paramType
=
"query"
,
@ApiImplicitParams
({
required
=
true
,
example
=
"1"
,
dataType
=
"int"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"通知id"
,
paramType
=
"query"
,
required
=
true
,
example
=
"1"
,
dataType
=
"int"
)
})
@GetMapping
(
"/getNotice"
)
@GetMapping
(
"/getNotice"
)
public
ResponseEntity
<
Notice
>
getNotice
(
@RequestParam
int
id
){
public
ResponseEntity
<
Notice
>
getNotice
(
@RequestParam
int
id
){
return
ResponseEntity
.
ok
(
noticeService
.
getNotice
(
id
));
return
ResponseEntity
.
ok
(
noticeService
.
getNotice
(
id
));
...
@@ -63,7 +65,7 @@ public class NoticeController {
...
@@ -63,7 +65,7 @@ public class NoticeController {
@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
int
user
,
int
type
,
int
pageNum
,
int
pageSize
){
public
ResponseEntity
<
Paging
<
Notice
>>
getNoticeList
(
@RequestParam
String
user
,
int
type
,
int
pageNum
,
int
pageSize
){
Paging
<
Notice
>
data
=
noticeService
.
getReceiveList
(
user
,
type
,
pageNum
,
pageSize
);
Paging
<
Notice
>
data
=
noticeService
.
getReceiveList
(
user
,
type
,
pageNum
,
pageSize
);
return
ResponseEntity
.
ok
(
data
);
return
ResponseEntity
.
ok
(
data
);
}
}
...
...
efs-bus/src/main/java/com/zjty/efs/bus/entity/Attention.java
浏览文件 @
84808aca
...
@@ -9,9 +9,10 @@ import lombok.NoArgsConstructor;
...
@@ -9,9 +9,10 @@ import lombok.NoArgsConstructor;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Documented
;
import
java.util.Date
;
@AutoDocument
@AutoDocument
@ApiModel
(
value
=
"提醒"
,
description
=
"提醒实体类"
)
//
@ApiModel(value = "提醒", description = "提醒实体类")
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
@Data
@Data
...
@@ -44,8 +45,19 @@ public class Attention {
...
@@ -44,8 +45,19 @@ public class Attention {
/**
/**
* 当前用户
* 当前用户
*/
*/
@ApiModelProperty
(
value
=
"userId"
,
example
=
"1"
,
dataType
=
"
int
"
,
name
=
"当前用户编号"
)
@ApiModelProperty
(
value
=
"userId"
,
example
=
"1"
,
dataType
=
"
String
"
,
name
=
"当前用户编号"
)
@Column
(
name
=
"user_id"
)
@Column
(
name
=
"user_id"
)
private
int
userId
;
private
String
userId
;
/**
* 状态
*/
@ApiModelProperty
(
value
=
"status"
,
example
=
"1"
,
dataType
=
"int"
,
name
=
"状态"
,
notes
=
"未查看 0,已查看 1"
)
@Column
(
name
=
"status"
)
private
int
status
;
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"更新时间"
)
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
}
}
efs-bus/src/main/java/com/zjty/efs/bus/entity/Notice.java
浏览文件 @
84808aca
...
@@ -43,16 +43,16 @@ public class Notice {
...
@@ -43,16 +43,16 @@ public class Notice {
/**
/**
* 收件人
* 收件人
*/
*/
@ApiModelProperty
(
value
=
"addressee"
,
example
=
"1"
,
dataType
=
"
int
"
,
name
=
"收件人"
)
@ApiModelProperty
(
value
=
"addressee"
,
example
=
"1"
,
dataType
=
"
String
"
,
name
=
"收件人"
)
@Column
(
name
=
"addressee"
)
@Column
(
name
=
"addressee"
)
private
int
addressee
;
private
String
addressee
;
/**
/**
* 发件人
* 发件人
*/
*/
@ApiModelProperty
(
value
=
"sender"
,
example
=
"2"
,
dataType
=
"String"
,
name
=
"发件人"
)
@ApiModelProperty
(
value
=
"sender"
,
example
=
"2"
,
dataType
=
"String"
,
name
=
"发件人"
)
@Column
(
name
=
"sender"
)
@Column
(
name
=
"sender"
)
private
int
sender
;
private
String
sender
;
/**
/**
* 留言
* 留言
...
@@ -80,14 +80,14 @@ public class Notice {
...
@@ -80,14 +80,14 @@ public class Notice {
/**
/**
* 失效时间
* 失效时间
*/
*/
@ApiModelProperty
(
value
=
"deadline"
,
example
=
"2020-02-12 10:23:12"
,
name
=
"通知失效时间"
)
@ApiModelProperty
(
value
=
"deadline"
,
name
=
"通知失效时间"
)
@Column
(
name
=
"deadline"
)
@Column
(
name
=
"deadline"
)
private
Date
deadline
;
private
Date
deadline
;
/**
/**
* 通知更新时间
* 通知更新时间
*/
*/
@ApiModelProperty
(
value
=
"updateTime"
,
example
=
"2020-02-12 10:23:12"
,
name
=
"通知更新时间"
)
@ApiModelProperty
(
value
=
"updateTime"
,
name
=
"通知更新时间"
)
@Column
(
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
private
Date
updateTime
;
...
@@ -105,4 +105,12 @@ public class Notice {
...
@@ -105,4 +105,12 @@ public class Notice {
@Column
(
name
=
"file_list"
)
@Column
(
name
=
"file_list"
)
private
String
fileList
;
private
String
fileList
;
/**
* 附件列表
*/
@ApiModelProperty
(
value
=
"unit"
,
example
=
""
,
dataType
=
"String"
,
name
=
"单位名称"
)
@Column
(
name
=
"unit"
)
private
String
unit
;
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/AttentionService.java
浏览文件 @
84808aca
...
@@ -2,8 +2,12 @@ package com.zjty.efs.bus.service;
...
@@ -2,8 +2,12 @@ package com.zjty.efs.bus.service;
import
com.zjty.efs.bus.entity.Attention
;
import
com.zjty.efs.bus.entity.Attention
;
import
com.zjty.efs.bus.entity.Paging
;
import
com.zjty.efs.bus.entity.Paging
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
public
interface
AttentionService
{
public
interface
AttentionService
{
Paging
<
Attention
>
getAttentionList
(
int
userId
,
int
pageNum
,
int
pageSize
);
Paging
<
Attention
>
getAttentionList
(
String
userId
,
int
pageNum
,
int
pageSize
);
boolean
addAttention
(
Attention
attention
);
boolean
updateStatus
(
List
<
Attention
>
attentions
);
boolean
getRedDot
(
String
userId
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/NoticeService.java
浏览文件 @
84808aca
...
@@ -24,6 +24,7 @@ public interface NoticeService {
...
@@ -24,6 +24,7 @@ public interface NoticeService {
/**
/**
* 查看通知
* 查看通知
* @param id 通知id
* @param id 通知id
*
* @return
* @return
*/
*/
Notice
getNotice
(
int
id
);
Notice
getNotice
(
int
id
);
...
@@ -36,7 +37,7 @@ public interface NoticeService {
...
@@ -36,7 +37,7 @@ public interface NoticeService {
*
*
* @return 通知json对象
* @return 通知json对象
*/
*/
Paging
<
Notice
>
getReceiveList
(
int
user
,
int
type
,
int
pageNum
,
int
pageSize
);
Paging
<
Notice
>
getReceiveList
(
String
user
,
int
type
,
int
pageNum
,
int
pageSize
);
/**
/**
* 修改通知为已读
* 修改通知为已读
...
@@ -52,7 +53,7 @@ public interface NoticeService {
...
@@ -52,7 +53,7 @@ public interface NoticeService {
* @param type 0 接收通知
* @param type 0 接收通知
* @return
* @return
*/
*/
List
<
Notice
>
findBySender
(
int
userId
,
int
status
,
int
type
);
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
);
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/AttentionServiceImpl.java
浏览文件 @
84808aca
...
@@ -9,12 +9,17 @@ import org.springframework.data.domain.Page;
...
@@ -9,12 +9,17 @@ import org.springframework.data.domain.Page;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
public
class
AttentionServiceImpl
implements
AttentionService
{
public
class
AttentionServiceImpl
implements
AttentionService
{
@Autowired
@Autowired
AttentionDao
attentionDao
;
AttentionDao
attentionDao
;
@Override
@Override
public
Paging
<
Attention
>
getAttentionList
(
int
userId
,
int
pageNum
,
int
pageSize
)
{
public
Paging
<
Attention
>
getAttentionList
(
String
userId
,
int
pageNum
,
int
pageSize
)
{
try
{
try
{
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Page
<
Attention
>
p
=
attentionDao
.
findOutByUserId
(
userId
,
pageable
);
Page
<
Attention
>
p
=
attentionDao
.
findOutByUserId
(
userId
,
pageable
);
...
@@ -32,8 +37,41 @@ public class AttentionServiceImpl implements AttentionService {
...
@@ -32,8 +37,41 @@ public class AttentionServiceImpl implements AttentionService {
}
}
public
boolean
addAttention
(
int
noticeId
){
@Override
public
boolean
addAttention
(
Attention
attention
)
{
try
{
attentionDao
.
save
(
attention
);
return
true
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
false
;
}
}
@Override
@Transactional
public
boolean
updateStatus
(
List
<
Attention
>
attentions
)
{
try
{
for
(
Attention
attention:
attentions
){
attention
.
setStatus
(
1
);
attentionDao
.
save
(
attention
);
}
return
true
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
false
;
}
}
return
true
;
@Override
public
boolean
getRedDot
(
String
userId
)
{
List
<
Attention
>
attentions
=
attentionDao
.
findOutByUserIdAndStatus
(
userId
,
0
);
if
(
attentions
.
size
()
>
0
){
return
true
;
}
else
{
return
false
;
}
}
}
}
}
efs-bus/src/main/java/com/zjty/efs/bus/service/impl/NoticeServiceImpl.java
浏览文件 @
84808aca
...
@@ -4,37 +4,77 @@ import com.zjty.efs.bus.Dao.NoticeDao;
...
@@ -4,37 +4,77 @@ import com.zjty.efs.bus.Dao.NoticeDao;
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
;
import
com.zjty.efs.log.subject.entity.EfsLog
;
import
com.zjty.efs.log.tool.EfsLogUtil
;
import
com.zjty.efs.user.subject.entity.UserDo
;
import
com.zjty.efs.user.subject.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
public
class
NoticeServiceImpl
implements
NoticeService
{
public
class
NoticeServiceImpl
implements
NoticeService
{
@Autowired
@Autowired
NoticeDao
noticeDao
;
NoticeDao
noticeDao
;
@Autowired
EfsLogUtil
efsLogUtil
;
@Autowired
UserService
userService
;
@Override
@Override
@Transactional
public
boolean
addNotice
(
Notice
notice
)
{
public
boolean
addNotice
(
Notice
notice
)
{
try
{
try
{
noticeDao
.
save
(
notice
);
Notice
notice1
=
new
Notice
();
Calendar
calendar
=
Calendar
.
getInstance
();
notice1
.
setType
(
0
);
calendar
.
add
(
Calendar
.
DATE
,
7
);
notice1
.
setTitle
(
notice
.
getTitle
());
UserDo
userDo
=
userService
.
findById
(
notice
.
getSender
());
// 发送人
notice1
.
setAddressee
(
notice
.
getAddressee
());
UserDo
userDo1
=
userService
.
findById
(
notice
.
getAddressee
());
//接收人
notice1
.
setDeadline
(
notice
.
getDeadline
());
notice
.
setUpdateTime
(
new
Date
());
notice1
.
setFileList
(
notice
.
getFileList
());
notice
.
setDeadline
(
calendar
.
getTime
());
notice1
.
setMessage
(
notice
.
getMessage
());
notice
.
setUnit
(
userDo
.
getUnit
());
notice1
.
setNote
(
notice
.
getNote
());
notice
.
setStatus
(
0
);
notice1
.
setSender
(
notice
.
getSender
());
notice1
.
setStatus
(
notice
.
getStatus
());
noticeDao
.
save
(
notice
);
notice1
.
setUpdateTime
(
notice
.
getUpdateTime
());
String
data
=
""
;
noticeDao
.
save
(
notice1
);
if
(
notice
.
getType
()
==
2
){
//如果是草稿
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]新增关于["
+
notice
.
getTitle
()
+
"草稿"
;
}
else
{
//如果是发送,就新增接收
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"]给["
+
userDo1
.
getUnit
()
+
"]["
+
userDo1
.
getDepartment
()
+
"]的["
+
userDo1
.
getName
()
+
"发送了关于["
+
notice
.
getTitle
()
+
"]的通知"
;
Notice
notice1
=
new
Notice
();
notice1
.
setType
(
0
);
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
.
setUnit
(
notice
.
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
()));
}
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data
,
new
Date
()));
return
true
;
return
true
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -45,8 +85,10 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -45,8 +85,10 @@ public class NoticeServiceImpl implements NoticeService {
}
}
@Override
@Override
@Transactional
public
boolean
updateNotice
(
Notice
notice
)
{
public
boolean
updateNotice
(
Notice
notice
)
{
try
{
try
{
notice
.
setStatus
(
0
);
noticeDao
.
save
(
notice
);
noticeDao
.
save
(
notice
);
return
true
;
return
true
;
...
@@ -57,11 +99,30 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -57,11 +99,30 @@ public class NoticeServiceImpl implements NoticeService {
}
}
@Override
@Override
@Transactional
public
Notice
getNotice
(
int
id
)
{
public
Notice
getNotice
(
int
id
)
{
try
{
try
{
Notice
notice
=
noticeDao
.
findById
(
id
);
Notice
notice
=
noticeDao
.
findById
(
id
);
notice
.
setStatus
(
1
);
notice
.
setStatus
(
1
);
noticeDao
.
save
(
notice
);
noticeDao
.
save
(
notice
);
String
userId
=
""
;
if
(
notice
.
getType
()
==
0
){
//已接收
userId
=
notice
.
getAddressee
();
}
else
{
userId
=
notice
.
getSender
();
}
if
(
notice
.
getType
()
==
0
){
//已接收
userId
=
notice
.
getAddressee
();
}
else
{
userId
=
notice
.
getSender
();
}
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
()));
return
notice
;
return
notice
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -71,10 +132,19 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -71,10 +132,19 @@ public class NoticeServiceImpl implements NoticeService {
}
}
@Override
@Override
public
Paging
<
Notice
>
getReceiveList
(
int
user
,
int
type
,
int
pageNum
,
int
pageSize
)
{
public
Paging
<
Notice
>
getReceiveList
(
String
user
,
int
type
,
int
pageNum
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Pageable
pageable
=
PageRequest
.
of
(
pageNum
-
1
,
pageSize
,
Sort
.
Direction
.
DESC
,
"updateTime"
);
Page
<
Notice
>
p
=
noticeDao
.
findOutBySenderAndType
(
user
,
type
,
pageable
);
Page
<
Notice
>
p
;
if
(
type
==
0
){
//已接收
p
=
noticeDao
.
findOutByAddresseeAndType
(
user
,
type
,
pageable
);
}
else
{
//已发送,草稿
p
=
noticeDao
.
findOutBySenderAndType
(
user
,
type
,
pageable
);
}
Paging
<
Notice
>
paging
=
new
Paging
<>();
Paging
<
Notice
>
paging
=
new
Paging
<>();
paging
.
setData
(
p
.
getContent
());
paging
.
setData
(
p
.
getContent
());
paging
.
setPageSize
(
pageSize
);
paging
.
setPageSize
(
pageSize
);
...
@@ -84,11 +154,27 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -84,11 +154,27 @@ public class NoticeServiceImpl implements NoticeService {
}
}
@Override
@Override
@Transactional
public
boolean
updateStatus
(
List
<
Notice
>
notices
)
{
public
boolean
updateStatus
(
List
<
Notice
>
notices
)
{
try
{
try
{
String
userId
=
""
;
if
(
notices
.
get
(
0
).
getType
()
==
0
){
userId
=
notices
.
get
(
0
).
getAddressee
();
}
else
{
userId
=
notices
.
get
(
0
).
getSender
();
}
UserDo
userDo
=
userService
.
findById
(
userId
);
// 发送人
String
data
=
"["
+
userDo
.
getUnit
()
+
"]["
+
userDo
.
getDepartment
()
+
"]的["
+
userDo
.
getName
()
+
"修改"
;
for
(
Notice
notice:
notices
){
for
(
Notice
notice:
notices
){
notice
.
setStatus
(
1
);
noticeDao
.
save
(
notice
);
noticeDao
.
save
(
notice
);
data
=
data
+
"["
+
notice
.
getTitle
()
+
"]"
;
}
}
data
=
data
+
"为已读"
;
efsLogUtil
.
addLog
(
new
EfsLog
(
null
,
userDo
.
getId
(),
data
,
new
Date
()));
return
true
;
return
true
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -97,9 +183,9 @@ public class NoticeServiceImpl implements NoticeService {
...
@@ -97,9 +183,9 @@ public class NoticeServiceImpl implements NoticeService {
}
}
@Override
@Override
public
List
<
Notice
>
findBySender
(
int
userId
,
int
status
,
int
type
)
{
public
List
<
Notice
>
findBySender
(
String
userId
,
int
status
,
int
type
)
{
try
{
try
{
return
noticeDao
.
findOutByS
enderAndStatusAndType
(
userId
,
status
,
type
);
return
noticeDao
.
findOutByS
tatusAndType
(
status
,
type
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
return
null
;
return
null
;
...
...
efs-bus/src/main/java/com/zjty/efs/bus/util/Job.java
0 → 100644
浏览文件 @
84808aca
package
com
.
zjty
.
efs
.
bus
.
util
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.List
;
@Component
public
class
Job
{
@Autowired
NoticeService
noticeService
;
@Autowired
AttentionService
attentionService
;
@Scheduled
(
cron
=
"0 0 10 * * ? "
)
public
void
cronJob
()
{
List
<
Notice
>
noticeList
=
noticeService
.
findBySender
(
""
,
0
,
0
);
Date
now
=
new
Date
();
String
data
=
""
;
for
(
Notice
notice:
noticeList
){
Attention
attention
=
new
Attention
();
Date
endTime
=
notice
.
getDeadline
();
long
days
=
(
endTime
.
getTime
()-
now
.
getTime
())/(
1000
*
3600
*
24
);
System
.
out
.
println
(
days
);
if
(
days
==
3
||
days
==
1
){
data
=
"您收到来自["
+
notice
.
getSender
()
+
"]的["
+
notice
.
getTitle
()
+
"],还有"
+
days
+
"天失效。"
;
attention
.
setData
(
data
);
attention
.
setNoticeId
(
notice
.
getId
());
attention
.
setUserId
(
notice
.
getAddressee
());
attention
.
setStatus
(
0
);
attention
.
setUpdateTime
(
new
Date
());
attentionService
.
addAttention
(
attention
);
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论