Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
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 a713ad1b
authored
Sep 02, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
3a625d09
77c2d54e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
263 additions
and
89 deletions
src/main/java/cn/com/glsx/admin/common/constants/ConstantsDevice.java
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
src/main/java/cn/com/glsx/admin/modules/entity/VehicleDevice.java
src/main/java/cn/com/glsx/admin/modules/model/TestVehicleVo.java
src/main/java/cn/com/glsx/admin/modules/model/VehicleInfoVo.java
src/main/java/cn/com/glsx/admin/modules/service/DeviceService.java
src/main/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveService.java
src/main/java/cn/com/glsx/admin/modules/service/RemoteDeviceService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleDeviceService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/main/resources/mapper/ElectricInStoreDriveMapper.xml
src/main/resources/mapper/TrialDriveReportMapper.xml
src/main/resources/mapper/VehicleDeviceMapper.xml
src/main/resources/mapper/VehicleMapper.xml
src/test/java/cn/com/glsx/admin/modules/service/TrialDriveReportServiceTest.java
src/main/java/cn/com/glsx/admin/common/constants/ConstantsDevice.java
View file @
a713ad1
...
...
@@ -48,4 +48,23 @@ public final class ConstantsDevice {
*/
public
static
final
int
SOURCE_NO
=
0
;
/**
* 试驾设备类型 0:非试驾设备
*/
public
static
final
int
NOT_TRIAL_DEVICE_STATUS
=
0
;
/**
* 试驾设备类型 1:试驾设备
*/
public
static
final
int
TRIAL_DEVICE_STATUS
=
1
;
/**
* 删除标记 0=正常 -1=删除
*/
public
static
final
int
NOT_DEL_FLAG
=
0
;
/**
* 删除标记 1=删除
*/
public
static
final
int
DEL_FLAG
=
1
;
}
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
View file @
a713ad1
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/glsx/admin/modules/entity/VehicleDevice.java
View file @
a713ad1
...
...
@@ -28,4 +28,10 @@ public class VehicleDevice extends BaseEntity {
*/
@Column
(
name
=
"bind_status"
)
private
Integer
bindStatus
;
/**
* 试驾类型 0:非试驾设备, 1,试驾设备
*/
@Column
(
name
=
"trial_type"
)
private
Integer
trialType
;
}
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/model/TestVehicleVo.java
View file @
a713ad1
...
...
@@ -26,4 +26,9 @@ public class TestVehicleVo {
* 车架号
*/
private
String
vin
;
/**
* 1有源 0无源
*/
private
Integer
source
;
}
src/main/java/cn/com/glsx/admin/modules/model/VehicleInfoVo.java
View file @
a713ad1
...
...
@@ -20,49 +20,26 @@ public class VehicleInfoVo implements Serializable {
private
String
sn
;
/**
* 主设备型号 1有线 0无线
*/
private
Integer
deviceType
;
/**
* 从设备1
*/
private
String
sn1
;
/**
* 从设备型号1 1有线 0无线
*/
private
Integer
deviceType1
;
/**
* 从设备2
*/
private
String
sn2
;
/**
* 从设备型号2 1有线 0无线
*/
private
Integer
deviceType2
;
/**
* 从设备3
*/
private
String
sn3
;
/**
* 从设备型号3 1有线 0无线
*/
private
Integer
deviceType3
;
/**
* 从设备4
*/
private
String
sn4
;
/**
* 从设备型号4 1有线 0无线
*/
private
Integer
deviceType4
;
/**
* 从设备5
...
...
@@ -70,19 +47,10 @@ public class VehicleInfoVo implements Serializable {
private
String
sn5
;
/**
* 从设备型号5 1有线 0无线
*/
private
Integer
deviceType5
;
/**
* 从设备6
*/
private
String
sn6
;
/**
* 从设备型号6 1有线 0无线
*/
private
Integer
deviceType6
;
/**
* 从设备7
...
...
@@ -90,31 +58,16 @@ public class VehicleInfoVo implements Serializable {
private
String
sn7
;
/**
* 从设备型号7 1有线 0无线
*/
private
Integer
deviceType7
;
/**
* 从设备8
*/
private
String
sn8
;
/**
* 从设备型号8 1有线 0无线
*/
private
Integer
deviceType8
;
/**
* 从设备9
*/
private
String
sn9
;
/**
* 从设备型号9 1有线 0无线
*/
private
Integer
deviceType9
;
/**
* 姓名
*/
private
String
ownerName
;
...
...
src/main/java/cn/com/glsx/admin/modules/service/DeviceService.java
View file @
a713ad1
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
import
cn.com.glsx.admin.common.constants.ConstantsDevice
;
import
cn.com.glsx.admin.modules.entity.Device
;
import
cn.com.glsx.admin.modules.entity.VehicleDevice
;
import
cn.com.glsx.admin.modules.mapper.DeviceMapper
;
import
cn.com.glsx.admin.modules.mapper.VehicleDeviceMapper
;
import
cn.com.glsx.admin.modules.model.param.TrackInfoBo
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
com.glsx.plat.common.utils.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,11 +28,36 @@ public class DeviceService {
@Autowired
private
RemoteDeviceService
remoteDeviceService
;
@Autowired
private
VehicleDeviceMapper
vehicleDeviceMapper
;
/**
* 插入设备数据
*
* @param device 设备数据
* @return 改变的行数
*/
public
int
insertDevice
(
Device
device
)
{
return
deviceMapper
.
insert
(
device
);
}
Device
getDeviceBySn
(
String
sn
)
{
/**
* 修改设备数据
*
* @param device 设备数据
* @return 改变的行数
*/
public
int
updateDevice
(
Device
device
)
{
return
deviceMapper
.
updateByPrimaryKeySelective
(
device
);
}
/**
* 根据 sn 获取设备信息
*
* @param sn 设备号
* @return 设备信息
*/
public
Device
getDeviceBySn
(
String
sn
)
{
return
deviceMapper
.
selectBySn
(
sn
);
}
...
...
@@ -88,4 +117,56 @@ public class DeviceService {
device
.
setDelFlag
(
0
);
return
deviceMapper
.
select
(
device
);
}
/**
* 通过 sn 调用标准接口获取 设备型号
*
* @param sn 设备号
* @return 设备型号
*/
public
String
getDeviceClassifyNameBysn
(
String
sn
)
{
return
remoteDeviceService
.
getDeviceClassifyNameBysn
(
sn
);
}
/**
* 检查设备号是否在旧E盾以及新E盾中存在(入库) false 不存在
*
* @param sn 设备号
*/
public
boolean
checkSnLocalAndRemote
(
String
sn
)
{
if
(
StringUtils
.
isEmpty
(
sn
))
{
return
false
;
}
Device
device
=
deviceMapper
.
selectBySn
(
sn
);
if
(
device
==
null
)
{
TrackInfoBo
trackInfoBo
=
remoteDeviceService
.
getDeviceBySn
(
sn
);
if
(
trackInfoBo
==
null
)
{
return
false
;
}
else
{
// 在老E盾库中存在就入库
saveTrackInfoBo
(
trackInfoBo
,
ShieldContextHolder
.
getUserId
());
}
}
return
true
;
}
/**
* 检查设备号是否已经绑定
*
* @param sn 设备号
*/
public
boolean
checkBindSn
(
String
sn
)
{
if
(
StringUtils
.
isEmpty
(
sn
))
{
return
false
;
}
VehicleDevice
param
=
new
VehicleDevice
();
param
.
setSn
(
sn
);
param
.
setBindStatus
(
ConstantsDevice
.
BIND_VEHICLE_STATUS
);
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
getVehicleDeviceBySnStatus
(
param
);
if
(
vehicleDevice
==
null
)
{
return
true
;
}
return
false
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveService.java
View file @
a713ad1
...
...
@@ -83,6 +83,7 @@ public class ElectricInStoreDriveService {
Integer
num29
=
null
;
Integer
num30
=
null
;
Integer
num31
=
null
;
Integer
summation
=
0
;
if
(
maxDayNum
>=
28
)
{
num28
=
0
;
...
...
@@ -96,6 +97,7 @@ public class ElectricInStoreDriveService {
if
(
maxDayNum
>=
31
)
{
num31
=
0
;
}
// 组合每一天的数据
for
(
ElectricInStoreDrive
inStoreDrive
:
inStoreDataList
)
{
// 设置报表统计时间
...
...
@@ -105,134 +107,164 @@ public class ElectricInStoreDriveService {
switch
(
dayOfMonth
)
{
case
1
:
num1
=
getInStoreNum
(
inStoreDrive
,
num1
);
summation
=
summation
+
num1
;
electricInStoreExport
.
setDayNum1
(
num1
);
break
;
case
2
:
num2
=
getInStoreNum
(
inStoreDrive
,
num2
);
summation
=
summation
+
num2
;
electricInStoreExport
.
setDayNum2
(
num2
);
break
;
case
3
:
num3
=
getInStoreNum
(
inStoreDrive
,
num3
);
summation
=
summation
+
num3
;
electricInStoreExport
.
setDayNum3
(
num3
);
break
;
case
4
:
num4
=
getInStoreNum
(
inStoreDrive
,
num4
);
summation
=
summation
+
num4
;
electricInStoreExport
.
setDayNum4
(
num4
);
break
;
case
5
:
num5
=
getInStoreNum
(
inStoreDrive
,
num5
);
summation
=
summation
+
num5
;
electricInStoreExport
.
setDayNum5
(
num5
);
break
;
case
6
:
num6
=
getInStoreNum
(
inStoreDrive
,
num6
);
summation
=
summation
+
num6
;
electricInStoreExport
.
setDayNum6
(
num6
);
break
;
case
7
:
num7
=
getInStoreNum
(
inStoreDrive
,
num7
);
summation
=
summation
+
num7
;
electricInStoreExport
.
setDayNum7
(
num7
);
break
;
case
8
:
num8
=
getInStoreNum
(
inStoreDrive
,
num8
);
summation
=
summation
+
num8
;
electricInStoreExport
.
setDayNum8
(
num8
);
break
;
case
9
:
num9
=
getInStoreNum
(
inStoreDrive
,
num9
);
summation
=
summation
+
num9
;
electricInStoreExport
.
setDayNum9
(
num9
);
break
;
case
10
:
num10
=
getInStoreNum
(
inStoreDrive
,
num10
);
summation
=
summation
+
num10
;
electricInStoreExport
.
setDayNum10
(
num10
);
break
;
case
11
:
num11
=
getInStoreNum
(
inStoreDrive
,
num11
);
summation
=
summation
+
num11
;
electricInStoreExport
.
setDayNum11
(
num11
);
break
;
case
12
:
num12
=
getInStoreNum
(
inStoreDrive
,
num12
);
summation
=
summation
+
num12
;
electricInStoreExport
.
setDayNum12
(
num12
);
break
;
case
13
:
num13
=
getInStoreNum
(
inStoreDrive
,
num13
);
summation
=
summation
+
num13
;
electricInStoreExport
.
setDayNum13
(
num13
);
break
;
case
14
:
num14
=
getInStoreNum
(
inStoreDrive
,
num14
);
summation
=
summation
+
num14
;
electricInStoreExport
.
setDayNum14
(
num14
);
break
;
case
15
:
num15
=
getInStoreNum
(
inStoreDrive
,
num15
);
summation
=
summation
+
num15
;
electricInStoreExport
.
setDayNum15
(
num15
);
break
;
case
16
:
num16
=
getInStoreNum
(
inStoreDrive
,
num16
);
summation
=
summation
+
num16
;
electricInStoreExport
.
setDayNum16
(
num16
);
break
;
case
17
:
num17
=
getInStoreNum
(
inStoreDrive
,
num17
);
summation
=
summation
+
num17
;
electricInStoreExport
.
setDayNum17
(
num17
);
break
;
case
18
:
num18
=
getInStoreNum
(
inStoreDrive
,
num18
);
summation
=
summation
+
num18
;
electricInStoreExport
.
setDayNum18
(
num18
);
break
;
case
19
:
num19
=
getInStoreNum
(
inStoreDrive
,
num19
);
summation
=
summation
+
num19
;
electricInStoreExport
.
setDayNum19
(
num19
);
break
;
case
20
:
num20
=
getInStoreNum
(
inStoreDrive
,
num20
);
summation
=
summation
+
num20
;
electricInStoreExport
.
setDayNum20
(
num20
);
break
;
case
21
:
num21
=
getInStoreNum
(
inStoreDrive
,
num21
);
summation
=
summation
+
num21
;
electricInStoreExport
.
setDayNum21
(
num21
);
break
;
case
22
:
num22
=
getInStoreNum
(
inStoreDrive
,
num22
);
summation
=
summation
+
num22
;
electricInStoreExport
.
setDayNum22
(
num22
);
break
;
case
23
:
num23
=
getInStoreNum
(
inStoreDrive
,
num23
);
summation
=
summation
+
num23
;
electricInStoreExport
.
setDayNum23
(
num23
);
break
;
case
24
:
num24
=
getInStoreNum
(
inStoreDrive
,
num24
);
summation
=
summation
+
num24
;
electricInStoreExport
.
setDayNum24
(
num24
);
break
;
case
25
:
num25
=
getInStoreNum
(
inStoreDrive
,
num25
);
summation
=
summation
+
num25
;
electricInStoreExport
.
setDayNum25
(
num25
);
break
;
case
26
:
num26
=
getInStoreNum
(
inStoreDrive
,
num26
);
summation
=
summation
+
num26
;
electricInStoreExport
.
setDayNum26
(
num26
);
break
;
case
27
:
num27
=
getInStoreNum
(
inStoreDrive
,
num27
);
summation
=
summation
+
num27
;
electricInStoreExport
.
setDayNum27
(
num27
);
break
;
case
28
:
num28
=
getInStoreNum
(
inStoreDrive
,
num28
);
summation
=
summation
+
num28
;
electricInStoreExport
.
setDayNum28
(
num28
);
break
;
case
29
:
num29
=
getInStoreNum
(
inStoreDrive
,
num29
);
summation
=
summation
+
num29
;
electricInStoreExport
.
setDayNum29
(
num29
);
break
;
case
30
:
num30
=
getInStoreNum
(
inStoreDrive
,
num30
);
summation
=
summation
+
num30
;
electricInStoreExport
.
setDayNum30
(
num30
);
break
;
case
31
:
num31
=
getInStoreNum
(
inStoreDrive
,
num31
);
summation
=
summation
+
num31
;
electricInStoreExport
.
setDayNum8
(
num31
);
break
;
default
:
log
.
info
(
"已经超过最大天数"
);
}
}
int
summation
=
num1
+
num2
+
num3
+
num4
+
num5
+
num6
+
num7
+
num8
+
num9
+
num10
+
num11
+
num12
+
num13
+
num14
+
num15
+
num16
;
summation
=
summation
+
num17
+
num18
+
num19
+
num20
+
num21
+
num22
+
num23
+
num24
+
num25
+
num26
+
num27
+
num28
+
num29
+
num30
+
num31
;
electricInStoreExport
.
setSummation
(
summation
);
electricInStoreExport
.
setDayNum1
(
replaceDayNum
(
electricInStoreExport
.
getDayNum1
()));
...
...
src/main/java/cn/com/glsx/admin/modules/service/RemoteDeviceService.java
View file @
a713ad1
...
...
@@ -7,7 +7,6 @@ import com.glsx.plat.common.utils.HttpUtils;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.util.PropertiesUtil
;
import
org.springframework.stereotype.Service
;
import
java.util.TreeMap
;
...
...
@@ -19,6 +18,7 @@ public class RemoteDeviceService {
/**
* 调用e盾标准接口获取设备信息
*
* @param sn
*/
public
TrackInfoBo
getDeviceBySn
(
String
sn
)
{
...
...
@@ -50,4 +50,39 @@ public class RemoteDeviceService {
TrackInfoBo
trackInfoBo
=
JSONObject
.
parseObject
(
data
,
TrackInfoBo
.
class
);
return
trackInfoBo
;
}
/**
* 调用e盾标准接口获取设备型号
*
* @param sn 设备号
*/
public
String
getDeviceClassifyNameBysn
(
String
sn
)
{
String
url
=
PropertiesUtils
.
getProperty
(
"edun.otsi.url"
)
+
"/api/device/getDeviceClassifyNameBysn"
;
String
appKet
=
PropertiesUtils
.
getProperty
(
"edun.otsi.appKet"
);
String
appSecret
=
PropertiesUtils
.
getProperty
(
"edun.otsi.appSecret"
);
TreeMap
<
String
,
Object
>
tparams
=
new
TreeMap
<>();
tparams
.
put
(
"appKey"
,
appKet
);
tparams
.
put
(
"sn"
,
sn
);
//加密得到sign
String
sign
=
GopUtil
.
sign
(
tparams
,
appSecret
);
tparams
.
put
(
"sign"
,
sign
);
String
result
=
HttpUtils
.
get
(
url
,
tparams
);
log
.
info
(
"getDeviceClassifyNameBysn====result==="
+
result
);
JSONObject
resultObj
=
JSONObject
.
parseObject
(
result
);
if
(
resultObj
==
null
)
{
log
.
info
(
"remote getInfoBysn result is null"
);
return
null
;
}
String
returnCode
=
resultObj
.
getString
(
"returnCode"
);
String
message
=
resultObj
.
getString
(
"message"
);
if
(
StringUtils
.
isBlank
(
returnCode
)
||
!
"0"
.
equals
(
returnCode
))
{
log
.
info
(
"remote getInfoBysn fail! returnCode:"
+
returnCode
+
"; message:"
+
message
);
return
null
;
}
String
deviceClassifyName
=
resultObj
.
getString
(
"data"
);
if
(
StringUtils
.
isBlank
(
deviceClassifyName
))
{
return
null
;
}
return
deviceClassifyName
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/VehicleDeviceService.java
View file @
a713ad1
...
...
@@ -90,8 +90,7 @@ public class VehicleDeviceService {
param
.
setBindStatus
(
ConstantsDevice
.
BIND_VEHICLE_STATUS
);
param
.
setVehicleId
(
vehicleId
);
//匹配设备
List
<
VehicleDevice
>
bindVehicleDevice
=
vehicleDeviceMapper
.
getVehicleDeviceByVehicleIdStatus
(
param
);
return
bindVehicleDevice
;
return
vehicleDeviceMapper
.
getVehicleDeviceByVehicleIdStatus
(
param
);
}
/**
...
...
@@ -103,8 +102,7 @@ public class VehicleDeviceService {
VehicleDevice
param
=
new
VehicleDevice
();
param
.
setSn
(
sn
);
param
.
setBindStatus
(
ConstantsDevice
.
BIND_VEHICLE_STATUS
);
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
getVehicleDeviceBySnStatus
(
param
);
return
vehicleDevice
;
return
vehicleDeviceMapper
.
getVehicleDeviceBySnStatus
(
param
);
}
/**
...
...
@@ -146,4 +144,23 @@ public class VehicleDeviceService {
public
void
unBindByVehicleId
(
Long
id
)
{
vehicleDeviceMapper
.
unBindByVehicleId
(
id
);
}
public
VehicleDevice
getTrialDeviceBySn
(
String
sn
)
{
VehicleDevice
param
=
new
VehicleDevice
();
param
.
setSn
(
sn
);
param
.
setBindStatus
(
ConstantsDevice
.
BIND_VEHICLE_STATUS
);
param
.
setTrialType
(
ConstantsDevice
.
TRIAL_DEVICE_STATUS
);
param
.
setDelFlag
(
ConstantsDevice
.
NOT_DEL_FLAG
);
return
vehicleDeviceMapper
.
selectOne
(
param
);
}
public
List
<
VehicleDevice
>
listTrialDeviceByVehicleIdBind
(
Long
vehicleId
)
{
VehicleDevice
param
=
new
VehicleDevice
();
param
.
setVehicleId
(
vehicleId
);
param
.
setBindStatus
(
ConstantsDevice
.
BIND_VEHICLE_STATUS
);
param
.
setTrialType
(
ConstantsDevice
.
TRIAL_DEVICE_STATUS
);
param
.
setDelFlag
(
ConstantsDevice
.
NOT_DEL_FLAG
);
//匹配设备
return
vehicleDeviceMapper
.
select
(
param
);
}
}
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
a713ad1
...
...
@@ -432,21 +432,19 @@ public class VehicleService {
/**
* 先删除试驾车辆 再删除绑定关系
*
* @param
tempId
* @param
vehicleId 车辆ID
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteDriveVehicleAndUnBind
(
String
tempId
)
{
// 删除车辆表中的数据 状态标记为删除
deleteDriveVehicle
(
Long
.
parseLong
(
tempId
));
public
void
deleteDriveVehicleAndUnBind
(
String
vehicleId
)
{
// 删除试驾车辆关系表中的数据 状态标记为删除
deleteTrialDriveVehicle
(
Long
.
parseLong
(
temp
Id
));
// 查询
关联的设备进行解绑
List
<
VehicleDevice
>
vehicleDeviceList
=
vehicleDeviceService
.
list
VehicleDeviceByVehicleIdBind
(
Long
.
parseLong
(
temp
Id
));
deleteTrialDriveVehicle
(
Long
.
parseLong
(
vehicle
Id
));
// 查询
与车架号关联 且是试驾设备的列表
List
<
VehicleDevice
>
vehicleDeviceList
=
vehicleDeviceService
.
list
TrialDeviceByVehicleIdBind
(
Long
.
parseLong
(
vehicle
Id
));
for
(
VehicleDevice
vehicleDevice
:
vehicleDeviceList
)
{
vehicleDevice
.
setUpdatedDate
(
new
Date
());
vehicleDevice
.
setUpdatedBy
(
ShieldContextHolder
.
getUserId
());
vehicleDevice
.
setBindStatus
(
ConstantsDevice
.
UN_BIND_VEHICLE_STATUS
);
vehicleDevice
.
set
DelFlag
(
Constants
.
DELETE_FLAG
);
//试驾设备标记为非试驾设备
vehicleDevice
.
set
TrialType
(
ConstantsDevice
.
NOT_TRIAL_DEVICE_STATUS
);
vehicleDeviceService
.
updateByPrimaryKey
(
vehicleDevice
);
}
}
...
...
@@ -1187,14 +1185,22 @@ public class VehicleService {
return
vehicleMapper
.
listTestDriveVehicle
();
}
public
void
addTestDriveVehicle
(
List
<
Long
>
vehicleIds
)
{
for
(
Long
id
:
vehicleIds
)
{
TrialDriveVehicle
trialDriveVehicle
=
new
TrialDriveVehicle
();
trialDriveVehicle
.
setVehicleId
(
id
);
trialDriveVehicle
.
setDelFlag
(
0
);
trialDriveVehicle
.
setCreatedDate
(
new
Date
());
trialDriveVehicle
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
trialDriveVehicleMapper
.
insertSelective
(
trialDriveVehicle
);
}
@Transactional
public
void
addTestDriveVehicle
(
TestVehicleVo
testVehicleVo
)
{
TrialDriveVehicle
trialDriveVehicle
=
new
TrialDriveVehicle
();
trialDriveVehicle
.
setVehicleId
(
testVehicleVo
.
getId
());
trialDriveVehicle
.
setDelFlag
(
0
);
trialDriveVehicle
.
setCreatedDate
(
new
Date
());
trialDriveVehicle
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
trialDriveVehicleMapper
.
insertSelective
(
trialDriveVehicle
);
VehicleDevice
vehicleDevice
=
vehicleDeviceService
.
getVehicleDeviceBySnBind
(
testVehicleVo
.
getSn
());
vehicleDevice
.
setTrialType
(
1
);
vehicleDeviceService
.
updateByPrimaryKey
(
vehicleDevice
);
}
public
void
removeTrialSn
(
String
sn
)
{
VehicleDevice
vehicleDevice
=
vehicleDeviceService
.
getTrialDeviceBySn
(
sn
);
vehicleDevice
.
setTrialType
(
ConstantsDevice
.
NOT_TRIAL_DEVICE_STATUS
);
vehicleDeviceService
.
updateByPrimaryKey
(
vehicleDevice
);
}
}
src/main/resources/mapper/ElectricInStoreDriveMapper.xml
View file @
a713ad1
...
...
@@ -38,11 +38,11 @@
from t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_electric_fence tef on tef.id = tefs.fence_id
inner join t_trial_drive_vehicle ttdv on ttdv
.vehicle_id = tv.id
left join t_vehicle_device tvd on tvd
.vehicle_id = tv.id
left join t_user tu on tu.id = tef.created_by
where tef.biz_fence_type = 12
and tu.del_flag = 0
and t
tdv.del_flag = 0
and t
vd.trial_type = 1
<if
test=
"keywords != null and keywords!='' "
>
and (
tu.account like '%${keywords}%'
...
...
@@ -69,9 +69,7 @@
</if>
</otherwise>
</choose>
<if
test=
"sn !=null and sn != ''"
>
and teid.sn = #{sn}
</if>
and teid.sn = #{sn}
</where>
</select>
</mapper>
src/main/resources/mapper/TrialDriveReportMapper.xml
View file @
a713ad1
...
...
@@ -9,7 +9,6 @@
<result
column=
"sn"
jdbcType=
"VARCHAR"
property=
"sn"
/>
<result
column=
"vin"
jdbcType=
"VARCHAR"
property=
"vin"
/>
<result
column=
"statDate"
jdbcType=
"VARCHAR"
property=
"statDate"
/>
<result
column=
"cnt"
jdbcType=
"INTEGER"
property=
"cnt"
/>
<result
column=
"dayCount"
jdbcType=
"INTEGER"
property=
"dayCount"
/>
<result
column=
"cnttotal"
jdbcType=
"INTEGER"
property=
"cnttotal"
/>
</resultMap>
...
...
@@ -35,11 +34,11 @@
from t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_electric_fence tef on tef.id = tefs.fence_id
inner join t_trial_drive_vehicle ttdv on ttdv
.vehicle_id = tv.id
left join t_vehicle_device tvd on tvd
.vehicle_id = tv.id
left join t_user tu on tu.id = tef.created_by
where tef.del_flag = 0
and tef.biz_fence_type = 12
and t
tdv.del_flag = 0
and t
vd.trial_type = 1
<if
test=
"keywords != null and keywords!='' "
>
and (
tu.account like '%${keywords}%'
...
...
@@ -69,10 +68,7 @@
</if>
</otherwise>
</choose>
<if
test=
"sn != null and sn !=''"
>
and tsfd.sn = #{sn}
</if>
and tsfd.sn = #{sn}
</where>
</select>
...
...
src/main/resources/mapper/VehicleDeviceMapper.xml
View file @
a713ad1
...
...
@@ -10,6 +10,7 @@
<result
column=
"sn"
jdbcType=
"VARCHAR"
property=
"sn"
/>
<result
column=
"bind_status"
jdbcType=
"TINYINT"
property=
"bindStatus"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"trial_type"
jdbcType=
"TINYINT"
property=
"trialType"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
<result
column=
"updated_date"
jdbcType=
"TIMESTAMP"
property=
"updatedDate"
/>
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
a713ad1
...
...
@@ -160,7 +160,7 @@
tvd.created_date installedTime
from t_vehicle tv
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0
and tvd.trial_type = 1
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0
...
...
@@ -181,7 +181,7 @@
tu.username shopName, tu.account shopCode,
group_concat(tvd.sn) sns
from t_vehicle tv
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0
and tvd.trial_type = 1
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0
...
...
@@ -346,9 +346,11 @@
</select>
<select
id=
"listTestDriveVehicle"
resultType=
"cn.com.glsx.admin.modules.model.TestVehicleVo"
>
select tv.id ,tv.vin ,tv.owner_name
select tv.id ,tv.vin ,tv.owner_name
,td.sn ,td.source
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn
where tv.del_flag = 0
and tv
.id not in (select vehicle_id from t_trial_drive_vehicle)
and tv
d.trial_type = 0
</select>
</mapper>
\ No newline at end of file
src/test/java/cn/com/glsx/admin/modules/service/TrialDriveReportServiceTest.java
View file @
a713ad1
...
...
@@ -8,6 +8,7 @@ import cn.com.glsx.usercenter.api.feign.OrganizationService;
import
cn.com.glsx.usercenter.api.feign.UserService
;
import
com.alibaba.fastjson.JSON
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
...
...
@@ -21,6 +22,7 @@ import java.util.ArrayList;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@RunWith
(
SpringRunner
.
class
)
...
...
@@ -90,4 +92,25 @@ public class TrialDriveReportServiceTest {
List
<
TrialDriveReportExport
>
testDriveData
=
trialDriveReportService
.
search
(
search
);
System
.
out
.
println
(
"testDriveData = "
+
JSON
.
toJSONString
(
testDriveData
));
}
@Test
public
void
test08
()
{
ArrayList
<
String
>
strings
=
new
ArrayList
<>();
strings
.
add
(
null
);
strings
.
add
(
null
);
strings
.
add
(
null
);
strings
.
add
(
null
);
strings
.
add
(
null
);
List
<
String
>
collect
=
strings
.
stream
().
filter
(
StringUtils:
:
isNotEmpty
).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"strings = "
+
JSON
.
toJSONString
(
collect
));
}
@Test
public
void
test09
()
{
Integer
a
=
1
;
Integer
b
=
null
;
System
.
out
.
println
(
a
+
b
);
}
}
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