Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
e9376a7b
Commit
e9376a7b
authored
Sep 20, 2023
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 知识库-添加评论
parent
ebb95b60
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
6 deletions
+80
-6
HaobanClerkTypeEnum.java
.../com/gic/haoban/manage/api/enums/HaobanClerkTypeEnum.java
+6
-4
CommentController.java
...oban/manage/web/controller/content/CommentController.java
+70
-2
SaveCommentQO.java
...c/haoban/manage/web/qo/content/comment/SaveCommentQO.java
+4
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/HaobanClerkTypeEnum.java
View file @
e9376a7b
...
@@ -9,20 +9,22 @@ package com.gic.haoban.manage.api.enums;
...
@@ -9,20 +9,22 @@ package com.gic.haoban.manage.api.enums;
**/
**/
public
enum
HaobanClerkTypeEnum
{
public
enum
HaobanClerkTypeEnum
{
;
CLERK
(
0
,
"导购/店员"
),
STORE_MANAGER
(
1
,
"店长"
),
AREA_MANAGER
(
2
,
"区经"
);
HaobanClerkTypeEnum
(
Integer
type
,
String
desc
){
HaobanClerkTypeEnum
(
Integer
type
,
String
desc
){
this
.
code
=
type
;
this
.
code
=
type
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
}
}
private
int
code
;
private
Integer
code
;
private
String
desc
;
private
String
desc
;
public
int
getCode
()
{
public
Integer
getCode
()
{
return
code
;
return
code
;
}
}
public
void
setCode
(
int
code
)
{
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/CommentController.java
View file @
e9376a7b
...
@@ -2,17 +2,34 @@ package com.gic.haoban.manage.web.controller.content;
...
@@ -2,17 +2,34 @@ package com.gic.haoban.manage.web.controller.content;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.content.api.dto.comment.ListCommentDTO
;
import
com.gic.content.api.dto.comment.ListSonCommentDTO
;
import
com.gic.content.api.enums.UserTypeEnum
;
import
com.gic.content.api.qdto.comment.ListMobileCommentQDTO
;
import
com.gic.content.api.qdto.comment.ListMobileCommentQDTO
;
import
com.gic.content.api.qdto.comment.SaveCommentQDTO
;
import
com.gic.content.api.service.ContentMaterialCommentApiService
;
import
com.gic.content.api.service.ContentMaterialCommentApiService
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.enums.HaobanClerkTypeEnum
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.web.qo.content.comment.CommentCountQO
;
import
com.gic.haoban.manage.web.qo.content.comment.CommentCountQO
;
import
com.gic.haoban.manage.web.qo.content.comment.CommentInfoVO
;
import
com.gic.haoban.manage.web.qo.content.comment.CommentInfoVO
;
import
com.gic.haoban.manage.web.qo.content.comment.SaveCommentQO
;
import
com.gic.haoban.manage.web.qo.content.comment.SaveCommentQO
;
import
com.gic.haoban.manage.web.qo.content.comment.SonCommentInfoVO
;
import
com.gic.haoban.manage.web.qo.content.comment.SonCommentInfoVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
* 知识库-评论
* 知识库-评论
* @Author MUSI
* @Author MUSI
...
@@ -27,6 +44,9 @@ public class CommentController {
...
@@ -27,6 +44,9 @@ public class CommentController {
@Autowired
@Autowired
private
ContentMaterialCommentApiService
contentMaterialCommentApiService
;
private
ContentMaterialCommentApiService
contentMaterialCommentApiService
;
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
/**
/**
* 评论总数(包含子评论)
* 评论总数(包含子评论)
* @return
* @return
...
@@ -37,6 +57,7 @@ public class CommentController {
...
@@ -37,6 +57,7 @@ public class CommentController {
ListMobileCommentQDTO
mobileCommentQDTO
=
new
ListMobileCommentQDTO
();
ListMobileCommentQDTO
mobileCommentQDTO
=
new
ListMobileCommentQDTO
();
mobileCommentQDTO
.
setEnterpriseId
(
commentCountQO
.
getEnterpriseId
());
mobileCommentQDTO
.
setEnterpriseId
(
commentCountQO
.
getEnterpriseId
());
mobileCommentQDTO
.
setContentMaterialCommentId
(
commentCountQO
.
getContentMaterialId
());
mobileCommentQDTO
.
setContentMaterialCommentId
(
commentCountQO
.
getContentMaterialId
());
mobileCommentQDTO
.
setMemberId
(
commentCountQO
.
getClerkId
());
mobileCommentQDTO
.
setMaterialPurpose
(
3
);
mobileCommentQDTO
.
setMaterialPurpose
(
3
);
ServiceResponse
<
Integer
>
serviceResponse
=
contentMaterialCommentApiService
.
countCommentForWechat
(
mobileCommentQDTO
);
ServiceResponse
<
Integer
>
serviceResponse
=
contentMaterialCommentApiService
.
countCommentForWechat
(
mobileCommentQDTO
);
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
...
@@ -49,6 +70,13 @@ public class CommentController {
...
@@ -49,6 +70,13 @@ public class CommentController {
*/
*/
@RequestMapping
(
path
=
"/list-comment"
)
@RequestMapping
(
path
=
"/list-comment"
)
public
RestResponse
<
Page
<
CommentInfoVO
>>
listCommentInfoVo
(
CommentCountQO
commentCountQO
)
{
public
RestResponse
<
Page
<
CommentInfoVO
>>
listCommentInfoVo
(
CommentCountQO
commentCountQO
)
{
ListMobileCommentQDTO
mobileCommentQDTO
=
new
ListMobileCommentQDTO
();
mobileCommentQDTO
.
setEnterpriseId
(
commentCountQO
.
getEnterpriseId
());
mobileCommentQDTO
.
setContentMaterialCommentId
(
commentCountQO
.
getContentMaterialId
());
mobileCommentQDTO
.
setMemberId
(
commentCountQO
.
getClerkId
());
mobileCommentQDTO
.
setMaterialPurpose
(
3
);
ServiceResponse
<
Page
<
ListCommentDTO
>>
serviceResponse
=
contentMaterialCommentApiService
.
listComment
(
mobileCommentQDTO
);
return
RestResponse
.
successResult
();
return
RestResponse
.
successResult
();
}
}
...
@@ -67,7 +95,47 @@ public class CommentController {
...
@@ -67,7 +95,47 @@ public class CommentController {
* @return
* @return
*/
*/
@RequestMapping
(
path
=
"/save-comment"
)
@RequestMapping
(
path
=
"/save-comment"
)
public
RestResponse
<?>
saveComment
(
SaveCommentQO
saveCommentQO
)
{
public
RestResponse
<
SonCommentInfoVO
>
saveComment
(
SaveCommentQO
saveCommentQO
)
{
return
RestResponse
.
successResult
();
SaveCommentQDTO
saveCommentQDTO
=
EntityUtil
.
changeEntityByJSON
(
SaveCommentQDTO
.
class
,
saveCommentQO
);
saveCommentQDTO
.
setMemberId
(
saveCommentQO
.
getClerkId
());
saveCommentQDTO
.
setReplyMemberId
(
saveCommentQO
.
getReplyClerkId
());
List
<
String
>
clerkIds
=
new
ArrayList
<>();
clerkIds
.
add
(
saveCommentQO
.
getClerkId
());
if
(
StringUtils
.
isNotBlank
(
saveCommentQO
.
getReplyClerkId
()))
{
clerkIds
.
add
(
saveCommentQO
.
getReplyClerkId
());
}
Map
<
String
,
StaffClerkRelationDTO
>
clerkInfoMap
=
this
.
getClerkInfoMap
(
saveCommentQO
.
getWxEnterpriseId
(),
clerkIds
);
StaffClerkRelationDTO
staffClerkRelationDTO
=
clerkInfoMap
.
get
(
saveCommentQO
.
getClerkId
());
if
(
staffClerkRelationDTO
!=
null
)
{
saveCommentQDTO
.
setUserCode
(
staffClerkRelationDTO
.
getClerkCode
());
if
(
HaobanClerkTypeEnum
.
AREA_MANAGER
.
getCode
().
equals
(
staffClerkRelationDTO
.
getClerkType
()))
{
saveCommentQDTO
.
setUserType
(
UserTypeEnum
.
AREA_MANAGER
.
value
);
}
else
{
saveCommentQDTO
.
setUserType
(
UserTypeEnum
.
CLERK
.
value
);
}
}
staffClerkRelationDTO
=
clerkInfoMap
.
get
(
saveCommentQO
.
getReplyClerkId
());
if
(
staffClerkRelationDTO
!=
null
)
{
saveCommentQDTO
.
setReplyUserCode
(
staffClerkRelationDTO
.
getClerkCode
());
if
(
HaobanClerkTypeEnum
.
AREA_MANAGER
.
getCode
().
equals
(
staffClerkRelationDTO
.
getClerkType
()))
{
saveCommentQDTO
.
setReplyUserType
(
UserTypeEnum
.
AREA_MANAGER
.
value
);
}
else
{
saveCommentQDTO
.
setReplyUserType
(
UserTypeEnum
.
CLERK
.
value
);
}
}
ServiceResponse
<
ListSonCommentDTO
>
serviceResponse
=
contentMaterialCommentApiService
.
saveComment
(
saveCommentQDTO
);
SonCommentInfoVO
sonCommentInfoVO
=
EntityUtil
.
changeEntityByJSON
(
SonCommentInfoVO
.
class
,
serviceResponse
.
getResult
());
return
RestResponse
.
successResult
(
sonCommentInfoVO
);
}
public
Map
<
String
,
StaffClerkRelationDTO
>
getClerkInfoMap
(
String
wxEnterpriseId
,
List
<
String
>
clerkIds
)
{
List
<
StaffClerkRelationDTO
>
staffClerkRelations
=
staffClerkRelationApiService
.
listByClerkIdsWxEnterpriseId
(
clerkIds
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelations
))
{
return
Collections
.
emptyMap
();
}
return
staffClerkRelations
.
stream
()
.
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
}
}
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/content/comment/SaveCommentQO.java
View file @
e9376a7b
...
@@ -16,6 +16,10 @@ public class SaveCommentQO implements Serializable {
...
@@ -16,6 +16,10 @@ public class SaveCommentQO implements Serializable {
private
static
final
long
serialVersionUID
=
-
1584226631161349430L
;
private
static
final
long
serialVersionUID
=
-
1584226631161349430L
;
/**
* 微信信息
*/
private
String
wxEnterpriseId
;
/**
/**
* 父级素材评论id
* 父级素材评论id
...
...
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