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
7cb189b4
Commit
7cb189b4
authored
Jul 29, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
6cb5b693
667f4b45
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
50 deletions
+119
-50
BatchFeignCallService.java
...va/com/tanpu/community/service/BatchFeignCallService.java
+35
-50
FeignService.java
...c/main/java/com/tanpu/community/service/FeignService.java
+84
-0
No files found.
community-service/src/main/java/com/tanpu/community/service/BatchFeignCallService.java
View file @
7cb189b4
...
@@ -204,19 +204,14 @@ public class BatchFeignCallService {
...
@@ -204,19 +204,14 @@ public class BatchFeignCallService {
}
}
if
(!
CollectionUtils
.
isEmpty
(
courseIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
courseIds
))
{
// 新版课程列表
// 新版课程列表
CommonResp
<
List
<
CourseSimpleResp
>>
commonResp
=
List
<
CourseSimpleResp
>
list
=
feignService
.
getCourseSimpleList
(
setToList
(
courseIds
));
feignForCourse
.
getCourseSimpleList
(
setToList
(
courseIds
));
courseMap
.
putAll
(
list
.
stream
().
collect
(
Collectors
.
toMap
(
CourseSimpleResp:
:
getCourseId
,
item
->
item
,(
oldValue
,
newValue
)->
oldValue
)));
if
(
commonResp
.
isSuccess
()
&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
courseMap
.
putAll
(
commonResp
.
getData
().
stream
().
collect
(
Collectors
.
toMap
(
CourseSimpleResp:
:
getCourseId
,
item
->
item
,(
oldValue
,
newValue
)->
oldValue
)));
}
}
}
if
(!
CollectionUtils
.
isEmpty
(
zhiboIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
zhiboIds
))
{
// 直播列表
// 直播列表
CommonResp
<
List
<
ZhiboListResp
>>
commonResp
=
List
<
ZhiboListResp
>
list
=
feignService
.
getZhiboSimpleList
(
setToList
(
zhiboIds
));
feignClientForZhibo
.
simpleList
(
setToList
(
zhiboIds
));
feignClientForZhibo
.
simpleList
(
setToList
(
zhiboIds
));
if
(
commonResp
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
zhiboMap
.
putAll
(
list
.
stream
().
collect
(
Collectors
.
toMap
(
ZhiboListResp:
:
getId
,
item
->
item
,(
oldValue
,
newValue
)->
oldValue
)));
zhiboMap
.
putAll
(
commonResp
.
getData
().
stream
().
collect
(
Collectors
.
toMap
(
ZhiboListResp:
:
getId
,
item
->
item
,(
oldValue
,
newValue
)->
oldValue
)));
}
}
}
if
(!
CollectionUtils
.
isEmpty
(
imageIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
imageIds
))
{
// 查询图片
// 查询图片
...
@@ -239,7 +234,7 @@ public class BatchFeignCallService {
...
@@ -239,7 +234,7 @@ public class BatchFeignCallService {
}
}
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
// 查询用户信息
// 查询用户信息
List
<
UserInfoResp
>
queryUsersListNew
=
feign
ClientForFatools
.
queryUserListNew
(
setToList
(
userIds
));
List
<
UserInfoResp
>
queryUsersListNew
=
feign
Service
.
getUserList
(
setToList
(
userIds
));
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
userMap
.
putAll
(
queryUsersListNew
.
stream
().
collect
(
Collectors
userMap
.
putAll
(
queryUsersListNew
.
stream
().
collect
(
Collectors
.
toMap
(
UserInfoResp:
:
getUserId
,
o
->
o
)));
.
toMap
(
UserInfoResp:
:
getUserId
,
o
->
o
)));
...
@@ -273,16 +268,13 @@ public class BatchFeignCallService {
...
@@ -273,16 +268,13 @@ public class BatchFeignCallService {
// .fundIds(Lists.newArrayList(tanpuFundIds))
// .fundIds(Lists.newArrayList(tanpuFundIds))
// .build();
// .build();
// 探普产品
// 探普产品
CommonResp
<
List
<
ProductInfoVO
>>
commonResp
=
List
<
ProductInfoVO
>
list
=
feignService
.
getProductInfoByIds
(
setToList
(
tanpuFundIds
));
feignForProduct
.
getProductInfoByIds
(
setToList
(
tanpuFundIds
));
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
list
.
stream
().
map
(
item
->
{
if
(
commonResp
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
commonResp
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
commonResp
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
tampFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
tampFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
tampFundMap
!=
null
&&
tampFundMap
.
size
()
>
0
)
{
if
(
tampFundMap
!=
null
&&
tampFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
tampFundMap
);
fundMap
.
putAll
(
tampFundMap
);
...
@@ -291,16 +283,13 @@ public class BatchFeignCallService {
...
@@ -291,16 +283,13 @@ public class BatchFeignCallService {
// 私募产品
// 私募产品
if
(!
CollectionUtils
.
isEmpty
(
fundIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
fundIds
))
{
// 私募产品
// 私募产品
CommonResp
<
List
<
ProductInfoVO
>>
fundResult
=
List
<
ProductInfoVO
>
list
=
feignService
.
getFundList
(
setToList
(
fundIds
));
feignForFund
.
getProductList
(
setToList
(
fundIds
));
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
list
.
stream
().
map
(
item
->
{
if
(
fundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
fundResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
fundResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
privateFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
privateFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
privateFundMap
!=
null
&&
privateFundMap
.
size
()
>
0
)
{
if
(
privateFundMap
!=
null
&&
privateFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
privateFundMap
);
fundMap
.
putAll
(
privateFundMap
);
...
@@ -309,16 +298,14 @@ public class BatchFeignCallService {
...
@@ -309,16 +298,14 @@ public class BatchFeignCallService {
// 理财师导入产品
// 理财师导入产品
if
(!
CollectionUtils
.
isEmpty
(
ifaFundIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
ifaFundIds
))
{
CommonResp
<
List
<
ProductInfoVO
>>
ifaFundResult
=
List
<
ProductInfoVO
>
list
=
feignService
.
getPrivateFundList
(
setToList
(
ifaFundIds
));
feignForFund
.
getPrivateFundList
(
setToList
(
ifaFundIds
));
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
list
.
stream
().
map
(
item
->
{
if
(
ifaFundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
ifaFundResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
ifaFundResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
ifaFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
ifaFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
ifaFundMap
!=
null
&&
ifaFundMap
.
size
()
>
0
)
{
if
(
ifaFundMap
!=
null
&&
ifaFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
ifaFundMap
);
fundMap
.
putAll
(
ifaFundMap
);
...
@@ -327,16 +314,14 @@ public class BatchFeignCallService {
...
@@ -327,16 +314,14 @@ public class BatchFeignCallService {
if
(!
CollectionUtils
.
isEmpty
(
publicFundIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
publicFundIds
))
{
// 公募产品
// 公募产品
CommonResp
<
List
<
ProductInfoVO
>>
publicFundResult
=
List
<
ProductInfoVO
>
list
=
feignService
.
getPublicFundList
(
setToList
(
publicFundIds
));
feignForPublicFund
.
getProductList
(
setToList
(
publicFundIds
));
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
list
.
stream
().
map
(
item
->
{
if
(
publicFundResult
.
isSuccess
()
&&
!
CollectionUtils
.
isEmpty
(
publicFundResult
.
getData
()))
{
List
<
FundInfoBaseResp
>
fundInfoBaseRespList
=
publicFundResult
.
getData
().
stream
().
map
(
item
->
{
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
FundInfoBaseResp
fundInfoBaseResp
=
FundInfoBaseResp
.
builder
().
build
();
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
BeanUtils
.
copyProperties
(
item
,
fundInfoBaseResp
);
return
fundInfoBaseResp
;
return
fundInfoBaseResp
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
publicFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
publicFundMap
=
fundInfoBaseRespList
.
stream
().
collect
(
Collectors
.
toMap
(
FundInfoBaseResp:
:
getFundId
,
item
->
item
));
}
if
(
publicFundMap
!=
null
&&
publicFundMap
.
size
()
>
0
)
{
if
(
publicFundMap
!=
null
&&
publicFundMap
.
size
()
>
0
)
{
fundMap
.
putAll
(
publicFundMap
);
fundMap
.
putAll
(
publicFundMap
);
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/FeignService.java
View file @
7cb189b4
...
@@ -3,8 +3,11 @@ package com.tanpu.community.service;
...
@@ -3,8 +3,11 @@ package com.tanpu.community.service;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO
;
import
com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp
;
import
com.tanpu.community.cache.LocalCache
;
import
com.tanpu.community.cache.LocalCache
;
import
com.tanpu.community.feign.course.FeignClientForCourse
;
import
com.tanpu.community.feign.course.FeignClientForCourse
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
...
@@ -76,6 +79,87 @@ public class FeignService {
...
@@ -76,6 +79,87 @@ public class FeignService {
});
});
}
}
public
List
<
CourseSimpleResp
>
getCourseSimpleList
(
List
<
String
>
courseIds
)
{
return
batchExecute
(
"getCourseSimpleList_"
,
courseIds
,
CourseSimpleResp
.
class
,
CourseSimpleResp:
:
getCourseId
,
ids
->
{
CommonResp
<
List
<
CourseSimpleResp
>>
resp
=
feignForCourse
.
getCourseSimpleList
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
public
List
<
ZhiboListResp
>
getZhiboSimpleList
(
List
<
String
>
zhiboIds
)
{
return
batchExecute
(
"getZhiboSimpleList_"
,
zhiboIds
,
ZhiboListResp
.
class
,
ZhiboListResp:
:
getId
,
ids
->
{
CommonResp
<
List
<
ZhiboListResp
>>
resp
=
feignClientForZhibo
.
simpleList
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
public
List
<
UserInfoResp
>
getUserList
(
List
<
String
>
userIds
)
{
return
batchExecute
(
"getUserList_"
,
userIds
,
UserInfoResp
.
class
,
UserInfoResp:
:
getUserId
,
ids
->
{
return
feignClientForFatools
.
queryUserListNew
(
ids
);
});
}
public
List
<
ProductInfoVO
>
getProductInfoByIds
(
List
<
String
>
fundIds
)
{
return
batchExecute
(
"getProductInfoByIds_"
,
fundIds
,
ProductInfoVO
.
class
,
ProductInfoVO:
:
getFundId
,
ids
->
{
CommonResp
<
List
<
ProductInfoVO
>>
resp
=
feignForProduct
.
getProductInfoByIds
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
public
List
<
ProductInfoVO
>
getFundList
(
List
<
String
>
fundIds
)
{
return
batchExecute
(
"getFundList"
,
fundIds
,
ProductInfoVO
.
class
,
ProductInfoVO:
:
getFundId
,
ids
->
{
CommonResp
<
List
<
ProductInfoVO
>>
resp
=
feignForFund
.
getProductList
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
public
List
<
ProductInfoVO
>
getPrivateFundList
(
List
<
String
>
fundIds
)
{
return
batchExecute
(
"getPrivateFundList"
,
fundIds
,
ProductInfoVO
.
class
,
ProductInfoVO:
:
getFundId
,
ids
->
{
CommonResp
<
List
<
ProductInfoVO
>>
resp
=
feignForFund
.
getPrivateFundList
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
public
List
<
ProductInfoVO
>
getPublicFundList
(
List
<
String
>
fundIds
)
{
return
batchExecute
(
"getPublicFundList"
,
fundIds
,
ProductInfoVO
.
class
,
ProductInfoVO:
:
getFundId
,
ids
->
{
CommonResp
<
List
<
ProductInfoVO
>>
resp
=
feignForPublicFund
.
getProductList
(
ids
);
if
(
resp
.
isSuccess
())
{
return
resp
.
getData
();
}
else
{
return
new
ArrayList
<>();
}
});
}
private
<
T
>
List
<
T
>
batchExecute
(
String
keyPrefix
,
private
<
T
>
List
<
T
>
batchExecute
(
String
keyPrefix
,
List
<
String
>
keys
,
List
<
String
>
keys
,
Class
<
T
>
clz
,
Class
<
T
>
clz
,
...
...
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