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
9b60af56
Commit
9b60af56
authored
Feb 21, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
讨论区附件
parent
f1224b4e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
191 additions
and
7 deletions
+191
-7
TopicAttachmentDetail.java
...m/tanpu/community/api/beans/qo/TopicAttachmentDetail.java
+3
-1
FundCompanyVO.java
...ava/com/tanpu/community/api/beans/resp/FundCompanyVO.java
+54
-0
Net.java
...src/main/java/com/tanpu/community/api/beans/resp/Net.java
+38
-0
MyFeignInterceptor.java
...n/java/com/tanpu/community/config/MyFeignInterceptor.java
+57
-0
FeignBackClientForProducts.java
...u/community/feign/product/FeignBackClientForProducts.java
+8
-0
FeignClientForProducts.java
...tanpu/community/feign/product/FeignClientForProducts.java
+6
-0
FeignService.java
...c/main/java/com/tanpu/community/service/FeignService.java
+14
-0
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+11
-6
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/TopicAttachmentDetail.java
View file @
9b60af56
package
com
.
tanpu
.
community
.
api
.
beans
.
qo
;
import
com.tanpu.community.api.beans.resp.CoursePackageSimpleResp
;
import
com.tanpu.community.api.beans.resp.FundCompanyVO
;
import
com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp
;
import
com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -23,7 +24,8 @@ public class TopicAttachmentDetail {
private
CoursePackageSimpleResp
coursePackage
;
@ApiModelProperty
(
"线下活动"
)
private
OfflineActivitySimpleResp
activity
;
@ApiModelProperty
(
"资管人"
)
private
FundCompanyVO
fundCompany
;
}
community-api/src/main/java/com/tanpu/community/api/beans/resp/FundCompanyVO.java
0 → 100644
View file @
9b60af56
package
com
.
tanpu
.
community
.
api
.
beans
.
resp
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author: zhoupeng
* @email: zhoupeng_08@163.com
*/
@ApiModel
(
"基金公司信息"
)
@Data
public
class
FundCompanyVO
{
@ApiModelProperty
(
"icon"
)
private
String
img
;
@ApiModelProperty
(
"公司简介"
)
private
String
companyProfile
;
@ApiModelProperty
(
"基金公司id"
)
private
String
companyId
;
@ApiModelProperty
(
"公司名称"
)
private
String
companyName
;
@ApiModelProperty
(
"总金额 单位:亿元"
)
private
String
totalMoney
;
@ApiModelProperty
(
"基金总数量"
)
private
Integer
totalFund
;
@ApiModelProperty
(
"代表id"
)
private
String
fundId
;
@ApiModelProperty
(
"对比产品id"
)
private
String
ratioId
;
@ApiModelProperty
(
"基金名称"
)
private
String
fundName
;
@ApiModelProperty
(
"成立以来的累计收益"
)
private
String
retIncep
;
@ApiModelProperty
(
"最新净值"
)
private
Net
net
;
@ApiModelProperty
(
"运行时间 时间戳"
)
private
Long
time
;
@ApiModelProperty
(
"成立时间"
)
private
Long
inceptionDate
;
}
community-api/src/main/java/com/tanpu/community/api/beans/resp/Net.java
0 → 100644
View file @
9b60af56
package
com
.
tanpu
.
community
.
api
.
beans
.
resp
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
/**
* @author: zhoupeng
* @email: zhoupeng_08@163.com
*/
@ApiModel
(
"净值"
)
@Data
@Builder
@AllArgsConstructor
public
class
Net
{
@ApiModelProperty
(
"基金ID"
)
private
String
fundId
;
@ApiModelProperty
(
"净值日期 返回时间戳"
)
private
Long
netDate
;
@ApiModelProperty
(
"单位净值"
)
private
String
netValue
;
@ApiModelProperty
(
"累计净值(分红再投)"
)
private
String
cumulativeNav
;
public
Net
()
{
}
public
Net
(
Long
netDate
,
String
netValue
,
String
cumulativeNav
)
{
this
.
netDate
=
netDate
;
this
.
netValue
=
netValue
;
this
.
cumulativeNav
=
cumulativeNav
;
}
}
community-service/src/main/java/com/tanpu/community/config/MyFeignInterceptor.java
0 → 100644
View file @
9b60af56
package
com
.
tanpu
.
community
.
config
;
import
feign.RequestInterceptor
;
import
feign.RequestTemplate
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Collection
;
import
java.util.Enumeration
;
import
java.util.Map
;
/**
* @description: 透传spring 头信息
* @author: wanglei
* @created: 2020/05/08 11:55
*/
@Slf4j
@Component
public
class
MyFeignInterceptor
implements
RequestInterceptor
{
@Override
public
void
apply
(
RequestTemplate
template
)
{
HttpServletRequest
request
=
getHttpServletRequest
();
if
(
request
!=
null
)
{
Map
<
String
,
Collection
<
String
>>
feignHeaders
=
template
.
headers
();
Enumeration
<
String
>
headerNames
=
request
.
getHeaderNames
();
while
(
headerNames
.
hasMoreElements
())
{
String
name
=
headerNames
.
nextElement
();
// 不覆盖feign的头信息
if
(!
feignHeaders
.
containsKey
(
name
)
)
{
// if (name.equalsIgnoreCase("uid") || name.equalsIgnoreCase("tamptoken")){
template
.
header
(
name
,
request
.
getHeader
(
name
));
// }
}
}
log
.
debug
(
"添加后的头信息:{}"
,
template
.
headers
());
}
else
{
log
.
debug
(
"没有添加feign头信息"
);
}
}
/**
* 如果不是从controller过来的请求(例如定时器等),是没有request对象的
*/
private
HttpServletRequest
getHttpServletRequest
()
{
try
{
return
((
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
()).
getRequest
();
}
catch
(
Exception
e
)
{
}
return
null
;
}
}
\ No newline at end of file
community-service/src/main/java/com/tanpu/community/feign/product/FeignBackClientForProducts.java
View file @
9b60af56
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.resp.FundCompanyVO
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO
;
import
feign.hystrix.FallbackFactory
;
...
...
@@ -42,6 +43,13 @@ public class FeignBackClientForProducts implements FallbackFactory<FeignClientFo
log
.
error
(
"FeignClientForProducts.getCompanyFundCount-查询产品ids:{}"
,
id
);
return
null
;
}
@Override
public
CommonResp
<
FundCompanyVO
>
getFundCompanyInfo
(
String
id
)
{
log
.
error
(
"请求信息"
,
throwable
);
log
.
error
(
"FeignClientForProducts.getFundCompanyInfo-查询资管人id:{}"
,
id
);
return
null
;
}
};
}
}
community-service/src/main/java/com/tanpu/community/feign/product/FeignClientForProducts.java
View file @
9b60af56
package
com
.
tanpu
.
community
.
feign
.
product
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.resp.FundCompanyVO
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -31,4 +32,9 @@ public interface FeignClientForProducts {
@ApiOperation
(
"私募类型基金公司-持有产品数"
)
@GetMapping
(
"/fund/companyFundCount"
)
CommonResp
<
FundCompanySimpleVO
>
getCompanyFundCount
(
@ApiParam
(
"基金公司id"
)
@RequestParam
(
"id"
)
String
id
);
@ApiOperation
(
"基金公司详情"
)
@GetMapping
(
"/fund/company"
)
CommonResp
<
FundCompanyVO
>
getFundCompanyInfo
(
@ApiParam
(
"基金公司id"
)
@RequestParam
(
"id"
)
String
id
);
}
community-service/src/main/java/com/tanpu/community/service/FeignService.java
View file @
9b60af56
...
...
@@ -3,6 +3,7 @@ package com.tanpu.community.service;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.resp.CoursePackageSimpleResp
;
import
com.tanpu.community.api.beans.resp.FundCompanyVO
;
import
com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp
;
import
com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp
;
import
com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp
;
...
...
@@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Function
;
...
...
@@ -183,6 +185,18 @@ public class FeignService {
});
}
public
List
<
FundCompanyVO
>
getFundCompany
(
List
<
String
>
companyIds
)
{
return
batchExecute
(
"getCoursePackageList"
,
companyIds
,
FundCompanyVO
.
class
,
FundCompanyVO:
:
getCompanyId
,
ids
->
{
CommonResp
<
FundCompanyVO
>
resp
=
feignForProduct
.
getFundCompanyInfo
(
ids
.
get
(
0
));
if
(
resp
.
isSuccess
())
{
return
Arrays
.
asList
(
resp
.
getData
());
}
else
{
return
new
ArrayList
<>();
}
});
}
private
<
T
>
List
<
T
>
batchExecute
(
String
keyPrefix
,
List
<
String
>
keys
,
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
9b60af56
...
...
@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.qo.TopicFollowQo;
import
com.tanpu.community.api.beans.qo.TopicPageDetailQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.resp.CoursePackageSimpleResp
;
import
com.tanpu.community.api.beans.resp.FundCompanyVO
;
import
com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
...
...
@@ -186,17 +187,21 @@ public class TopicService {
// 基金
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
FUND
.
type
).
detail
(
null
).
build
();
attachements
.
add
(
attach
);
}
else
if
(
RelTypeEnum
.
FUND_COMPANY
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
}
else
if
(
RelTypeEnum
.
FUND_COMPANY
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
// 资管人
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
FUND_COMPANY
.
type
).
detail
(
null
).
build
();
List
<
FundCompanyVO
>
fundCompany
=
feignService
.
getFundCompany
(
Collections
.
singletonList
(
entity
.
getSubjectId
()));
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
FUND_COMPANY
.
type
)
.
detail
(
TopicAttachmentDetail
.
builder
().
fundCompany
(
fundCompany
.
get
(
0
)).
build
()).
build
();
attachements
.
add
(
attach
);
}
else
if
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
}
else
if
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
// 课程包
List
<
CoursePackageSimpleResp
>
coursePackage
=
feignService
.
getCoursePackageList
(
Collections
.
singletonList
(
entity
.
getSubjectId
()));
TopicAttachment
Detail
detailVo
=
TopicAttachmentDetail
.
builder
().
coursePackage
(
coursePackage
.
get
(
0
)).
build
();
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
).
detail
(
detailVo
).
build
();
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
)
.
detail
(
TopicAttachmentDetail
.
builder
().
coursePackage
(
coursePackage
.
get
(
0
)).
build
()
).
build
();
attachements
.
add
(
attach
);
}
else
if
(
RelTypeEnum
.
OFFLINE_ACTIVITY
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
}
else
if
(
RelTypeEnum
.
OFFLINE_ACTIVITY
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
// 线下活动
List
<
OfflineActivitySimpleResp
>
activitySimpleList
=
feignService
.
getActivitySimpleList
(
Collections
.
singletonList
(
entity
.
getSubjectId
()));
TopicAttachmentDetail
detailVo
=
TopicAttachmentDetail
.
builder
().
activity
(
activitySimpleList
.
get
(
0
)).
build
();
...
...
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