Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-cloud-platform
Project
Project
Details
Activity
Releases
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
周健威
rs-cloud-platform
Commits
7a4d4c0e
Commit
7a4d4c0e
authored
Dec 29, 2020
by
unset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加通知信息
parent
e53f8b90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
3 deletions
+93
-3
NoticeInfoDto.java
...ava/com/upyuns/platform/rs/website/dto/NoticeInfoDto.java
+2
-0
NoticeInfoBiz.java
...ava/com/upyuns/platform/rs/website/biz/NoticeInfoBiz.java
+69
-0
NoticeInfoWebController.java
...rm/rs/website/controller/web/NoticeInfoWebController.java
+22
-3
No files found.
rs-website/rs-website-api/src/main/java/com/upyuns/platform/rs/website/dto/NoticeInfoDto.java
View file @
7a4d4c0e
...
...
@@ -16,4 +16,6 @@ public class NoticeInfoDto extends PageParam {
Integer
read
;
String
ids
;
}
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/biz/NoticeInfoBiz.java
View file @
7a4d4c0e
...
...
@@ -2,8 +2,10 @@ package com.upyuns.platform.rs.website.biz;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.upyuns.platform.rs.website.dto.NoticeInfoDto
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
com.upyuns.platform.rs.website.entity.NoticeInfo
;
...
...
@@ -12,6 +14,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
...
...
@@ -47,4 +50,70 @@ public class NoticeInfoBiz extends BaseBiz<NoticeInfoMapper,NoticeInfo> {
return
ObjectRestResponse
.
succ
(
pageDataVO
);
}
public
ObjectRestResponse
deleteOne
(
Integer
id
)
{
if
(
id
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
NoticeInfo
noticeInfo
=
selectById
(
id
);
if
(
noticeInfo
==
null
||
noticeInfo
.
getIsDel
()
==
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
NOTEXIST_CODE
));
}
noticeInfo
.
setIsDel
(
1
);
updateSelectiveByIdRe
(
noticeInfo
);
return
ObjectRestResponse
.
succ
();
}
/**
* 设置为已读
* @param id
* @return
*/
public
ObjectRestResponse
updateRead
(
Integer
id
)
{
if
(
id
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
NoticeInfo
noticeInfo
=
selectById
(
id
);
if
(
noticeInfo
==
null
||
noticeInfo
.
getIsDel
()
==
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
NOTEXIST_CODE
));
}
noticeInfo
.
setIsRead
(
2
);
updateSelectiveByIdRe
(
noticeInfo
);
return
ObjectRestResponse
.
succ
();
}
/**
* 设置为已读
* @param ids
* @return
*/
public
ObjectRestResponse
updateAllRead
(
String
ids
)
{
if
(
StringUtils
.
isBlank
(
ids
))
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
String
[]
arr
=
ids
.
split
(
","
);
if
(
arr
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
for
(
String
id
:
arr
)
{
updateRead
(
Integer
.
parseInt
(
id
));
}
return
ObjectRestResponse
.
succ
();
}
public
ObjectRestResponse
updateAll
(
NoticeInfoDto
noticeInfoDto
)
{
Example
example
=
new
Example
(
NoticeInfo
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isRead"
,
1
);
criteria
.
andEqualTo
(
"userId"
,
noticeInfoDto
.
getUserId
());
List
<
NoticeInfo
>
list
=
mapper
.
selectByExample
(
example
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
list
.
parallelStream
().
forEach
(
noticeInfo
->
{
noticeInfo
.
setIsRead
(
2
);
updateSelectiveByIdRe
(
noticeInfo
);
});
}
return
ObjectRestResponse
.
succ
();
}
}
\ No newline at end of file
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/controller/web/NoticeInfoWebController.java
View file @
7a4d4c0e
...
...
@@ -8,9 +8,7 @@ import com.upyuns.platform.rs.website.biz.NoticeInfoBiz;
import
com.upyuns.platform.rs.website.dto.NoticeInfoDto
;
import
com.upyuns.platform.rs.website.entity.NoticeInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"noticeInfo/web"
)
...
...
@@ -29,4 +27,25 @@ public class NoticeInfoWebController extends BaseController<NoticeInfoBiz,Notice
noticeInfoDto
.
setUserId
(
Integer
.
parseInt
(
getCurrentUserId
()));
return
baseBiz
.
getByUserId
(
noticeInfoDto
);
}
@DeleteMapping
(
value
=
"deleteOne"
)
public
ObjectRestResponse
deleteOne
(
Integer
id
)
{
return
baseBiz
.
deleteOne
(
id
);
}
@PostMapping
(
value
=
"updateRead"
)
public
ObjectRestResponse
updateRead
(
NoticeInfo
noticeInfo
)
{
return
baseBiz
.
updateRead
(
noticeInfo
.
getId
());
}
@PostMapping
(
value
=
"updateAllRead"
)
public
ObjectRestResponse
updateAllRead
(
@RequestBody
NoticeInfoDto
noticeInfoDto
)
{
return
baseBiz
.
updateAllRead
(
noticeInfoDto
.
getIds
());
}
@PostMapping
(
value
=
"updateAll"
)
public
ObjectRestResponse
updateAll
(
@RequestBody
NoticeInfoDto
noticeInfoDto
)
{
noticeInfoDto
.
setUserId
(
Integer
.
parseInt
(
getCurrentUserId
()));
return
baseBiz
.
updateAll
(
noticeInfoDto
);
}
}
\ No newline at end of file
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