Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
a320e10f
Commit
a320e10f
authored
Aug 15, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公告模块
parent
9ee4925d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
480 additions
and
5 deletions
+480
-5
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
+1
-0
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
+54
-5
src/main/java/com/zhiwei/brandkbs2/controller/app/AppUserCenterController.java
+53
-0
src/main/java/com/zhiwei/brandkbs2/dao/NoticeInfoDao.java
+15
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/NoticeInfoDaoImpl.java
+27
-0
src/main/java/com/zhiwei/brandkbs2/pojo/NoticeInfo.java
+72
-0
src/main/java/com/zhiwei/brandkbs2/pojo/UserInfo.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/NoticeInfoDTO.java
+27
-0
src/main/java/com/zhiwei/brandkbs2/service/NoticeInfoService.java
+75
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/NoticeInfoServiceImpl.java
+152
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+2
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
View file @
a320e10f
...
...
@@ -144,6 +144,7 @@ public class GenericAttribute {
public
static
final
String
AVATAR_URL
=
"avatarUrl"
;
public
static
final
String
EXPORT_AMOUNT
=
"exportAmount"
;
public
static
final
String
EXPIRED_TIME
=
"expiredTime"
;
public
static
final
String
PHONE_NUMBER
=
"phoneNumber"
;
// public enum ChannelParam{
// 负面稿件数("negativeArticles"),
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
View file @
a320e10f
...
...
@@ -9,11 +9,9 @@ import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.NoticeInfoDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
...
...
@@ -61,6 +59,9 @@ public class ProjectController extends BaseController {
@Resource
(
name
=
"eventServiceImpl"
)
private
EventService
eventService
;
@Resource
(
name
=
"noticeInfoServiceImpl"
)
private
NoticeInfoService
noticeInfoService
;
@Value
(
"${brandkbs.img.url}"
)
private
String
brandkbsImgPath
;
...
...
@@ -81,7 +82,8 @@ public class ProjectController extends BaseController {
@ApiOperation
(
"查询所有项目"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
)})
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/list"
)
public
ResponseResult
findProjectList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
ProjectService
.
findProjectList
(
page
,
size
,
keyword
));
...
...
@@ -205,4 +207,51 @@ public class ProjectController extends BaseController {
return
ResponseResult
.
success
(
eventTags
);
}
@ApiOperation
(
"产品公告-新建公告"
)
@PostMapping
(
"/notice/add"
)
public
ResponseResult
addNoticeInfo
(
@RequestBody
NoticeInfoDTO
noticeInfoDTO
){
noticeInfoService
.
addNoticeInfo
(
noticeInfoDTO
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"产品公告-编辑公告"
)
@PostMapping
(
"/notice/update"
)
public
ResponseResult
updateNoticeInfo
(
@RequestBody
NoticeInfoDTO
noticeInfoDTO
){
noticeInfoService
.
updateNoticeInfo
(
noticeInfoDTO
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"产品公告-修改公告展示状态"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"公告id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/notice/show/{id}"
)
public
ResponseResult
updateShowStatus
(
@PathVariable
String
id
){
return
noticeInfoService
.
updateShowStatus
(
id
);
}
@ApiOperation
(
"产品公告-修改公告开关状态"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"公告id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/notice/used/{id}"
)
public
ResponseResult
updateUsedStatus
(
@PathVariable
String
id
){
noticeInfoService
.
updateUsedStatus
(
id
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"产品公告-查询所有公告"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/notice/list"
)
public
ResponseResult
getNoticeInfoList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
noticeInfoService
.
getNoticeInfoList
(
page
,
size
,
keyword
));
}
@ApiOperation
(
"产品公告-删除公告"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"公告id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@DeleteMapping
(
"/notice/delete/{id}"
)
public
ResponseResult
deleteNoticeInfo
(
@PathVariable
String
id
)
{
noticeInfoService
.
deleteNoticeInfo
(
id
);
return
ResponseResult
.
success
();
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppUserCenterController.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.NoticeInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
/**
* @ClassName AppContendController
* @Description 提供前台竞品库相关信息展示
* @author cjz
* @date 2022-08-09 10:22
*/
@RestController
@RequestMapping
(
"/app/user"
)
@Api
(
tags
=
"个人中心"
,
description
=
"提供个人中心相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppUserCenterController
extends
BaseController
{
@Resource
(
name
=
"noticeInfoServiceImpl"
)
private
NoticeInfoService
noticeInfoService
;
@ApiOperation
(
"个人中心-系统通知-公告列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
)})
@GetMapping
(
"/notice/list"
)
public
ResponseResult
getNoticeInfoList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
)
{
return
ResponseResult
.
success
(
noticeInfoService
.
getNoticeInfoList
(
page
,
size
));
}
@ApiOperation
(
"获取最新公告"
)
@GetMapping
(
"/notice"
)
public
ResponseResult
getLastNoticeInfo
(){
return
ResponseResult
.
success
(
noticeInfoService
.
getLastNoticeInfo
());
}
@ApiOperation
(
"更新公告已读信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"公告id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/notice/read/{id}"
)
public
ResponseResult
updateReadUserId
(
@PathVariable
String
id
){
noticeInfoService
.
updateReadUserId
(
id
);
return
ResponseResult
.
success
();
}
}
src/main/java/com/zhiwei/brandkbs2/dao/NoticeInfoDao.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.NoticeInfo
;
import
org.springframework.data.mongodb.core.query.Query
;
/**
* @ClassName: NoticeInfoDao
* @Description NoticeInfoDao
* @author: cjz
* @date: 2023-08-08 14:49
*/
public
interface
NoticeInfoDao
extends
BaseMongoDao
<
NoticeInfo
>{
NoticeInfo
findOne
(
Query
query
);
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/NoticeInfoDaoImpl.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.NoticeInfoDao
;
import
com.zhiwei.brandkbs2.pojo.NoticeInfo
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName: NoticeInfoDaoImpl
* @Description NoticeInfoDaoImpl
* @author: cjz
* @date: 2023-08-08 14:49
*/
@Component
(
"noticeInfoDao"
)
public
class
NoticeInfoDaoImpl
extends
BaseMongoDaoImpl
<
NoticeInfo
>
implements
NoticeInfoDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_notice_info"
;
public
NoticeInfoDaoImpl
()
{
super
(
COLLECTION_NAME
);
}
@Override
public
NoticeInfo
findOne
(
Query
query
)
{
return
mongoTemplate
.
findOne
(
query
,
NoticeInfo
.
class
,
COLLECTION_NAME
);
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/NoticeInfo.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.*
;
import
java.util.List
;
/**
* @Description: 公告
* @author: YaoGuoDong
* @date: 2020-10-27 13:58
**/
@Getter
@Setter
@AllArgsConstructor
public
class
NoticeInfo
extends
AbstractBaseMongo
{
/**
* title标题
*/
private
String
title
;
/**
* content 公告内容
*/
private
String
content
;
/**
* type 通知类型 迭代内容|实时通知 ,并无实时公告的展示逻辑,预留备用
*/
private
String
type
;
/**
* status 公告状态 启动|终止
*/
private
Boolean
start
;
/**
* show 公告展示 展示|隐藏
*/
private
Boolean
show
;
/**
* submitter 提交人
*/
private
String
submitter
;
/**
* submitterId 提交人id
*/
private
String
submitterId
;
/**
* fileAddress 文件地址,保留预留备用
*/
private
String
fileAddress
;
/**
* uidList 已阅读列表
*/
private
List
<
String
>
uidList
;
/**
* uTime 更新时间
*/
private
Long
uTime
;
/**
* cTime 创建时间
*/
private
Long
cTime
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/UserInfo.java
View file @
a320e10f
...
...
@@ -22,6 +22,7 @@ public class UserInfo {
private
String
avatarUrl
;
private
Integer
exportAmount
;
private
Long
expiredTime
;
private
long
phoneNumber
;
public
UserInfo
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
...
...
@@ -42,6 +43,7 @@ public class UserInfo {
res
.
put
(
GenericAttribute
.
AVATAR_URL
,
this
.
avatarUrl
);
res
.
put
(
GenericAttribute
.
EXPORT_AMOUNT
,
this
.
exportAmount
);
res
.
put
(
GenericAttribute
.
EXPIRED_TIME
,
this
.
expiredTime
);
res
.
put
(
GenericAttribute
.
PHONE_NUMBER
,
this
.
phoneNumber
);
return
res
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/NoticeInfoDTO.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"公告传输类"
)
public
class
NoticeInfoDTO
{
/**
* 主键ID
*/
@ApiModelProperty
(
"主键ID"
)
private
String
id
;
/**
* 公告标题
*/
@ApiModelProperty
(
"公告标题"
)
private
String
title
;
/**
* 公告内容
*/
@ApiModelProperty
(
"公告内容"
)
private
String
content
;
}
src/main/java/com/zhiwei/brandkbs2/service/NoticeInfoService.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.NoticeInfo
;
import
com.zhiwei.brandkbs2.pojo.dto.NoticeInfoDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
/**
* @ClassName: NoticeInfoService
* @Description 公告业务接口
* @author: cjz
* @date: 2023-08-08 14:32
*/
public
interface
NoticeInfoService
{
/**
* 后台-项目配置-产品公告-新建公告
* @param noticeInfoDTO 公告传输类
*/
void
addNoticeInfo
(
NoticeInfoDTO
noticeInfoDTO
);
/**
* 后台-项目配置-产品公告-编辑公告
* @param noticeInfoDTO 公告传输类
*/
void
updateNoticeInfo
(
NoticeInfoDTO
noticeInfoDTO
);
/**
* 后台-项目配置-产品公告-修改展示状态
* @param id 公告id
*/
ResponseResult
updateShowStatus
(
String
id
);
/**
* 后台-项目配置-产品公告-修改 启动|终止状态
* @param id 公告id
*/
void
updateUsedStatus
(
String
id
);
/**
* 后台-项目配置-产品公告-获取公告列表
* @param page 页码
* @param size 每页记录数
* @param keyword 搜索关键词
* @return
*/
PageVO
<
JSONObject
>
getNoticeInfoList
(
int
page
,
int
size
,
String
keyword
);
/**
* 后台-项目配置-产品公告-删除公告
* @param id 公告id
*/
void
deleteNoticeInfo
(
String
id
);
/**
* 个人中心-系统通知-获取公告列表
* @param page 页码
* @param size 每页记录数
* @return
*/
PageVO
<
NoticeInfo
>
getNoticeInfoList
(
int
page
,
int
size
);
/**
* 前台-获取最新公告
* @return
*/
JSONObject
getLastNoticeInfo
();
/**
* 更新公告已读信息
* @param id 公告id
*/
void
updateReadUserId
(
String
id
);
}
src/main/java/com/zhiwei/brandkbs2/service/impl/NoticeInfoServiceImpl.java
0 → 100644
View file @
a320e10f
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.NoticeInfoDao
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.NoticeInfo
;
import
com.zhiwei.brandkbs2.pojo.dto.NoticeInfoDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.NoticeInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"noticeInfoServiceImpl"
)
public
class
NoticeInfoServiceImpl
implements
NoticeInfoService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
NoticeInfoServiceImpl
.
class
);
@Resource
(
name
=
"noticeInfoDao"
)
NoticeInfoDao
noticeInfoDao
;
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
static
final
String
UPDATE_CONTENT_NOTICE
=
"迭代内容"
;
@Override
public
void
addNoticeInfo
(
NoticeInfoDTO
dto
)
{
long
now
=
System
.
currentTimeMillis
();
NoticeInfo
noticeInfo
=
new
NoticeInfo
(
dto
.
getTitle
(),
dto
.
getContent
(),
UPDATE_CONTENT_NOTICE
,
false
,
false
,
UserThreadLocal
.
getNickname
(),
UserThreadLocal
.
getUserId
(),
null
,
new
ArrayList
<>(),
now
,
now
);
noticeInfoDao
.
insertOne
(
noticeInfo
);
}
@Override
public
void
updateNoticeInfo
(
NoticeInfoDTO
dto
)
{
NoticeInfo
noticeInfo
=
noticeInfoDao
.
findOneById
(
dto
.
getId
());
noticeInfo
.
setTitle
(
dto
.
getTitle
());
noticeInfo
.
setContent
(
dto
.
getContent
());
noticeInfo
.
setSubmitter
(
UserThreadLocal
.
getNickname
());
noticeInfo
.
setSubmitterId
(
UserThreadLocal
.
getUserId
());
noticeInfo
.
setUTime
(
System
.
currentTimeMillis
());
noticeInfoDao
.
updateOne
(
noticeInfo
);
}
@Override
public
ResponseResult
updateShowStatus
(
String
id
)
{
NoticeInfo
noticeInfo
=
noticeInfoDao
.
findOneById
(
id
);
if
(
noticeInfo
.
getStart
().
equals
(
Boolean
.
FALSE
)){
return
ResponseResult
.
failure
(
"修改公告展示状态失败-公告处于终止状态"
);
}
noticeInfo
.
setShow
(!
noticeInfo
.
getShow
());
noticeInfo
.
setSubmitter
(
UserThreadLocal
.
getNickname
());
noticeInfo
.
setSubmitterId
(
UserThreadLocal
.
getUserId
());
noticeInfo
.
setUTime
(
System
.
currentTimeMillis
());
noticeInfoDao
.
updateOne
(
noticeInfo
);
return
ResponseResult
.
success
();
}
@Override
public
void
updateUsedStatus
(
String
id
)
{
NoticeInfo
noticeInfo
=
noticeInfoDao
.
findOneById
(
id
);
noticeInfo
.
setStart
(!
noticeInfo
.
getStart
());
noticeInfo
.
setSubmitter
(
UserThreadLocal
.
getNickname
());
noticeInfo
.
setSubmitterId
(
UserThreadLocal
.
getUserId
());
noticeInfo
.
setUTime
(
System
.
currentTimeMillis
());
noticeInfoDao
.
updateOne
(
noticeInfo
);
}
@Override
public
PageVO
<
JSONObject
>
getNoticeInfoList
(
int
page
,
int
size
,
String
keyword
)
{
Query
query
=
new
Query
();
if
(
StringUtils
.
isNotBlank
(
keyword
))
{
noticeInfoDao
.
addKeywordFuzz
(
query
,
keyword
,
"title"
);
}
long
total
=
noticeInfoDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
NoticeInfo
>
noticeInfoList
=
noticeInfoDao
.
findList
(
query
);
List
<
JSONObject
>
res
=
new
ArrayList
<>();
for
(
NoticeInfo
noticeInfo
:
noticeInfoList
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
noticeInfo
.
getId
());
jsonObject
.
put
(
"title"
,
noticeInfo
.
getTitle
());
jsonObject
.
put
(
"content"
,
noticeInfo
.
getContent
());
jsonObject
.
put
(
"start"
,
noticeInfo
.
getStart
());
jsonObject
.
put
(
"show"
,
noticeInfo
.
getShow
());
jsonObject
.
put
(
"readCount"
,
noticeInfo
.
getUidList
().
size
());
jsonObject
.
put
(
"submitter"
,
noticeInfo
.
getSubmitter
());
jsonObject
.
put
(
"submitterId"
,
noticeInfo
.
getSubmitterId
());
jsonObject
.
put
(
"cTime"
,
noticeInfo
.
getCTime
());
jsonObject
.
put
(
"uTime"
,
noticeInfo
.
getUTime
());
res
.
add
(
jsonObject
);
}
return
PageVO
.
createPageVo
(
total
,
page
,
size
,
res
);
}
@Override
public
void
deleteNoticeInfo
(
String
id
)
{
noticeInfoDao
.
deleteOneById
(
id
);
}
@Override
public
PageVO
<
NoticeInfo
>
getNoticeInfoList
(
int
page
,
int
size
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"start"
).
is
(
true
));
query
.
addCriteria
(
Criteria
.
where
(
"show"
).
is
(
true
));
long
total
=
noticeInfoDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
NoticeInfo
>
noticeInfoList
=
noticeInfoDao
.
findList
(
query
);
return
PageVO
.
createPageVo
(
total
,
page
,
size
,
noticeInfoList
);
}
@Override
public
JSONObject
getLastNoticeInfo
()
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"start"
).
is
(
true
));
query
.
addCriteria
(
Criteria
.
where
(
"show"
).
is
(
true
));
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"uTime"
));
NoticeInfo
noticeInfo
=
noticeInfoDao
.
findOne
(
query
);
String
userId
=
UserThreadLocal
.
getUserId
();
JSONObject
jsonObject
=
new
JSONObject
();
if
(
noticeInfo
.
getUidList
().
contains
(
userId
)){
jsonObject
.
put
(
"read"
,
true
);
jsonObject
.
put
(
"notice"
,
null
);
return
jsonObject
;
}
jsonObject
.
put
(
"read"
,
false
);
jsonObject
.
put
(
"notice"
,
noticeInfo
);
return
jsonObject
;
}
@Override
public
void
updateReadUserId
(
String
id
)
{
NoticeInfo
noticeInfo
=
noticeInfoDao
.
findOneById
(
id
);
List
<
String
>
uidList
=
noticeInfo
.
getUidList
();
String
userId
=
UserThreadLocal
.
getUserId
();
if
(
uidList
.
contains
(
userId
)){
return
;
}
uidList
.
add
(
userId
);
noticeInfo
.
setUidList
(
uidList
);
noticeInfoDao
.
updateOne
(
noticeInfo
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
a320e10f
...
...
@@ -113,6 +113,7 @@ public class UserServiceImpl implements UserService {
userInfo
.
setRoleId
(
RoleEnum
.
SUPER_ADMIN
.
getState
());
userInfo
.
setAvatarUrl
(
user
.
getAvatarUrl
());
userInfo
.
setExportAmount
(
10000
);
userInfo
.
setPhoneNumber
(
user
.
getPhoneNumber
());
return
userInfo
;
}
AtomicBoolean
hit
=
new
AtomicBoolean
(
false
);
...
...
@@ -125,6 +126,7 @@ public class UserServiceImpl implements UserService {
userInfo
.
setAvatarUrl
(
user
.
getAvatarUrl
());
userInfo
.
setExportAmount
(
userRole
.
getExportAmount
());
userInfo
.
setExpiredTime
(
userRole
.
getExpiredTime
());
userInfo
.
setPhoneNumber
(
user
.
getPhoneNumber
());
});
if
(!
hit
.
get
())
{
return
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment