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
0413dd68
Commit
0413dd68
authored
Jul 12, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品接口修改
parent
0bdbd00c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
592 additions
and
307 deletions
+592
-307
AttachmentDetailVo.java
.../com/tanpu/community/api/beans/qo/AttachmentDetailVo.java
+3
-3
ProductInfoVO.java
...com/tanpu/community/api/beans/vo/feign/ProductInfoVO.java
+5
-1
UserInfoVo.java
...va/com/tanpu/community/api/beans/vo/feign/UserInfoVo.java
+55
-0
FeignBackClientForCourse.java
...anpu/community/feign/course/FeignBackClientForCourse.java
+2
-2
FeignClientForFatools.java
.../tanpu/community/feign/fatools/FeignClientForFatools.java
+31
-0
FeignbackForFatools.java
...om/tanpu/community/feign/fatools/FeignbackForFatools.java
+40
-0
FeignForFund.java
.../java/com/tanpu/community/feign/product/FeignForFund.java
+28
-0
FeignForPublicFund.java
...com/tanpu/community/feign/product/FeignForPublicFund.java
+20
-0
FeignbackForFund.java
...a/com/tanpu/community/feign/product/FeignbackForFund.java
+36
-0
FeignbackForPublicFund.java
...tanpu/community/feign/product/FeignbackForPublicFund.java
+25
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+13
-77
ProductService.java
...main/java/com/tanpu/community/service/ProductService.java
+321
-221
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+13
-3
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/AttachmentDetailVo.java
View file @
0413dd68
...
@@ -18,10 +18,10 @@ public class AttachmentDetailVo {
...
@@ -18,10 +18,10 @@ public class AttachmentDetailVo {
@ApiModelProperty
(
"直播信息"
)
@ApiModelProperty
(
"直播信息"
)
private
ZhiboListResp
zhibo
;
private
ZhiboListResp
zhibo
;
@ApiModelProperty
(
"产品信息"
)
@ApiModelProperty
(
"产品信息"
)
private
ProductInfoVO
product
;
private
FundInfoBaseResp
product
;
@ApiModelProperty
(
"短视频"
)
@ApiModelProperty
(
"短视频"
)
private
ShortVideoBaseInfoResp
shortVideo
;
private
ShortVideoBaseInfoResp
shortVideo
;
@ApiModelProperty
(
"
新版
课程"
)
@ApiModelProperty
(
"课程"
)
private
CoursePackageDetail
course
;
private
ShortVideoBaseInfoResp
curriculum
;
}
}
community-api/src/main/java/com/tanpu/community/api/beans/vo/feign/ProductInfoVO.java
View file @
0413dd68
...
@@ -7,6 +7,10 @@ import lombok.Data;
...
@@ -7,6 +7,10 @@ import lombok.Data;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
/**
* @author: zhoupeng
* @email: zhoupeng_08@163.com
*/
@ApiModel
(
"产品信息"
)
@ApiModel
(
"产品信息"
)
@Data
@Data
public
class
ProductInfoVO
{
public
class
ProductInfoVO
{
...
@@ -154,7 +158,7 @@ public class ProductInfoVO {
...
@@ -154,7 +158,7 @@ public class ProductInfoVO {
private
Integer
fundNum
;
private
Integer
fundNum
;
@ApiModelProperty
(
"公司资产规模"
)
@ApiModelProperty
(
"公司资产规模"
)
private
Integer
companyAssetSize
;
private
String
companyAssetSize
;
@ApiModelProperty
(
"点评"
)
@ApiModelProperty
(
"点评"
)
private
List
<
Type
>
commentContent
;
private
List
<
Type
>
commentContent
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/vo/feign/UserInfoVo.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
api
.
beans
.
vo
.
feign
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
@ApiModel
(
description
=
"用户信息"
)
@Data
public
class
UserInfoVo
{
@ApiModelProperty
(
"用户ID"
)
private
String
id
;
@ApiModelProperty
(
"用户姓名"
)
private
String
uiUsername
;
@ApiModelProperty
(
"用户昵称"
)
private
String
uiNickname
;
@ApiModelProperty
(
"用户头像"
)
private
String
uiHeadimg
;
@ApiModelProperty
(
"用户头像"
)
private
String
uiHeadimgMp
;
@ApiModelProperty
(
"二维码名片图片"
)
private
String
uiWechatQrcode
;
@ApiModelProperty
(
"微店小程序图片"
)
private
String
uiWechatXcxQrcode
;
@ApiModelProperty
(
"用户权限"
)
private
String
uiAuth
;
@ApiModelProperty
(
"用户手机号"
)
private
String
uiMobilephoneMp
;
@ApiModelProperty
(
"名片电话"
)
private
String
uiTelphoneMp
;
@ApiModelProperty
(
"注册手机号"
)
private
String
uiTelphone
;
@ApiModelProperty
(
"微信id'"
)
private
String
uiOpenId
;
@ApiModelProperty
(
"realname"
)
private
String
realname
;
@ApiModelProperty
(
"level"
)
private
Integer
level
;
@ApiModelProperty
(
"0游客,1注册用户,20探普理顾 30:探普专家理顾 40:交易理财师"
)
private
Integer
levelGrade
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
"注册时间"
)
private
Date
uiRegisterTime
;
}
community-service/src/main/java/com/tanpu/community/feign/course/FeignBackClientForCourse.java
View file @
0413dd68
...
@@ -17,14 +17,14 @@ public class FeignBackClientForCourse implements FallbackFactory<FeignClientForC
...
@@ -17,14 +17,14 @@ public class FeignBackClientForCourse implements FallbackFactory<FeignClientForC
public
CommonResp
<
CourseDetailExt
>
getCourseIdDetailInfo
(
String
id
,
String
packageId
)
{
public
CommonResp
<
CourseDetailExt
>
getCourseIdDetailInfo
(
String
id
,
String
packageId
)
{
log
.
error
(
"请求信息"
,
throwable
);
log
.
error
(
"请求信息"
,
throwable
);
log
.
error
(
"FeignClientForCourse.getCourseIdDetailInfo-查询课程id:{},package:{}"
,
id
,
packageId
);
log
.
error
(
"FeignClientForCourse.getCourseIdDetailInfo-查询课程id:{},package:{}"
,
id
,
packageId
);
return
null
;
return
CommonResp
.
failed
(
"调用getCourseIdDetailInfo失败"
)
;
}
}
@Override
@Override
public
CommonResp
<
CoursePackageDetail
>
getCoursePackageDetailInfo
(
String
id
)
{
public
CommonResp
<
CoursePackageDetail
>
getCoursePackageDetailInfo
(
String
id
)
{
log
.
error
(
"请求信息"
,
throwable
);
log
.
error
(
"请求信息"
,
throwable
);
log
.
error
(
"FeignClientForCourse.getCoursePackageDetailInfo-查询课程包id:{}"
,
id
);
log
.
error
(
"FeignClientForCourse.getCoursePackageDetailInfo-查询课程包id:{}"
,
id
);
return
null
;
return
CommonResp
.
failed
(
"调用getCoursePackageDetailInfo失败"
)
;
}
}
};
};
}
}
...
...
community-service/src/main/java/com/tanpu/community/feign/fatools/FeignClientForFatools.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
fatools
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.UserInfoVo
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Set
;
//@FeignClient(value = "fatools", fallbackFactory = FeignbackForFatools.class, url = "http://127.0.0.1:8189/fatools")
@FeignClient
(
value
=
"fatools"
,
contextId
=
"fatoolsUser"
,
fallbackFactory
=
FeignbackForFatools
.
class
,
path
=
"/fatools"
)
public
interface
FeignClientForFatools
{
@ApiOperation
(
value
=
"查询用户详情"
)
@GetMapping
(
"/user/getUserInfoById"
)
UserInfoVo
getUserInfoById
(
@RequestParam
(
"userId"
)
String
userId
);
@GetMapping
(
"/column/getCurriculumByColumnRelId"
)
List
<
ShortVideoBaseInfoResp
>
getCurriculumByColumnRelId
(
@RequestParam
(
"ids"
)
List
<
String
>
ids
);
@ApiOperation
(
value
=
"获取不能转播直播"
)
@GetMapping
(
value
=
"/app/getNotRelaySet"
)
CommonResp
<
Set
<
String
>>
getNotRelaySet
(
@ApiParam
(
"用户id"
)
@RequestParam
(
"userId"
)
String
userId
,
@ApiParam
(
"直播列表id"
)
@RequestParam
(
"roomIds"
)
Set
<
String
>
roomIds
);
}
community-service/src/main/java/com/tanpu/community/feign/fatools/FeignbackForFatools.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
fatools
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.UserInfoVo
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Set
;
@Slf4j
@Component
public
class
FeignbackForFatools
implements
FallbackFactory
<
FeignClientForFatools
>
{
@Override
public
FeignClientForFatools
create
(
Throwable
throwable
)
{
return
new
FeignClientForFatools
()
{
@Override
public
UserInfoVo
getUserInfoById
(
String
userId
)
{
log
.
info
(
"FeignbackForFatools.getUserInfoById调用失败"
,
throwable
);
return
null
;
}
@Override
public
List
<
ShortVideoBaseInfoResp
>
getCurriculumByColumnRelId
(
List
<
String
>
ids
)
{
log
.
info
(
"FeignbackForFatools.getCurriculumByColumnRelId调用失败"
,
throwable
);
return
null
;
}
@Override
public
CommonResp
<
Set
<
String
>>
getNotRelaySet
(
String
userId
,
Set
roomIds
)
{
log
.
info
(
"FeignbackForFatools.getNotRelaySet"
,
throwable
);
return
CommonResp
.
error
();
}
};
}
}
community-service/src/main/java/com/tanpu/community/feign/product/FeignForFund.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
//@FeignClient(value = "service-fund", url = "http://127.0.0.1:8194/fund")
@FeignClient
(
value
=
"service-fund"
,
path
=
"/fund"
)
public
interface
FeignForFund
{
@ApiOperation
(
"获取产品详情"
)
@GetMapping
(
"/product/list"
)
CommonResp
<
List
<
ProductInfoVO
>>
getProductList
(
@ApiParam
(
"产品id"
)
@RequestParam
(
"ids"
)
List
<
String
>
ids
);
@ApiOperation
(
"获取ifa导入产品"
)
@GetMapping
(
"/privatefund/list"
)
CommonResp
<
List
<
ProductInfoVO
>>
getPrivateFundList
(
@ApiParam
(
"产品id"
)
@RequestParam
(
"ids"
)
List
<
String
>
ids
);
@ApiOperation
(
"获取非净值产品"
)
@GetMapping
(
"/product/not/net"
)
CommonResp
<
List
<
ProductInfoVO
>>
getProductListNotNetInfo
(
@ApiParam
(
"产品id"
)
@RequestParam
(
"ids"
)
List
<
String
>
ids
);
}
community-service/src/main/java/com/tanpu/community/feign/product/FeignForPublicFund.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
//@FeignClient(value = "service-fundpublic", url = "http://127.0.0.1:8194/fundpublic")
@FeignClient
(
value
=
"service-fundpublic"
,
path
=
"/fundpublic"
)
public
interface
FeignForPublicFund
{
@ApiOperation
(
"获取产品详情"
)
@GetMapping
(
"/product/list"
)
CommonResp
<
List
<
ProductInfoVO
>>
getProductList
(
@ApiParam
(
"产品id"
)
@RequestParam
(
"ids"
)
List
<
String
>
ids
);
}
community-service/src/main/java/com/tanpu/community/feign/product/FeignbackForFund.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Slf4j
@Component
public
class
FeignbackForFund
implements
FallbackFactory
<
FeignForFund
>
{
@Override
public
FeignForFund
create
(
Throwable
throwable
)
{
return
new
FeignForFund
()
{
@Override
public
CommonResp
<
List
<
ProductInfoVO
>>
getProductList
(
List
<
String
>
ids
)
{
log
.
error
(
"FeignbackForFund.getProductList"
);
return
CommonResp
.
failed
(
"调用私募详情失败"
);
}
@Override
public
CommonResp
<
List
<
ProductInfoVO
>>
getPrivateFundList
(
List
<
String
>
ids
)
{
log
.
error
(
"FeignbackForFund.getPrivateFundList"
);
return
CommonResp
.
failed
(
"调用ifa导入基金失败"
);
}
@Override
public
CommonResp
<
List
<
ProductInfoVO
>>
getProductListNotNetInfo
(
List
<
String
>
ids
)
{
log
.
error
(
"FeignbackForFund.getProductListNotNetInfo"
,
throwable
);
return
CommonResp
.
failed
(
"查询无净值产品"
);
}
};
}
}
community-service/src/main/java/com/tanpu/community/feign/product/FeignbackForPublicFund.java
0 → 100644
View file @
0413dd68
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Slf4j
@Component
public
class
FeignbackForPublicFund
implements
FallbackFactory
<
FeignForPublicFund
>
{
@Override
public
FeignForPublicFund
create
(
Throwable
throwable
)
{
return
new
FeignForPublicFund
()
{
@Override
public
CommonResp
<
List
<
ProductInfoVO
>>
getProductList
(
List
<
String
>
ids
)
{
log
.
error
(
"getProductList.getProductList"
);
return
CommonResp
.
failed
(
"调用公募详情失败"
);
}
};
}
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
0413dd68
package
com
.
tanpu
.
community
.
manager
;
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.CommunityConstant
;
import
com.tanpu.community.api.beans.qo.AttachmentDetailVo
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq
;
import
com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.api.beans.vo.feign.*
;
import
com.tanpu.community.api.enums.BlockTypeEnum
;
import
com.tanpu.community.api.enums.*
;
import
com.tanpu.community.api.enums.CollectionTypeEnum
;
import
com.tanpu.community.api.enums.ThemeListTypeEnum
;
import
com.tanpu.community.api.enums.ThemeTypeEnum
;
import
com.tanpu.community.dao.entity.community.*
;
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
;
import
com.tanpu.community.feign.zhibo.FeignClientForZhibo
;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.service.other.*
;
import
com.tanpu.community.service.other.*
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.ConvertUtil
;
...
@@ -29,7 +23,10 @@ import javax.annotation.Resource;
...
@@ -29,7 +23,10 @@ import javax.annotation.Resource;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
@Service
@Service
public
class
ThemeManager
{
public
class
ThemeManager
{
...
@@ -70,16 +67,7 @@ public class ThemeManager {
...
@@ -70,16 +67,7 @@ public class ThemeManager {
private
HomePageService
homePageService
;
private
HomePageService
homePageService
;
@Resource
@Resource
private
FeignClientForTanpuroom
feignClientForTanpuroom
;
private
ProductService
productService
;
@Resource
private
FeignClientForZhibo
feignClientForZhibo
;
@Resource
private
FeignClientForProducts
feignClientForProducts
;
@Autowired
private
FeignClientForCourse
feignClientForCourse
;
@Autowired
@Autowired
private
OSSFileService
ossFileService
;
private
OSSFileService
ossFileService
;
...
@@ -140,7 +128,7 @@ public class ThemeManager {
...
@@ -140,7 +128,7 @@ public class ThemeManager {
if
(
themeEntity
==
null
)
{
if
(
themeEntity
==
null
)
{
throw
new
BizException
(
"找不到帖子id:"
+
themeId
);
throw
new
BizException
(
"找不到帖子id:"
+
themeId
);
}
}
ThemeQo
themeQo
=
ConvertUtil
.
themeEntityToQo
(
themeEntity
);
ThemeQo
themeQo
=
ConvertUtil
.
themeEntityToQo
2
(
themeEntity
);
buildMainTestExtraInfo
(
themeQo
,
userId
);
buildMainTestExtraInfo
(
themeQo
,
userId
);
return
themeQo
;
return
themeQo
;
}
}
...
@@ -220,6 +208,7 @@ public class ThemeManager {
...
@@ -220,6 +208,7 @@ public class ThemeManager {
//主题Entity转QO
//主题Entity转QO
private
List
<
ThemeQo
>
convertEntityToQo
(
List
<
ThemeEntity
>
themeEntities
,
String
userId
)
{
private
List
<
ThemeQo
>
convertEntityToQo
(
List
<
ThemeEntity
>
themeEntities
,
String
userId
)
{
List
<
ThemeQo
>
themeQos
=
ConvertUtil
.
themeEntitiesToDTOs
(
themeEntities
);
List
<
ThemeQo
>
themeQos
=
ConvertUtil
.
themeEntitiesToDTOs
(
themeEntities
);
productService
.
transferAttachment
(
themeQos
,
userId
);
for
(
ThemeQo
themeQO
:
themeQos
)
{
for
(
ThemeQo
themeQO
:
themeQos
)
{
buildThemeQoExtraInfo
(
userId
,
themeQO
);
buildThemeQoExtraInfo
(
userId
,
themeQO
);
}
}
...
@@ -231,15 +220,7 @@ public class ThemeManager {
...
@@ -231,15 +220,7 @@ public class ThemeManager {
private
void
buildThemeQoExtraInfo
(
String
userId
,
ThemeQo
themeQo
)
{
private
void
buildThemeQoExtraInfo
(
String
userId
,
ThemeQo
themeQo
)
{
//附件列表
//附件列表
String
themeId
=
themeQo
.
getThemeId
();
String
themeId
=
themeQo
.
getThemeId
();
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
if
(
content
!=
null
&&
content
.
size
()
>
2
)
{
themeQo
.
setContent
(
content
.
subList
(
0
,
2
));
}
content
=
themeQo
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
transferAttachment
(
themeContentQo
,
userId
);
}
//迄今时间
//迄今时间
themeQo
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
themeQo
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
...
@@ -256,7 +237,7 @@ public class ThemeManager {
...
@@ -256,7 +237,7 @@ public class ThemeManager {
//转发原文
//转发原文
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
if
(
formerThemeId
!=
null
){
if
(
formerThemeId
!=
null
){
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
(
themeService
.
queryByThemeId
(
formerThemeId
));
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
2
(
themeService
.
queryByThemeId
(
formerThemeId
));
if
(
formerTheme
==
null
){
if
(
formerTheme
==
null
){
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
}
}
...
@@ -285,10 +266,6 @@ public class ThemeManager {
...
@@ -285,10 +266,6 @@ public class ThemeManager {
private
void
buildMainTestExtraInfo
(
ThemeQo
themeQo
,
String
userId
)
{
private
void
buildMainTestExtraInfo
(
ThemeQo
themeQo
,
String
userId
)
{
//附件列表
//附件列表
String
themeId
=
themeQo
.
getThemeId
();
String
themeId
=
themeQo
.
getThemeId
();
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
transferAttachment
(
themeContentQo
,
userId
);
}
//迄今时间
//迄今时间
themeQo
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
themeQo
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
//用户信息:头像、昵称
//用户信息:头像、昵称
...
@@ -298,7 +275,7 @@ public class ThemeManager {
...
@@ -298,7 +275,7 @@ public class ThemeManager {
//转发原文
//转发原文
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
if
(
formerThemeId
!=
null
){
if
(
formerThemeId
!=
null
){
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
(
themeService
.
queryByThemeId
(
formerThemeId
));
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
2
(
themeService
.
queryByThemeId
(
formerThemeId
));
if
(
formerTheme
==
null
){
if
(
formerTheme
==
null
){
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
}
}
...
@@ -315,47 +292,6 @@ public class ThemeManager {
...
@@ -315,47 +292,6 @@ public class ThemeManager {
}
}
public
void
transferAttachment
(
ThemeContentQo
themeContentQo
,
String
userId
)
{
String
type
=
themeContentQo
.
getType
();
if
(
RelTypeEnum
.
FUND
.
type
.
equals
(
type
))
{
//产品
String
productId
=
themeContentQo
.
getValue
();
CommonResp
<
ProductInfoVO
>
productDetailInfo
=
feignClientForProducts
.
getProductDetailInfo
(
productId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
product
(
productDetailInfo
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
LIVE
.
type
.
equals
(
type
))
{
//直播
String
zhiboId
=
themeContentQo
.
getValue
();
String
[]
roomIds
=
new
String
[]{
zhiboId
};
CommonResp
<
List
<
ZhiboListResp
>>
zhiboDetailVOCommonResp
=
feignClientForZhibo
.
simpleList
(
Arrays
.
asList
(
roomIds
));
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
zhibo
(
zhiboDetailVOCommonResp
.
getData
().
get
(
0
)).
build
());
}
else
if
(
RelTypeEnum
.
SHORT_VIDEO
.
type
.
equals
(
type
))
{
//短视频
String
videoId
=
themeContentQo
.
getValue
();
String
[]
attachmentIds
=
new
String
[]{
videoId
};
CommonResp
<
List
<
ShortVideoBaseInfoResp
>>
shortVideoBaseInfo
=
feignClientForTanpuroom
.
getShortVideoBaseInfo
(
Arrays
.
asList
(
attachmentIds
));
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
shortVideo
(
shortVideoBaseInfo
.
getData
().
get
(
0
)).
build
());
}
else
if
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
.
equals
(
type
))
{
//课程
String
packageId
=
themeContentQo
.
getValue
();
CommonResp
<
CoursePackageDetail
>
courseIdDetailInfo
=
feignClientForCourse
.
getCoursePackageDetailInfo
(
packageId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
course
(
courseIdDetailInfo
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
SINGLE_IMG
.
type
.
equals
(
type
))
{
//单图,根据id传入url
String
imgId
=
themeContentQo
.
getValue
();
FileRecordEntity
fileEntity
=
ossFileService
.
queryById
(
imgId
);
if
(
fileEntity
==
null
)
{
throw
new
BizException
(
"图片未找到,id:"
+
imgId
);
}
themeContentQo
.
setValue
(
CommunityConstant
.
OSS_PREFIX_URL
+
fileEntity
.
getFileOssKey
());
}
}
//计算迄今时间
//计算迄今时间
private
String
calUpToNowTime
(
LocalDateTime
start
)
{
private
String
calUpToNowTime
(
LocalDateTime
start
)
{
...
...
community-service/src/main/java/com/tanpu/community/service/ProductService.java
View file @
0413dd68
//package com.tanpu.community.service;
package
com
.
tanpu
.
community
.
service
;
//
//import com.google.common.collect.Lists;
import
com.google.common.collect.Lists
;
//import org.springframework.beans.BeanUtils;
import
com.google.common.collect.Maps
;
//import org.springframework.util.CollectionUtils;
import
com.tanpu.common.api.CommonResp
;
//
import
com.tanpu.common.enums.fund.ProductTypeEnum
;
//import java.util.List;
import
com.tanpu.community.api.beans.qo.AttachmentDetailVo
;
//import java.util.Map;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
//import java.util.stream.Collectors;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
//
import
com.tanpu.community.api.beans.vo.feign.FundInfoBaseResp
;
//public class ProductService {
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.ZhiboListResp
;
// * 获取资源信息
import
com.tanpu.community.api.enums.RelTypeEnum
;
// *
import
com.tanpu.community.dao.entity.community.FileRecordEntity
;
// * @param shortVideoMap
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
// * @param curriculumMap
import
com.tanpu.community.feign.product.FeignClientForProducts
;
// * @param zhiboMap
import
com.tanpu.community.feign.product.FeignForFund
;
// * @param fundMap
import
com.tanpu.community.feign.product.FeignForPublicFund
;
// */
import
com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom
;
// private void getResInfo(Map<String, ShortVideoBaseInfoResp> shortVideoMap,
import
com.tanpu.community.feign.zhibo.FeignClientForZhibo
;
// Map<String, ShortVideoBaseInfoResp> curriculumMap,
import
org.springframework.beans.BeanUtils
;
// Map<String, ZhiboListResp> zhiboMap,
import
org.springframework.beans.factory.annotation.Autowired
;
// Map<String, FundInfoBaseResp> fundMap,
import
org.springframework.stereotype.Service
;
// List<NewsFeedRes> newsFeedRes,
import
org.springframework.util.CollectionUtils
;
// Map<String, NewsFeedRes> newFeedMap
// ) {
import
javax.annotation.Resource
;
// // 白名单基金id
import
java.util.List
;
// List<String> tanpuFundIds = Lists.newArrayList();
import
java.util.Map
;
// // 私募基金id
import
java.util.stream.Collectors
;
// List<String> fundIds = Lists.newArrayList();
// // 理财师导入
@Service
// List<String> ifaFundIds = Lists.newArrayList();
public
class
ProductService
{
// // 公募基金id
// List<String> publicFundIds = Lists.newArrayList();
// // 无净值产品id
@Resource
// List<String> notNetFundIds = Lists.newArrayList();
private
FeignClientForTanpuroom
feignClientForTanpuroom
;
// // 短视频id
// List<String> shortVideoIds = Lists.newArrayList();
@Resource
// // 直播id
private
FeignClientForZhibo
feignClientForZhibo
;
// List<String> zhiboIds = Lists.newArrayList();
// // 课程id
@Resource
// List<String> curriculumIds = Lists.newArrayList();
private
FeignClientForProducts
feignForProduct
;
// // 获取关联资源id
// if (newsFeedRes != null) {
//
@Resource
// }
private
FeignForFund
feignForFund
;
// if (!CollectionUtils.isEmpty(shortVideoIds)) {
// // 短视频列表
@Resource
// }
private
FeignForPublicFund
feignForPublicFund
;
// if (!CollectionUtils.isEmpty(curriculumIds)) {
// // 课程列表
@Resource
// }
private
FeignClientForFatools
feignClientForFatools
;
// if (!CollectionUtils.isEmpty(zhiboIds)) {
// // 直播列表
@Autowired
// }
private
OSSFileService
ossFileService
;
// this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap);
// }
//
public
void
transferAttachment
(
List
<
ThemeQo
>
themeQos
,
String
userId
)
{
// /**
// 短视频信息
// * 设置产品信息
Map
<
String
,
ShortVideoBaseInfoResp
>
shortVideoMap
=
Maps
.
newHashMap
();
// *
// 课程信息
// * @param tanpuFundIds
Map
<
String
,
ShortVideoBaseInfoResp
>
curriculumMap
=
Maps
.
newHashMap
();
// * @param fundIds
// 直播信息
// * @param publicFundIds
Map
<
String
,
ZhiboListResp
>
zhiboMap
=
Maps
.
newHashMap
();
// * @param fundMap
// 设置产品信息
// */
Map
<
String
,
FundInfoBaseResp
>
fundMap
=
Maps
.
newHashMap
();
// private void getFundInfo(List<String> tanpuFundIds,
// 图片信息
// List<String> fundIds,
Map
<
String
,
String
>
imgMap
=
Maps
.
newHashMap
();
// List<String> publicFundIds,
// 批量查询资源信息
// List<String> ifaFundIds,
this
.
getResInfo
(
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
imgMap
,
themeQos
);
// List<String> notNetFundIds,
//逐个装入
// Map<String, FundInfoBaseResp> fundMap) {
setResInfo
(
themeQos
,
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
imgMap
);
// Map<String, FundInfoBaseResp> tampFundMap = null;
// Map<String, FundInfoBaseResp> privateFundMap = null;
}
// Map<String, FundInfoBaseResp> publicFundMap = null;
// Map<String, FundInfoBaseResp> ifaFundMap = null;
// Map<String, FundInfoBaseResp> notNetFundMap = null;
/**
// if (!CollectionUtils.isEmpty(tanpuFundIds)) {
* 获取资源信息
//// ProductListReq productListReq = ProductListReq.builder()
*
//// .fundIds(Lists.newArrayList(tanpuFundIds))
* @param shortVideoMap
//// .build();
* @param curriculumMap
// // 探普产品
* @param zhiboMap
// CommonResp<List<ProductInfoVO>> commonResp = feignForProduct.getProductInfoByIds(tanpuFundIds);
* @param fundMap
// if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getAttributes())) {
*/
// List<FundInfoBaseResp> fundInfoBaseRespList = commonResp.attributes.stream().map(item -> {
private
void
getResInfo
(
Map
<
String
,
ShortVideoBaseInfoResp
>
shortVideoMap
,
// FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
Map
<
String
,
ShortVideoBaseInfoResp
>
curriculumMap
,
// BeanUtils.copyProperties(item, fundInfoBaseResp);
Map
<
String
,
ZhiboListResp
>
zhiboMap
,
// return fundInfoBaseResp;
Map
<
String
,
FundInfoBaseResp
>
fundMap
,
// }).collect(Collectors.toList());
Map
<
String
,
String
>
imgMap
,
// tampFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
List
<
ThemeQo
>
themeQos
// }
)
{
//
// 白名单基金id
// if (tampFundMap != null && tampFundMap.size() > 0) {
List
<
String
>
tanpuFundIds
=
Lists
.
newArrayList
();
// fundMap.putAll(tampFundMap);
// 私募基金id
// }
List
<
String
>
fundIds
=
Lists
.
newArrayList
();
// }
// 理财师导入
// // 私募产品
List
<
String
>
ifaFundIds
=
Lists
.
newArrayList
();
// if (!CollectionUtils.isEmpty(fundIds)) {
// 公募基金id
// // 私募产品
List
<
String
>
publicFundIds
=
Lists
.
newArrayList
();
// CommonResp<List<ProductInfoVO>> fundResult = feignForFund.getProductList(fundIds);
// 无净值产品id
// if (fundResult.isSuccess() && !CollectionUtils.isEmpty(fundResult.getAttributes())) {
List
<
String
>
notNetFundIds
=
Lists
.
newArrayList
();
// List<FundInfoBaseResp> fundInfoBaseRespList = fundResult.attributes.stream().map(item -> {
// 短视频id
// FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
List
<
String
>
shortVideoIds
=
Lists
.
newArrayList
();
// BeanUtils.copyProperties(item, fundInfoBaseResp);
// 直播id
// return fundInfoBaseResp;
List
<
String
>
zhiboIds
=
Lists
.
newArrayList
();
// }).collect(Collectors.toList());
// 课程id
// privateFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
List
<
String
>
curriculumIds
=
Lists
.
newArrayList
();
// }
// 图片id
//
List
<
String
>
imageIds
=
Lists
.
newArrayList
();
// if (privateFundMap != null && privateFundMap.size() > 0) {
// 获取关联资源id
// fundMap.putAll(privateFundMap);
if
(
themeQos
!=
null
)
{
// }
themeQos
.
stream
().
forEach
(
o
->
o
.
getContent
().
stream
().
forEach
(
c
->
{
// }
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
//
zhiboIds
.
add
(
c
.
getRemark
());
// // 理财师导入产品
}
else
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
SHORT_VIDEO
.
type
))
{
// if (!CollectionUtils.isEmpty(ifaFundIds)) {
shortVideoIds
.
add
(
c
.
getValue
());
// CommonResp<List<ProductInfoVO>> ifaFundResult = feignForFund.getPrivateFundList(ifaFundIds);
}
else
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
// if (ifaFundResult.isSuccess() && !CollectionUtils.isEmpty(ifaFundResult.getAttributes())) {
if
(
c
.
getProductType
()
==
ProductTypeEnum
.
PUBLIC
.
type
)
{
// List<FundInfoBaseResp> fundInfoBaseRespList = ifaFundResult.attributes.stream().map(item -> {
publicFundIds
.
add
(
c
.
getValue
());
// FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
}
else
if
(
c
.
getProductType
()
==
ProductTypeEnum
.
PRIVATE
.
type
)
{
// BeanUtils.copyProperties(item, fundInfoBaseResp);
fundIds
.
add
(
c
.
getValue
());
// return fundInfoBaseResp;
}
else
if
(
c
.
getProductType
()
==
ProductTypeEnum
.
TAMP
.
type
)
{
// }).collect(Collectors.toList());
tanpuFundIds
.
add
(
c
.
getValue
());
// ifaFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
}
else
if
(
c
.
getProductType
()
==
ProductTypeEnum
.
CUSTOMER_IMPORT
.
type
)
{
// }
ifaFundIds
.
add
(
c
.
getValue
());
//
}
else
if
(
c
.
getProductType
()
==
ProductTypeEnum
.
NOT_NET_PRODUCT
.
type
)
{
// if (ifaFundMap != null && ifaFundMap.size() > 0) {
notNetFundIds
.
add
(
c
.
getValue
());
// fundMap.putAll(ifaFundMap);
}
// }
// }
}
else
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
VIDEO
.
type
)
||
c
.
getType
().
equals
(
RelTypeEnum
.
AUDIO
.
type
))
{
//
curriculumIds
.
add
(
c
.
getValue
());
// if (!CollectionUtils.isEmpty(publicFundIds)) {
}
else
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
SINGLE_IMG
.
type
))
{
// // 公募产品
imageIds
.
add
(
c
.
getValue
());
// CommonResp<List<ProductInfoVO>> publicFundResult = feignForPublicFund.getProductList(publicFundIds);
}
// if (publicFundResult.isSuccess() && !CollectionUtils.isEmpty(publicFundResult.getAttributes())) {
// List<FundInfoBaseResp> fundInfoBaseRespList = publicFundResult.attributes.stream().map(item -> {
// FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
}));
// BeanUtils.copyProperties(item, fundInfoBaseResp);
// return fundInfoBaseResp;
}
// }).collect(Collectors.toList());
if
(!
CollectionUtils
.
isEmpty
(
shortVideoIds
))
{
// publicFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
// 短视频列表
// }
CommonResp
<
List
<
ShortVideoBaseInfoResp
>>
commonResp
=
feignClientForTanpuroom
.
getShortVideoBaseInfo
(
shortVideoIds
);
// if (publicFundMap != null && publicFundMap.size() > 0) {
if
(
commonResp
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
// fundMap.putAll(publicFundMap);
shortVideoMap
.
putAll
(
commonResp
.
getData
().
stream
().
collect
(
Collectors
.
toMap
(
ShortVideoBaseInfoResp:
:
getSourceId
,
item
->
item
)));
// }
}
// }
}
//
if
(!
CollectionUtils
.
isEmpty
(
curriculumIds
))
{
// if (!CollectionUtils.isEmpty(notNetFundIds)) {
// 课程列表
// // 无净值产品
List
<
ShortVideoBaseInfoResp
>
commonResp
=
feignClientForFatools
.
getCurriculumByColumnRelId
(
curriculumIds
);
// CommonResp<List<ProductInfoVO>> notNetInfoResult = feignForFund.getProductListNotNetInfo(notNetFundIds);
if
(
commonResp
!=
null
&&
!
CollectionUtils
.
isEmpty
(
commonResp
))
{
// if (notNetInfoResult.isSuccess() && !CollectionUtils.isEmpty(notNetInfoResult.getAttributes())) {
curriculumMap
.
putAll
(
commonResp
.
stream
().
collect
(
Collectors
.
toMap
(
ShortVideoBaseInfoResp:
:
getColumnRelId
,
item
->
item
)));
// List<FundInfoBaseResp> fundInfoBaseRespList = notNetInfoResult.attributes.stream().map(item -> {
}
// FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
}
// BeanUtils.copyProperties(item, fundInfoBaseResp);
if
(!
CollectionUtils
.
isEmpty
(
zhiboIds
))
{
// return fundInfoBaseResp;
// 直播列表
// }).collect(Collectors.toList());
CommonResp
<
List
<
ZhiboListResp
>>
commonResp
=
feignClientForZhibo
.
simpleList
(
zhiboIds
);
// notNetFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if
(
commonResp
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
// }
zhiboMap
.
putAll
(
commonResp
.
getData
().
stream
().
collect
(
Collectors
.
toMap
(
ZhiboListResp:
:
getId
,
item
->
item
)));
// if (notNetFundMap != null && notNetFundMap.size() > 0) {
}
// fundMap.putAll(notNetFundMap);
}
// }
if
(!
CollectionUtils
.
isEmpty
(
imageIds
))
{
// }
// 直播列表
// }
List
<
FileRecordEntity
>
fileRecordEntities
=
ossFileService
.
queryByIds
(
imageIds
);
//
if
(!
CollectionUtils
.
isEmpty
(
fileRecordEntities
))
{
// /**
imgMap
.
putAll
(
fileRecordEntities
.
stream
().
collect
(
Collectors
// * 设置资源信息
.
toMap
(
FileRecordEntity:
:
getFileId
,
FileRecordEntity:
:
getUrl
)));
// *
}
// * @param item
}
// * @param resp
this
.
getFundInfo
(
tanpuFundIds
,
fundIds
,
publicFundIds
,
ifaFundIds
,
notNetFundIds
,
fundMap
);
// * @param newFeedMap
}
// * @param shortVideoMap
// * @param curriculumMap
/**
// * @param zhiboMap
* 设置产品信息
// * @param fundMap
*
// */
* @param tanpuFundIds
// private void setResInfo(NewsFeed item,
* @param fundIds
// NewsFeedResp resp,
* @param publicFundIds
// Map<String, NewsFeedRes> newFeedMap,
* @param fundMap
// Map<String, ShortVideoBaseInfoResp> shortVideoMap,
*/
// Map<String, ShortVideoBaseInfoResp> curriculumMap,
private
void
getFundInfo
(
List
<
String
>
tanpuFundIds
,
// Map<String, ZhiboListResp> zhiboMap,
List
<
String
>
fundIds
,
// Map<String, FundInfoBaseResp> fundMap) {
List
<
String
>
publicFundIds
,
// if (newFeedMap.containsKey(item.getId())) {
List
<
String
>
ifaFundIds
,
// NewsFeedRes nf = newFeedMap.get(item.getId());
List
<
String
>
notNetFundIds
,
// if (nf.getRelType().equals(RelTypeEnum.LIVE.type)) {
Map
<
String
,
FundInfoBaseResp
>
fundMap
)
{
// if (zhiboMap.containsKey(nf.getRemark())) {
Map
<
String
,
FundInfoBaseResp
>
tampFundMap
=
null
;
// ZhiboListResp zhibo = zhiboMap.get(nf.getRemark());
Map
<
String
,
FundInfoBaseResp
>
privateFundMap
=
null
;
// zhibo.setParentId(zhibo.getParentId());
Map
<
String
,
FundInfoBaseResp
>
publicFundMap
=
null
;
// zhibo.setId(zhibo.getId());
Map
<
String
,
FundInfoBaseResp
>
ifaFundMap
=
null
;
// resp.setResList(RelContentResp.builder()
Map
<
String
,
FundInfoBaseResp
>
notNetFundMap
=
null
;
// .relType(RelTypeEnum.LIVE.type)
if
(!
CollectionUtils
.
isEmpty
(
tanpuFundIds
))
{
// .zhibo(zhibo).build());
// ProductListReq productListReq = ProductListReq.builder()
// }
// .fundIds(Lists.newArrayList(tanpuFundIds))
// } else if (nf.getRelType().equals(RelTypeEnum.SHORT_VIDEO.type)) {
// .build();
// if (shortVideoMap.containsKey(nf.getRelId())) {
// 探普产品
// resp.setResList(RelContentResp.builder()
CommonResp
<
List
<
ProductInfoVO
>>
commonResp
=
feignForProduct
.
getProductInfoByIds
(
tanpuFundIds
);
// .relType(RelTypeEnum.SHORT_VIDEO.type)
if
(
commonResp
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
// .shortVideo(shortVideoMap.get(nf.getRelId())).build());
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
commonResp
.
getData
().
stream
().
map
(
item
->
{
// }
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
// } else if (nf.getRelType().equals(RelTypeEnum.VIDEO.type) || nf.getRelType().equals(RelTypeEnum.AUDIO.type)) {
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
// if (curriculumMap.containsKey(nf.getRelId())) {
return
fundInfoBaseResp
;
// resp.setResList(RelContentResp.builder()
}).
collect
(
Collectors
.
toList
());
// .relType(curriculumMap.get(nf.getRelId()).getRelType())
tampFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
// .curriculum(curriculumMap.get(nf.getRelId())).build());
}
// }
// } else if (nf.getRelType().equals(RelTypeEnum.FUND.type)) {
if
(
tampFundMap
!=
null
&&
tampFundMap
.
size
()
>
0
)
{
// if (fundMap.containsKey(nf.getRelId())) {
fundMap
.
putAll
(
tampFundMap
);
// FundInfoBaseResp product = fundMap.get(nf.getRelId());
}
// // 推荐语
}
// product.setRemark(nf.getRemark());
// 私募产品
// // 产品类型
if
(!
CollectionUtils
.
isEmpty
(
fundIds
))
{
// product.setProductType(nf.getProductType());
// 私募产品
// resp.setResList(RelContentResp.builder()
CommonResp
<
List
<
ProductInfoVO
>>
fundResult
=
feignForFund
.
getProductList
(
fundIds
);
// .relType(RelTypeEnum.FUND.type)
if
(
fundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
fundResult
.
getData
()))
{
// .product(product).build());
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
fundResult
.
getData
().
stream
().
map
(
item
->
{
// }
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
// }
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
// }
return
fundInfoBaseResp
;
// }
}).
collect
(
Collectors
.
toList
());
//}
privateFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
privateFundMap
!=
null
&&
privateFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
privateFundMap
);
}
}
// 理财师导入产品
if
(!
CollectionUtils
.
isEmpty
(
ifaFundIds
))
{
CommonResp
<
List
<
ProductInfoVO
>>
ifaFundResult
=
feignForFund
.
getPrivateFundList
(
ifaFundIds
);
if
(
ifaFundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
ifaFundResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
ifaFundResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
ifaFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
ifaFundMap
!=
null
&&
ifaFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
ifaFundMap
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
publicFundIds
))
{
// 公募产品
CommonResp
<
List
<
ProductInfoVO
>>
publicFundResult
=
feignForPublicFund
.
getProductList
(
publicFundIds
);
if
(
publicFundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
publicFundResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
publicFundResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
publicFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
publicFundMap
!=
null
&&
publicFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
publicFundMap
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
notNetFundIds
))
{
// 无净值产品
CommonResp
<
List
<
ProductInfoVO
>>
notNetInfoResult
=
feignForFund
.
getProductListNotNetInfo
(
notNetFundIds
);
if
(
notNetInfoResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
notNetInfoResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
notNetInfoResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
notNetFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
notNetFundMap
!=
null
&&
notNetFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
notNetFundMap
);
}
}
}
/**
* 设置资源信息
*/
private
void
setResInfo
(
List
<
ThemeQo
>
themeQos
,
Map
<
String
,
ShortVideoBaseInfoResp
>
shortVideoMap
,
Map
<
String
,
ShortVideoBaseInfoResp
>
curriculumMap
,
Map
<
String
,
ZhiboListResp
>
zhiboMap
,
Map
<
String
,
FundInfoBaseResp
>
fundMap
,
Map
<
String
,
String
>
imgUrlMap
)
{
for
(
ThemeQo
themeQo
:
themeQos
)
{
for
(
ThemeContentQo
themeContent
:
themeQo
.
getContent
())
{
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
if
(
zhiboMap
.
containsKey
(
themeContent
.
getValue
()))
{
ZhiboListResp
zhibo
=
zhiboMap
.
get
(
themeContent
.
getRemark
());
themeContent
.
setDetail
(
AttachmentDetailVo
.
builder
().
zhibo
(
zhibo
).
build
());
}
}
else
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
SHORT_VIDEO
.
type
))
{
if
(
shortVideoMap
.
containsKey
(
themeContent
.
getValue
()))
{
themeContent
.
setDetail
(
AttachmentDetailVo
.
builder
()
.
shortVideo
(
shortVideoMap
.
get
(
themeContent
.
getValue
())).
build
());
}
}
else
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
VIDEO
.
type
)
||
themeContent
.
getType
().
equals
(
RelTypeEnum
.
AUDIO
.
type
))
{
if
(
curriculumMap
.
containsKey
(
themeContent
.
getValue
()))
{
themeContent
.
setDetail
(
AttachmentDetailVo
.
builder
()
.
curriculum
(
curriculumMap
.
get
(
themeContent
.
getValue
())).
build
());
}
}
else
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
if
(
fundMap
.
containsKey
(
themeContent
.
getValue
()))
{
FundInfoBaseResp
product
=
fundMap
.
get
(
themeContent
.
getValue
());
// 推荐语
product
.
setRemark
(
themeContent
.
getRemark
());
// 产品类型
product
.
setProductType
(
themeContent
.
getProductType
());
themeContent
.
setDetail
(
AttachmentDetailVo
.
builder
()
.
product
(
product
).
build
());
}
}
}
}
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
0413dd68
...
@@ -18,14 +18,19 @@ import java.util.stream.Collectors;
...
@@ -18,14 +18,19 @@ import java.util.stream.Collectors;
public
class
ConvertUtil
{
public
class
ConvertUtil
{
public
static
ThemeQo
themeEntityToQo
(
ThemeEntity
themeEntity
)
{
public
static
ThemeQo
themeEntityToQo
2
(
ThemeEntity
themeEntity
)
{
if
(
themeEntity
==
null
){
if
(
themeEntity
==
null
){
return
null
;
return
null
;
}
}
ThemeQo
themeQO
=
new
ThemeQo
();
ThemeQo
themeQO
=
new
ThemeQo
();
BeanUtils
.
copyProperties
(
themeEntity
,
themeQO
);
BeanUtils
.
copyProperties
(
themeEntity
,
themeQO
);
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{});
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{});
themeQO
.
setContent
(
themeContentQos
);
//首页列表使用,限制附件个数为1(1文本+1附件)
if
(
themeContentQos
!=
null
&&
themeContentQos
.
size
()
>
2
)
{
themeQO
.
setContent
(
themeContentQos
.
subList
(
0
,
2
));
}
else
{
themeQO
.
setContent
(
themeContentQos
);
}
return
themeQO
;
return
themeQO
;
}
}
...
@@ -36,8 +41,13 @@ public class ConvertUtil {
...
@@ -36,8 +41,13 @@ public class ConvertUtil {
return
themeEntity
;
return
themeEntity
;
}
}
/**
* 首页主题列表,限制附件个数为1(1文本+1附件)
* @param themeEntities
* @return
*/
public
static
List
<
ThemeQo
>
themeEntitiesToDTOs
(
List
<
ThemeEntity
>
themeEntities
)
{
public
static
List
<
ThemeQo
>
themeEntitiesToDTOs
(
List
<
ThemeEntity
>
themeEntities
)
{
return
themeEntities
.
stream
().
map
(
ConvertUtil:
:
themeEntityToQo
).
collect
(
Collectors
.
toList
());
return
themeEntities
.
stream
().
map
(
ConvertUtil:
:
themeEntityToQo
2
).
collect
(
Collectors
.
toList
());
}
}
...
...
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