Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
d5d03481
Commit
d5d03481
authored
Oct 29, 2024
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文案
parent
232e0f1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
MaterialApiServiceImpl.java
...nage/service/service/out/impl/MaterialApiServiceImpl.java
+4
-1
QWmediaTest.java
haoban-manage3-service/src/test/java/QWmediaTest.java
+2
-1
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MaterialApiServiceImpl.java
View file @
d5d03481
...
@@ -541,6 +541,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -541,6 +541,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return
jr
;
return
jr
;
});
});
json
=
future
.
get
();
json
=
future
.
get
();
if
(
json
==
null
)
{
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"9999"
,
"获取图片失败,请稍后再试"
);
}
if
(
json
.
getErrorCode
()
==
0
)
{
if
(
json
.
getErrorCode
()
==
0
)
{
String
mediaId
=
json
.
getResult
().
toString
()
;
String
mediaId
=
json
.
getResult
().
toString
()
;
RedisUtil
.
setCache
(
key
,
mediaId
,
1L
,
TimeUnit
.
DAYS
);
RedisUtil
.
setCache
(
key
,
mediaId
,
1L
,
TimeUnit
.
DAYS
);
...
@@ -550,7 +553,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -550,7 +553,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"获取素材id失败"
,
e
);
logger
.
info
(
"获取素材id失败"
,
e
);
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"9999"
,
"获取图片,请稍后再试"
);
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"9999"
,
"获取图片
失败
,请稍后再试"
);
}
}
}
}
}
}
haoban-manage3-service/src/test/java/QWmediaTest.java
View file @
d5d03481
...
@@ -61,6 +61,7 @@ public class QWmediaTest {
...
@@ -61,6 +61,7 @@ public class QWmediaTest {
jo
.
put
(
"showStyle"
,
"0"
);
jo
.
put
(
"showStyle"
,
"0"
);
jo
.
put
(
"lineOne"
,
"门店CCA"
);
jo
.
put
(
"lineOne"
,
"门店CCA"
);
jo
.
put
(
"lineTwo"
,
"宇智222为您推荐"
);
jo
.
put
(
"lineTwo"
,
"宇智222为您推荐"
);
jo
.
put
(
"mediaType"
,
1
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
50
);
// 创建线程池
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
50
);
// 创建线程池
Semaphore
semaphore
=
new
Semaphore
(
50
);
// 限制并发请求数为50
Semaphore
semaphore
=
new
Semaphore
(
50
);
// 限制并发请求数为50
...
@@ -71,7 +72,7 @@ public class QWmediaTest {
...
@@ -71,7 +72,7 @@ public class QWmediaTest {
AtomicLong
minTime
=
new
AtomicLong
(
Long
.
MAX_VALUE
);
AtomicLong
minTime
=
new
AtomicLong
(
Long
.
MAX_VALUE
);
for
(
int
i
=
0
;
i
<
TOTAL_REQUESTS
;
i
++)
{
for
(
int
i
=
0
;
i
<
TOTAL_REQUESTS
;
i
++)
{
final
int
requestId
=
i
+
200
;
final
int
requestId
=
i
;
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
long
startTime
=
System
.
currentTimeMillis
();
long
startTime
=
System
.
currentTimeMillis
();
try
{
try
{
...
...
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