Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
efbf6613
Commit
efbf6613
authored
Jan 29, 2021
by
田超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fixbug/1004247' into 'master'
bug:[1004247] fixCollect See merge request rays/pcloud-book!1183
parents
8016f8b9
3d396fbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletions
+39
-1
ServeCollectBizImpl.java
.../com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
+39
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
View file @
efbf6613
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.entity.AppType
;
import
com.pcloud.appcenter.app.entity.AppType
;
...
@@ -274,6 +275,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
...
@@ -274,6 +275,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
paramCheck
(
serveCollect
);
paramCheck
(
serveCollect
);
fillParam
(
serveCollect
);
fillParam
(
serveCollect
);
AppletTaskDTO
appletTaskDTO
=
new
AppletTaskDTO
();
AppletTaskDTO
appletTaskDTO
=
new
AppletTaskDTO
();
if
(
StringUtil
.
isEmpty
(
serveCollect
.
getServeTypeName
()))
{
fillTypeCodeAndTypeName
(
Lists
.
newArrayList
(
serveCollect
));
}
serveCollectDao
.
insert
(
serveCollect
);
serveCollectDao
.
insert
(
serveCollect
);
Integer
taskCount
=
readerConsr
.
getTaskCount
(
serveCollect
.
getWechatUserId
(),
MoneyReceiveTypeEnum
.
COLLECTION
.
key
);
Integer
taskCount
=
readerConsr
.
getTaskCount
(
serveCollect
.
getWechatUserId
(),
MoneyReceiveTypeEnum
.
COLLECTION
.
key
);
Integer
subtractTaskCount
=
RmallContants
.
COLLECTION_MONEY_TIMES
-
1
;
Integer
subtractTaskCount
=
RmallContants
.
COLLECTION_MONEY_TIMES
-
1
;
...
@@ -504,17 +508,23 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
...
@@ -504,17 +508,23 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
}
private
void
fillTypeCodeAndTypeName
(
List
<
ServeCollect
>
recordList
){
private
void
fillTypeCodeAndTypeName
(
List
<
ServeCollect
>
recordList
){
List
<
Long
>
newsIdList
=
recordList
.
stream
().
filter
(
serveCollect
->
AppletRecordTypeEnum
.
NEWS
.
value
.
equals
(
serveCollect
.
getServeType
())).
map
(
serveCollect
->
serveCollect
.
getServeId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
productsIdList
=
recordList
.
stream
().
filter
(
serveCollect
->
AppletRecordTypeEnum
.
PRODUCT
.
value
.
equals
(
serveCollect
.
getServeType
())).
List
<
Long
>
productsIdList
=
recordList
.
stream
().
filter
(
serveCollect
->
AppletRecordTypeEnum
.
PRODUCT
.
value
.
equals
(
serveCollect
.
getServeType
())).
map
(
serveCollect
->
serveCollect
.
getServeId
()).
collect
(
Collectors
.
toList
());
map
(
serveCollect
->
serveCollect
.
getServeId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
appIdList
=
recordList
.
stream
().
filter
(
serveCollect
->
AppletRecordTypeEnum
.
APP
.
value
.
equals
(
serveCollect
.
getServeType
())).
List
<
Long
>
appIdList
=
recordList
.
stream
().
filter
(
serveCollect
->
AppletRecordTypeEnum
.
APP
.
value
.
equals
(
serveCollect
.
getServeType
())).
map
(
serveCollect
->
serveCollect
.
getServeId
()).
collect
(
Collectors
.
toList
());
map
(
serveCollect
->
serveCollect
.
getServeId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
AppletNewsDTO
>
newsDtoMap
=
new
HashMap
<>();
Future
<
Map
<
Long
,
AppletNewsDTO
>>
newsDtoMapFuture
=
null
;
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Future
<
Map
<
Long
,
ProductDto
>>
productDtoMapFuture
=
null
;
Future
<
Map
<
Long
,
ProductDto
>>
productDtoMapFuture
=
null
;
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Future
<
Map
<
Long
,
AppDto
>>
appDtoMapFuture
=
null
;
Future
<
Map
<
Long
,
AppDto
>>
appDtoMapFuture
=
null
;
if
(!
ListUtils
.
isEmpty
(
newsIdList
))
{
newsDtoMapFuture
=
ThreadPoolUtils
.
FILL_APPLET_RECORD
.
submit
(()
->
appletNewsBiz
.
getByIds4Record
(
newsIdList
));
}
if
(!
CollUtil
.
isEmpty
(
productsIdList
)){
if
(!
CollUtil
.
isEmpty
(
productsIdList
)){
productDtoMapFuture
=
ThreadPoolUtils
.
FILL_APPLET_RECORD
.
submit
(()
->
productConsr
.
getProBasesByIds
(
productsIdList
));
productDtoMapFuture
=
ThreadPoolUtils
.
FILL_APPLET_RECORD
.
submit
(()
->
productConsr
.
getProBasesByIds
(
productsIdList
));
}
}
...
@@ -524,6 +534,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
...
@@ -524,6 +534,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
Iterator
<
ServeCollect
>
iterator
=
recordList
.
iterator
();
Iterator
<
ServeCollect
>
iterator
=
recordList
.
iterator
();
while
(
iterator
.
hasNext
()){
while
(
iterator
.
hasNext
()){
ServeCollect
serveCollect
=
iterator
.
next
();
ServeCollect
serveCollect
=
iterator
.
next
();
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
NEWS
.
value
,
serveCollect
.
getServeType
())
&&
null
!=
newsDtoMap
)
{
fillNewsTypeNameAndTypeCode
(
newsDtoMap
,
newsDtoMapFuture
,
serveCollect
);
}
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
PRODUCT
.
value
,
serveCollect
.
getServeType
())){
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
PRODUCT
.
value
,
serveCollect
.
getServeType
())){
fillProTypeNameAndTypeCode
(
productDtoMap
,
productDtoMapFuture
,
serveCollect
);
fillProTypeNameAndTypeCode
(
productDtoMap
,
productDtoMapFuture
,
serveCollect
);
}
}
...
@@ -556,6 +569,12 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
...
@@ -556,6 +569,12 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
}
/**
* 填充App收藏的TypeName与TypeCode
* @param appDtoMap
* @param appDtoMapFuture
* @param serveCollect
*/
private
void
fillAppTypeNameAndTypeCode
(
Map
<
Long
,
AppDto
>
appDtoMap
,
Future
<
Map
<
Long
,
AppDto
>>
appDtoMapFuture
,
ServeCollect
serveCollect
){
private
void
fillAppTypeNameAndTypeCode
(
Map
<
Long
,
AppDto
>
appDtoMap
,
Future
<
Map
<
Long
,
AppDto
>>
appDtoMapFuture
,
ServeCollect
serveCollect
){
try
{
try
{
appDtoMap
=
appDtoMapFuture
.
get
();
appDtoMap
=
appDtoMapFuture
.
get
();
...
@@ -571,6 +590,25 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
...
@@ -571,6 +590,25 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
}
}
}
private
void
fillNewsTypeNameAndTypeCode
(
Map
<
Long
,
AppletNewsDTO
>
newsDtoMap
,
Future
<
Map
<
Long
,
AppletNewsDTO
>>
newsDtoMapFuture
,
ServeCollect
serveCollect
){
try
{
newsDtoMap
=
newsDtoMapFuture
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
){
LOGGER
.
error
(
"获取App详情错误:{}=="
,
e
);
}
if
(
CollUtil
.
isEmpty
(
newsDtoMap
)){
return
;
}
if
(
null
!=
newsDtoMap
.
get
(
serveCollect
.
getServeId
())){
if
(
serveCollect
.
getServeTypeCode
()
==
null
){
serveCollect
.
setServeTypeCode
(
"NEWS"
);
}
if
(
null
==
serveCollect
.
getServeTypeName
()){
serveCollect
.
setServeTypeName
(
newsDtoMap
.
get
(
serveCollect
.
getServeId
()).
getSource
());
}
}
}
@Override
@Override
public
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
)
{
public
List
<
Long
>
getAllCollect
(
Long
wechatUserId
,
String
typeCode
)
{
return
serveCollectDao
.
getAllCollect
(
wechatUserId
,
typeCode
);
return
serveCollectDao
.
getAllCollect
(
wechatUserId
,
typeCode
);
...
...
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