Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-miniappserver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b3b80a86
authored
Jul 08, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
3c9d7bbb
b6f1ed3c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
66 deletions
src/main/java/cn/com/glsx/app/common/constants/Constants.java
src/main/java/cn/com/glsx/app/modules/converter/VehicleMonitorConvert.java
src/main/java/cn/com/glsx/app/modules/model/param/ResidentSearch.java
src/main/java/cn/com/glsx/app/modules/service/VehicleMonitorService.java
src/main/java/cn/com/glsx/app/common/constants/Constants.java
View file @
b3b80a8
...
@@ -49,4 +49,9 @@ public final class Constants {
...
@@ -49,4 +49,9 @@ public final class Constants {
* 低电量
* 低电量
*/
*/
public
static
final
int
LOW_POWER_THRESHOLD
=
10
;
public
static
final
int
LOW_POWER_THRESHOLD
=
10
;
/**
* 默认时段全天
*/
public
static
final
int
TIMES_DEFAULT
=
0
;
}
}
src/main/java/cn/com/glsx/app/modules/converter/VehicleMonitorConvert.java
View file @
b3b80a8
package
cn
.
com
.
glsx
.
app
.
modules
.
converter
;
package
cn
.
com
.
glsx
.
app
.
modules
.
converter
;
import
cn.com.glsx.admin.common.util.DateUtil
;
import
cn.com.glsx.admin.common.util.DateUtil
;
import
cn.com.glsx.app.common.constants.Constants
;
import
cn.com.glsx.app.modules.entity.VehicleDeviceWorkOrder
;
import
cn.com.glsx.app.modules.entity.VehicleDeviceWorkOrder
;
import
cn.com.glsx.app.modules.model.param.ResidentSearch
;
import
cn.com.glsx.app.modules.model.param.ResidentSearch
;
import
cn.com.glsx.app.modules.model.view.ResidentListVO
;
import
cn.com.glsx.app.modules.model.view.ResidentListVO
;
...
@@ -55,13 +56,13 @@ public class VehicleMonitorConvert {
...
@@ -55,13 +56,13 @@ public class VehicleMonitorConvert {
}
}
public
static
ResidentRequest
buildResidentRequest
(
ResidentSearch
search
,
String
beginTime
,
String
endTime
,
public
static
ResidentRequest
buildResidentRequest
(
ResidentSearch
search
,
Integer
locInfoType
)
{
Integer
locInfoType
)
{
ResidentRequest
residentRequest
=
new
ResidentRequest
();
ResidentRequest
residentRequest
=
new
ResidentRequest
();
residentRequest
.
setSn
(
search
.
getSn
());
residentRequest
.
setSn
(
search
.
getSn
());
residentRequest
.
setBeginTime
(
beginTime
);
residentRequest
.
setBeginTime
(
search
.
getStartTime
());
residentRequest
.
setEndTime
(
endTime
);
residentRequest
.
setEndTime
(
search
.
getEndTime
());
residentRequest
.
setTimes
(
search
.
getTimes
());
residentRequest
.
setTimes
(
Constants
.
TIMES_DEFAULT
);
Optional
.
ofNullable
(
search
.
getTimes
()).
ifPresent
(
residentRequest:
:
setTimes
);
residentRequest
.
setLocInfoType
(
locInfoType
);
residentRequest
.
setLocInfoType
(
locInfoType
);
return
residentRequest
;
return
residentRequest
;
}
}
...
...
src/main/java/cn/com/glsx/app/modules/model/param/ResidentSearch.java
View file @
b3b80a8
...
@@ -43,15 +43,4 @@ public class ResidentSearch implements Serializable {
...
@@ -43,15 +43,4 @@ public class ResidentSearch implements Serializable {
@ApiModelProperty
(
value
=
"时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天"
)
@ApiModelProperty
(
value
=
"时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天"
)
private
Integer
times
;
private
Integer
times
;
/**
* 定位方式 默认gps 1GPS ,2基站
*/
@ApiModelProperty
(
value
=
"定位方式 默认gps 1GPS ,2基站"
)
private
Integer
locationType
;
/**
* 时间范围 1:1个月内 ,2:3个月内 ,3:半年内,4:截至到目前
*/
@ApiModelProperty
(
value
=
"时间范围 1:1个月内 ,2:3个月内 ,3:半年内,4:截至到目前"
)
private
String
timeRange
;
}
}
src/main/java/cn/com/glsx/app/modules/service/VehicleMonitorService.java
View file @
b3b80a8
...
@@ -136,61 +136,12 @@ public class VehicleMonitorService {
...
@@ -136,61 +136,12 @@ public class VehicleMonitorService {
// 判断查询类型
// 判断查询类型
//2为无源设备查询基站;1为有源设备查询GPS
//2为无源设备查询基站;1为有源设备查询GPS
Device
device
=
deviceService
.
getDeviceBySn
(
search
.
getSn
());
Device
device
=
deviceService
.
getDeviceBySn
(
search
.
getSn
());
VehicleDevice
vehicleDevice
=
vehicleDeviceService
.
getByBindSn
(
search
.
getSn
());
boolean
isGps
=
Objects
.
isNull
(
device
)
||
Objects
.
equals
(
device
.
getSource
(),
1
);
boolean
isGps
=
Objects
.
isNull
(
device
)
||
Objects
.
equals
(
device
.
getSource
(),
1
);
int
lacType
=
isGps
?
1
:
2
;
int
lacType
=
isGps
?
1
:
2
;
Date
deviceActivateTime
=
Optional
.
ofNullable
(
vehicleDevice
)
.
map
(
VehicleDevice:
:
getCreatedDate
)
.
orElse
(
new
Date
());
//转换前端时间
ImmutablePair
<
String
,
String
>
timeImmutablePair
=
convertTime
(
search
,
deviceActivateTime
);
//ICE接口查询常驻地列表
//ICE接口查询常驻地列表
return
VehicleMonitorConvert
.
buildResidentRequest
(
search
,
timeImmutablePair
.
getLeft
(),
timeImmutablePair
.
getRight
(),
lacType
);
return
VehicleMonitorConvert
.
buildResidentRequest
(
search
,
lacType
);
}
}
/**
* 转换开始结束时间
*
* @return 开始时间只取设备激活时间之后
*/
public
ImmutablePair
<
String
,
String
>
convertTime
(
ResidentSearch
search
,
Date
deviceActivateTime
)
{
Date
now
=
new
Date
();
String
startDate
=
""
;
String
endDate
=
DateUtil
.
getNowDateTimeFormat
();
String
deviceActivateTimeStr
=
DateUtil
.
formatDate
(
deviceActivateTime
);
switch
(
search
.
getTimeRange
())
{
//前一个月
case
VehicleConstants
.
RESIDENT_TYPE_ONE
:
String
afterOneMonth
=
DateUtil
.
formatDate
(
DateUtil
.
getDayBefore
(
30
,
now
));
startDate
=
DateUtil
.
getAfterDateTimeStr
(
afterOneMonth
,
deviceActivateTimeStr
);
break
;
//前三个月
case
VehicleConstants
.
RESIDENT_TYPE_THREE
:
String
afterThreeMonth
=
DateUtil
.
formatDate
(
DateUtil
.
getDayBefore
(
90
,
now
));
startDate
=
DateUtil
.
getAfterDateTimeStr
(
afterThreeMonth
,
deviceActivateTimeStr
);
break
;
//前半年
case
VehicleConstants
.
RESIDENT_TYPE_SIX
:
String
afterSixMonth
=
DateUtil
.
formatDate
(
DateUtil
.
getDayBefore
(
180
,
now
));
startDate
=
DateUtil
.
getAfterDateTimeStr
(
afterSixMonth
,
deviceActivateTimeStr
);
break
;
case
VehicleConstants
.
RESIDENT_TYPE_PRESENT
:
startDate
=
deviceActivateTimeStr
;
break
;
//自定义
case
VehicleConstants
.
RESIDENT_TYPE_CUSTOM
:
startDate
=
DateUtil
.
getAfterDateTimeStr
(
search
.
getStartTime
(),
deviceActivateTimeStr
);
endDate
=
search
.
getEndTime
();
break
;
default
:
}
return
new
ImmutablePair
<>(
startDate
,
endDate
);
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment