Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a290bf45
authored
May 06, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发设备激活保存激活位置点功能
1 parent
429f49b8
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
412 additions
and
6 deletions
src/main/java/cn/com/glsx/stdinterface/common/constants/Constants.java
src/main/java/cn/com/glsx/stdinterface/modules/component/DeviceActiveComponent.java
src/main/java/cn/com/glsx/stdinterface/modules/component/DeviceActiveEventHandle.java
src/main/java/cn/com/glsx/stdinterface/modules/controller/DeviceActiveController.java
src/main/java/cn/com/glsx/stdinterface/modules/entity/VehicleDevice.java
src/main/java/cn/com/glsx/stdinterface/modules/mapper/VehicleDeviceMapper.java
src/main/java/cn/com/glsx/stdinterface/modules/model/datasync/DeviceActiveSync.java
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteGpsBsService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceActiveService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/WorkOrderService.java
src/main/resources/mapper/VehicleDeviceMapper.xml
src/test/java/cn/com/glsx/stdinterface/modules/service/WorkOrderServiceTest.java
src/main/java/cn/com/glsx/stdinterface/common/constants/Constants.java
View file @
a290bf4
...
@@ -173,4 +173,16 @@ public final class Constants {
...
@@ -173,4 +173,16 @@ public final class Constants {
public
static
final
int
ACTIVED
=
1
;
public
static
final
int
ACTIVED
=
1
;
}
}
public
static
class
LocationType
{
/**
* 定位类型(0、GPS,1、基站)
*/
public
static
final
int
GPS
=
0
;
/**
* 定位类型(0、GPS,1、基站)
*/
public
static
final
int
BS
=
1
;
}
}
}
src/main/java/cn/com/glsx/stdinterface/modules/component/DeviceActiveComponent.java
0 → 100644
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
component
;
import
cn.com.glsx.stdinterface.modules.model.datasync.DeviceActiveSync
;
import
cn.com.glsx.stdinterface.modules.service.DeviceActiveService
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* 设备激活处理组件类
*
* @author yangll
*/
@Slf4j
@Component
public
class
DeviceActiveComponent
{
@Autowired
private
DeviceActiveService
deviceActiveService
;
/**
* 保存设备激活信息到关联表
*
* @param deviceActiveSync 设备号集合
*/
public
void
saveActiveInfo
(
DeviceActiveSync
deviceActiveSync
)
{
log
.
info
(
"active snList:"
+
JSONUtil
.
toJsonStr
(
deviceActiveSync
.
getSnList
()));
deviceActiveService
.
saveActiveInfo
(
deviceActiveSync
.
getSnList
());
}
}
src/main/java/cn/com/glsx/stdinterface/modules/component/DeviceActiveEventHandle.java
0 → 100644
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
component
;
import
cn.com.glsx.stdinterface.modules.model.datasync.DeviceActiveSync
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
/**
* 设备激活同步激活经纬度和激活地址
*
* @author yangll
*/
@Slf4j
@Component
public
class
DeviceActiveEventHandle
{
@Autowired
private
DeviceActiveComponent
deviceActiveComponent
;
@EventListener
public
void
event
(
DeviceActiveSync
deviceActiveSync
)
{
log
.
info
(
"event channel DeviceActive snList:{}"
,
JSONUtil
.
toJsonStr
(
deviceActiveSync
.
getSnList
()));
deviceActiveComponent
.
saveActiveInfo
(
deviceActiveSync
);
}
}
src/main/java/cn/com/glsx/stdinterface/modules/controller/DeviceActiveController.java
0 → 100644
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
controller
;
import
cn.com.glsx.stdinterface.api.DeviceActiveClient
;
import
cn.com.glsx.stdinterface.dto.DeviceActiveDto
;
import
cn.com.glsx.stdinterface.modules.service.DeviceActiveService
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.enums.OperateType
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 设备激活 controller
*
* @author yangll
* @date 2022/4/12
*/
@Slf4j
@RestController
@RequestMapping
(
"/deviceactive"
)
@Api
(
value
=
"设备激活"
,
tags
=
{
"设备激活"
})
public
class
DeviceActiveController
implements
DeviceActiveClient
{
@Autowired
private
DeviceActiveService
deviceActiveService
;
@Override
@PostMapping
(
"/saveActiveInfo"
)
@ApiOperation
(
value
=
"保存设备激活定位点"
)
@SysLog
(
module
=
"设备激活"
,
value
=
"保存设备激活定位点"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
public
R
saveActiveInfo
(
@RequestBody
DeviceActiveDto
deviceActiveDto
)
{
deviceActiveService
.
saveActiveInfo
(
deviceActiveDto
.
getSnList
());
return
R
.
ok
();
}
/**
* 手动更新设备号激活定位数据
*
* @param snList 设备号集合
* @return
*/
@PostMapping
(
"/saveActiveInfoFlush"
)
@ApiOperation
(
value
=
"手动更新设备激活定位点"
)
@SysLog
(
module
=
"设备激活"
,
value
=
"手动更新设备激活定位点"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
public
R
saveActiveInfoFlush
(
@RequestBody
List
<
String
>
snList
)
{
deviceActiveService
.
saveActiveInfo
(
snList
);
return
R
.
ok
();
}
/**
* 手动更新设备号激活定位数据
*
* @return
*/
@PostMapping
(
"/saveActiveInfoFlushAll"
)
@ApiOperation
(
value
=
"手动更新全部设备激活定位点"
)
@SysLog
(
module
=
"设备激活"
,
value
=
"手动更新设备激活定位点"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
public
R
saveActiveInfoFlushAll
()
{
deviceActiveService
.
saveActiveInfoFlushAll
();
return
R
.
ok
();
}
/**
* 获取七天以内没有激活定位信息的设备号
*
* @return 设备号集合
*/
@Override
@GetMapping
(
"/getUnActiveInfoSnList"
)
@ApiOperation
(
value
=
"获取七天以内没有激活定位信息的设备号"
)
@SysLog
(
module
=
"设备激活"
,
value
=
"获取七天以内没有激活定位信息的设备号"
,
action
=
OperateType
.
QUERY
,
saveLog
=
false
)
public
R
<
List
<
String
>>
getUnActiveInfoSnList
()
{
List
<
String
>
unActiveInfoSnList
=
deviceActiveService
.
getUnActiveInfoSnList
();
log
.
info
(
"unActiveInfoSnList size==="
+
unActiveInfoSnList
.
size
());
return
R
.
ok
().
data
(
unActiveInfoSnList
);
}
}
src/main/java/cn/com/glsx/stdinterface/modules/entity/VehicleDevice.java
View file @
a290bf4
...
@@ -5,6 +5,7 @@ import lombok.Data;
...
@@ -5,6 +5,7 @@ import lombok.Data;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
java.util.Date
;
/**
/**
* 车辆设备绑定关系
* 车辆设备绑定关系
...
@@ -47,4 +48,33 @@ public class VehicleDevice extends BaseEntity {
...
@@ -47,4 +48,33 @@ public class VehicleDevice extends BaseEntity {
@Column
(
name
=
"wire_type"
)
@Column
(
name
=
"wire_type"
)
private
Integer
wireType
;
private
Integer
wireType
;
/**
* 激活上点时间
*/
@Column
(
name
=
"active_location_date"
)
private
Date
activeLocationDate
;
/**
* 激活上点经度
*/
@Column
(
name
=
"active_location_lng"
)
private
String
activeLocationLng
;
/**
* 激活上点纬度
*/
@Column
(
name
=
"active_location_lat"
)
private
String
activeLocationLat
;
/**
* 激活上点类型 0、GPS,1、基站
*/
@Column
(
name
=
"active_location_type"
)
private
Integer
activeLocationType
;
/**
* 激活上点地址
*/
@Column
(
name
=
"active_location_address"
)
private
String
activeLocationAddress
;
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/modules/mapper/VehicleDeviceMapper.java
View file @
a290bf4
...
@@ -32,4 +32,8 @@ public interface VehicleDeviceMapper extends CommonBaseMapper<VehicleDevice> {
...
@@ -32,4 +32,8 @@ public interface VehicleDeviceMapper extends CommonBaseMapper<VehicleDevice> {
* 取绑定状态设备
* 取绑定状态设备
*/
*/
VehicleDevice
selectVehicleDevcieBySn
(
@Param
(
"sn"
)
String
sn
);
VehicleDevice
selectVehicleDevcieBySn
(
@Param
(
"sn"
)
String
sn
);
List
<
String
>
getUnActiveInfoSnList
(
@Param
(
"dayTimeFormat"
)
String
dayTimeFormat
);
List
<
String
>
getAllUnActiveInfoSnList
();
}
}
src/main/java/cn/com/glsx/stdinterface/modules/model/datasync/DeviceActiveSync.java
0 → 100644
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
model
.
datasync
;
import
lombok.Data
;
import
java.util.List
;
/**
* 设备激活观察者模式类
*/
@Data
public
class
DeviceActiveSync
{
/**
* 设备列表
*/
private
List
<
String
>
snList
;
public
DeviceActiveSync
(
List
<
String
>
snList
)
{
this
.
setSnList
(
snList
);
}
}
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteGpsBsService.java
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
remote
;
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
remote
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsBsData
;
import
cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum
;
import
cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService
;
import
cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.google.common.collect.Maps
;
import
com.google.gson.reflect.TypeToken
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
* GpsBsService 服务的处理层
* GpsBsService 服务的处理层
*
*
...
@@ -37,4 +47,39 @@ public class RemoteGpsBsService {
...
@@ -37,4 +47,39 @@ public class RemoteGpsBsService {
}
}
return
address
;
return
address
;
}
}
/**
* 根据设备号获取定位信息
*
* @param snList 设备号集合
* @return
*/
public
Map
<
String
,
GpsBsData
>
getLastGpsBsMapBySns
(
List
<
String
>
snList
)
{
Map
<
String
,
Integer
>
snsMap
=
Maps
.
newHashMap
();
snList
.
forEach
(
sn
->
snsMap
.
put
(
sn
,
DeviceTypeRelationEnum
.
GPS
.
getBizDeviceType
()));
R
<
List
<
GpsBsData
>>
listR
=
gpsBsFeignService
.
getLastGpsBsBySns
(
snsMap
);
List
<
GpsBsData
>
gpsBsDataList
=
listR
.
getDataList
(
new
TypeToken
<
List
<
GpsBsData
>>()
{
}.
getType
());
Map
<
String
,
GpsBsData
>
gpsBsDataMap
=
Maps
.
newHashMap
();
if
(
CollectionUtils
.
isNotEmpty
(
gpsBsDataList
))
{
gpsBsDataMap
=
gpsBsDataList
.
stream
().
collect
(
Collectors
.
toMap
(
GpsBsData:
:
getSn
,
Function
.
identity
(),
(
o
,
n
)
->
n
));
}
return
gpsBsDataMap
;
}
/**
* 根据设备号获取定位信息
*
* @param snList 设备号集合
* @return
*/
public
List
<
GpsBsData
>
getLastGpsBsListBySns
(
List
<
String
>
snList
)
{
Map
<
String
,
Integer
>
snsMap
=
Maps
.
newHashMap
();
snList
.
forEach
(
sn
->
snsMap
.
put
(
sn
,
DeviceTypeRelationEnum
.
GPS
.
getBizDeviceType
()));
R
<
List
<
GpsBsData
>>
listR
=
gpsBsFeignService
.
getLastGpsBsBySns
(
snsMap
);
List
<
GpsBsData
>
gpsBsDataList
=
listR
.
getDataList
(
new
TypeToken
<
List
<
GpsBsData
>>()
{
}.
getType
());
return
gpsBsDataList
;
}
}
}
src/main/java/cn/com/glsx/stdinterface/modules/service/DeviceActiveService.java
0 → 100644
View file @
a290bf4
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
service
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsBsData
;
import
cn.com.glsx.devicemonitor.api.dto.response.GpsLocation
;
import
cn.com.glsx.stdinterface.common.constants.Constants
;
import
cn.com.glsx.stdinterface.modules.entity.VehicleDevice
;
import
cn.com.glsx.stdinterface.modules.mapper.VehicleDeviceMapper
;
import
cn.com.glsx.stdinterface.modules.remote.RemoteGpsBsService
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 设备激活 service
*
* @author yangll
*/
@Slf4j
@Service
public
class
DeviceActiveService
{
@Autowired
private
RemoteGpsBsService
remoteGpsBsService
;
@Autowired
private
VehicleDeviceMapper
vehicleDeviceMapper
;
/**
* 保存设备激活信息
*
* @param snList 设备号集合
*/
public
void
saveActiveInfo
(
List
<
String
>
snList
)
{
if
(
CollectionUtil
.
isEmpty
(
snList
))
{
log
.
info
(
"snList is null"
);
return
;
}
List
<
GpsBsData
>
lastGpsBsList
=
remoteGpsBsService
.
getLastGpsBsListBySns
(
snList
);
lastGpsBsList
.
forEach
(
gpsBsData
->
{
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
selectBindingDeviceBySn
(
gpsBsData
.
getSn
());
GpsLocation
gpsLocation
=
gpsBsData
.
getGpsLocation
();
// 默认保存GPS定位数据 没有GPS定位数据 保存BS定位数据
if
(
Objects
.
nonNull
(
gpsLocation
))
{
vehicleDevice
.
setActiveLocationDate
(
DateUtil
.
parseDateTime
(
gpsLocation
.
getDateTime
()));
vehicleDevice
.
setActiveLocationType
(
Constants
.
LocationType
.
GPS
);
vehicleDevice
.
setActiveLocationLng
(
gpsLocation
.
getLng
());
vehicleDevice
.
setActiveLocationLat
(
gpsLocation
.
getLat
());
vehicleDevice
.
setActiveLocationAddress
(
gpsLocation
.
getAddress
());
}
else
{
GpsLocation
bsLocation
=
gpsBsData
.
getBsLocation
();
if
(
Objects
.
nonNull
(
bsLocation
))
{
vehicleDevice
.
setActiveLocationDate
(
DateUtil
.
parseDateTime
(
bsLocation
.
getDateTime
()));
vehicleDevice
.
setActiveLocationType
(
Constants
.
LocationType
.
BS
);
vehicleDevice
.
setActiveLocationLng
(
bsLocation
.
getLng
());
vehicleDevice
.
setActiveLocationLat
(
bsLocation
.
getLat
());
vehicleDevice
.
setActiveLocationAddress
(
bsLocation
.
getAddress
());
}
}
// 保存激活信息
log
.
info
(
"active device info:"
+
JSONUtil
.
toJsonStr
(
vehicleDevice
));
vehicleDeviceMapper
.
updateByPrimaryKeySelective
(
vehicleDevice
);
});
}
/**
* 获取7天内没有激活数据的设备号
*
* @return 设备号集合
*/
public
List
<
String
>
getUnActiveInfoSnList
()
{
// 获取七天前的日期
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DATE
,
-
7
);
String
dayTimeFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
cal
.
getTime
());
log
.
info
(
"开始数据统计的天数==="
+
dayTimeFormat
);
return
vehicleDeviceMapper
.
getUnActiveInfoSnList
(
dayTimeFormat
);
}
/**
* 手动更新全部设备激活定位数据
*/
public
void
saveActiveInfoFlushAll
()
{
List
<
String
>
allUnActiveInfoSnList
=
vehicleDeviceMapper
.
getAllUnActiveInfoSnList
();
log
.
info
(
"allUnActiveInfoSnList size==="
+
allUnActiveInfoSnList
.
size
());
saveActiveInfo
(
allUnActiveInfoSnList
);
}
}
src/main/java/cn/com/glsx/stdinterface/modules/service/WorkOrderService.java
View file @
a290bf4
...
@@ -24,6 +24,7 @@ import cn.com.glsx.stdinterface.modules.converter.*;
...
@@ -24,6 +24,7 @@ import cn.com.glsx.stdinterface.modules.converter.*;
import
cn.com.glsx.stdinterface.modules.entity.*
;
import
cn.com.glsx.stdinterface.modules.entity.*
;
import
cn.com.glsx.stdinterface.modules.mapper.*
;
import
cn.com.glsx.stdinterface.modules.mapper.*
;
import
cn.com.glsx.stdinterface.modules.model.*
;
import
cn.com.glsx.stdinterface.modules.model.*
;
import
cn.com.glsx.stdinterface.modules.model.datasync.DeviceActiveSync
;
import
cn.com.glsx.stdinterface.modules.remote.NotifyCenterService
;
import
cn.com.glsx.stdinterface.modules.remote.NotifyCenterService
;
import
cn.com.glsx.stdinterface.modules.util.DeviceLocationUtil
;
import
cn.com.glsx.stdinterface.modules.util.DeviceLocationUtil
;
import
cn.com.glsx.usercenter.api.dto.response.User
;
import
cn.com.glsx.usercenter.api.dto.response.User
;
...
@@ -32,6 +33,7 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -32,6 +33,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
...
@@ -43,6 +45,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -43,6 +45,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -122,6 +125,9 @@ public class WorkOrderService {
...
@@ -122,6 +125,9 @@ public class WorkOrderService {
@Autowired
@Autowired
private
DeviceService
deviceService
;
private
DeviceService
deviceService
;
@Autowired
private
ApplicationEventPublisher
applicationEventPublisher
;
/**
/**
* 新增工单
* 新增工单
*
*
...
@@ -1341,6 +1347,21 @@ public class WorkOrderService {
...
@@ -1341,6 +1347,21 @@ public class WorkOrderService {
log
.
error
(
"actived or audit workorder update device activedStatus exception:{}"
,
e
.
getMessage
(),
e
);
log
.
error
(
"actived or audit workorder update device activedStatus exception:{}"
,
e
.
getMessage
(),
e
);
}
}
}
}
// 发送设备激活监听事件
List
<
String
>
snList
=
devices
.
stream
().
map
(
VehicleDevice:
:
getSn
).
filter
(
StringUtils:
:
isNotBlank
).
collect
(
Collectors
.
toList
());
pushDeviceEvent
(
snList
);
}
/**
* 发送激活设备信息
*
* @param snList 设备号集合
*/
private
void
pushDeviceEvent
(
List
<
String
>
snList
)
{
log
.
info
(
"active device publisher event:snList:{}"
,
JSONObject
.
toJSONString
(
snList
));
// 发送设备激活时间
applicationEventPublisher
.
publishEvent
(
new
DeviceActiveSync
(
snList
));
}
}
/**
/**
...
...
src/main/resources/mapper/VehicleDeviceMapper.xml
View file @
a290bf4
...
@@ -12,6 +12,11 @@
...
@@ -12,6 +12,11 @@
<result
column=
"trial_type"
jdbcType=
"TINYINT"
property=
"trialType"
/>
<result
column=
"trial_type"
jdbcType=
"TINYINT"
property=
"trialType"
/>
<result
column=
"his_type"
jdbcType=
"TINYINT"
property=
"hisType"
/>
<result
column=
"his_type"
jdbcType=
"TINYINT"
property=
"hisType"
/>
<result
column=
"wire_type"
jdbcType=
"TINYINT"
property=
"wireType"
/>
<result
column=
"wire_type"
jdbcType=
"TINYINT"
property=
"wireType"
/>
<result
column=
"active_location_date"
jdbcType=
"TIMESTAMP"
property=
"activeLocationDate"
/>
<result
column=
"active_location_lng"
jdbcType=
"VARCHAR"
property=
"activeLocationLng"
/>
<result
column=
"active_location_lat"
jdbcType=
"VARCHAR"
property=
"activeLocationLat"
/>
<result
column=
"active_location_type"
jdbcType=
"TINYINT"
property=
"activeLocationType"
/>
<result
column=
"active_location_address"
jdbcType=
"VARCHAR"
property=
"activeLocationAddress"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
...
@@ -22,8 +27,9 @@
...
@@ -22,8 +27,9 @@
<!--
<!--
WARNING - @mbg.generated
WARNING - @mbg.generated
-->
-->
id, vehicle_id, sn, bind_status, trial_type, his_type, wire_type, del_flag, created_date, created_by,
id, vehicle_id, sn, bind_status, trial_type, his_type, wire_type, active_location_date,
updated_date, updated_by
active_location_lng, active_location_lat, active_location_type, active_location_address,
del_flag, created_date, created_by, updated_date, updated_by
</sql>
</sql>
<select
id=
"getVdIdbySn"
resultMap=
"BaseResultMap"
>
<select
id=
"getVdIdbySn"
resultMap=
"BaseResultMap"
>
...
@@ -75,4 +81,23 @@
...
@@ -75,4 +81,23 @@
and sn = #{sn}
and sn = #{sn}
order by id desc limit 1
order by id desc limit 1
</select>
</select>
<select
id=
"getUnActiveInfoSnList"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_vehicle_device
where del_flag = 0
and bind_status = 1
and left(created_date,10)
<![CDATA[ >= ]]>
#{dayTimeFormat}
and active_location_date is null
</select>
<select
id=
"getAllUnActiveInfoSnList"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_vehicle_device
where del_flag = 0
and bind_status = 1
and active_location_date is null
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
src/test/java/cn/com/glsx/stdinterface/modules/service/WorkOrderServiceTest.java
View file @
a290bf4
...
@@ -12,6 +12,7 @@ import cn.com.glsx.stdinterface.modules.entity.WorkOrderDocs;
...
@@ -12,6 +12,7 @@ import cn.com.glsx.stdinterface.modules.entity.WorkOrderDocs;
import
cn.com.glsx.stdinterface.modules.mapper.WorkOrderDocsMapper
;
import
cn.com.glsx.stdinterface.modules.mapper.WorkOrderDocsMapper
;
import
cn.com.glsx.stdinterface.modules.model.CommonApiRequest
;
import
cn.com.glsx.stdinterface.modules.model.CommonApiRequest
;
import
cn.com.glsx.stdinterface.modules.model.WorkOrderInfoBO
;
import
cn.com.glsx.stdinterface.modules.model.WorkOrderInfoBO
;
import
cn.com.glsx.stdinterface.modules.model.datasync.DeviceActiveSync
;
import
cn.com.glsx.stdinterface.modules.remote.NotifyCenterService
;
import
cn.com.glsx.stdinterface.modules.remote.NotifyCenterService
;
import
cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils
;
import
cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
...
@@ -25,13 +26,11 @@ import org.junit.Test;
...
@@ -25,13 +26,11 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
...
@@ -54,6 +53,9 @@ public class WorkOrderServiceTest {
...
@@ -54,6 +53,9 @@ public class WorkOrderServiceTest {
@Resource
@Resource
private
ZhongliVehicleService
zhongliVehicleService
;
private
ZhongliVehicleService
zhongliVehicleService
;
@Autowired
private
ApplicationEventPublisher
applicationEventPublisher
;
@Test
@Test
public
void
test
()
{
public
void
test
()
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
...
@@ -183,4 +185,14 @@ public class WorkOrderServiceTest {
...
@@ -183,4 +185,14 @@ public class WorkOrderServiceTest {
orderReq
.
setPlateNo
(
"粤CF32223"
);
orderReq
.
setPlateNo
(
"粤CF32223"
);
workOrderService
.
updateWorkOrderVin
(
workOrderVehicle
,
orderReq
);
workOrderService
.
updateWorkOrderVin
(
workOrderVehicle
,
orderReq
);
}
}
@Test
public
void
publishEnvent
()
{
List
<
String
>
snList
=
new
ArrayList
<>();
snList
.
add
(
"111111"
);
snList
.
add
(
"111112"
);
snList
.
add
(
"111113"
);
applicationEventPublisher
.
publishEvent
(
new
DeviceActiveSync
(
snList
));
System
.
out
.
println
(
"success"
);
}
}
}
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