Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
294dc31b
Commit
294dc31b
authored
Mar 06, 2023
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加坐标时间戳
parent
0fba0107
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
15 deletions
+32
-15
Car.java
.../main/java/com/yeejoin/equipmanage/common/entity/Car.java
+2
-2
CoordinateUtil.java
.../com/yeejoin/equipmanage/common/utils/CoordinateUtil.java
+3
-3
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+1
-1
Coordinate.java
...n/java/com/yeejoin/equipmanage/controller/Coordinate.java
+4
-1
CarIotListener.java
...java/com/yeejoin/equipmanage/listener/CarIotListener.java
+12
-7
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+1
-0
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+9
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/Car.java
View file @
294dc31b
...
@@ -226,6 +226,6 @@ public class Car extends BaseEntity {
...
@@ -226,6 +226,6 @@ public class Car extends BaseEntity {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
iotDeviceName
;
private
String
iotDeviceName
;
@TableField
(
exist
=
false
)
//
@TableField(exist = false)
private
String
type
=
"car"
;
//
private String type = "car";
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/CoordinateUtil.java
View file @
294dc31b
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
public
class
CoordinateUtil
{
public
class
CoordinateUtil
{
// WGS84标准参考椭球中的地球长半径(单位:
千
米)
// WGS84标准参考椭球中的地球长半径(单位:米)
private
static
final
double
EARH_RADIUS_WGS84
=
6378137.0
/
1000
;
private
static
final
double
EARH_RADIUS_WGS84
=
6378137.0
;
public
static
double
distance
(
double
lat1
,
double
lng1
,
double
lat2
,
double
lng2
)
{
public
static
double
distance
(
double
lat1
,
double
lng1
,
double
lat2
,
double
lng2
)
{
double
radLat1
=
Math
.
toRadians
(
lat1
);
double
radLat1
=
Math
.
toRadians
(
lat1
);
...
@@ -13,6 +13,6 @@ public class CoordinateUtil {
...
@@ -13,6 +13,6 @@ public class CoordinateUtil {
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
return
Math
.
round
(
s
*
EARH_RADIUS_WGS84
)
;
return
s
*
EARH_RADIUS_WGS84
;
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
294dc31b
...
@@ -288,7 +288,7 @@ public class CarController extends AbstractBaseController {
...
@@ -288,7 +288,7 @@ public class CarController extends AbstractBaseController {
Equipment
equipment
=
iEquipmentService
.
getById
(
car
.
getEquipmentId
());
Equipment
equipment
=
iEquipmentService
.
getById
(
car
.
getEquipmentId
());
car
.
setName
(
equipment
!=
null
?
equipment
.
getName
()
:
null
);
car
.
setName
(
equipment
!=
null
?
equipment
.
getName
()
:
null
);
}
}
if
(
ObjectUtils
.
isEmpty
(
car
.
getBizOrgName
())
&&
!
ObjectUtils
.
isEmpty
(
car
.
getBizOrgCode
()))
{
if
(!
ObjectUtils
.
isEmpty
(
car
.
getBizOrgCode
()))
{
FeignClientResult
<
Map
<
String
,
Object
>>
result
=
Privilege
.
companyClient
.
queryByOrgcode
(
car
.
getBizOrgCode
());
FeignClientResult
<
Map
<
String
,
Object
>>
result
=
Privilege
.
companyClient
.
queryByOrgcode
(
car
.
getBizOrgCode
());
System
.
out
.
println
(
"=============================="
+
JSONObject
.
toJSONString
(
result
.
getResult
()));
System
.
out
.
println
(
"=============================="
+
JSONObject
.
toJSONString
(
result
.
getResult
()));
if
(
result
.
getResult
()
!=
null
&&
result
.
getResult
().
containsKey
(
"compnay"
))
{
if
(
result
.
getResult
()
!=
null
&&
result
.
getResult
().
containsKey
(
"compnay"
))
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/Coordinate.java
View file @
294dc31b
...
@@ -11,5 +11,8 @@ public class Coordinate {
...
@@ -11,5 +11,8 @@ public class Coordinate {
private
List
<
Double
>
lnglat
;
private
List
<
Double
>
lnglat
;
//车速
//车速
private
int
speed
;
private
double
speed
;
//时间
private
String
time
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotListener.java
View file @
294dc31b
...
@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.listener;
...
@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.listener;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.math.BigDecimal
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -123,24 +124,28 @@ public class CarIotListener extends EmqxListener {
...
@@ -123,24 +124,28 @@ public class CarIotListener extends EmqxListener {
// Date endTime =UTCToCST(lastObj.getString("time"));
// Date endTime =UTCToCST(lastObj.getString("time"));
Date
endTime
=
new
Date
(
jsonObject
.
getLong
(
"time"
));
Date
endTime
=
new
Date
(
jsonObject
.
getLong
(
"time"
));
long
takeTime
=
endTime
.
getTime
()
-
last
.
getStartTime
().
getTime
()
;
long
takeTime
=
(
endTime
.
getTime
()/
1000
*
1000
)
-
(
last
.
getStartTime
().
getTime
()/
1000
*
1000
)
;
last
.
setEndLongitude
(
endLongitude
);
last
.
setEndLongitude
(
endLongitude
);
last
.
setEndLatitude
(
endLatitude
);
last
.
setEndLatitude
(
endLatitude
);
last
.
setEndTime
(
endTime
);
last
.
setEndTime
(
endTime
);
last
.
setEndName
(
getAddress
(
endLongitude
,
endLatitude
));
last
.
setEndName
(
getAddress
(
endLongitude
,
endLatitude
));
last
.
setEndSpeed
(
lastObj
.
getIntValue
(
"FireCar_Speed"
));
last
.
setEndSpeed
(
lastObj
.
getIntValue
(
"FireCar_Speed"
));
last
.
setTakeTime
(
takeTime
);
last
.
setTakeTime
(
takeTime
);
double
travel
=
0
;
double
travel
=
0
.0
;
// 获取里程
// 获取里程
for
(
int
i
=
0
;
i
<
filterList
.
size
()
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
filterList
.
size
()
-
1
;
i
++)
{
JSONObject
start
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
filterList
.
get
(
i
)));
JSONObject
start
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
filterList
.
get
(
i
)));
JSONObject
end
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
filterList
.
get
(
i
+
1
)));
JSONObject
end
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
filterList
.
get
(
i
+
1
)));
travel
+=
CoordinateUtil
.
distance
(
start
.
getDoubleValue
(
"FireCar_Longitude"
),
travel
+=
CoordinateUtil
.
distance
(
start
.
getDoubleValue
(
"FireCar_Latitude"
),
start
.
getDoubleValue
(
"FireCar_Latitude"
),
end
.
getDoubleValue
(
"FireCar_Longitude"
),
start
.
getDoubleValue
(
"FireCar_Longitude"
),
end
.
getDoubleValue
(
"FireCar_Latitude"
),
end
.
getDoubleValue
(
"FireCar_Latitude"
));
end
.
getDoubleValue
(
"FireCar_Longitude"
));
}
last
.
setTravel
(
new
BigDecimal
(
travel
/
1000
).
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
try
{
iWlCarMileageService
.
updateById
(
last
);
}
catch
(
Exception
e
)
{
iWlCarMileageService
.
updateById
(
last
);
}
}
last
.
setTravel
(
travel
);
iWlCarMileageService
.
updateById
(
last
);
}
}
}
}
}
else
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
))
{
}
else
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
))
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
294dc31b
...
@@ -923,6 +923,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
...
@@ -923,6 +923,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if
(!
x
.
getEqtype
().
startsWith
(
"4"
)
&&
StringUtil
.
isNotEmpty
(
x
.
getAmount
()))
{
if
(!
x
.
getEqtype
().
startsWith
(
"4"
)
&&
StringUtil
.
isNotEmpty
(
x
.
getAmount
()))
{
x
.
setAmount
(
x
.
getAmount
().
split
(
"\\."
)[
0
]);
x
.
setAmount
(
x
.
getAmount
().
split
(
"\\."
)[
0
]);
}
}
x
.
setType
(
null
);
});
});
return
list
;
return
list
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
294dc31b
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
java.sql.Timestamp
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -64,6 +66,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
...
@@ -64,6 +66,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
List
<
Object
>
list
=
result
.
getResult
();
List
<
Object
>
list
=
result
.
getResult
();
List
<
Coordinate
>
coordinateList
=
new
ArrayList
<
Coordinate
>();
List
<
Coordinate
>
coordinateList
=
new
ArrayList
<
Coordinate
>();
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
DateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
);
for
(
Object
object
:
list
)
{
for
(
Object
object
:
list
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
if
(
jsonObject
.
get
(
"FireCar_Longitude"
)
!=
null
&&
jsonObject
.
get
(
"FireCar_Latitude"
)
!=
null
)
{
if
(
jsonObject
.
get
(
"FireCar_Longitude"
)
!=
null
&&
jsonObject
.
get
(
"FireCar_Latitude"
)
!=
null
)
{
...
@@ -72,7 +75,12 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
...
@@ -72,7 +75,12 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
));
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
));
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
));
lnglat
.
add
(
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
));
coordinate
.
setLnglat
(
lnglat
);
coordinate
.
setLnglat
(
lnglat
);
coordinate
.
setSpeed
(
jsonObject
.
getIntValue
(
"FireCar_Speed"
));
coordinate
.
setSpeed
(
jsonObject
.
getDoubleValue
(
"FireCar_Speed"
));
try
{
coordinate
.
setTime
(
String
.
valueOf
(
format
.
parse
(
jsonObject
.
getString
(
"time"
)).
getTime
()));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
coordinateList
.
add
(
coordinate
);
coordinateList
.
add
(
coordinate
);
}
}
}
}
...
...
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