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
5fb355ac
Commit
5fb355ac
authored
Mar 11, 2022
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1006670] 落地页3期接口优化
parent
3e9dfec3
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
364 additions
and
54 deletions
+364
-54
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+12
-0
AppConsr.java
.../src/main/java/com/pcloud/book/consumer/app/AppConsr.java
+12
-0
ProductConsr.java
.../java/com/pcloud/book/consumer/resource/ProductConsr.java
+46
-0
TradeConsr.java
.../main/java/com/pcloud/book/consumer/trade/TradeConsr.java
+36
-0
ResourcePageBiz.java
.../main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
+5
-0
ResourcePageBizImpl.java
...a/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
+196
-52
ResourcePageColumnDao.java
...java/com/pcloud/book/group/dao/ResourcePageColumnDao.java
+3
-1
ResourcePageColumnDaoImpl.java
...pcloud/book/group/dao/impl/ResourcePageColumnDaoImpl.java
+10
-1
ResourcePageFacade.java
...com/pcloud/book/group/facade/impl/ResourcePageFacade.java
+29
-0
ResourcePageColumnDao.xml
...src/main/resources/mapper/group/ResourcePageColumnDao.xml
+15
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/constant/BookConstant.java
View file @
5fb355ac
...
@@ -474,4 +474,16 @@ public class BookConstant {
...
@@ -474,4 +474,16 @@ public class BookConstant {
* 手机号授权
* 手机号授权
*/
*/
public
static
final
String
BOOK_PHONE_AUTH_CACHE_KEY
=
CacheConstant
.
BOOK
+
"getBookPhoneAuth:"
;
public
static
final
String
BOOK_PHONE_AUTH_CACHE_KEY
=
CacheConstant
.
BOOK
+
"getBookPhoneAuth:"
;
/**
* 编辑默认渠道缓存
*/
public
static
final
String
ADVISER_DEFAULT_CHANNEL_ID_CACHE
=
CacheConstant
.
BOOK
+
"adviserDefaultChannelIdCache"
;
/**
* 关注公众号临时二维码
*/
public
static
final
String
PAGE_ID_TEMP_CODE_CACHE
=
CacheConstant
.
BOOK
+
"TEMPCODE"
;
public
static
final
String
PAGE_ID_CODE_CACHE
=
CacheConstant
.
BOOK
+
"PAGECODE"
;
public
static
final
String
PAGE_ID_LOGOURL_CACHE
=
CacheConstant
.
BOOK
+
"LOGOURL"
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/app/AppConsr.java
View file @
5fb355ac
...
@@ -306,4 +306,16 @@ public class AppConsr {
...
@@ -306,4 +306,16 @@ public class AppConsr {
}
}
return
null
;
return
null
;
}
}
@ParamLog
(
description
=
"获取应用基本信息与价格"
,
isAfterReturn
=
false
)
public
Map
<
Long
,
AppDto
>
mapBaseWithPriceByIds
(
List
<
Long
>
appIds
){
if
(
ListUtils
.
isEmpty
(
appIds
))
return
null
;
try
{
Map
<
Long
,
AppDto
>
appBaseStatus
=
ResponseHandleUtil
.
parseMap
(
appService
.
mapBaseWithPriceByIds
(
appIds
),
Long
.
class
,
AppDto
.
class
);
return
appBaseStatus
;
}
catch
(
Exception
e
){
LOGGER
.
error
(
"获取应用基本信息与价格失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/resource/ProductConsr.java
View file @
5fb355ac
...
@@ -186,6 +186,52 @@ public class ProductConsr {
...
@@ -186,6 +186,52 @@ public class ProductConsr {
}
}
/**
* 资源中心拉取商品最基本信息
*/
public
Map
<
Long
,
ProductDto
>
getProductBasesByIds4Book
(
List
<
Long
>
productIds
)
throws
BizException
{
LOGGER
.
info
(
"【资源中心(消)】获取商品最最基本信息4Book,<START>.[productIds]="
+
productIds
+
"]"
);
if
(
productIds
==
null
||
productIds
.
isEmpty
())
{
return
null
;
}
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
productIds
=
productIds
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
Integer
size
=
productIds
.
size
();
if
(
productIds
.
size
()
>
1000
)
{
Integer
[]
queryCountArray
=
{
0
,
1
,
2
,
3
};
Integer
queryCount
=
4
;
//并发查询
List
<
Long
>
finalProductIds
=
productIds
;
Map
<
Long
,
ProductDto
>
finalProductDtoMap
=
productDtoMap
;
CompletableFuture
[]
completableFutures
=
Arrays
.
stream
(
queryCountArray
).
map
(
x
->
CompletableFuture
.
supplyAsync
(()
->
{
Integer
startIndex
=
size
/
queryCount
*
x
;
Integer
endIndex
=
size
/
queryCount
*
(
x
+
1
);
List
<
Long
>
queryList
=
finalProductIds
.
subList
(
startIndex
,
endIndex
);
Map
<
Long
,
ProductDto
>
productMap
=
ResponseHandleUtil
.
parseMapResponse
(
productService
.
getProductBasesByIds4Book
(
queryList
),
Long
.
class
,
ProductDto
.
class
);
return
productMap
;
},
ThreadPoolUtils
.
EXPORT_THREAD_POOL
).
whenComplete
(((
productMap
,
throwable
)
->
{
finalProductDtoMap
.
putAll
(
productMap
);
}))).
toArray
(
CompletableFuture
[]::
new
);
try
{
CompletableFuture
.
allOf
(
completableFutures
).
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
LOGGER
.
warn
(
"[getProductBasesByIds4Book] 填充信息失败,err:{}"
,
e
.
getMessage
(),
e
);
}
return
finalProductDtoMap
;
}
else
{
try
{
productDtoMap
=
ResponseHandleUtil
.
parseMapResponse
(
productService
.
getProductBasesByIds4Book
(
productIds
),
Long
.
class
,
ProductDto
.
class
);
}
catch
(
BizException
e
)
{
LOGGER
.
warn
(
"调用:productService.getProductBasesByIds4Book报错"
,
e
.
getMessage
(),
e
);
}
return
productDtoMap
;
}
}
/**
/**
* 资源中心拉取商品基本信息
* 资源中心拉取商品基本信息
*/
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/trade/TradeConsr.java
View file @
5fb355ac
...
@@ -371,4 +371,40 @@ public class TradeConsr {
...
@@ -371,4 +371,40 @@ public class TradeConsr {
}
}
return
null
;
return
null
;
}
}
/**
* 应用作品购买状态
*/
public
Map
<
String
,
Boolean
>
mapAppProductBuyStateOpt
(
Long
wechatUserId
,
List
<
Long
>
appIds
,
List
<
Long
>
productIds
)
{
if
(
null
==
wechatUserId
||
(
ListUtils
.
isEmpty
(
appIds
)
&&
ListUtils
.
isEmpty
(
productIds
)))
{
return
new
HashMap
<>();
}
OrderSearchDto
orderSearchDto
=
new
OrderSearchDto
();
orderSearchDto
.
setAppIds
(
appIds
);
orderSearchDto
.
setProductIds
(
productIds
);
orderSearchDto
.
setWechatUserId
(
wechatUserId
);
try
{
return
ResponseHandleUtil
.
parseMap
(
orderFormService
.
mapAppProductBuyStateOpt
(
orderSearchDto
),
String
.
class
,
Boolean
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用orderFormService.mapAppProductBuyStateOpt失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 课程单节课购买状态
*/
public
Map
<
Long
,
Boolean
>
mapCourseProductBuyStateOpt
(
Long
wechatUserId
,
List
<
Long
>
productIds
)
{
if
(
null
==
wechatUserId
||
ListUtils
.
isEmpty
(
productIds
))
{
return
new
HashMap
<>();
}
OrderSearchDto
orderSearchDto
=
new
OrderSearchDto
();
orderSearchDto
.
setProductIds
(
productIds
);
orderSearchDto
.
setWechatUserId
(
wechatUserId
);
try
{
return
ResponseHandleUtil
.
parseMap
(
orderFormService
.
mapCourseProductBuyStateOpt
(
orderSearchDto
),
Long
.
class
,
Boolean
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"调用orderFormService.mapCourseProductBuyStateOpt失败"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
View file @
5fb355ac
...
@@ -535,6 +535,11 @@ public interface ResourcePageBiz {
...
@@ -535,6 +535,11 @@ public interface ResourcePageBiz {
*/
*/
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
);
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
);
List
<
Integer
>
getColumnTypeByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
);
//优化 此处把模块分开调接口 columnType
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4WechatV2
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Integer
columnType
);
/**
/**
* 保存分享配置
* 保存分享配置
* @param param
* @param param
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
5fb355ac
...
@@ -181,6 +181,8 @@ import java.util.concurrent.TimeoutException;
...
@@ -181,6 +181,8 @@ import java.util.concurrent.TimeoutException;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.security.auth.callback.CallbackHandler
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
...
@@ -1026,10 +1028,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1026,10 +1028,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageId = pageId;
resourcePageId = pageId;
navigationId = naviId;
navigationId = naviId;
}*/
}*/
long
t1
=
System
.
currentTimeMillis
();
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
null
);
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
);
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第一步耗时="
+(
t2
-
t1
));
if
(
CollUtil
.
isNotEmpty
(
serveVOS
))
{
if
(
CollUtil
.
isNotEmpty
(
serveVOS
))
{
List
<
ResourcePageItemVO
>
itemVOList
;
List
<
ResourcePageItemVO
>
itemVOList
;
if
(
null
!=
wechatUserId
)
{
if
(
null
!=
wechatUserId
)
{
...
@@ -1037,13 +1036,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1037,13 +1036,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
else
{
}
else
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
null
);
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
null
);
}
}
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第二步耗时="
+(
t3
-
t2
));
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
//二维码类型
//二维码类型
fillQrcodeType
(
resourcePageId
,
itemVOList
);
fillQrcodeType
(
resourcePageId
,
itemVOList
);
long
t4
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第三步耗时="
+(
t4
-
t3
));
Map
<
String
,
List
<
ResourcePageItemVO
>>
listMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getServeType
));
Map
<
String
,
List
<
ResourcePageItemVO
>>
listMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getServeType
));
itemVOList
=
new
ArrayList
<>();
itemVOList
=
new
ArrayList
<>();
//应用和作品提出来一起查
//应用和作品提出来一起查
...
@@ -1057,14 +1052,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1057,14 +1052,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
this
.
fillResourceByType
(
entry
.
getValue
(),
wechatUserId
,
entry
.
getKey
());
this
.
fillResourceByType
(
entry
.
getValue
(),
wechatUserId
,
entry
.
getKey
());
itemVOList
.
addAll
(
entry
.
getValue
());
itemVOList
.
addAll
(
entry
.
getValue
());
}
}
long
t6
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四步-1耗时="
+(
t6
-
t4
));
if
(
CollUtil
.
isNotEmpty
(
itemAppAndProductVOList
)){
if
(
CollUtil
.
isNotEmpty
(
itemAppAndProductVOList
)){
fillAppProductServe
(
itemAppAndProductVOList
,
wechatUserId
);
fillAppProductServe
(
itemAppAndProductVOList
,
wechatUserId
);
itemVOList
.
addAll
(
itemAppAndProductVOList
);
itemVOList
.
addAll
(
itemAppAndProductVOList
);
}
}
long
t5
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四步-2耗时="
+(
t5
-
t6
));
itemVOList
.
sort
(
Comparator
.
comparing
(
ResourcePageItemVO:
:
getId
));
itemVOList
.
sort
(
Comparator
.
comparing
(
ResourcePageItemVO:
:
getId
));
Map
<
Long
,
List
<
ResourcePageItemVO
>>
columnMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getResourcePageColumnId
));
Map
<
Long
,
List
<
ResourcePageItemVO
>>
columnMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getResourcePageColumnId
));
List
<
ResourceColumnAndServeVO
>
removeColumns
=
new
ArrayList
<>();
List
<
ResourceColumnAndServeVO
>
removeColumns
=
new
ArrayList
<>();
...
@@ -1086,8 +1077,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1086,8 +1077,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
columnAndServeVO
.
setLogoUrl
(
itemVOS
.
get
(
0
).
getLogoUrl
());
columnAndServeVO
.
setLogoUrl
(
itemVOS
.
get
(
0
).
getLogoUrl
());
}
}
}
}
long
t7
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第五步耗时="
+(
t7
-
t5
));
if
(!
ListUtils
.
isEmpty
(
removeColumns
))
{
if
(!
ListUtils
.
isEmpty
(
removeColumns
))
{
serveVOS
.
removeAll
(
removeColumns
);
serveVOS
.
removeAll
(
removeColumns
);
}
}
...
@@ -1097,10 +1086,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1097,10 +1086,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
serveVOS
=
CollUtil
.
toList
();
serveVOS
=
CollUtil
.
toList
();
}
}
// 填充广告
// 填充广告
long
t8
=
System
.
currentTimeMillis
();
this
.
fillAdvertising
(
serveVOS
,
bookId
,
adviserId
,
channelId
,
enableAdverting
);
this
.
fillAdvertising
(
serveVOS
,
bookId
,
adviserId
,
channelId
,
enableAdverting
);
long
t9
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第六步耗时="
+(
t9
-
t8
));
return
serveVOS
;
return
serveVOS
;
}
}
...
@@ -1393,22 +1379,22 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1393,22 +1379,22 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
long
t1
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
MapBaseStatusDTO
>
appPriceMap
=
new
HashMap
<>();
//
Map<Long, MapBaseStatusDTO> appPriceMap = new HashMap<>();
Future
<
Map
<
Long
,
AppDto
>>
appMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
Future
<
Map
<
Long
,
AppDto
>>
appMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
appConsr
.
mapBaseByIds
(
appIds
);
return
appConsr
.
mapBase
WithPrice
ByIds
(
appIds
);
});
});
Future
<
Map
<
Long
,
ProductDto
>>
productMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
Future
<
Map
<
Long
,
ProductDto
>>
productMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
productConsr
.
getProductBasesByIds
(
productIds
);
return
productConsr
.
getProductBasesByIds
4Book
(
productIds
);
});
});
Future
<
Map
<
Long
,
MapBaseStatusDTO
>>
appPriceMapSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
/*
Future<Map<Long, MapBaseStatusDTO>> appPriceMapSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return appConsr.mapBaseStatusById(appIds);
return appConsr.mapBaseStatusById(appIds);
});
});
*/
Map
<
Long
,
AccountSettingDto
>
channelAccountSettingDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AccountSettingDto
>
channelAccountSettingDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AccountSetting
>
accountSettingMap
=
new
HashMap
<>();
Map
<
Long
,
AccountSetting
>
accountSettingMap
=
new
HashMap
<>();
//应用配置公众号工具
//应用配置公众号工具
Map
<
Long
,
Long
>
appOfficialAccountToolMap
=
new
HashMap
<>();
Map
<
Long
,
Long
>
appOfficialAccountToolMap
=
new
HashMap
<>();
//是否购买
//是否购买
Map
<
Lo
ng
,
Boolean
>
buyStateMap
=
new
HashMap
<>();
Map
<
Stri
ng
,
Boolean
>
buyStateMap
=
new
HashMap
<>();
//课程是否购买(单节/整套)
//课程是否购买(单节/整套)
Map
<
Long
,
Boolean
>
courseBuyStateMap
=
new
HashMap
<>();
Map
<
Long
,
Boolean
>
courseBuyStateMap
=
new
HashMap
<>();
if
(
null
!=
wechatUserId
)
{
if
(
null
!=
wechatUserId
)
{
...
@@ -1419,11 +1405,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1419,11 +1405,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Future
<
Map
<
Long
,
AccountSettingDto
>>
channelAccountSettingDtoSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
Future
<
Map
<
Long
,
AccountSettingDto
>>
channelAccountSettingDtoSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
channelConsr
.
listWechatAccountInfo
(
channelIds
);
return
channelConsr
.
listWechatAccountInfo
(
channelIds
);
});
});
Future
<
Map
<
Lo
ng
,
Boolean
>>
buyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
Future
<
Map
<
Stri
ng
,
Boolean
>>
buyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
tradeConsr
.
mapAppProductBuyState
(
wechatUserId
,
appIds
,
nonCourseProductIds
);
return
tradeConsr
.
mapAppProductBuyState
Opt
(
wechatUserId
,
appIds
,
nonCourseProductIds
);
});
});
Future
<
Map
<
Long
,
Boolean
>>
courseBuyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
Future
<
Map
<
Long
,
Boolean
>>
courseBuyStateSubmit
=
ThreadPoolUtils
.
RESOURCE_POOL
.
submit
(()
->{
return
tradeConsr
.
mapCourseProductBuyState
(
wechatUserId
,
courseProductIds
);
return
tradeConsr
.
mapCourseProductBuyState
Opt
(
wechatUserId
,
courseProductIds
);
});
});
try
{
try
{
appOfficialAccountToolMap
=
appOfficialAccountToolSubmit
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
appOfficialAccountToolMap
=
appOfficialAccountToolSubmit
.
get
(
ThreadPoolUtils
.
REMOTE_TIME_OUT
,
TimeUnit
.
SECONDS
);
...
@@ -1456,13 +1442,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1456,13 +1442,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
catch
(
InterruptedException
|
ExecutionException
|
TimeoutException
e
)
{
}
catch
(
InterruptedException
|
ExecutionException
|
TimeoutException
e
)
{
log
.
warn
(
"调用资源中心获取商品信息错误:"
+
e
.
getMessage
(),
e
);
log
.
warn
(
"调用资源中心获取商品信息错误:"
+
e
.
getMessage
(),
e
);
}
}
try
{
/*
try {
appPriceMap = appPriceMapSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
appPriceMap = appPriceMapSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
} catch (InterruptedException | ExecutionException | TimeoutException e) {
log.error("调用应用中心获取应用价格信息错误:"+e.getMessage(), e);
log.error("调用应用中心获取应用价格信息错误:"+e.getMessage(), e);
}
}*/
long
t2
=
System
.
currentTimeMillis
();
Map
<
Long
,
Long
>
defaultChannelIdMap
=
new
HashMap
<>();
System
.
out
.
println
(
"第四-2-1步耗时="
+(
t2
-
t1
));
for
(
ResourcePageItemVO
itemVO
:
itemVOS
)
{
for
(
ResourcePageItemVO
itemVO
:
itemVOS
)
{
Long
serveId
=
itemVO
.
getServeId
();
Long
serveId
=
itemVO
.
getServeId
();
String
serveType
=
itemVO
.
getServeType
();
String
serveType
=
itemVO
.
getServeType
();
...
@@ -1474,12 +1459,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1474,12 +1459,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
itemVO
.
setTypeCode
(
appDto
.
getTypeCode
());
itemVO
.
setTypeCode
(
appDto
.
getTypeCode
());
itemVO
.
setTypeName
(
appDto
.
getTypeName
());
itemVO
.
setTypeName
(
appDto
.
getTypeName
());
itemVO
.
setTransverseImg
(
appDto
.
getTransverseImg
());
itemVO
.
setTransverseImg
(
appDto
.
getTransverseImg
());
itemVO
.
setPrice
(
appDto
.
getPric
e
());
itemVO
.
setPrice
(
null
==
appDto
.
getRetailPrice
()
?
Double
.
valueOf
(
0
d
)
:
appDto
.
getRetailPrice
().
doubleValu
e
());
itemVO
.
setHasThirdLink
(!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
())?
true
:
false
);
itemVO
.
setHasThirdLink
(!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
())?
true
:
false
);
if
(!
MapUtils
.
isEmpty
(
appPriceMap
)
&&
appPriceMap
.
containsKey
(
serveId
))
{
/*
if (!MapUtils.isEmpty(appPriceMap) && appPriceMap.containsKey(serveId)) {
BigDecimal price = appPriceMap.get(serveId).getRetailPrice();
BigDecimal price = appPriceMap.get(serveId).getRetailPrice();
itemVO.setPrice(null == price?Double.valueOf(0d):price.doubleValue());
itemVO.setPrice(null == price?Double.valueOf(0d):price.doubleValue());
}
}
*/
//标记应用共享状态
//标记应用共享状态
itemVO
.
setAppCreateUser
(
appDto
.
getCreatedUser
());
itemVO
.
setAppCreateUser
(
appDto
.
getCreatedUser
());
itemVO
.
setShareState
(
appDto
.
getShareState
());
itemVO
.
setShareState
(
appDto
.
getShareState
());
...
@@ -1507,14 +1492,34 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1507,14 +1492,34 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Long
channelId
=
getChannelIdFromUrl
(
itemVO
.
getLinkUrl
());
Long
channelId
=
getChannelIdFromUrl
(
itemVO
.
getLinkUrl
());
if
(
null
==
channelId
)
{
if
(
null
==
channelId
)
{
log
.
info
(
itemVO
.
getServeName
()
+
"无运营平台, serveId="
+
itemVO
.
getServeId
());
log
.
info
(
itemVO
.
getServeName
()
+
"无运营平台, serveId="
+
itemVO
.
getServeId
());
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
if
(
defaultChannelIdMap
.
containsKey
(
adviserId
)){
channelId
=
defaultChannelIdMap
.
get
(
adviserId
);
if
(
null
!=
channelId
){
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
}
}
else
{
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
if
(
null
!=
channelId
)
{
defaultChannelIdMap
.
put
(
adviserId
,
channelId
);
}
}
}
}
itemVO
.
setChannelId
(
channelId
);
itemVO
.
setChannelId
(
channelId
);
if
(
null
!=
wechatUserId
)
{
if
(
null
!=
wechatUserId
)
{
setResourceLink4Wechat
(
itemVO
,
channelAccountSettingDtoMap
,
appOfficialAccountToolMap
,
accountSettingMap
);
setResourceLink4Wechat
(
itemVO
,
channelAccountSettingDtoMap
,
appOfficialAccountToolMap
,
accountSettingMap
);
itemVO
.
setBuyState
(
false
);
itemVO
.
setBuyState
(
false
);
if
(!
MapUtils
.
isEmpty
(
buyStateMap
)
&&
buyStateMap
.
containsKey
(
serveId
))
{
if
(!
MapUtils
.
isEmpty
(
buyStateMap
))
{
itemVO
.
setBuyState
(
buyStateMap
.
get
(
serveId
));
if
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
serveType
)){
String
key
=
"PRODUCT"
+
serveId
;
if
(
buyStateMap
.
containsKey
(
key
)){
itemVO
.
setBuyState
(
buyStateMap
.
get
(
key
));
}
}
else
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
serveType
)){
String
key
=
"APP"
+
serveId
;
if
(
buyStateMap
.
containsKey
(
key
)){
itemVO
.
setBuyState
(
buyStateMap
.
get
(
key
));
}
}
}
}
if
(!
MapUtils
.
isEmpty
(
courseBuyStateMap
)
&&
courseBuyStateMap
.
containsKey
(
serveId
)
if
(!
MapUtils
.
isEmpty
(
courseBuyStateMap
)
&&
courseBuyStateMap
.
containsKey
(
serveId
)
&&
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
itemVO
.
getServeType
()))
{
&&
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
itemVO
.
getServeType
()))
{
...
@@ -1522,8 +1527,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -1522,8 +1527,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
}
}
}
}
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第四-2-2步耗时="
+(
t3
-
t2
));
}
}
/**
/**
...
@@ -2102,7 +2105,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -2102,7 +2105,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
* * @param null
* * @param null
*/
*/
private
void
updateSeq4Batch
(
Long
resourcePageId
,
Long
navigationId
)
{
private
void
updateSeq4Batch
(
Long
resourcePageId
,
Long
navigationId
)
{
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
);
List
<
ResourceColumnAndServeVO
>
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
null
);
if
(
ListUtils
.
isEmpty
(
serveVOS
))
{
if
(
ListUtils
.
isEmpty
(
serveVOS
))
{
return
;
return
;
}
}
...
@@ -3167,22 +3170,54 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -3167,22 +3170,54 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
qrcodeTemp
.
setAccountSettingId
(
accountSettingId
);
qrcodeTemp
.
setAccountSettingId
(
accountSettingId
);
qrcodeTemp
.
setCreatedUser
(
wechatUserId
);
qrcodeTemp
.
setCreatedUser
(
wechatUserId
);
qrcodeTemp
.
setPageId
(
resourcePageId
);
qrcodeTemp
.
setPageId
(
resourcePageId
);
String
qrcodeUrl
=
qrcodeSceneConsr
.
createTempQrcode4H5
(
qrcodeTemp
);
String
qrcodeUrl
=
null
;
try
{
qrcodeUrl
=
qrcodeSceneConsr
.
createTempQrcode4H5
(
qrcodeTemp
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"H5生成临时二维码失败"
+
e
.
getMessage
());
pageItemVO
=
new
ResourcePageItemVO
();
pageItemVO
.
setPopupState
(
popupState
);
return
pageItemVO
;
}
//todo 每个人生成的码都缓存下来。如果公众号id。或者logoUrl变了。要删缓存。临时二维码有效期30天
String
tempKey
=
BookConstant
.
PAGE_ID_TEMP_CODE_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
String
logoUrlKey
=
BookConstant
.
PAGE_ID_LOGOURL_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
String
pageKey
=
BookConstant
.
PAGE_ID_CODE_CACHE
+
resourcePageId
+
"-"
+
accountSettingId
+
"-"
+
wechatUserId
;
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
)
&&
!
StringUtil
.
isEmpty
(
logoUrl
))
{
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
)
&&
!
StringUtil
.
isEmpty
(
logoUrl
))
{
//添加Logo
String
cacheQrcodeUrl
=
JedisClusterUtils
.
get
(
tempKey
);
String
url
=
""
;
String
cacheLogoUrl
=
JedisClusterUtils
.
get
(
logoUrlKey
);
String
tmpDirPath
=
FileUtil
.
getTmpDirPath
();
//qrcodeUrl 变了要重新生成
if
(!
tmpDirPath
.
endsWith
(
File
.
separator
))
{
if
(
StrUtil
.
isBlank
(
cacheQrcodeUrl
)){
tmpDirPath
=
tmpDirPath
+
File
.
separator
;
JedisClusterUtils
.
set
(
tempKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
else
{
//如果缓存里面有值。然后就从缓存里面拿的和新拿到的qrcodeUrl比较。如果不同。说明原来的临时二维码到期了。重新生成了。那么都要重新生成一次
if
(!
cacheQrcodeUrl
.
equalsIgnoreCase
(
qrcodeUrl
)){
//重新生成
JedisClusterUtils
.
set
(
tempKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
}
}
File
file
=
FileUtil
.
touch
(
tmpDirPath
+
UUIDUitl
.
generateShort
()
+
".png"
);
//logoUrl 变了也要重新生成
HttpUtil
.
downloadFile
(
qrcodeUrl
,
file
);
if
(
StrUtil
.
isBlank
(
cacheLogoUrl
)){
try
{
JedisClusterUtils
.
set
(
logoUrlKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
url
=
QrCodeUtil
.
decode
(
file
);
}
else
{
}
catch
(
QrCodeException
e
){
//如果缓存里面有值。然后就从缓存里面拿的和新拿到的logoUrl比较。如果不同。说明变了logoUrl了。那么都要重新生成一次
log
.
info
(
"解析二维码图片失败,qrcodeUrl:{}"
,
qrcodeUrl
);
if
(!
cacheLogoUrl
.
equalsIgnoreCase
(
logoUrl
)){
//重新生成
JedisClusterUtils
.
set
(
logoUrlKey
,
logoUrl
,
60
*
60
*
24
*
30
);
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
}
String
cachePageUrl
=
JedisClusterUtils
.
get
(
pageKey
);
if
(
StrUtil
.
isNotBlank
(
cachePageUrl
)){
qrcodeUrl
=
cacheQrcodeUrl
;
}
else
{
//添加Logo
qrcodeUrl
=
getQrcodeUrl
(
logoUrl
,
qrcodeUrl
);
JedisClusterUtils
.
set
(
pageKey
,
qrcodeUrl
,
60
*
60
*
24
*
30
);
}
}
qrcodeUrl
=
this
.
getLogoQrcode
(
url
,
logoUrl
,
qrcodeUrl
);
}
}
pageItemVO
.
setResultUrl
(
qrcodeUrl
);
pageItemVO
.
setResultUrl
(
qrcodeUrl
);
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
))
{
if
(!
StringUtil
.
isEmpty
(
qrcodeUrl
))
{
...
@@ -3193,6 +3228,23 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -3193,6 +3228,23 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return
pageItemVO
;
return
pageItemVO
;
}
}
private
String
getQrcodeUrl
(
String
logoUrl
,
String
qrcodeUrl
)
{
String
url
=
""
;
String
tmpDirPath
=
FileUtil
.
getTmpDirPath
();
if
(!
tmpDirPath
.
endsWith
(
File
.
separator
))
{
tmpDirPath
=
tmpDirPath
+
File
.
separator
;
}
File
file
=
FileUtil
.
touch
(
tmpDirPath
+
UUIDUitl
.
generateShort
()
+
".png"
);
HttpUtil
.
downloadFile
(
qrcodeUrl
,
file
);
try
{
url
=
QrCodeUtil
.
decode
(
file
);
}
catch
(
QrCodeException
e
){
log
.
info
(
"解析二维码图片失败,qrcodeUrl:{}"
,
qrcodeUrl
);
}
qrcodeUrl
=
this
.
getLogoQrcode
(
url
,
logoUrl
,
qrcodeUrl
);
return
qrcodeUrl
;
}
@Override
@Override
public
ResourcePageDTO
getResourcePageById
(
Long
resourcePageId
)
{
public
ResourcePageDTO
getResourcePageById
(
Long
resourcePageId
)
{
ResourcePageDTO
resourcePageDTO
=
new
ResourcePageDTO
();
ResourcePageDTO
resourcePageDTO
=
new
ResourcePageDTO
();
...
@@ -3597,6 +3649,98 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
...
@@ -3597,6 +3649,98 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
@Override
@Override
public
List
<
Integer
>
getColumnTypeByPageId4Wechat
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
)
{
List
<
Integer
>
columnIdList
=
resourcePageColumnDao
.
getColumnIdListByPageId
(
resourcePageId
,
navigationId
);
if
(
CollUtil
.
isEmpty
(
columnIdList
)){
columnIdList
=
new
ArrayList
<>();
}
columnIdList
.
add
(
0
);
return
columnIdList
;
}
//优化 此处把模块分开调接口 通过columnType
@Override
public
List
<
ResourceColumnAndServeVO
>
getColumnAndServeListByPageId4WechatV2
(
Long
resourcePageId
,
Long
wechatUserId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
enableAdverting
,
Long
navigationId
,
Integer
columnType
)
{
List
<
ResourceColumnAndServeVO
>
serveVOS
=
new
ArrayList
<>();
if
(
null
!=
columnType
&&
columnType
!=
0
)
{
serveVOS
=
resourcePageColumnDao
.
getColumnListByPageId
(
resourcePageId
,
navigationId
,
columnType
);
if
(
CollUtil
.
isNotEmpty
(
serveVOS
))
{
List
<
ResourcePageItemVO
>
itemVOList
;
if
(
null
!=
wechatUserId
)
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
true
);
}
else
{
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
resourcePageId
,
null
);
}
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
//二维码类型
fillQrcodeType
(
resourcePageId
,
itemVOList
);
Map
<
String
,
List
<
ResourcePageItemVO
>>
listMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getServeType
));
itemVOList
=
new
ArrayList
<>();
//应用和作品提出来一起查
List
<
ResourcePageItemVO
>
itemAppAndProductVOList
=
new
ArrayList
<>();
//过滤一些资源,重新排序
for
(
Map
.
Entry
<
String
,
List
<
ResourcePageItemVO
>>
entry
:
listMap
.
entrySet
())
{
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
entry
.
getKey
())
||
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
entry
.
getKey
()))
{
itemAppAndProductVOList
.
addAll
(
entry
.
getValue
());
continue
;
}
this
.
fillResourceByType
(
entry
.
getValue
(),
wechatUserId
,
entry
.
getKey
());
itemVOList
.
addAll
(
entry
.
getValue
());
}
if
(
CollUtil
.
isNotEmpty
(
itemAppAndProductVOList
))
{
fillAppProductServe
(
itemAppAndProductVOList
,
wechatUserId
);
itemVOList
.
addAll
(
itemAppAndProductVOList
);
}
itemVOList
.
sort
(
Comparator
.
comparing
(
ResourcePageItemVO:
:
getId
));
Map
<
Long
,
List
<
ResourcePageItemVO
>>
columnMap
=
itemVOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ResourcePageItemVO:
:
getResourcePageColumnId
));
List
<
ResourceColumnAndServeVO
>
removeColumns
=
new
ArrayList
<>();
for
(
ResourceColumnAndServeVO
columnAndServeVO
:
serveVOS
)
{
List
<
ResourcePageItemVO
>
itemVOS
=
columnMap
.
get
(
columnAndServeVO
.
getResourcePageColumnId
());
if
(
ListUtils
.
isEmpty
(
itemVOS
))
{
removeColumns
.
add
(
columnAndServeVO
);
continue
;
}
columnAndServeVO
.
setItemVOList
(
itemVOS
);
String
serveType
=
itemVOS
.
get
(
0
).
getServeType
();
if
(
ResourcePageConstants
.
ServeTypeEnum
.
APP
.
getValue
().
equals
(
serveType
)
||
(
ResourcePageConstants
.
ServeTypeEnum
.
PRODUCT
.
getValue
().
equals
(
serveType
)))
{
serveType
=
"APP/PRODUCT"
;
}
columnAndServeVO
.
setServeType
(
serveType
);
//图片位
if
(
ResourcePageConstants
.
ColumnTypeEnum
.
PICTURE
.
getCode
().
equals
(
columnAndServeVO
.
getColumnType
()))
{
columnAndServeVO
.
setLogoUrl
(
itemVOS
.
get
(
0
).
getLogoUrl
());
}
}
if
(!
ListUtils
.
isEmpty
(
removeColumns
))
{
serveVOS
.
removeAll
(
removeColumns
);
}
}
}
if
(
CollUtil
.
isEmpty
(
serveVOS
))
{
serveVOS
=
CollUtil
.
toList
();
}
}
else
{
this
.
fillAdvertising
(
serveVOS
,
bookId
,
adviserId
,
channelId
,
enableAdverting
);
}
//填充自定义图片
if
(
ListUtils
.
isEmpty
(
serveVOS
))
{
return
new
ArrayList
<>();
}
List
<
ResourcePageItemVO
>
resourcePageItemVOList
=
new
ArrayList
<>();
serveVOS
.
stream
().
forEach
(
e
->
{
if
(!
ListUtils
.
isEmpty
(
e
.
getItemVOList
()))
{
resourcePageItemVOList
.
addAll
(
e
.
getItemVOList
());
}
});
if
(
ListUtils
.
isEmpty
(
resourcePageItemVOList
))
{
return
new
ArrayList
<>();
}
fillSelfPic
(
resourcePageItemVOList
);
return
serveVOS
;
}
@Override
public
Integer
saveShareConfig
(
ResourcePageShareParam
param
)
{
public
Integer
saveShareConfig
(
ResourcePageShareParam
param
)
{
checkShareParam
(
param
);
checkShareParam
(
param
);
shareMapper
.
save
(
buildNewShareConfig
(
param
));
shareMapper
.
save
(
buildNewShareConfig
(
param
));
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/ResourcePageColumnDao.java
View file @
5fb355ac
...
@@ -29,7 +29,9 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
...
@@ -29,7 +29,9 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/3/29 13:45
* @date:2021/3/29 13:45
* * @param null
* * @param null
*/
*/
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
);
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
,
Integer
columnType
);
List
<
Integer
>
getColumnIdListByPageId
(
Long
resourcePageId
,
Long
navigationId
);
/**
/**
* 根据类型查询
* 根据类型查询
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/ResourcePageColumnDaoImpl.java
View file @
5fb355ac
...
@@ -30,14 +30,23 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
...
@@ -30,14 +30,23 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
}
}
@Override
@Override
public
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
)
{
public
List
<
ResourceColumnAndServeVO
>
getColumnListByPageId
(
Long
resourcePageId
,
Long
navigationId
,
Integer
columnType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
map
.
put
(
"columnType"
,
columnType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnListByPageId"
),
map
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnListByPageId"
),
map
);
}
}
@Override
@Override
public
List
<
Integer
>
getColumnIdListByPageId
(
Long
resourcePageId
,
Long
navigationId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnIdListByPageId"
),
map
);
}
@Override
public
List
<
ResourcePageColumn
>
getByColumnTypeAndPage
(
Long
resourcePageId
,
Integer
columnType
)
{
public
List
<
ResourcePageColumn
>
getByColumnTypeAndPage
(
Long
resourcePageId
,
Integer
columnType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"resourcePageId"
,
resourcePageId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/ResourcePageFacade.java
View file @
5fb355ac
...
@@ -111,6 +111,35 @@ public class ResourcePageFacade {
...
@@ -111,6 +111,35 @@ public class ResourcePageFacade {
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
));
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
));
}
}
//优化 此处把模块分开调接口
@ApiOperation
(
"客户端-根据页面id查资源页栏目分类"
)
@GetMapping
(
"getColumnTypeByPageId4Wechat"
)
public
ResponseDto
<?>
getColumnTypeByPageId4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"resourcePageId"
)
Long
resourcePageId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"enableAdverting"
,
required
=
false
)
Integer
enableAdverting
,
@RequestParam
(
value
=
"navigationId"
,
required
=
false
)
Long
navigationId
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnTypeByPageId4Wechat
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
));
}
//优化 此处把模块分开调接口 columnType
@ApiOperation
(
"客户端-根据页面id查资源页栏目及资源"
)
@GetMapping
(
"getColumnAndServeListByPageId4WechatV2"
)
public
ResponseDto
<?>
getColumnAndServeListByPageId4WechatV2
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"resourcePageId"
)
Long
resourcePageId
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"enableAdverting"
,
required
=
false
)
Integer
enableAdverting
,
@RequestParam
(
value
=
"navigationId"
,
required
=
false
)
Long
navigationId
,
@RequestParam
(
value
=
"columnType"
,
required
=
false
)
Integer
columnType
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getColumnAndServeListByPageId4WechatV2
(
resourcePageId
,
wechatUserId
,
bookId
,
adviserId
,
channelId
,
enableAdverting
,
navigationId
,
columnType
));
}
@ApiOperation
(
"客户端分页查栏目资源"
)
@ApiOperation
(
"客户端分页查栏目资源"
)
@GetMapping
(
"listPageResourcePageItem"
)
@GetMapping
(
"listPageResourcePageItem"
)
public
ResponseDto
<?>
listPageResourcePageItem
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
public
ResponseDto
<?>
listPageResourcePageItem
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
...
...
pcloud-service-book/src/main/resources/mapper/group/ResourcePageColumnDao.xml
View file @
5fb355ac
...
@@ -125,11 +125,26 @@
...
@@ -125,11 +125,26 @@
<if
test=
"navigationId != null"
>
<if
test=
"navigationId != null"
>
and navigation_id = #{navigationId}
and navigation_id = #{navigationId}
</if>
</if>
<if
test=
"columnType!=null"
>
and column_type = #{columnType}
</if>
ORDER BY
ORDER BY
column_seq ASC,
column_seq ASC,
id ASC
id ASC
</select>
</select>
<select
id=
"getColumnIdListByPageId"
resultType=
"Integer"
parameterType=
"map"
>
SELECT
DISTINCT column_type
FROM
resource_page_column
WHERE
resource_page_id = #{resourcePageId}
<if
test=
"navigationId != null"
>
and navigation_id = #{navigationId}
</if>
</select>
<select
id=
"getByColumnTypeAndPage"
parameterType=
"map"
resultMap=
"ResourcePageColumnMap"
>
<select
id=
"getByColumnTypeAndPage"
parameterType=
"map"
resultMap=
"ResourcePageColumnMap"
>
select
select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id, background_type, background_url
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id, background_type, background_url
...
...
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