Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
31ef190f
authored
Dec 07, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 状态判断x,y重新计算
parent
78c3bc5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
14 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderCoordinateVO.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
31ef190f
...
@@ -259,17 +259,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -259,17 +259,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
continue
;
continue
;
}
}
Collection
<
Object
>
values
=
entries
.
values
();
Collection
<
Object
>
values
=
entries
.
values
();
log
.
info
(
"空间设备当前大小:{}"
,
values
.
size
());
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
String
distance
=
result
.
getString
(
"distance"
);
String
distance
=
result
.
getString
(
"distance"
);
String
angle
=
result
.
getString
(
"angle"
);
String
angle
=
result
.
getString
(
"angle"
);
BigDecimal
x
=
new
BigDecimal
(
distance
).
multiply
(
BigDecimal
.
valueOf
(
Math
.
cos
(
Double
.
parseDouble
(
angle
)))
vo
.
setX
(
Integer
.
parseInt
(
distance
)
*
Math
.
cos
(
90
-
Integer
.
parseInt
(
angle
)));
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
vo
.
setY
(
Integer
.
parseInt
(
distance
)
*
Math
.
sin
(
90
-
Integer
.
parseInt
(
angle
)));
BigDecimal
y
=
new
BigDecimal
(
distance
).
multiply
(
BigDecimal
.
valueOf
(
Math
.
sin
(
Math
.
cos
(
Double
.
parseDouble
(
angle
))))
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
vo
.
setX
(
x
);
vo
.
setY
(
y
);
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
return
vo
;
return
vo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -281,12 +278,12 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -281,12 +278,12 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
return
platElderRealTimeNowVO
;
return
platElderRealTimeNowVO
;
}
}
Double
[]
doubleArrX
=
voList
.
stream
().
map
(
e
->
e
.
getX
().
doubleValue
()
).
toArray
(
Double
[]::
new
);
Double
[]
doubleArrX
=
voList
.
stream
().
map
(
PlatElderCoordinateVO:
:
getX
).
toArray
(
Double
[]::
new
);
double
x
=
StandardDeviationUtil
.
variance
(
doubleArrX
);
double
x
=
StandardDeviationUtil
.
variance
(
doubleArrX
);
boolean
xFlag
=
new
BigDecimal
(
x
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
boolean
xFlag
=
new
BigDecimal
(
x
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
log
.
info
(
"空间设备算出来X方差为:{},是否大于2:{},设备id:{}"
,
x
,
xFlag
,
device
.
getOriDeviceId
());
log
.
info
(
"空间设备算出来X方差为:{},是否大于2:{},设备id:{}"
,
x
,
xFlag
,
device
.
getOriDeviceId
());
Double
[]
doubleArrY
=
voList
.
stream
().
map
(
e
->
e
.
getY
().
doubleValue
()
).
toArray
(
Double
[]::
new
);
Double
[]
doubleArrY
=
voList
.
stream
().
map
(
PlatElderCoordinateVO:
:
getY
).
toArray
(
Double
[]::
new
);
double
y
=
StandardDeviationUtil
.
variance
(
doubleArrY
);
double
y
=
StandardDeviationUtil
.
variance
(
doubleArrY
);
boolean
yFlag
=
new
BigDecimal
(
y
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
boolean
yFlag
=
new
BigDecimal
(
y
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
...
@@ -306,13 +303,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -306,13 +303,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
continue
;
continue
;
}
}
Collection
<
Object
>
values
=
entries
.
values
();
Collection
<
Object
>
values
=
entries
.
values
();
log
.
info
(
"跌倒设备当前大小:{}"
,
values
.
size
());
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
List
<
PlatElderCoordinateVO
>
voList
=
values
.
stream
().
map
(
entity
->
{
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
JSONObject
result
=
JSON
.
parseObject
(
entity
.
toString
());
Object
track
=
result
.
get
(
"track"
);
Object
track
=
result
.
get
(
"track"
);
List
<
Integer
>
list
=
track
==
null
?
Lists
.
newArrayList
()
:
(
List
<
Integer
>)
track
;
List
<
Integer
>
list
=
track
==
null
?
Lists
.
newArrayList
()
:
(
List
<
Integer
>)
track
;
vo
.
setX
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
1
))
:
BigDecimal
.
ZERO
);
vo
.
setX
(
CollectionUtils
.
isNotEmpty
(
list
)
?
list
.
get
(
1
).
doubleValue
()
:
null
);
vo
.
setY
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
2
)):
BigDecimal
.
ZERO
);
vo
.
setY
(
CollectionUtils
.
isNotEmpty
(
list
)
?
list
.
get
(
2
).
doubleValue
():
null
);
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
vo
.
setPerson
(
Integer
.
valueOf
(
result
.
getString
(
"person"
)));
vo
.
setPerson
(
Integer
.
valueOf
(
result
.
getString
(
"person"
)));
return
vo
;
return
vo
;
...
@@ -324,12 +322,12 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -324,12 +322,12 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
OUT
.
getValue
());
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
OUT
.
getValue
());
return
platElderRealTimeNowVO
;
return
platElderRealTimeNowVO
;
}
}
Double
[]
doubleArrX
=
voList
.
stream
().
map
(
e
->
e
.
getX
().
doubleValue
()
).
toArray
(
Double
[]::
new
);
Double
[]
doubleArrX
=
voList
.
stream
().
map
(
PlatElderCoordinateVO:
:
getX
).
filter
(
Objects:
:
nonNull
).
toArray
(
Double
[]::
new
);
double
x
=
StandardDeviationUtil
.
variance
(
doubleArrX
);
double
x
=
StandardDeviationUtil
.
variance
(
doubleArrX
);
boolean
xFlag
=
new
BigDecimal
(
x
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
boolean
xFlag
=
new
BigDecimal
(
x
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
log
.
info
(
"跌倒设备算出来X方差为:{},是否大于2:{},设备id:{}"
,
x
,
xFlag
,
device
.
getOriDeviceId
());
log
.
info
(
"跌倒设备算出来X方差为:{},是否大于2:{},设备id:{}"
,
x
,
xFlag
,
device
.
getOriDeviceId
());
Double
[]
doubleArrY
=
voList
.
stream
().
map
(
e
->
e
.
getY
().
doubleValue
()
).
toArray
(
Double
[]::
new
);
Double
[]
doubleArrY
=
voList
.
stream
().
map
(
PlatElderCoordinateVO:
:
getY
).
filter
(
Objects:
:
nonNull
).
toArray
(
Double
[]::
new
);
double
y
=
StandardDeviationUtil
.
variance
(
doubleArrY
);
double
y
=
StandardDeviationUtil
.
variance
(
doubleArrY
);
boolean
yFlag
=
new
BigDecimal
(
y
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
boolean
yFlag
=
new
BigDecimal
(
y
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
...
...
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderCoordinateVO.java
View file @
31ef190f
...
@@ -35,8 +35,8 @@ public class PlatElderCoordinateVO {
...
@@ -35,8 +35,8 @@ public class PlatElderCoordinateVO {
private
List
<
Integer
>
track
;
private
List
<
Integer
>
track
;
@ApiModelProperty
(
"x"
)
@ApiModelProperty
(
"x"
)
private
BigDecimal
x
;
private
Double
x
;
@ApiModelProperty
(
"y"
)
@ApiModelProperty
(
"y"
)
private
BigDecimal
y
;
private
Double
y
;
}
}
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