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
9cd7e2d6
Commit
9cd7e2d6
authored
Sep 13, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车辆过滤无效里程优化
parent
502e67e9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
WlCarMileage.java
...a/com/yeejoin/equipmanage/common/entity/WlCarMileage.java
+2
-0
WlCarMileageController.java
...eejoin/equipmanage/controller/WlCarMileageController.java
+0
-0
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+18
-11
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/WlCarMileage.java
View file @
9cd7e2d6
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -20,6 +21,7 @@ import java.util.Date;
...
@@ -20,6 +21,7 @@ import java.util.Date;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"wl_car_mileage"
)
@ApiModel
(
value
=
"WlCarMileage对象"
,
description
=
"车量里程表"
)
@ApiModel
(
value
=
"WlCarMileage对象"
,
description
=
"车量里程表"
)
public
class
WlCarMileage
extends
BaseEntity
{
public
class
WlCarMileage
extends
BaseEntity
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/WlCarMileageController.java
View file @
9cd7e2d6
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
9cd7e2d6
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yeejoin.equipmanage.common.entity.Car
;
import
com.yeejoin.equipmanage.common.entity.Car
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.common.entity.WlCarMileage
;
import
com.yeejoin.equipmanage.common.utils.CoordinateUtil
;
import
com.yeejoin.equipmanage.common.utils.CoordinateUtil
;
import
com.yeejoin.equipmanage.common.utils.DateUtils
;
import
com.yeejoin.equipmanage.common.utils.HttpUtil
;
import
com.yeejoin.equipmanage.common.utils.HttpUtil
;
import
com.yeejoin.equipmanage.controller.Coordinate
;
import
com.yeejoin.equipmanage.controller.Coordinate
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
...
@@ -45,6 +46,7 @@ import java.text.ParseException;
...
@@ -45,6 +46,7 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* 车量里程表 服务实现类
* 车量里程表 服务实现类
...
@@ -58,7 +60,8 @@ import java.util.*;
...
@@ -58,7 +60,8 @@ import java.util.*;
@EnableAsync
@EnableAsync
public
class
WlCarMileageServiceImpl
extends
ServiceImpl
<
WlCarMileageMapper
,
WlCarMileage
>
public
class
WlCarMileageServiceImpl
extends
ServiceImpl
<
WlCarMileageMapper
,
WlCarMileage
>
implements
IWlCarMileageService
{
implements
IWlCarMileageService
{
@Value
(
"${car.max.speed:100}"
)
private
Integer
CAR_MAX_SPEED
;
@Autowired
@Autowired
IotFeign
iotFeign
;
IotFeign
iotFeign
;
...
@@ -241,19 +244,23 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
...
@@ -241,19 +244,23 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
c
.
setTime
(
date
);
c
.
setTime
(
date
);
c
.
add
(
Calendar
.
MONTH
,
1
);
c
.
add
(
Calendar
.
MONTH
,
1
);
daylist
.
addAll
(
getDayByMonth
(
c
.
getTime
()));
daylist
.
addAll
(
getDayByMonth
(
c
.
getTime
()));
List
<
Map
<
String
,
Object
>>
hasList
=
this
.
listMaps
(
new
QueryWrapper
<
WlCarMileage
>()
//
List<Map<String, Object>> hasList = this.listMaps(new QueryWrapper<WlCarMileage>()
.
select
(
"COUNT(1) AS count,date"
).
lambda
().
eq
(
WlCarMileage:
:
getIotCode
,
car
.
getIotCode
())
//
.select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.
between
(
WlCarMileage:
:
getDate
,
daylist
.
get
(
0
),
daylist
.
get
(
daylist
.
size
()
-
1
))
//
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.
isNotNull
(
WlCarMileage:
:
getEndTime
)
//
.isNotNull(WlCarMileage::getEndTime)
.
ge
(
WlCarMileage:
:
getTravel
,
0.5
)
//
.ge(WlCarMileage::getTravel, 0.5)
.
groupBy
(
WlCarMileage:
:
getDate
));
//
.groupBy(WlCarMileage::getDate));
Map
<
String
,
Object
>
hasMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
hasMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
mapOne
:
hasList
)
{
List
<
WlCarMileage
>
wlCarMileageList
=
this
.
list
(
new
QueryWrapper
<
WlCarMileage
>().
eq
(
"iot_code"
,
car
.
getIotCode
())
hasMap
.
put
(
String
.
valueOf
(
mapOne
.
get
(
"date"
)),
mapOne
.
get
(
"count"
));
.
between
(
"date"
,
daylist
.
get
(
0
),
daylist
.
get
(
daylist
.
size
()
-
1
))
}
.
isNotNull
(
"end_time"
)
.
ge
(
"travel"
,
0.5
)
.
groupBy
(
"date"
));
List
<
WlCarMileage
>
wlCarMileageListActiveData
=
wlCarMileageList
.
stream
().
filter
(
wlCarMileage
->
(!
ObjectUtils
.
isEmpty
(
wlCarMileage
.
getTakeTime
())
&&
(!
ObjectUtils
.
isEmpty
(
wlCarMileage
.
getTravel
())
&&
(
wlCarMileage
.
getTravel
()
/
(
wlCarMileage
.
getTakeTime
()
/
3600000
))
<
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
)
{
for
(
String
day
:
daylist
)
{
boolean
has
=
false
;
boolean
has
=
false
;
if
(
hasMap
.
containsKey
(
day
))
{
if
(
activeDateList
.
contains
(
day
))
{
has
=
true
;
has
=
true
;
}
}
map
.
put
(
day
,
has
);
map
.
put
(
day
,
has
);
...
...
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