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
c061f578
Commit
c061f578
authored
Mar 31, 2022
by
liuyaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
伴随分析逻辑修改
parent
93522880
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
33 deletions
+92
-33
common/common_utils/src/main/java/com/founder/commonutils/newPublicEntity/SkTrail.java
+9
-0
common/common_utils/src/main/java/com/founder/commonutils/newPublicEntity/TogetherEntity.java
+5
-0
service/publicapi/src/main/java/com/founder/publicapi/controller/SkModelService/SkbsController.java
+78
-33
No files found.
common/common_utils/src/main/java/com/founder/commonutils/newPublicEntity/SkTrail.java
View file @
c061f578
...
...
@@ -79,6 +79,15 @@ public class SkTrail extends Model<SkTrail> implements Comparable<SkTrail>{
private
String
isdeleted
;
/**
* 开始时间,
*/
private
String
startTime
;
/**
* 结束时间
*/
private
String
endTime
;
/**
* 获取主键值
*
* @return 主键值
...
...
common/common_utils/src/main/java/com/founder/commonutils/newPublicEntity/TogetherEntity.java
View file @
c061f578
...
...
@@ -20,8 +20,13 @@ public class TogetherEntity {
private
long
starttimestamp
;
private
long
endtimestamp
;
private
long
timestamp
;
//时间戳
private
double
radius
;
//两点距离(米)
private
int
minutes
;
//时间范围(分钟)
private
long
timeIterval
;
//时间间隔
private
String
timeItervalStr
;
//时间间隔
}
service/publicapi/src/main/java/com/founder/publicapi/controller/SkModelService/SkbsController.java
View file @
c061f578
...
...
@@ -2,8 +2,10 @@ package com.founder.publicapi.controller.SkModelService;
import
com.founder.commonutils.newPublicEntity.SkTrail
;
import
com.founder.commonutils.newPublicEntity.TogetherEntity
;
import
com.founder.publicapi.service.serviceimpl.TbStAsjServiceImpl
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.*
;
...
...
@@ -42,6 +44,7 @@ public class SkbsController {
/**将原数据转为需要的数据*/
public
List
getYToGjInfo
(
TogetherEntity
requestParams
,
List
<
SkTrail
>
list
){
List
<
TogetherEntity
>
resultList
=
new
ArrayList
<>();
long
timeItervalMillns
=
requestParams
.
getMinutes
()
*
60
*
1000
;
//分钟转毫秒
TogetherEntity
a
;
for
(
SkTrail
var
:
list
)
{
if
(
StringUtils
.
isBlank
(
var
.
getTime
())
||
StringUtils
.
isBlank
(
var
.
getX
())
||
StringUtils
.
isBlank
(
var
.
getY
()))
{
...
...
@@ -51,12 +54,54 @@ public class SkbsController {
a
.
setJ
(
Double
.
parseDouble
(
var
.
getX
()));
a
.
setW
(
Double
.
parseDouble
(
var
.
getY
()));
a
.
setAddress
(
var
.
getAddress
());
a
.
setStarttimestamp
(
getDateMinusToStr
(
var
.
getTime
(),
requestParams
.
getMinutes
()));
a
.
setEndtimestamp
(
getDateAddToStr
(
var
.
getTime
(),
requestParams
.
getMinutes
()));
a
.
setObjectValue
(
var
.
getObjectvalue
());
a
.
setObjectType
(
var
.
getObjecttype
());
//如果是强轨迹则传入时间点 Time
if
(
StringUtils
.
isNotBlank
(
var
.
getTime
())){
a
.
setTimestamp
(
Long
.
parseLong
(
var
.
getTime
()));
resultList
.
add
(
a
);
}
//如果是强轨迹则传入时间段StartTime EndTime
if
(
a
.
getJ
()
!=
0
D
&&
a
.
getW
()
!=
0
D
&&
StringUtils
.
isNotBlank
(
a
.
getStartTime
())
&&
StringUtils
.
isNotBlank
(
a
.
getEndTime
()))
{
a
.
setStarttimestamp
(
getDateMinusToStr
(
a
.
getStartTime
(),
0
));
a
.
setEndtimestamp
(
getDateMinusToStr
(
a
.
getEndTime
(),
0
));
List
<
Long
>
timeList
=
getTimeSplitList
(
a
.
getStarttimestamp
(),
a
.
getEndtimestamp
(),
timeItervalMillns
);
if
(
timeList
!=
null
&&
timeList
.
size
()
!=
0
)
{
Iterator
<
Long
>
it
=
timeList
.
iterator
();
while
(
it
.
hasNext
())
{
a
.
setTimestamp
(
it
.
next
());
resultList
.
add
(
a
);
}
}
}
else
if
(
a
.
getJ
()
!=
0
D
&&
a
.
getW
()
!=
0
D
&&
StringUtils
.
isNotBlank
(
a
.
getStartTime
()))
{
a
.
setTimestamp
(
getDateMinusToStr
(
a
.
getStartTime
(),
0
));
resultList
.
add
(
a
);
}
else
if
(
a
.
getJ
()
!=
0
D
&&
a
.
getW
()
!=
0
D
&&
StringUtils
.
isNotBlank
(
a
.
getEndTime
()))
{
a
.
setTimestamp
(
getDateMinusToStr
(
a
.
getStartTime
(),
0
));
resultList
.
add
(
a
);
}
}
return
resultList
;
}
/**
* 将开始时间和结束时间的时间段转为时间点*/
public
List
<
Long
>
getTimeSplitList
(
long
startTime
,
long
endTime
,
long
timeItervalMillns
)
{
List
resultList
=
new
ArrayList
();
resultList
.
add
(
startTime
);
do
{
startTime
+=
timeItervalMillns
;
if
(
startTime
<
endTime
)
{
resultList
.
add
(
startTime
);
}
else
if
(
startTime
>=
endTime
){
resultList
.
add
(
endTime
);
break
;
}
}
while
(
startTime
<
endTime
);
return
resultList
;
}
...
...
@@ -68,17 +113,6 @@ public class SkbsController {
Date
date
=
new
Date
(
Long
.
parseLong
(
time
));
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
c
.
add
(
Calendar
.
SECOND
,
-
minutes
);
return
c
.
getTimeInMillis
();
}
/**
* @param time 字符串时间戳
*结束时间加上分钟
* */
public
long
getDateAddToStr
(
String
time
,
int
minutes
)
{
Date
date
=
new
Date
(
Long
.
parseLong
(
time
));
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
c
.
add
(
Calendar
.
SECOND
,
minutes
);
return
c
.
getTimeInMillis
();
}
...
...
@@ -92,34 +126,45 @@ public class SkbsController {
* */
public
List
getSkbsfx
(
TogetherEntity
requestParams
,
List
<
TogetherEntity
>
paramList
){
List
<
TogetherEntity
>
resultList
=
new
ArrayList
<>();
Collections
.
sort
(
paramList
,
Comparator
.
comparing
(
TogetherEntity:
:
getStarttimestamp
));
long
timeItervalMinutes
=
requestParams
.
getMinutes
()
*
60
*
1000
;
/**
* list2为所有数据的集合,将集合按轨迹开始时间排序
* */
Collections
.
sort
(
paramList
,
Comparator
.
comparing
(
TogetherEntity:
:
getTimestamp
));
for
(
int
i
=
1
;
i
<
paramList
.
size
();
i
++)
{
TogetherEntity
t
=
paramList
.
get
(
i
-
1
);
TogetherEntity
t1
=
paramList
.
get
(
i
);
if
(!
t
.
getObjectValue
().
equals
(
t1
.
getObjectValue
())){
TogetherEntity
a
=
paramList
.
get
(
i
-
1
);
TogetherEntity
a1
=
paramList
.
get
(
i
);
TogetherEntity
t
=
new
TogetherEntity
();
TogetherEntity
t1
=
new
TogetherEntity
();
//复制实体数据
BeanUtils
.
copyProperties
(
a
,
t
);
BeanUtils
.
copyProperties
(
a1
,
t1
);
if
(!
t
.
getObjectValue
().
equals
(
t1
.
getObjectValue
()))
{
long
timeIterval
=
t1
.
getTimestamp
()
-
t
.
getTimestamp
();
double
s
=
getDistance
(
t
.
getJ
(),
t
.
getW
(),
t1
.
getJ
(),
t1
.
getW
());
if
(
s
!=
0
&&
s
<
requestParams
.
getRadius
())
{
long
time1
=
t
.
getStarttimestamp
();
long
time2
=
t
.
getEndtimestamp
();
long
time3
=
t1
.
getStarttimestamp
();
long
time4
=
t1
.
getEndtimestamp
();
if
(
time4
>=
time1
&&
time2
>=
time3
){
if
(
resultList
.
size
()!=
0
){
TogetherEntity
t3
=
resultList
.
get
(
resultList
.
size
()-
1
);
if
(
t
.
getW
()!=
t3
.
getW
()||
t
.
getJ
()!=
t3
.
getJ
()){
if
(
s
<
requestParams
.
getRadius
()
&&
timeIterval
<
timeItervalMinutes
)
{
resultList
.
add
(
t
);
}
}
else
{
resultList
.
add
(
t
);
}
t1
.
setDescripText
(
"距离"
+
t
.
getAddress
()
+
" 有 "
+
s
+
" 米"
);
t1
.
setTimeIterval
(
timeIterval
);
t1
.
setTimeItervalStr
(
String
.
valueOf
(
timeIterval
));
//添加地址
StringBuilder
sbdescripText
=
new
StringBuilder
();
sbdescripText
.
append
(
"距离"
);
sbdescripText
.
append
(
t
.
getAddress
());
sbdescripText
.
append
(
" 有 "
);
sbdescripText
.
append
(
s
);
sbdescripText
.
append
(
" 米"
);
t1
.
setDescripText
(
sbdescripText
.
toString
());
resultList
.
add
(
t1
);
}
}
}
}
resultList
.
stream
().
sorted
(
Comparator
.
comparing
(
TogetherEntity:
:
getTimestamp
));
return
resultList
;
}
...
...
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