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
fbb3bb27
Commit
fbb3bb27
authored
Jul 09, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题接口修改
parent
b4d12b79
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
11 deletions
+45
-11
CommunityConstant.java
.../com/tanpu/community/api/constants/CommunityConstant.java
+6
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+10
-5
OSSFileService.java
...main/java/com/tanpu/community/service/OSSFileService.java
+4
-0
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+24
-5
create.sql
docs/create.sql
+1
-1
No files found.
community-api/src/main/java/com/tanpu/community/api/constants/CommunityConstant.java
0 → 100644
View file @
fbb3bb27
package
com
.
tanpu
.
community
.
api
.
constants
;
public
class
CommunityConstant
{
public
static
final
String
OSS_PREFIX_URL
=
"https://tamp-sit.oss-cn-shanghai.aliyuncs.com"
;
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
fbb3bb27
...
...
@@ -14,11 +14,9 @@ import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO
;
import
com.tanpu.community.api.constants.CommunityConstant
;
import
com.tanpu.community.api.enums.*
;
import
com.tanpu.community.dao.entity.community.BlackListEntity
;
import
com.tanpu.community.dao.entity.community.HomePageEntity
;
import
com.tanpu.community.dao.entity.community.ThemeAttachmentEntity
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.entity.community.*
;
import
com.tanpu.community.feign.course.FeignClientForCourse
;
import
com.tanpu.community.feign.product.FeignClientForProducts
;
import
com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom
;
...
...
@@ -87,6 +85,8 @@ public class ThemeManager {
@Autowired
private
FeignClientForCourse
feignClientForCourse
;
private
OSSFileService
ossFileService
;
public
void
publishTheme
(
CreateThemeReq
req
,
String
userId
)
{
...
...
@@ -298,10 +298,15 @@ public class ThemeManager {
String
packageId
=
themeContentQo
.
getValue
();
CommonResp
<
CoursePackageDetail
>
courseIdDetailInfo
=
feignClientForCourse
.
getCoursePackageDetailInfo
(
packageId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
coursePackageDetail
(
courseIdDetailInfo
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
SINGLE_IMG
.
type
.
equals
(
type
))
{
//单图,根据id传入url
String
imgId
=
themeContentQo
.
getValue
();
FileRecordEntity
fileEntity
=
ossFileService
.
queryById
(
imgId
);
themeContentQo
.
setValue
(
CommunityConstant
.
OSS_PREFIX_URL
+
fileEntity
.
getFileOssKey
());
}
}
}
//计算迄今时间
...
...
community-service/src/main/java/com/tanpu/community/service/OSSFileService.java
View file @
fbb3bb27
...
...
@@ -79,4 +79,8 @@ public class OSSFileService {
return
record
;
}
public
FileRecordEntity
queryById
(
String
fileId
)
{
return
fileRecordMapper
.
selectById
(
fileId
);
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
fbb3bb27
...
...
@@ -2,6 +2,7 @@ package com.tanpu.community.util;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.ImagesDTO
;
import
com.tanpu.community.api.beans.TopicDO
;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
...
...
@@ -105,17 +106,35 @@ public class ConvertUtil {
}
}
/**
* 解析 List<ThemeContentReq>为Attachment列表
* @param req
* @param themeId
* @return
*/
public
static
List
<
ThemeAttachmentEntity
>
themeReqToAttachmentList
(
CreateThemeReq
req
,
String
themeId
)
{
List
<
ThemeContentReq
>
contents
=
req
.
getContent
();
List
<
ThemeAttachmentEntity
>
list
=
new
ArrayList
<>();
for
(
ThemeContentReq
content
:
contents
)
{
if
(!
RelTypeEnum
.
TEXT
.
type
.
equals
(
content
.
getType
())){
list
.
add
(
ThemeAttachmentEntity
.
builder
()
.
attachType
(
Integer
.
valueOf
(
content
.
getType
()))
.
attachId
(
content
.
getValue
())
.
themeId
(
themeId
)
.
build
());
//讨论-多图类型,拆开解析到attachment表中
if
((
content
.
getType
().
equals
(
RelTypeEnum
.
MULTIPLE_IMAGE
.
type
))){
List
<
ImagesDTO
>
imgList
=
content
.
getImgList
();
for
(
ImagesDTO
imagesDTO
:
imgList
)
{
list
.
add
(
ThemeAttachmentEntity
.
builder
()
.
attachType
(
Integer
.
valueOf
(
RelTypeEnum
.
SINGLE_IMG
.
type
))
.
attachId
(
imagesDTO
.
getRelId
())
.
themeId
(
themeId
)
.
build
());
}
}
else
{
list
.
add
(
ThemeAttachmentEntity
.
builder
()
.
attachType
(
Integer
.
valueOf
(
content
.
getType
()))
.
attachId
(
content
.
getValue
())
.
themeId
(
themeId
)
.
build
());
}
}
}
return
list
;
...
...
docs/create.sql
View file @
fbb3bb27
...
...
@@ -30,7 +30,7 @@ CREATE TABLE `follow_rel` (
CREATE
TABLE
`theme`
(
`id`
int
(
32
)
auto_increment
PRIMARY
KEY
COMMENT
'id'
,
`theme_id`
varchar
(
64
)
NOT
NULL
COMMENT
'UUID'
,
`title`
varchar
(
64
)
NOT
NULL
COMMENT
'标题'
,
`title`
varchar
(
64
)
COMMENT
'标题'
,
`theme_type`
int
(
4
)
NOT
NULL
COMMENT
'类型'
,
`content`
text
COMMENT
'文本内容'
,
`attach_type`
int
(
4
)
NOT
NULL
COMMENT
'附件类型'
,
...
...
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