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
bd8b0548
Commit
bd8b0548
authored
Oct 26, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.车辆里程统计问题不显示问题处理。
2.新增开关默认走电力的监听器。
parent
12255d2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
14 deletions
+27
-14
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+5
-1
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+7
-7
AmostEquipApplication.java
...quip/src/main/java/com/yeejoin/AmostEquipApplication.java
+15
-6
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
bd8b0548
...
...
@@ -1383,6 +1383,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Double
totalTravel
=
0.0
;
LambdaQueryWrapper
<
WlCarMileage
>
wrapper
=
new
LambdaQueryWrapper
<
WlCarMileage
>();
wrapper
.
eq
(
WlCarMileage:
:
getIotCode
,
car
.
getIotCode
());
wrapper
.
ge
(
WlCarMileage:
:
getTravel
,
0.5
);
wrapper
.
isNotNull
(
WlCarMileage:
:
getEndTime
);
wrapper
.
isNotNull
(
WlCarMileage:
:
getStartTime
);
// .ge("travel", 0.5)
List
<
WlCarMileage
>
list
=
iWlCarMileageService
.
list
(
wrapper
);
for
(
WlCarMileage
wl
:
list
)
{
//判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
...
...
@@ -1390,7 +1394,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
totalTravel
+=
wl
.
getTravel
();
}
}
car
.
setTotalTravel
(
totalTravel
);
car
.
setTotalTravel
(
Double
.
valueOf
(
String
.
format
(
"%.1f"
,
totalTravel
))
);
WlCarMileage
last
=
iWlCarMileageService
.
getOne
(
new
LambdaQueryWrapper
<
WlCarMileage
>().
eq
(
WlCarMileage:
:
getIotCode
,
car
.
getIotCode
())
.
orderByDesc
(
WlCarMileage:
:
getEndTime
).
last
(
"limit 1"
));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
bd8b0548
...
...
@@ -239,7 +239,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()));
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
()));
coordinate
.
setLnglat
(
doubles
);
Double
speeed
=
getSpeedByOriginalData
(
objects
,
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()),
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
())
,
i
);
Double
speeed
=
getSpeedByOriginalData
(
objects
,
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()),
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
()));
coordinate
.
setSpeed
(
speeed
);
coordinates
.
add
(
coordinate
);
}
...
...
@@ -281,8 +281,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
List
<
WlCarMileage
>
wlCarMileageList
=
this
.
list
(
new
QueryWrapper
<
WlCarMileage
>().
eq
(
"iot_code"
,
car
.
getIotCode
())
.
between
(
"date"
,
daylist
.
get
(
0
),
daylist
.
get
(
daylist
.
size
()
-
1
))
.
isNotNull
(
"end_time"
)
.
ge
(
"travel"
,
0.5
)
.
groupBy
(
"date"
));
.
ge
(
"travel"
,
0.5
)
);
//
.groupBy("date"));
List
<
WlCarMileage
>
wlCarMileageListActiveData
=
wlCarMileageList
.
stream
().
filter
(
wl
->
(!
ObjectUtils
.
isEmpty
(
wl
.
getTakeTime
())
&&
!
ObjectUtils
.
isEmpty
(
wl
.
getTravel
())
&&
((
wl
.
getTravel
()
/
(
wl
.
getTakeTime
()
/
3600000.0
))
<
CAR_MAX_SPEED
))).
collect
(
Collectors
.
toList
());
List
<
String
>
activeDateList
=
wlCarMileageListActiveData
.
stream
().
map
(
wlCarMileage
->
String
.
valueOf
(
DateUtils
.
convertDateToString
(
wlCarMileage
.
getDate
(),
DateUtils
.
DATE_PATTERN
))).
collect
(
Collectors
.
toList
());
for
(
String
day
:
daylist
)
{
...
...
@@ -494,11 +494,11 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
* @param index 当前纠偏数据的索引
* @return 当前数据应该展示的速度
*/
public
Double
getSpeedByOriginalData
(
JSONArray
objects
,
Double
startLatitude
,
Double
startLongitude
,
Integer
index
)
{
public
Double
getSpeedByOriginalData
(
JSONArray
objects
,
Double
startLatitude
,
Double
startLongitude
)
{
Double
speed
=
0.0
;
for
(
int
i
=
index
;
i
<
objects
.
size
()
-
1
;
i
++)
{
JSONObject
jsonObject1
=
objects
.
getJSONObject
(
i
ndex
);
JSONObject
jsonObject2
=
objects
.
getJSONObject
(
i
ndex
+
1
);
for
(
int
i
=
0
;
i
<
objects
.
size
()
-
1
;
i
++)
{
JSONObject
jsonObject1
=
objects
.
getJSONObject
(
i
);
JSONObject
jsonObject2
=
objects
.
getJSONObject
(
i
+
1
);
Double
travel1
=
CoordinateUtil
.
distance
(
startLatitude
,
startLongitude
,
jsonObject1
.
getDoubleValue
(
"x"
),
jsonObject1
.
getDoubleValue
(
"y"
));
Double
travel2
=
CoordinateUtil
.
distance
(
startLatitude
,
startLongitude
,
jsonObject2
.
getDoubleValue
(
"x"
),
jsonObject2
.
getDoubleValue
(
"y"
));
log
.
info
(
"travel1:"
+
travel1
+
"travel2:"
+
travel2
);
...
...
amos-boot-system-equip/src/main/java/com/yeejoin/AmostEquipApplication.java
View file @
bd8b0548
...
...
@@ -9,6 +9,7 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
...
...
@@ -45,6 +46,9 @@ import java.net.UnknownHostException;
public
class
AmostEquipApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmostEquipApplication
.
class
);
//是否走江西电建的车辆监听器,默认不走,如果在配置文件中添加了该配置且配置的值不为false
@Value
(
"${jxiop.carIotNewListener.enable:false}"
)
private
String
jxiop
;
@Autowired
private
EmqKeeper
emqKeeper
;
...
...
@@ -86,16 +90,21 @@ public class AmostEquipApplication {
@Bean
void
initMqtt
()
throws
MqttException
{
try
{
emqKeeper
.
subscript
(
"+/+/property"
,
1
,
carIotListener
);
if
(
jxiop
.
equals
(
"false"
)){
emqKeeper
.
subscript
(
"+/+/property"
,
1
,
carIotListener
);
}
else
{
emqKeeper
.
subscript
(
"+/+/property"
,
1
,
carIotNewListener
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"EMQ初始化连接失败!"
);
}
}
//
江西电建服务重启后对于未计时且未结束的里程的进行处理
@Bean
void
initCarMelige
()
{
threadCarMileageTreatment
.
start
();
}
//
江西电建服务重启后对于未计时且未结束的里程的进行处理
//
@Bean
//
void initCarMelige() {
//
threadCarMileageTreatment.start();
//
}
}
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