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
ece9c568
Commit
ece9c568
authored
Feb 23, 2022
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1006639] 活动报名慢sql
parent
c2bbd899
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
111 additions
and
11 deletions
+111
-11
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+28
-5
AdvertisingSettlementMethodDao.java
.../book/advertising/dao/AdvertisingSettlementMethodDao.java
+2
-0
AdvertisingSettlementMethodDaoImpl.java
...ertising/dao/impl/AdvertisingSettlementMethodDaoImpl.java
+8
-0
ProductConsr.java
.../java/com/pcloud/book/consumer/resource/ProductConsr.java
+18
-0
BookAuthServeBizImpl.java
.../pcloud/book/copyright/biz/impl/BookAuthServeBizImpl.java
+5
-4
BookAuthUserBizImpl.java
...m/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
+25
-2
AdvertisingSettlementMethodMapper.xml
.../mapper/advertising/AdvertisingSettlementMethodMapper.xml
+25
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
ece9c568
...
...
@@ -88,6 +88,7 @@ import com.pcloud.book.group.entity.BookGroup;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.vo.GroupQrcodeVO
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
import
com.pcloud.common.constant.UrlConstant
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
...
@@ -142,6 +143,9 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
static
com
.
pcloud
.
book
.
util
.
common
.
ThreadPoolUtils
.
SEND_MESSAGE_THREAD_POOL
;
/**
...
...
@@ -2151,17 +2155,27 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
public
List
<
AdvertisingSpaceDTO
>
get4Wechat
(
Long
sceneId
,
Long
adviserId
,
Long
channelId
,
String
adPositionDetail
,
Long
bookGroupId
)
throws
BizException
{
Long
agentId
;
Long
bookId
;
Long
aId
;
if
(
null
!=
bookGroupId
)
{
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
null
==
bookGroupDTO
||
null
==
bookGroupDTO
.
getBookId
())
{
return
new
ArrayList
<>();
}
bookId
=
bookGroupDTO
.
getBookId
();
a
gentId
=
adviserConsr
.
getAgentIdByAdviser
(
bookGroupDTO
.
getCreateUser
()
);
a
Id
=
bookGroupDTO
.
getCreateUser
(
);
}
else
{
a
gentId
=
adviserConsr
.
getAgentIdByAdviser
(
adviserId
)
;
a
Id
=
adviserId
;
bookId
=
ResponseHandleUtil
.
parseResponse
(
qrcodeSceneService
.
getBookId4SceneId
(
sceneId
),
Long
.
class
);
}
String
adviserAgentKey
=
ChannelConstants
.
ADVISER_AGENT
+
aId
;
if
(
null
==
JedisClusterUtils
.
get
(
adviserAgentKey
)){
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
aId
);
if
(
null
!=
agentId
)
{
JedisClusterUtils
.
setJson
(
adviserAgentKey
,
agentId
.
toString
(),
3600
);
}
}
else
{
agentId
=
JedisClusterUtils
.
getJson
(
adviserAgentKey
,
Long
.
class
);
}
if
(
null
==
agentId
||
null
==
bookId
)
{
return
new
ArrayList
<>();
}
...
...
@@ -2180,13 +2194,22 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
return
new
ArrayList
<>();
}
if
(!
ListUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
spaceDTO
->
spaceDTO
.
setBookId
(
bookId
));
List
<
Long
>
masterIds
=
list
.
stream
().
map
(
a
->
a
.
getMasterId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
adIds
=
list
.
stream
().
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
AdvertisingSettlementMethodDTO
>
listDto
=
advertisingSettlementMethodDao
.
getByMasterIdsAndAdIds
(
masterIds
,
adIds
);
Map
<
String
,
String
>
methodMap
=
CollUtil
.
isEmpty
(
listDto
)
?
new
HashMap
<>()
:
listDto
.
stream
().
collect
(
Collectors
.
toMap
(
a
->
a
.
getMasterId
()
+
"-"
+
a
.
getAdId
(),
a
->
a
.
getSettlementMethod
(),
(
v1
,
v2
)
->
v2
));
for
(
AdvertisingSpaceDTO
spaceDTO
:
list
)
{
spaceDTO
.
setBookId
(
bookId
);
//填充结算方式
AdvertisingSettlementMethodDTO
methodDTO
=
advertisingSettlementMethodDao
.
getByMasterIdAndAdId
(
spaceDTO
.
getMasterId
(),
spaceDTO
.
getId
());
String
key
=
spaceDTO
.
getMasterId
()
+
"-"
+
spaceDTO
.
getId
();
if
(
CollUtil
.
isNotEmpty
(
methodMap
)
&&
methodMap
.
containsKey
(
key
)){
spaceDTO
.
setSettlementMethod
(
methodMap
.
get
(
key
));
}
/* AdvertisingSettlementMethodDTO methodDTO = advertisingSettlementMethodDao.getByMasterIdAndAdId(spaceDTO.getMasterId(), spaceDTO.getId());
if (null != methodDTO) {
spaceDTO.setSettlementMethod(methodDTO.getSettlementMethod());
}
}
*/
}
}
return
list
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingSettlementMethodDao.java
View file @
ece9c568
...
...
@@ -32,4 +32,6 @@ public interface AdvertisingSettlementMethodDao extends BaseDao<AdvertisingSettl
* @return
*/
AdvertisingSettlementMethodDTO
getByMasterIdAndAdId
(
Long
masterId
,
Long
adId
);
List
<
AdvertisingSettlementMethodDTO
>
getByMasterIdsAndAdIds
(
List
<
Long
>
masterIds
,
List
<
Long
>
adIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingSettlementMethodDaoImpl.java
View file @
ece9c568
...
...
@@ -42,4 +42,12 @@ public class AdvertisingSettlementMethodDaoImpl extends BaseDaoImpl<AdvertisingS
paramMap
.
put
(
"adId"
,
adId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByMasterIdAndAdId"
),
paramMap
);
}
@Override
public
List
<
AdvertisingSettlementMethodDTO
>
getByMasterIdsAndAdIds
(
List
<
Long
>
masterIds
,
List
<
Long
>
adIds
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterIds"
,
masterIds
);
paramMap
.
put
(
"adIds"
,
adIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getByMasterIdsAndAdIds"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/resource/ProductConsr.java
View file @
ece9c568
...
...
@@ -37,6 +37,8 @@ import java.util.concurrent.CompletableFuture;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
/**
* @描述:商品中间件
* @作者:songx
...
...
@@ -462,4 +464,20 @@ public class ProductConsr {
LOGGER
.
error
(
"【资源中心(消)】调用失败[setOffShelvesProductOnShelves]:"
+
e
.
getMessage
(),
e
);
}
}
public
Map
<
String
,
String
>
getProTypeCodeByIds
(
List
<
Long
>
productIds
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
if
(
CollUtil
.
isEmpty
(
productIds
)){
return
result
;
}
try
{
result
=
ResponseHandleUtil
.
parseMap
(
productService
.
getProTypeCodeByIds
(
productIds
),
String
.
class
,
String
.
class
);
}
catch
(
BizException
e
)
{
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取商品id集合对应商品类型失败[productService.getProTypeCodeByIds]:"
+
e
.
getMessage
(),
e
);
throw
new
ChannelBizException
(
ChannelBizException
.
INVOKE_RES_ERROR
,
"获取商品类型失败~!"
);
}
return
result
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthServeBizImpl.java
View file @
ece9c568
...
...
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
/**
* @author lily
...
...
@@ -97,11 +98,11 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
}
// TAPD:1005196 目前只支持视频、题库等作品
List
<
String
>
openAuthPayProductTypeCodeList
=
CollUtil
.
toList
(
"VIDEO"
,
"PRETEST"
);
Map
<
Long
,
ProductDto
>
productMap
=
productConsr
.
getProBases
ByIds
(
productIds
);
Map
<
String
,
String
>
productMap
=
productConsr
.
getProTypeCode
ByIds
(
productIds
);
if
(
CollUtil
.
isNotEmpty
(
productMap
)){
for
(
ProductDto
productDto
:
productMap
.
values
())
{
if
(
productDto
.
getProductTypeDto
()
!=
null
&&
openAuthPayProductTypeCodeList
.
contains
(
productDto
.
getProductTypeDto
().
getTypeCod
e
())){
isSetServesMap
.
put
(
"PRODUCT"
+
productDto
.
getProductId
(),
true
);
for
(
Entry
<
String
,
String
>
entry
:
productMap
.
entrySet
())
{
if
(
openAuthPayProductTypeCodeList
.
contains
(
entry
.
getValu
e
())){
isSetServesMap
.
put
(
"PRODUCT"
+
entry
.
getKey
(),
true
);
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
View file @
ece9c568
...
...
@@ -30,9 +30,12 @@ import com.pcloud.book.util.common.ThreadPoolUtils;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.resourcecenter.base.constants.ResourceRedisCons
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.slf4j.Logger
;
...
...
@@ -188,12 +191,19 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override
public
Boolean
checkIsHaveAuthWithServer
(
String
userInfo
,
Long
serverId
,
String
serverType
)
{
// 如果包含超级作者资源, 则直接返回
long
t1
=
System
.
currentTimeMillis
();
if
(
checkIsSuperProduct
(
serverId
)){
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第0阶段耗时="
+
(
t2
-
t1
));
return
false
;
}
long
t2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第1阶段耗时="
+
(
t2
-
t1
));
// 否则查询授权关系
Long
bookId
=
qrcodeSceneConsr
.
getBookId4SceneId
(
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
));
long
t3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第2阶段耗时="
+
(
t3
-
t2
));
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
wecharUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
...
...
@@ -210,8 +220,12 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
}
else
{
return
checkIsHaveAuthWithServer
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
serverId
);
Boolean
aBoolean
=
checkIsHaveAuthWithServer
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
serverId
);
long
t4
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"第3阶段耗时="
+
(
t4
-
t3
));
return
aBoolean
;
}
}
private
Boolean
checkIsHaveAuthWithServer
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Long
wecharUserId
,
Long
serverId
)
{
...
...
@@ -240,11 +254,20 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
// 判断是否为超级作者的商品
private
Boolean
checkIsSuperProduct
(
Long
serverId
)
{
String
isSuper
=
null
;
try
{
isSuper
=
JedisClusterUtils
.
hget
(
ResourceRedisCons
.
IS_SUPER_MERCHANT_PRODUCT
,
serverId
.
toString
());
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"从redis获取是否为超级作者的商品失败"
);
}
if
(
null
==
isSuper
)
{
Map
<
Long
,
Boolean
>
map
=
productConsr
.
getIsSuperByProductIdList
(
Lists
.
newArrayList
(
serverId
));
if
(
map
!=
null
&&
map
.
containsKey
(
serverId
))
{
return
map
.
get
(
serverId
);
}
}
else
{
return
Boolean
.
valueOf
(
isSuper
);
}
return
false
;
}
...
...
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingSettlementMethodMapper.xml
View file @
ece9c568
...
...
@@ -122,4 +122,28 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getByMasterIdsAndAdIds"
parameterType=
"map"
resultMap=
"AdvertisingSettlementMethodDTO"
>
select master_id, ad_id, settlement_method
from
(select
master_id, ad_id, settlement_method
from advertising_settlement_method
where
1=1
<if
test=
"masterIds != null and masterIds.size()>0"
>
and master_id in
<foreach
collection=
"masterIds"
open=
"("
close=
")"
separator=
","
index=
"index"
item=
"item"
>
#{item}
</foreach>
</if>
<if
test=
"adIds != null and adIds.size()>0"
>
and ad_id in
<foreach
collection=
"adIds"
open=
"("
close=
")"
separator=
","
index=
"index"
item=
"item"
>
#{item}
</foreach>
</if>
order by create_time desc
)t GROUP BY master_id,ad_id
</select>
</mapper>
\ No newline at end of file
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