Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
1030299c
Commit
1030299c
authored
2 years ago
by
龙于生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增资讯已阅、评论意见反馈接口
parent
2171f0dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
0 deletions
+139
-0
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
+83
-0
src/main/java/cn/timer/api/dto/qyxx/CmsContentReadDto.java
+56
-0
No files found.
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
View file @
1030299c
...
...
@@ -7,7 +7,9 @@ import java.util.Timer;
import
java.util.TimerTask
;
import
cn.timer.api.bean.qyxx.*
;
import
cn.timer.api.dto.qyxx.CmsContentReadDto
;
import
cn.timer.api.utils.redis.RedisUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -50,6 +52,7 @@ import javax.annotation.Resource;
@Api
(
tags
=
"5.0企业讯息"
)
@Transactional
@RequestMapping
(
value
=
"/qyxx"
,
produces
=
{
"application/json"
})
@Slf4j
public
class
CmsController
{
@Autowired
...
...
@@ -591,4 +594,84 @@ public class CmsController {
return
ResultUtil
.
success
(
"设置失败"
);
}
/**
* 查询传阅列表
* @return
*/
@PostMapping
(
value
=
"/getCmsContentReads"
)
@ApiOperation
(
value
=
"查询传阅列表"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getCmsContentReads
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CmsContentReadDto
cmsContentReadDto
)
{
Page
<
CmsContentRead
>
page
=
new
Page
<
CmsContentRead
>(
cmsContentReadDto
.
getCurrentPage
(),
cmsContentReadDto
.
getTotalPage
());
//查询传阅列表
IPage
<
CmsContentRead
>
cmsContentReads
=
CmsContentRead
.
builder
().
build
()
.
selectPage
(
page
,
new
QueryWrapper
<
CmsContentRead
>()
.
lambda
().
eq
(
CmsContentRead:
:
getCmsContentId
,
cmsContentReadDto
.
getCmsContentId
())
.
eq
(
CmsContentRead:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
CmsContentRead:
:
getUserId
,
userBean
.
getEmpNum
())
.
orderByDesc
(
CmsContentRead:
:
getReviewTime
));
return
ResultUtil
.
data
(
cmsContentReads
);
}
/**
* 标记已阅
*/
@GetMapping
(
value
=
"/haveRead/{id}"
)
@ApiOperation
(
value
=
"标记已阅"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
haveRead
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
//用户id查询传阅消息
CmsContentRead
cmsContentRead
=
CmsContentRead
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
CmsContentRead
>().
lambda
()
.
eq
(
CmsContentRead:
:
getUserId
,
userBean
.
getEmpNum
())
.
eq
(
CmsContentRead:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
CmsContentRead:
:
getCmsContentId
,
id
));
if
(
cmsContentRead
==
null
){
cmsContentRead
=
new
CmsContentRead
();
cmsContentRead
.
setUserId
(
userBean
.
getEmpNum
());
cmsContentRead
.
setUserName
(
userBean
.
getUserInfo
().
getName
());
cmsContentRead
.
setOrgCode
(
userBean
.
getOrgCode
());
cmsContentRead
.
setCmsContentId
(
id
);
}
else
{
//已阅 直接返回
if
(
cmsContentRead
.
getReadStatus
()
==
1
){
return
ResultUtil
.
data
(
1
);
}
}
try
{
cmsContentRead
.
setReadStatus
(
1
);
cmsContentRead
.
setReviewTime
(
new
Date
());
cmsContentRead
.
insertOrUpdate
();
}
catch
(
Exception
e
){
log
.
error
(
"=============已阅操作失败, "
+
e
);
return
ResultUtil
.
error
(
e
);
}
return
ResultUtil
.
success
();
}
/**
* 根据讯息id查传阅列表
* @return
*/
@PostMapping
(
value
=
"/comment"
)
@ApiOperation
(
value
=
"评论意见反馈"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
comment
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CmsContentReadDto
cmsContentReadDto
)
{
//用户id查询传阅消息
CmsContentRead
cmsContentRead
=
CmsContentRead
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
CmsContentRead
>().
lambda
()
.
eq
(
CmsContentRead:
:
getUserId
,
userBean
.
getEmpNum
())
.
eq
(
CmsContentRead:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
CmsContentRead:
:
getCmsContentId
,
cmsContentReadDto
.
getCmsContentId
()));
try
{
cmsContentRead
.
setReviewContent
(
cmsContentReadDto
.
getReviewContent
());
cmsContentRead
.
insertOrUpdate
();
}
catch
(
Exception
e
){
log
.
error
(
"=============评论失败, "
+
e
);
return
ResultUtil
.
error
(
e
);
}
return
ResultUtil
.
success
();
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dto/qyxx/CmsContentReadDto.java
0 → 100644
View file @
1030299c
package
cn
.
timer
.
api
.
dto
.
qyxx
;
import
cn.timer.api.utils.Page
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
CmsContentReadDto
extends
Page
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"企业讯息主表ID"
,
example
=
"101"
)
private
Integer
cmsContentId
;
@ApiModelProperty
(
value
=
"留言/意见反馈"
,
example
=
""
)
private
String
reviewContent
;
@ApiModelProperty
(
value
=
"留言/意见反馈时间"
,
example
=
""
)
private
Date
reviewTime
;
@ApiModelProperty
(
value
=
"组织机构代码"
,
example
=
"1"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"用户ID"
,
example
=
"1"
)
private
Integer
userId
;
@ApiModelProperty
(
value
=
"用户姓名"
,
example
=
"张三"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"阅读标记0.未读 1.已读"
,
example
=
"0"
)
private
Integer
readStatus
;
@ApiModelProperty
(
value
=
"逻辑删除标记0.未删除 1.删除"
,
example
=
"0"
)
private
Integer
deleteFlag
;
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
""
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"更新时间"
,
example
=
""
)
private
Date
updateTime
;
}
This diff is collapsed.
Click to expand it.
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