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 f71572ab
authored
May 27, 2021
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]试驾服务
1 parent
ddf263bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
30 deletions
src/main/java/cn/com/glsx/admin/modules/entity/Vehicle.java
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveVehicleEditBo.java
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleDocSearch.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleDocService.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/main/resources/mapper/VehicleMapper.xml
src/main/java/cn/com/glsx/admin/modules/entity/Vehicle.java
View file @
f71572a
package
cn
.
com
.
glsx
.
admin
.
modules
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.glsx.plat.mybatis.base.BaseEntity
;
import
lombok.Data
;
...
...
@@ -171,6 +172,12 @@ public class Vehicle extends BaseEntity {
*/
@Column
(
name
=
"buy_type"
)
private
String
buyType
;
/**
* 购置方式
*/
@Column
(
name
=
"registration_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
registrationDate
;
}
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveVehicleEditBo.java
View file @
f71572a
...
...
@@ -4,6 +4,7 @@ import cn.com.glsx.admin.modules.model.ValidateGroups;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
/**
* @Desc:
...
...
@@ -37,5 +38,9 @@ public class TrialDriveVehicleEditBo extends TrialDriveVehicleBo {
* 备注
*/
private
String
remark
;
/**
* 备注
*/
private
Date
registrationDate
;
}
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleDocSearch.java
View file @
f71572a
...
...
@@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.Not
Blank
;
import
javax.validation.constraints.Not
Null
;
/**
* @author zhouhaibao
...
...
@@ -15,7 +15,7 @@ import javax.validation.constraints.NotBlank;
@AllArgsConstructor
public
class
VehicleDocSearch
{
@Not
Blank
(
message
=
"车辆id不能为空"
)
@Not
Null
(
message
=
"车辆id不能为空"
)
private
Long
vehicleId
;
private
Integer
docType
;
...
...
src/main/java/cn/com/glsx/admin/modules/service/VehicleDocService.java
View file @
f71572a
...
...
@@ -54,29 +54,32 @@ public class VehicleDocService {
TrialDriveVehicleEditBo
trialDriveVehicleEditBo
=
new
TrialDriveVehicleEditBo
();
BeanUtils
.
copyProperties
(
vehicleInfoBo
,
trialDriveVehicleEditBo
);
trialDriveVehicleEditBo
.
setTempId
(
vehicleInfoBo
.
getTempId
()
+
""
);
vehicleService
.
updateDriveVehicleById
(
trialDriveVehicleEditBo
);
trialDriveVehicleEditBo
.
setRegistrationDate
(
new
Date
());
vehicleService
.
updateVehicle
(
trialDriveVehicleEditBo
);
// 2.更新上牌资料信息
List
<
VehicleDocBo
>
vehicleDocBoList
=
vehicleInfoBo
.
getList
();
List
<
VehicleDoc
>
vehicleDocList
=
vehicleDocBoList
.
stream
().
map
(
index
->
{
VehicleDoc
vehicleDoc
=
new
VehicleDoc
();
BeanUtils
.
copyProperties
(
index
,
vehicleDoc
);
vehicleDoc
.
setVehicleId
(
vehicleInfoBo
.
getTempId
());
return
vehicleDoc
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
vehicleDocList
))
{
vehicleDocList
.
forEach
(
index
->
{
List
<
VehicleDoc
>
vehicleDoc
=
vehicleDocMapper
.
findByCondition
(
new
VehicleDocSearch
(
index
.
getVehicleId
(),
index
.
getDocType
()));
if
(
CollectionUtils
.
isEmpty
(
vehicleDoc
))
{
index
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
index
.
setCreatedDate
(
new
Date
());
vehicleDocMapper
.
insert
(
index
);
}
else
{
index
.
setId
(
vehicleDoc
.
get
(
0
).
getId
());
index
.
setUpdatedBy
(
ShieldContextHolder
.
getUserId
());
index
.
setUpdatedDate
(
new
Date
());
vehicleDocMapper
.
updateByPrimaryKeySelective
(
index
);
}
});
if
(
CollectionUtils
.
isNotEmpty
(
vehicleDocBoList
))
{
List
<
VehicleDoc
>
vehicleDocList
=
vehicleDocBoList
.
stream
().
map
(
index
->
{
VehicleDoc
vehicleDoc
=
new
VehicleDoc
();
BeanUtils
.
copyProperties
(
index
,
vehicleDoc
);
vehicleDoc
.
setVehicleId
(
vehicleInfoBo
.
getTempId
());
return
vehicleDoc
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
vehicleDocList
))
{
vehicleDocList
.
forEach
(
index
->
{
List
<
VehicleDoc
>
vehicleDoc
=
vehicleDocMapper
.
findByCondition
(
new
VehicleDocSearch
(
index
.
getVehicleId
(),
index
.
getDocType
()));
if
(
CollectionUtils
.
isEmpty
(
vehicleDoc
))
{
index
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
index
.
setCreatedDate
(
new
Date
());
vehicleDocMapper
.
insert
(
index
);
}
else
{
index
.
setId
(
vehicleDoc
.
get
(
0
).
getId
());
index
.
setUpdatedBy
(
ShieldContextHolder
.
getUserId
());
index
.
setUpdatedDate
(
new
Date
());
vehicleDocMapper
.
updateByPrimaryKeySelective
(
index
);
}
});
}
}
// 3.提交上牌资料审核信息
approvalService
.
saveApproval
(
new
ApprovalBo
(
ConstantsApproval
.
VEL_DOC_APPROVAL
,
vehicleInfoBo
.
getTempId
()));
...
...
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
f71572a
...
...
@@ -117,20 +117,29 @@ public class VehicleService {
/**
* 修改试驾车辆信息
*
* @param driveVehicleoBo
* @param driveVehicleoBo
车辆入参
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
DriveVehicleById
(
TrialDriveVehicleEditBo
driveVehicleoBo
)
{
public
void
update
Vehicle
(
TrialDriveVehicleEditBo
driveVehicleoBo
)
{
Vehicle
vehicle
=
vehicleMapper
.
selectById
(
Long
.
parseLong
(
driveVehicleoBo
.
getTempId
()));
BeanUtils
.
copyProperties
(
driveVehicleoBo
,
vehicle
);
vehicle
.
setUpdatedBy
(
ShieldContextHolder
.
getUserId
());
vehicle
.
setUpdatedDate
(
new
Date
());
vehicleMapper
.
updateByPrimaryKey
(
vehicle
);
List
<
VehicleDevice
>
bindVehicleDevice
=
listVehicleDeviceByVehicleIdStatus
(
vehicle
.
getId
());
String
sn
=
driveVehicleoBo
.
getSn
();
}
/**
* 修改试驾车辆信息(车辆设备关系维护)
*
* @param driveVehicleoBo
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateDriveVehicleById
(
TrialDriveVehicleEditBo
driveVehicleoBo
)
{
updateVehicle
(
driveVehicleoBo
);
List
<
VehicleDevice
>
bindVehicleDevice
=
listVehicleDeviceByVehicleIdStatus
(
Long
.
valueOf
(
driveVehicleoBo
.
getTempId
()));
String
sn
=
driveVehicleoBo
.
getSn
();
if
(
StringUtils
.
isBlank
(
sn
)
&&
CollectionUtils
.
isEmpty
(
bindVehicleDevice
))
{
return
;
return
;
}
else
if
(
StringUtils
.
isBlank
(
sn
)
&&
CollectionUtils
.
isNotEmpty
(
bindVehicleDevice
))
{
throw
new
AdminException
(
ResultEnum
.
UN_BIND_DEVICE
);
}
else
if
(
StringUtils
.
isNotBlank
(
sn
)
&&
CollectionUtils
.
isNotEmpty
(
bindVehicleDevice
))
{
...
...
@@ -147,12 +156,13 @@ public class VehicleService {
}
}
else
if
(
StringUtils
.
isNotBlank
(
sn
)
&&
CollectionUtils
.
isEmpty
(
bindVehicleDevice
))
{
//绑定
saveVehicleDevice
(
sn
,
vehicle
.
getId
(
));
saveVehicleDevice
(
sn
,
Long
.
valueOf
(
driveVehicleoBo
.
getTempId
()
));
}
}
/**
* 保存车辆设备绑定关系
*
* @param sn
* @param vehicleId
*/
...
...
@@ -168,6 +178,7 @@ public class VehicleService {
/**
* 查询车辆绑定了哪些设备
*
* @param vehicleId
* @return
*/
...
...
@@ -331,6 +342,7 @@ public class VehicleService {
/**
* 下载失败的数据
*
* @param failSeqNoFile
* @return
* @throws FileNotFoundException
...
...
@@ -343,6 +355,7 @@ public class VehicleService {
/**
* 批量插入
*
* @param vehicleList
*/
public
int
insertList
(
List
<
Vehicle
>
vehicleList
)
{
...
...
@@ -351,6 +364,7 @@ public class VehicleService {
/**
* 查找特约店(账户)是否存在
*
* @param userRequest
* @return
*/
...
...
@@ -366,6 +380,7 @@ public class VehicleService {
/**
* 保存车辆、车辆和设备的绑定关系
*
* @param vi
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -380,13 +395,14 @@ public class VehicleService {
//保存车辆和设备的绑定关系
String
sn
=
vi
.
getSn
();
if
(
StringUtils
.
isBlank
(
sn
))
{
return
;
return
;
}
saveVehicleDevice
(
sn
,
vehicle
.
getId
());
}
/**
* 保存导入失败的数据
*
* @param failList
*/
public
String
saveFialData
(
List
<
TrialDriveVehicleImport
>
failList
)
{
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
f71572a
...
...
@@ -36,6 +36,7 @@
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
<result
column=
"updated_date"
jdbcType=
"TIMESTAMP"
property=
"updatedDate"
/>
<result
column=
"updated_by"
jdbcType=
"INTEGER"
property=
"updatedBy"
/>
<result
column=
"registration_date"
jdbcType=
"TIMESTAMP"
property=
"registrationDate"
/>
</resultMap>
<resultMap
id=
"TearDownAlarmMap"
type=
"cn.com.glsx.admin.modules.model.export.TearDownModelExport"
>
...
...
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