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
15003967
Commit
15003967
authored
Jun 20, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.车辆修改名称无效。2.车辆存储的开始时间精度丢失。
parent
621181df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+1
-1
CarIotNewListener.java
...a/com/yeejoin/equipmanage/listener/CarIotNewListener.java
+2
-1
ThreadCar.java
...c/main/java/com/yeejoin/equipmanage/thread/ThreadCar.java
+6
-7
ThreadCarMileageTreatment.java
...yeejoin/equipmanage/thread/ThreadCarMileageTreatment.java
+11
-13
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
15003967
...
...
@@ -224,7 +224,7 @@ public class CarController extends AbstractBaseController {
}
});
}
if
(
ObjectUtils
.
isEmpty
(
car
.
getName
()))
{
if
(
!
ObjectUtils
.
isEmpty
(
car
.
getEquipmentId
()))
{
Equipment
equipment
=
iEquipmentService
.
getById
(
car
.
getEquipmentId
());
car
.
setName
(
equipment
!=
null
?
equipment
.
getName
()
:
null
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotNewListener.java
View file @
15003967
...
...
@@ -104,7 +104,8 @@ public class CarIotNewListener extends EmqxListener {
wlCarMileage
.
setStartLongitude
(
startLongitude
);
wlCarMileage
.
setStartLatitude
(
startLatitude
);
// Date startTime = UTCToCST();
Date
startTime
=
new
Date
(
jsonObject
.
getLong
(
"time"
));
//时间值被mysql自动转换
Date
startTime
=
new
Date
((
jsonObject
.
getLong
(
"time"
)/
1000
)*
1000
);
wlCarMileage
.
setStartTime
(
startTime
);
wlCarMileage
.
setStartName
(
getAddress
(
startLongitude
,
startLatitude
));
wlCarMileage
.
setStartSpeed
(
Double
.
valueOf
(
jsonObject
.
getDoubleValue
(
"FireCar_Speed"
)).
intValue
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/thread/ThreadCar.java
View file @
15003967
...
...
@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.IWlCarMileageService;
import
com.yeejoin.equipmanage.utils.CarUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.jfree.util.Log
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -50,7 +51,7 @@ public class ThreadCar extends Thread {
JSONObject
lastObj
=
null
;
WlCarMileage
last
=
null
;
try
{
System
.
out
.
println
(
"-------------------------"
+
this
.
topic
+
"结束坐标开始计时------------------------------"
);
Log
.
info
(
"-------------------------"
+
this
.
topic
+
"结束坐标开始计时------------------------------"
);
this
.
sleep
(
clippingTime
);
//业务处理
//如果十分钟没有坐标,则需要设置结束标记
...
...
@@ -85,17 +86,15 @@ public class ThreadCar extends Thread {
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if
(
lastObj
==
null
)
{
lastObj
=
new
JSONObject
();
lastObj
.
put
(
"FireCar_Longitude"
,
0.0
);
lastObj
.
put
(
"FireCar_Latitude"
,
0.0
);
lastObj
.
put
(
"FireCar_Longitude"
,
last
.
getStartLongitude
()
);
lastObj
.
put
(
"FireCar_Latitude"
,
last
.
getEndLatitude
()
);
lastObj
.
put
(
"time"
,
0
);
lastObj
.
put
(
"FireCar_Speed"
,
0
);
}
double
endLongitude
=
lastObj
.
getDoubleValue
(
"FireCar_Longitude"
);
double
endLatitude
=
lastObj
.
getDoubleValue
(
"FireCar_Latitude"
);
// 230215180624
// Date endTime =UTCToCST(lastObj.getString("time"));
Date
endTime
=
new
Date
(
jsonObject
.
getLong
(
"time"
)
);
Date
endTime
=
new
Date
();
//实时库中的时间虽然坐标与记录的一致,但是更新时间可能最新,故可能会有记录的结束时间早于开始时间
long
takeTime
=
(
endTime
.
getTime
()
/
1000
*
1000
)
-
(
last
.
getStartTime
().
getTime
()
/
1000
*
1000
);
if
(
takeTime
<
0
){
...
...
@@ -118,7 +117,7 @@ public class ThreadCar extends Thread {
}
last
.
setTravel
(
new
BigDecimal
(
travel
/
1000
).
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
iWlCarMileageService
.
updateById
(
last
);
System
.
out
.
println
(
"============================================================更新结束坐标成功==========:"
+
topic
);
Log
.
info
(
"============================================================更新结束坐标成功==========:"
+
topic
);
this
.
interrupt
();
}
}
catch
(
Exception
exception
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/thread/ThreadCarMileageTreatment.java
View file @
15003967
...
...
@@ -13,6 +13,7 @@ import com.yeejoin.equipmanage.service.impl.CarServiceImpl;
import
com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl
;
import
com.yeejoin.equipmanage.utils.CarUtils
;
import
liquibase.pro.packaged.E
;
import
org.jfree.util.Log
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -30,7 +31,6 @@ public class ThreadCarMileageTreatment extends Thread {
@Autowired
private
WlCarMileageServiceImpl
wlCarMileageServiceImpl
;
@Autowired
CarServiceImpl
carServiceImpl
;
@Autowired
...
...
@@ -40,22 +40,23 @@ public class ThreadCarMileageTreatment extends Thread {
@Override
public
void
run
()
{
System
.
out
.
println
(
"----------------------------------------------------开始处理未结束里程---------------------------------"
);
Log
.
info
(
"----------------------------------------------------开始处理未结束里程---------------------------------"
);
HashMap
<
String
,
String
>
hashMap
=
new
HashMap
<>();
//toDo
WlCarMileage
last
=
null
;
JSONObject
lastObj
=
null
;
Car
car
=
null
;
List
<
WlCarMileage
>
wlCarMileageList
=
wlCarMileageServiceImpl
.
list
(
new
QueryWrapper
<
WlCarMileage
>().
isNull
(
"end_time"
));
wlCarMileageList
.
forEach
(
wlCarMileage
->
{
Car
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileage
.
getIotCode
()));
for
(
int
i
=
0
;
i
<
wlCarMileageList
.
size
();
i
++)
{
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileageList
.
get
(
i
)
.
getIotCode
()));
String
coordinateSting
=
String
.
valueOf
(
car
.
getLongitude
())
+
String
.
valueOf
(
car
.
getLatitude
());
hashMap
.
put
(
car
.
getIotCode
(),
coordinateSting
);
}
);
}
try
{
Thread
.
sleep
(
clipping_time
);
for
(
int
i
=
0
;
i
<
wlCarMileageList
.
size
();
i
++)
{
WlCarMileage
wlCarMileage
=
wlCarMileageList
.
get
(
i
);
Car
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileage
.
getIotCode
()));
car
=
carServiceImpl
.
getOne
(
new
QueryWrapper
<
Car
>().
eq
(
"iot_code"
,
wlCarMileage
.
getIotCode
()));
String
coordinateSting
=
String
.
valueOf
(
car
.
getLongitude
())
+
String
.
valueOf
(
car
.
getLatitude
());
if
(
coordinateSting
.
equals
(
hashMap
.
get
(
car
.
getIotCode
())))
{
String
iotCode
=
car
.
getIotCode
();
...
...
@@ -69,7 +70,6 @@ public class ThreadCarMileageTreatment extends Thread {
last
.
getStartTime
(),
new
Date
(
new
Date
().
getTime
()
+
2000
));
List
<
Object
>
list
=
result
.
getResult
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
// 过滤空坐标
List
<
Object
>
filterList
=
new
ArrayList
<
Object
>();
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++)
{
...
...
@@ -84,19 +84,16 @@ public class ThreadCarMileageTreatment extends Thread {
}
}
}
// JSONObject lastObj =
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
Log
.
info
(
"----------------------------------------lastobj----------------------"
+
lastObj
.
toJSONString
());
if
(
lastObj
==
null
)
{
lastObj
=
new
JSONObject
();
lastObj
.
put
(
"FireCar_Longitude"
,
0.0
);
lastObj
.
put
(
"FireCar_Latitude"
,
0.0
);
lastObj
.
put
(
"FireCar_Longitude"
,
last
.
getStartLongitude
()
);
lastObj
.
put
(
"FireCar_Latitude"
,
last
.
getEndLatitude
()
);
lastObj
.
put
(
"time"
,
0
);
lastObj
.
put
(
"FireCar_Speed"
,
0
);
}
double
endLongitude
=
lastObj
.
getDoubleValue
(
"FireCar_Longitude"
);
double
endLatitude
=
lastObj
.
getDoubleValue
(
"FireCar_Latitude"
);
// 230215180624
// Date endTime =UTCToCST(lastObj.getString("time"));
Date
endTime
=
new
Date
();
long
takeTime
=
(
endTime
.
getTime
()
/
1000
*
1000
)
-
(
last
.
getStartTime
().
getTime
()
/
1000
*
1000
);
if
(
takeTime
<
0
){
...
...
@@ -118,6 +115,7 @@ public class ThreadCarMileageTreatment extends Thread {
end
.
getDoubleValue
(
"FireCar_Longitude"
));
}
last
.
setTravel
(
new
BigDecimal
(
travel
/
1000
).
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
Log
.
info
(
"----------------------------------------last----------------------"
+
lastObj
.
toJSONString
());
wlCarMileageServiceImpl
.
updateById
(
last
);
}
}
...
...
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