Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
3baff7fb
Commit
3baff7fb
authored
May 13, 2021
by
刘亚鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车轨接口修改
parent
b8b1f6c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
12 deletions
+41
-12
serviceapi/peopleapi/src/main/java/com/founder/peopleapi/service/impl/PhoneServiceImpl.java
+41
-12
No files found.
serviceapi/peopleapi/src/main/java/com/founder/peopleapi/service/impl/PhoneServiceImpl.java
View file @
3baff7fb
...
...
@@ -20,9 +20,7 @@ import java.time.LocalDateTime;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.*
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -39,16 +37,47 @@ public class PhoneServiceImpl implements PhoneService {
@Override
public
MapRestResult
getSjGjInfo
(
String
objectType
,
String
objectValue
,
String
kssj
,
String
jssj
)
{
Map
resMap
=
getSjgjXx
(
objectType
,
objectValue
,
kssj
,
jssj
);
int
total
=
0
;
String
[]
array
=
objectValue
.
split
(
","
);
List
dataList
=
new
ArrayList
();
if
(
array
!=
null
&&
array
.
length
>
0
)
{
//翻译并封装成实体返回---使用200并发
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
//信号量,此处用于控制并发的线程数
final
Semaphore
semaphore
=
new
Semaphore
(
50
);
//闭锁,可实现计数器递减
final
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
array
.
length
);
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
String
val
=
array
[
i
];
executorService
.
execute
(()
->
{
try
{
//执行此方法用于获取执行许可,当总计未释放的许可数不超过200时,
//允许通行,否则线程阻塞等待,直到获取到许可。
semaphore
.
acquire
();
Map
resMap
=
getSjgjXx
(
objectType
,
val
,
kssj
,
jssj
);
List
childrenList
=
(
List
)
resMap
.
get
(
"rows"
);
Map
resulMap
=
new
HashMap
();
resulMap
.
put
(
"phone"
,
objectValue
);
resulMap
.
put
(
"phone"
,
val
);
resulMap
.
put
(
"dataList"
,
childrenList
);
resulMap
.
put
(
"count"
,
childrenList
.
size
());
Map
dataMap
=
new
HashMap
();
List
dataList
=
new
ArrayList
();
dataList
.
add
(
resulMap
);
//释放许可
semaphore
.
release
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
//闭锁减一
countDownLatch
.
countDown
();
});
}
try
{
countDownLatch
.
await
();
//线程阻塞,直到闭锁值为0时,阻塞才释放,继续往下执行
executorService
.
shutdown
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Map
dataMap
=
new
HashMap
();
dataMap
.
put
(
"data"
,
dataList
);
return
MapRestResult
.
build
(
200
,
"成功获取手机轨迹信息!"
,
dataMap
);
}
...
...
@@ -483,7 +512,7 @@ public class PhoneServiceImpl implements PhoneService {
LinkedHashMap
resultJson
=
(
LinkedHashMap
)
jsonObject
.
getBody
().
get
(
"data"
);
//获取返回的数据结果
List
<
LinkedHashMap
>
array
=
(
List
<
LinkedHashMap
>)
resultJson
.
get
(
"rows"
);
System
.
out
.
println
(
array
.
toString
());
if
(
array
!=
null
&&
array
.
size
()!=
0
)
{
if
(
array
!=
null
&&
array
.
size
()
!=
0
)
{
LinkedHashMap
object
=
array
.
get
(
0
);
String
bshxx
=
p
.
getObjectValue
();
String
xm
=
(
String
)
object
.
get
(
"xm"
);
...
...
@@ -707,8 +736,8 @@ public class PhoneServiceImpl implements PhoneService {
}
@Override
public
MapRestResult
selectJzXx
(
String
qsjd
,
String
qswd
,
String
jsjd
,
String
jswd
)
{
List
<
JzXxResult
>
kkList
=
phoneInfoMapper
.
getJzInfoByQsJwd
(
qsjd
,
qswd
,
jsjd
,
jswd
);
return
MapRestResult
.
build
(
200
,
"获取基站信息"
,
kkList
.
size
(),
kkList
);
public
MapRestResult
selectJzXx
(
String
qsjd
,
String
qswd
,
String
jsjd
,
String
jswd
)
{
List
<
JzXxResult
>
kkList
=
phoneInfoMapper
.
getJzInfoByQsJwd
(
qsjd
,
qswd
,
jsjd
,
jswd
);
return
MapRestResult
.
build
(
200
,
"获取基站信息"
,
kkList
.
size
(),
kkList
);
}
}
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