Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
f79ce678
Commit
f79ce678
authored
Aug 09, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步专栏userId
parent
68be1bfc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
13 deletions
+66
-13
SynchroThemeReq.java
.../tanpu/community/api/beans/req/theme/SynchroThemeReq.java
+32
-0
NewsFeedSave4NewCommReq.java
.../api/beans/vo/feign/newsfeed/NewsFeedSave4NewCommReq.java
+3
-0
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+2
-4
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+15
-7
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+14
-2
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/SynchroThemeReq.java
0 → 100644
View file @
f79ce678
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/**
* 专栏同步到圈子
*/
@Data
public
class
SynchroThemeReq
{
@NotNull
(
message
=
"类型不能为空"
)
@ApiModelProperty
(
value
=
"类型 1:讨论无标题 2:长文有标题"
)
private
Integer
themeType
;
@ApiModelProperty
(
value
=
"专栏id"
)
private
String
themeId
=
""
;
@NotEmpty
(
message
=
"内容不能为空"
)
@ApiModelProperty
(
value
=
"文本内容"
)
private
List
<
ThemeContentReq
>
content
;
public
String
userId
=
""
;
}
community-api/src/main/java/com/tanpu/community/api/beans/vo/feign/newsfeed/NewsFeedSave4NewCommReq.java
View file @
f79ce678
...
...
@@ -23,4 +23,7 @@ public class NewsFeedSave4NewCommReq {
@ApiModelProperty
(
"关联多个内容"
)
private
List
<
NewsFeedResReq
>
newsFeedResList
;
@ApiModelProperty
(
"用户id"
)
public
String
userId
=
""
;
}
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
f79ce678
...
...
@@ -113,13 +113,11 @@ public class ThemeController {
return
CommonResp
.
success
(
themeManager
.
getFollowUpdateCount
(
userId
));
}
@AuthLogin
@ApiOperation
(
"专栏同步主题"
)
@PostMapping
(
value
=
"/convertFromNewsFeed"
)
@ResponseBody
public
CommonResp
<
Void
>
convertFromNewsFeed
(
@Validated
@RequestBody
CreateThemeReq
req
)
{
String
userId
=
userHolder
.
getUserId
();
themeManager
.
convertFromNewsFeed
(
req
,
userId
);
public
CommonResp
<
Void
>
convertFromNewsFeed
(
@Validated
@RequestBody
SynchroThemeReq
req
)
{
themeManager
.
convertFromNewsFeed
(
req
);
return
CommonResp
.
success
();
}
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
f79ce678
...
...
@@ -21,6 +21,7 @@ import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import
com.tanpu.community.api.beans.req.theme.ForwardThemeReq
;
import
com.tanpu.community.api.beans.req.theme.LikeThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ReportThemeReq
;
import
com.tanpu.community.api.beans.req.theme.SynchroThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeListReq
;
import
com.tanpu.community.api.beans.resp.CreateThemeResp
;
...
...
@@ -238,13 +239,14 @@ public class ThemeManager {
// 只有讨论类型才能同步专栏
throw
new
BizException
(
"长文类型无法同步专栏"
);
}
NewsFeedSave4NewCommReq
convertReq
=
new
NewsFeedSave4NewCommReq
();
convertReq
.
setNewsFeedId
(
themeId
);
NewsFeedSave4NewCommReq
newsFeedReq
=
new
NewsFeedSave4NewCommReq
();
newsFeedReq
.
setNewsFeedId
(
themeId
);
newsFeedReq
.
setUserId
(
userId
);
ArrayList
<
NewsFeedResReq
>
feedList
=
new
ArrayList
<>();
for
(
ThemeContentReq
themeContentReq
:
req
.
getContent
())
{
// 文字内容添加到content
if
(
RelTypeEnum
.
TEXT
.
type
.
equals
(
themeContentReq
.
getType
()))
{
convert
Req
.
setContent
(
themeContentReq
.
getValue
());
newsFeed
Req
.
setContent
(
themeContentReq
.
getValue
());
}
else
if
(
RelTypeEnum
.
MULTIPLE_IMAGE
.
type
.
equals
(
themeContentReq
.
getType
()))
{
List
<
ImagesDTO
>
imgList
=
themeContentReq
.
getImgList
();
...
...
@@ -260,8 +262,8 @@ public class ThemeManager {
.
build
());
}
}
convert
Req
.
setNewsFeedResList
(
feedList
);
CommonResp
restResponse
=
feignClientForCommunity
.
saveNewsFeed4NewComm
(
convert
Req
);
newsFeed
Req
.
setNewsFeedResList
(
feedList
);
CommonResp
restResponse
=
feignClientForCommunity
.
saveNewsFeed4NewComm
(
newsFeed
Req
);
if
(
restResponse
.
isNotSuccess
()
||
!
ObjectUtils
.
anyNotNull
(
restResponse
.
getData
()))
{
throw
new
BizException
(
"同步圈子调用失败"
);
...
...
@@ -679,7 +681,13 @@ public class ThemeManager {
}
// 从专栏同步
public
void
convertFromNewsFeed
(
CreateThemeReq
req
,
String
userId
)
{
public
void
convertFromNewsFeed
(
SynchroThemeReq
req2
)
{
String
userId
=
req2
.
getUserId
();
CreateThemeReq
req
=
new
CreateThemeReq
();
BeanUtils
.
copyProperties
(
req2
,
req
);
req
.
setTopicId
(
""
);
req
.
setTitle
(
""
);
// 校验参数
checkAttachment
(
req
.
getContent
());
// 转播权限校验
...
...
@@ -690,7 +698,7 @@ public class ThemeManager {
BeanUtils
.
copyProperties
(
req
,
themeEntity
);
themeEntity
.
setAuthorId
(
userId
);
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
themeEntity
.
setThemeId
(
CommunityConstant
.
THEME_PREFIX
+
req
.
getEdi
tThemeId
());
themeEntity
.
setThemeId
(
CommunityConstant
.
THEME_PREFIX
+
req
2
.
ge
tThemeId
());
themeService
.
insertTheme
(
themeEntity
);
// 保存附件表
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
f79ce678
...
...
@@ -4,7 +4,14 @@ import com.fasterxml.jackson.core.type.TypeReference;
import
com.tanpu.biz.common.enums.RelTypeEnum
;
import
com.tanpu.biz.common.enums.community.TopicStatusEnum
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.qo.CommentQo
;
import
com.tanpu.community.api.beans.qo.ESThemeQo
;
import
com.tanpu.community.api.beans.qo.FollowQo
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeAnalysDO
;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.resp.FileUploadResp
;
...
...
@@ -12,7 +19,12 @@ import com.tanpu.community.api.beans.vo.ImagesDTO;
import
com.tanpu.community.api.beans.vo.KafkaDurationUptMsg
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.dao.entity.community.*
;
import
com.tanpu.community.dao.entity.community.CommentEntity
;
import
com.tanpu.community.dao.entity.community.FileRecordEntity
;
import
com.tanpu.community.dao.entity.community.ThemeAttachmentEntity
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.VisitLogEntity
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.StringUtils
;
...
...
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