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
83a22ac5
Commit
83a22ac5
authored
Jun 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞收藏相关
parent
c915b558
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
239 additions
and
4 deletions
+239
-4
ThemeDTO.java
...src/main/java/com/tanpu/community/api/beans/ThemeDTO.java
+176
-0
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+10
-4
ThemeConvert.java
.../com/tanpu/community/controller/convert/ThemeConvert.java
+49
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+4
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/ThemeDTO.java
View file @
83a22ac5
package
com
.
tanpu
.
community
.
api
.
beans
;
package
com
.
tanpu
.
community
.
api
.
beans
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.time.LocalDateTime
;
public
class
ThemeDTO
{
public
class
ThemeDTO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"id"
)
private
String
id
;
@ApiModelProperty
(
value
=
"标题"
)
private
String
title
;
@ApiModelProperty
(
value
=
"类型"
)
private
Integer
themeType
;
@ApiModelProperty
(
value
=
"文本内容"
)
private
String
content
;
@ApiModelProperty
(
value
=
"附件类型"
)
private
Integer
attachType
;
@ApiModelProperty
(
value
=
"附件内容"
)
private
String
attachment
;
@ApiModelProperty
(
value
=
"作者id"
)
private
String
authorId
;
@ApiModelProperty
(
value
=
"被转发的主题"
)
private
String
formerThemeId
;
@ApiModelProperty
(
value
=
"所属的话题"
)
private
String
topicId
;
private
String
createBy
;
private
LocalDateTime
createTime
;
private
String
updateBy
;
private
LocalDateTime
updateTime
;
private
Integer
deleteTag
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Integer
getThemeType
()
{
return
themeType
;
}
public
void
setThemeType
(
Integer
themeType
)
{
this
.
themeType
=
themeType
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
Integer
getAttachType
()
{
return
attachType
;
}
public
void
setAttachType
(
Integer
attachType
)
{
this
.
attachType
=
attachType
;
}
public
String
getAttachment
()
{
return
attachment
;
}
public
void
setAttachment
(
String
attachment
)
{
this
.
attachment
=
attachment
;
}
public
String
getAuthorId
()
{
return
authorId
;
}
public
void
setAuthorId
(
String
authorId
)
{
this
.
authorId
=
authorId
;
}
public
String
getFormerThemeId
()
{
return
formerThemeId
;
}
public
void
setFormerThemeId
(
String
formerThemeId
)
{
this
.
formerThemeId
=
formerThemeId
;
}
public
String
getTopicId
()
{
return
topicId
;
}
public
void
setTopicId
(
String
topicId
)
{
this
.
topicId
=
topicId
;
}
public
String
getCreateBy
()
{
return
createBy
;
}
public
void
setCreateBy
(
String
createBy
)
{
this
.
createBy
=
createBy
;
}
public
LocalDateTime
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
LocalDateTime
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getUpdateBy
()
{
return
updateBy
;
}
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
;
}
public
LocalDateTime
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
LocalDateTime
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getDeleteTag
()
{
return
deleteTag
;
}
public
void
setDeleteTag
(
Integer
deleteTag
)
{
this
.
deleteTag
=
deleteTag
;
}
@Override
public
String
toString
()
{
return
"ThemeEntity{"
+
"id="
+
id
+
", title="
+
title
+
", themeType="
+
themeType
+
", content="
+
content
+
", attachType="
+
attachType
+
", attachment="
+
attachment
+
", authorId="
+
authorId
+
", formerThemeId="
+
formerThemeId
+
", topicId="
+
topicId
+
", createBy="
+
createBy
+
", createTime="
+
createTime
+
", updateBy="
+
updateBy
+
", updateTime="
+
updateTime
+
", deleteTag="
+
deleteTag
+
"}"
;
}
}
}
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
83a22ac5
...
@@ -2,14 +2,17 @@ package com.tanpu.community.controller;
...
@@ -2,14 +2,17 @@ package com.tanpu.community.controller;
import
com.tanpu.community.api.beans.ThemeDTO
;
import
com.tanpu.community.api.beans.ThemeDTO
;
import
com.tanpu.community.
dao.entity.community.FansRelEntity
;
import
com.tanpu.community.
controller.convert.ThemeConvert
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.manager.ThemeManager
;
import
com.tanpu.community.manager.ThemeManager
;
import
com.tanpu.community.service.FansRelService
;
import
com.tanpu.community.service.FansRelService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,8 +30,11 @@ public class ThemeController {
...
@@ -27,8 +30,11 @@ public class ThemeController {
@ApiOperation
(
"新增主题"
)
@ApiOperation
(
"新增主题"
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@ResponseBody
@ResponseBody
public
void
insertTheme
(
@RequestBody
ThemeDTO
themeDTO
){
public
String
insertTheme
(
@RequestBody
ThemeDTO
themeDTO
){
String
userId
=
"liujm"
;
themeDTO
.
setAuthorId
(
userId
);
themeManager
.
insert
(
ThemeConvert
.
convertToEntity
(
themeDTO
));
return
"success"
;
}
}
@ApiOperation
(
"系统推荐主题列表"
)
@ApiOperation
(
"系统推荐主题列表"
)
...
...
community-service/src/main/java/com/tanpu/community/controller/convert/ThemeConvert.java
0 → 100644
View file @
83a22ac5
package
com
.
tanpu
.
community
.
controller
.
convert
;
import
com.tanpu.community.api.beans.ThemeDTO
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
ThemeConvert
{
public
static
ThemeDTO
convertToDTO
(
ThemeEntity
themeEntity
){
ThemeDTO
themeDTO
=
new
ThemeDTO
();
themeDTO
.
setId
(
themeEntity
.
getId
());
themeDTO
.
setContent
(
themeEntity
.
getContent
());
themeDTO
.
setThemeType
(
themeEntity
.
getThemeType
());
themeDTO
.
setAttachment
(
themeEntity
.
getAttachment
());
themeDTO
.
setAttachType
(
themeEntity
.
getAttachType
());
themeDTO
.
setFormerThemeId
(
themeEntity
.
getFormerThemeId
());
themeDTO
.
setAuthorId
(
themeEntity
.
getAuthorId
());
themeDTO
.
setCreateBy
(
themeEntity
.
getCreateBy
());
themeDTO
.
setUpdateBy
(
themeEntity
.
getUpdateBy
());
themeDTO
.
setCreateTime
(
themeEntity
.
getCreateTime
());
themeDTO
.
setUpdateBy
(
themeEntity
.
getUpdateBy
());
return
themeDTO
;
}
public
static
ThemeEntity
convertToEntity
(
ThemeDTO
themeDTO
){
ThemeEntity
themeEntity
=
new
ThemeEntity
();
themeEntity
.
setContent
(
themeDTO
.
getContent
());
themeEntity
.
setThemeType
(
themeDTO
.
getThemeType
());
themeEntity
.
setAttachment
(
themeDTO
.
getAttachment
());
themeEntity
.
setAttachType
(
themeDTO
.
getAttachType
());
themeEntity
.
setFormerThemeId
(
themeDTO
.
getFormerThemeId
());
themeEntity
.
setAuthorId
(
themeDTO
.
getAuthorId
());
themeEntity
.
setCreateBy
(
themeDTO
.
getCreateBy
());
themeEntity
.
setUpdateBy
(
themeDTO
.
getUpdateBy
());
themeEntity
.
setCreateTime
(
themeDTO
.
getCreateTime
());
themeEntity
.
setUpdateBy
(
themeDTO
.
getUpdateBy
());
return
themeEntity
;
}
public
static
List
<
ThemeDTO
>
convertToEntitys
(
List
<
ThemeEntity
>
topicEntities
){
return
topicEntities
.
stream
().
map
(
ThemeConvert:
:
convertToDTO
).
collect
(
Collectors
.
toList
());
}
public
static
List
<
ThemeDTO
>
convertToDTOs
(
List
<
ThemeEntity
>
topicEntities
){
return
topicEntities
.
stream
().
map
(
ThemeConvert:
:
convertToDTO
).
collect
(
Collectors
.
toList
());
}
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
83a22ac5
...
@@ -104,4 +104,8 @@ public class ThemeManager {
...
@@ -104,4 +104,8 @@ public class ThemeManager {
blackListEntity
.
setBlockedType
(
BlockTypeEnum
.
CONTENT
.
getCode
());
blackListEntity
.
setBlockedType
(
BlockTypeEnum
.
CONTENT
.
getCode
());
blackListService
.
insertBlackList
(
blackListEntity
);
blackListService
.
insertBlackList
(
blackListEntity
);
}
}
public
void
insert
(
ThemeEntity
themeEntity
)
{
themeService
.
insertTheme
(
themeEntity
);
}
}
}
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