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
3942d87c
Commit
3942d87c
authored
Aug 09, 2022
by
李传峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:[none] 处理超时,4千多个批量调用改单个单个调用
parent
0f0cb089
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
LinkRevertBizImpl.java
...m/pcloud/book/advertising/biz/impl/LinkRevertBizImpl.java
+17
-3
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/LinkRevertBizImpl.java
View file @
3942d87c
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.pcloud.book.advertising.biz.LinkRevertBiz
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandDao
;
import
com.pcloud.book.advertising.dao.AdvertisingGroupTagDao
;
...
...
@@ -27,6 +28,8 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.wechatgroup.message.dto.LinkGroupParamDTO
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -48,6 +51,8 @@ import java.util.stream.Collectors;
@Component
(
"linkRevertBiz"
)
public
class
LinkRevertBizImpl
implements
LinkRevertBiz
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatGroupLinkPrefix
;
@Autowired
...
...
@@ -171,6 +176,7 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
new
Thread
()
{
@Override
public
void
run
()
{
long
start
=
System
.
currentTimeMillis
();
List
<
AdvertisingLinkRevert
>
list
=
advertisingLinkRevertDao
.
getAll
();
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
...
...
@@ -181,15 +187,20 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
List
<
String
>
groupIds
=
advertisingGroupTagDao
.
getTagWxGroupIdsByBrandId
(
brandId
);
groupMap
.
put
(
brandId
,
groupIds
);
}
List
<
LinkGroupParamDTO
>
paramDTOS
=
new
ArrayList
<>();
long
s2
=
System
.
currentTimeMillis
();
Map
<
String
,
Integer
>
sendCountMap
=
new
HashMap
<>();
for
(
AdvertisingLinkRevert
linkRevert
:
list
)
{
LinkGroupParamDTO
paramDTO
=
new
LinkGroupParamDTO
();
paramDTO
.
setLink
(
linkRevert
.
getShortLink
());
paramDTO
.
setWxGroupIds
(
groupMap
.
get
(
linkRevert
.
getBrandId
()));
paramDTO
.
setDate
(
DateUtils
.
getYesterday
());
paramDTOS
.
add
(
paramDTO
);
Map
<
String
,
Integer
>
scMap
=
wechatGroupConsr
.
getLinkSendCount
(
Lists
.
newArrayList
(
paramDTO
));
sendCountMap
.
putAll
(
scMap
);
}
Map
<
String
,
Integer
>
sendCountMap
=
wechatGroupConsr
.
getLinkSendCount
(
paramDTOS
);
long
s3
=
System
.
currentTimeMillis
();
List
<
AdvertisingLinkSend
>
sendList
=
new
ArrayList
<>();
for
(
AdvertisingLinkRevert
linkRevert
:
list
)
{
AdvertisingLinkSend
linkSend
=
new
AdvertisingLinkSend
();
...
...
@@ -204,6 +215,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
sendList
.
add
(
linkSend
);
}
advertisingLinkSendDao
.
insert
(
sendList
);
long
s4
=
System
.
currentTimeMillis
();
logger
.
warn
(
"统计昨日链接发送次数,总耗时={},查询数据耗时={},wechatGroup耗时={},写数据耗时={}"
,
s4
-
start
,
s2
-
start
,
s3
-
s2
,
s4
-
s3
);
}
}.
start
();
}
...
...
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