Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jgjy
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
jgjy
Commits
cca4a58e
提交
cca4a58e
authored
5月 16, 2019
作者:
lvwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
47492dec
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
12 行删除
+44
-12
org.eclipse.core.resources.prefs
...qx.fg.resource/.settings/org.eclipse.core.resources.prefs
+1
-0
CommentController.java
...va/com/zrqx/fg/resource/controller/CommentController.java
+2
-2
CommentService.java
...ain/java/com/zrqx/fg/resource/service/CommentService.java
+2
-1
CommentServiceImpl.java
...com/zrqx/fg/resource/service/impl/CommentServiceImpl.java
+39
-9
没有找到文件。
com.zrqx.fg.resource/.settings/org.eclipse.core.resources.prefs
浏览文件 @
cca4a58e
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/java/com/zrqx/fg/resource/controller/ResourceController.java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
...
...
com.zrqx.fg.resource/src/main/java/com/zrqx/fg/resource/controller/CommentController.java
浏览文件 @
cca4a58e
...
...
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -19,6 +18,7 @@ import com.zrqx.core.util.page.PageInfo;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
import
com.zrqx.core.vo.resource.fg.comment.FgCommentVo
;
import
com.zrqx.core.vo.resource.fg.comment.FgUserCommentVo
;
import
com.zrqx.fg.resource.service.CommentService
;
@RestController
...
...
@@ -43,7 +43,7 @@ public class CommentController {
@ApiOperation
(
"查看评论(根据当前登录用户会员id)"
)
@GetMapping
(
ResourceRequestPath
.
PAGE
+
ResourceRequestPath
.
COMMENT
)
public
CallBack
<
PageInfo
<
FgCommentVo
>>
pageComment
(
PageParam
pageParam
)
{
public
CallBack
<
PageInfo
<
Fg
User
CommentVo
>>
pageComment
(
PageParam
pageParam
)
{
return
CallBack
.
success
(
commentService
.
pageComment
(
pageParam
));
}
...
...
com.zrqx.fg.resource/src/main/java/com/zrqx/fg/resource/service/CommentService.java
浏览文件 @
cca4a58e
...
...
@@ -6,6 +6,7 @@ import com.zrqx.core.service.BaseService;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.vo.resource.fg.comment.FgCommentVo
;
import
com.zrqx.core.vo.resource.fg.comment.FgUserCommentVo
;
public
interface
CommentService
extends
BaseService
<
Comment
,
Integer
>
{
...
...
@@ -34,7 +35,7 @@ public interface CommentService extends BaseService<Comment, Integer> {
* @author lw
* @date: 2019年4月20日 上午10:41:30
*/
PageInfo
<
FgCommentVo
>
pageComment
(
PageParam
pageParam
);
PageInfo
<
Fg
User
CommentVo
>
pageComment
(
PageParam
pageParam
);
/**
* 删除评论
...
...
com.zrqx.fg.resource/src/main/java/com/zrqx/fg/resource/service/impl/CommentServiceImpl.java
浏览文件 @
cca4a58e
...
...
@@ -4,12 +4,20 @@ import java.util.Date;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zrqx.core.commons.redis.Redis
;
import
com.zrqx.core.enums.resource.comment.CommentStatusEnum
;
import
com.zrqx.core.exception.BusinessValidateException
;
...
...
@@ -18,13 +26,17 @@ import com.zrqx.core.mapper.BaseMapper;
import
com.zrqx.core.model.member.member.Member
;
import
com.zrqx.core.model.resource.comment.Comment
;
import
com.zrqx.core.model.resource.comment.Reply
;
import
com.zrqx.core.model.resource.goods.eleresource.EleResource
;
import
com.zrqx.core.model.resource.goods.phyresource.PhyResource
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.vo.resource.fg.comment.FgCommentVo
;
import
com.zrqx.core.vo.resource.fg.
goods.FgResource
Vo
;
import
com.zrqx.core.vo.resource.fg.
comment.FgUserComment
Vo
;
import
com.zrqx.fg.resource.mapper.comment.CommentMapper
;
import
com.zrqx.fg.resource.mapper.comment.ReplyMapper
;
import
com.zrqx.fg.resource.mapper.goods.ele.EleResourceMapper
;
import
com.zrqx.fg.resource.mapper.goods.phy.PhyResourceMapper
;
import
com.zrqx.fg.resource.service.CommentService
;
@Service
...
...
@@ -37,6 +49,10 @@ public class CommentServiceImpl extends BaseServiceImpl<Comment, Integer> implem
@Autowired
ReplyMapper
replyMapper
;
@Autowired
EleResourceMapper
eleResourceMapper
;
@Autowired
PhyResourceMapper
phyResourceMapper
;
@Autowired
Redis
redis
;
@Override
...
...
@@ -79,6 +95,7 @@ public class CommentServiceImpl extends BaseServiceImpl<Comment, Integer> implem
Comment
comment
=
new
Comment
();
comment
.
setComment
(
form
.
getComment
());
comment
.
setResourceId
(
form
.
getResourceId
());
comment
.
setResourceType
(
form
.
getResourceType
());
comment
.
setCreateTime
(
new
Date
());
comment
.
setCreater
(
String
.
valueOf
(
redis
.
getMember
().
getId
()));
comment
.
setCreaterName
(
redis
.
getMember
().
getName
());
...
...
@@ -87,7 +104,7 @@ public class CommentServiceImpl extends BaseServiceImpl<Comment, Integer> implem
}
@Override
public
PageInfo
<
FgCommentVo
>
pageComment
(
PageParam
pageParam
)
{
public
PageInfo
<
Fg
User
CommentVo
>
pageComment
(
PageParam
pageParam
)
{
Member
member
=
redis
.
getMember
();
if
(
member
==
null
||
member
.
getId
()
==
null
)
throw
new
BusinessValidateException
(
"请重新登录"
);
if
(
pageParam
==
null
)
pageParam
.
setOrderBy
(
" createTime desc "
);
...
...
@@ -95,21 +112,34 @@ public class CommentServiceImpl extends BaseServiceImpl<Comment, Integer> implem
Comment
commentRecord
=
new
Comment
();
commentRecord
.
setCreater
(
String
.
valueOf
(
member
.
getId
()));
List
<
Comment
>
comments
=
commentMapper
.
select
(
commentRecord
);
List
<
Fg
CommentVo
>
fg
CommentVos
=
comments
.
stream
().
map
(
comment
->
{
List
<
Fg
UserCommentVo
>
fgUser
CommentVos
=
comments
.
stream
().
map
(
comment
->
{
Reply
replyRecord
=
new
Reply
();
replyRecord
.
setCommentId
(
comment
.
getId
());
Reply
reply
=
replyMapper
.
selectOne
(
replyRecord
);
FgCommentVo
fgCommentVo
=
new
FgCommentVo
();
FgUserCommentVo
fgUserCommentVo
=
new
FgUserCommentVo
();
String
resourceType
=
comment
.
getResourceType
();
if
(
resourceType
.
contains
(
"1-"
)){
PhyResource
phyResource
=
phyResourceMapper
.
selectByPrimaryKey
(
comment
.
getResourceId
());
fgUserCommentVo
.
setResourceCover
(
phyResource
.
getCover
());
fgUserCommentVo
.
setResourceId
(
phyResource
.
getId
());
fgUserCommentVo
.
setResourceName
(
phyResource
.
getName
());
}
else
{
EleResource
eleResource
=
eleResourceMapper
.
selectByPrimaryKey
(
comment
.
getResourceId
());
fgUserCommentVo
.
setResourceCover
(
eleResource
.
getCover
());
fgUserCommentVo
.
setResourceId
(
eleResource
.
getId
());
fgUserCommentVo
.
setResourceName
(
eleResource
.
getName
());
}
try
{
BeanUtils
.
copyProperties
(
fgCommentVo
,
comment
);
BeanUtils
.
copyProperties
(
fgCommentVo
,
reply
);
BeanUtils
.
copyProperties
(
fg
User
CommentVo
,
comment
);
BeanUtils
.
copyProperties
(
fg
User
CommentVo
,
reply
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"评论:"
+
comment
.
getId
()
+
"获取评论(根据用户)异常\n"
+
e
.
getMessage
());
}
fg
CommentVo
.
setStatusZh
(
CommentStatusEnum
.
getName
(
fg
CommentVo
.
getStatus
()));
return
fgCommentVo
;
fg
UserCommentVo
.
setStatusZh
(
CommentStatusEnum
.
getName
(
fgUser
CommentVo
.
getStatus
()));
return
fg
User
CommentVo
;
}).
collect
(
Collectors
.
toList
());
return
new
PageInfo
<
Fg
CommentVo
>(
fg
CommentVos
);
return
new
PageInfo
<
Fg
UserCommentVo
>(
fgUser
CommentVos
);
}
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论