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
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
168 additions
and
2 deletions
+168
-2
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
+0
-0
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 {
* 手机号授权
*/
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 {
}
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
...
...
@@ -187,6 +187,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
;
}
}
/**
* 资源中心拉取商品基本信息
*/
public
Map
<
Long
,
Product4BookDTO
>
getProBasesWithSceneByIds
(
List
<
Long
>
productIds
)
throws
BizException
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/trade/TradeConsr.java
View file @
5fb355ac
...
...
@@ -371,4 +371,40 @@ public class TradeConsr {
}
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 {
*/
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
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
5fb355ac
This diff is collapsed.
Click to expand it.
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> {
* @date:2021/3/29 13:45
* * @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
}
@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
.
put
(
"navigationId"
,
navigationId
);
map
.
put
(
"resourcePageId"
,
resourcePageId
);
map
.
put
(
"columnType"
,
columnType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getColumnListByPageId"
),
map
);
}
@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
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
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 {
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
(
"客户端分页查栏目资源"
)
@GetMapping
(
"listPageResourcePageItem"
)
public
ResponseDto
<?>
listPageResourcePageItem
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
...
...
pcloud-service-book/src/main/resources/mapper/group/ResourcePageColumnDao.xml
View file @
5fb355ac
...
...
@@ -125,11 +125,26 @@
<if
test=
"navigationId != null"
>
and navigation_id = #{navigationId}
</if>
<if
test=
"columnType!=null"
>
and column_type = #{columnType}
</if>
ORDER BY
column_seq ASC,
id ASC
</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, 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