Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
customer-service
Commits
112e7a59
Commit
112e7a59
authored
May 14, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加承运商接口:查询司机与车辆绑定列表
parent
74198e4b
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
433 additions
and
11 deletions
+433
-11
DriverVehicleController.java
...mer/module/driver/controller/DriverVehicleController.java
+13
-0
DriverVehicleQueryForm.java
...t/customer/module/driver/form/DriverVehicleQueryForm.java
+51
-0
DriverVehicleService.java
.../customer/module/driver/service/DriverVehicleService.java
+10
-0
DriverVehicleServiceImpl.java
.../module/driver/service/impl/DriverVehicleServiceImpl.java
+25
-0
CarrierDriverBindVehicleDetailVO.java
...er/module/driver/vo/CarrierDriverBindVehicleDetailVO.java
+77
-0
CarrierDriverBindVehicleVO.java
...customer/module/driver/vo/CarrierDriverBindVehicleVO.java
+8
-8
AccountInfoForm.java
...ight/customer/module/goodsowner/form/AccountInfoForm.java
+2
-2
AccountServiceImpl.java
...er/module/goodsowner/service/impl/AccountServiceImpl.java
+3
-0
VehicleController.java
...customer/module/vehicle/controller/VehicleController.java
+15
-0
VehicleDao.java
...m/esv/freight/customer/module/vehicle/dao/VehicleDao.java
+11
-0
VehicleDriverDao.java
...freight/customer/module/vehicle/dao/VehicleDriverDao.java
+10
-0
VehicleDriverService.java
...customer/module/vehicle/service/VehicleDriverService.java
+10
-0
VehicleService.java
...eight/customer/module/vehicle/service/VehicleService.java
+12
-0
VehicleDriverServiceImpl.java
...module/vehicle/service/impl/VehicleDriverServiceImpl.java
+6
-0
VehicleServiceImpl.java
...tomer/module/vehicle/service/impl/VehicleServiceImpl.java
+23
-0
VehicleAllVO.java
.../esv/freight/customer/module/vehicle/vo/VehicleAllVO.java
+40
-0
AccountDao.xml
src/main/resources/mapper/goodsowner/AccountDao.xml
+1
-1
VehicleDao.xml
src/main/resources/mapper/vehicle/VehicleDao.xml
+33
-0
VehicleDriverDao.xml
src/main/resources/mapper/vehicle/VehicleDriverDao.xml
+26
-0
DriverVehicleControllerTest.java
...module/driver/controller/DriverVehicleControllerTest.java
+31
-0
VehicleControllerTest.java
...omer/module/vehicle/controller/VehicleControllerTest.java
+26
-0
No files found.
src/main/java/com/esv/freight/customer/module/driver/controller/DriverVehicleController.java
View file @
112e7a59
...
@@ -6,6 +6,7 @@ import com.esv.freight.customer.common.validator.groups.ValidatorDetail;
...
@@ -6,6 +6,7 @@ import com.esv.freight.customer.common.validator.groups.ValidatorDetail;
import
com.esv.freight.customer.module.driver.form.CarrierForm
;
import
com.esv.freight.customer.module.driver.form.CarrierForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorBind
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorBind
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorCanBind
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorCanBind
;
...
@@ -129,4 +130,16 @@ public class DriverVehicleController {
...
@@ -129,4 +130,16 @@ public class DriverVehicleController {
public
EResponse
canBindDriver
(
@RequestBody
@Validated
(
ValidatorCanBind
.
class
)
DriverQueryForm
form
)
throws
EException
{
public
EResponse
canBindDriver
(
@RequestBody
@Validated
(
ValidatorCanBind
.
class
)
DriverQueryForm
form
)
throws
EException
{
return
EResponse
.
ok
(
driverVehicleService
.
selectVehicleCanBindDriverList
(
form
));
return
EResponse
.
ok
(
driverVehicleService
.
selectVehicleCanBindDriverList
(
form
));
}
}
/**
* description 查询司机与车辆绑定列表
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/13 19:11
**/
@PostMapping
(
"/query"
)
public
EResponse
query
(
@RequestBody
DriverVehicleQueryForm
form
)
throws
EException
{
return
EResponse
.
ok
(
driverVehicleService
.
getDriverVehicle4Params
(
form
));
}
}
}
src/main/java/com/esv/freight/customer/module/driver/form/DriverVehicleQueryForm.java
0 → 100644
View file @
112e7a59
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
form
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Range
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/28 20:13
* @version:1.0
*/
@Data
public
class
DriverVehicleQueryForm
{
/**
* 承运商ID
*/
@NotNull
(
message
=
"参数id不能为空"
)
private
Long
id
;
/**
* 车牌号
*/
@Length
(
max
=
8
,
message
=
"参数licenseNumber长度不合法"
)
private
String
licenseNumber
;
/**
* 页码
**/
@Range
(
min
=
1
,
max
=
65535
,
message
=
"无效的pageNum"
)
@NotNull
(
message
=
"参数pageNum不能为空"
)
private
Integer
pageNum
;
/**
* 每页记录条数
**/
@Range
(
min
=
1
,
max
=
100
,
message
=
"pageSize"
)
@NotNull
(
message
=
"参数pageSize不能为空"
)
private
Integer
pageSize
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverVehicleService.java
View file @
112e7a59
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.vo.CarrierDriverVehicleVO
;
import
com.esv.freight.customer.module.driver.vo.CarrierDriverVehicleVO
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleCanBindDriverVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleCanBindDriverVO
;
...
@@ -95,4 +96,13 @@ public interface DriverVehicleService {
...
@@ -95,4 +96,13 @@ public interface DriverVehicleService {
**/
**/
PageResultVO
selectVehicleCanBindDriverList
(
DriverQueryForm
form
);
PageResultVO
selectVehicleCanBindDriverList
(
DriverQueryForm
form
);
/**
* description 查询司机与车辆绑定列表
* param [form]
* return com.esv.freight.customer.common.vo.PageResultVO
* author Administrator
* createTime 2020/05/13 19:06
**/
PageResultVO
getDriverVehicle4Params
(
DriverVehicleQueryForm
form
);
}
}
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverVehicleServiceImpl.java
View file @
112e7a59
...
@@ -15,6 +15,7 @@ import com.esv.freight.customer.module.driver.dto.DriverVehicleDto;
...
@@ -15,6 +15,7 @@ import com.esv.freight.customer.module.driver.dto.DriverVehicleDto;
import
com.esv.freight.customer.module.driver.entity.DriverAccountEntity
;
import
com.esv.freight.customer.module.driver.entity.DriverAccountEntity
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.service.DriverAccountService
;
import
com.esv.freight.customer.module.driver.service.DriverAccountService
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.vo.*
;
import
com.esv.freight.customer.module.driver.vo.*
;
...
@@ -301,4 +302,28 @@ public class DriverVehicleServiceImpl implements DriverVehicleService {
...
@@ -301,4 +302,28 @@ public class DriverVehicleServiceImpl implements DriverVehicleService {
return
new
PageResultVO
(
page
,
targetRecordList
);
return
new
PageResultVO
(
page
,
targetRecordList
);
}
}
@Override
public
PageResultVO
getDriverVehicle4Params
(
DriverVehicleQueryForm
form
)
{
// 3:查询
IPage
<
DriverVehicleDto
>
page
=
new
Page
<>(
form
.
getPageNum
(),
form
.
getPageSize
());
this
.
vehicleDriverService
.
selectDriverVehicle4Params
(
page
,
form
);
// 4:数据转换
List
<
DriverVehicleDto
>
dtoList
=
page
.
getRecords
();
List
<
CarrierDriverBindVehicleDetailVO
>
targetRecordList
=
new
ArrayList
<>();
for
(
DriverVehicleDto
dto
:
dtoList
)
{
CarrierDriverBindVehicleDetailVO
vo
=
new
CarrierDriverBindVehicleDetailVO
();
BeanUtils
.
copyProperties
(
dto
,
vo
);
if
(
CarrierConstants
.
CARRIER_TYPE_COMPANY
.
equals
(
dto
.
getCarrierType
()))
{
vo
.
setCarrierName
(
dto
.
getCarrierFullName
());
}
else
{
vo
.
setCarrierName
(
dto
.
getCarrierContactor
());
}
targetRecordList
.
add
(
vo
);
}
return
new
PageResultVO
(
page
,
targetRecordList
);
}
}
}
src/main/java/com/esv/freight/customer/module/driver/vo/CarrierDriverBindVehicleDetailVO.java
0 → 100644
View file @
112e7a59
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
vo
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.driver.vo.CarrierDriverBindVehicleDetailVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/06 11:15
* @version:1.0
*/
@Data
public
class
CarrierDriverBindVehicleDetailVO
{
/**
* 承运商ID
*/
private
Long
carrierId
;
/**
* 承运商名称
*/
private
String
carrierName
;
/**
* 司机ID
*/
private
Long
driverId
;
/**
* 司机(帐号)手机号
*/
private
String
driverAccount
;
/**
* 司机帐号状态:1-正常、2-停用
*/
private
Integer
driverAccountStatus
;
/**
* 司机帐号创建来源:1-平台创建、2-自行注册
*/
private
Integer
driverSourceType
;
/**
* 司机帐号审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
private
Integer
driverAuditStatus
;
/**
* 司机姓名
*/
private
String
driverName
;
/**
* 车辆ID
*/
private
Long
vehicleId
;
/**
* 车辆状态:1-正常、2-停用
*/
private
Integer
vehicleStatus
;
/**
* 车辆审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
private
Integer
vehicleAuditStatus
;
/**
* 车辆创建来源:1-平台创建、2-司机创建
*/
private
Integer
vehicleSourceType
;
/**
* 车辆车牌号
*/
private
String
vehicleLicenseNumber
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/driver/vo/CarrierDriverBindVehicleVO.java
View file @
112e7a59
...
@@ -19,7 +19,7 @@ public class CarrierDriverBindVehicleVO {
...
@@ -19,7 +19,7 @@ public class CarrierDriverBindVehicleVO {
/**
/**
* 司机ID
* 司机ID
*/
*/
private
Stri
ng
driverId
;
private
Lo
ng
driverId
;
/**
/**
* 司机(帐号)手机号
* 司机(帐号)手机号
*/
*/
...
@@ -27,15 +27,15 @@ public class CarrierDriverBindVehicleVO {
...
@@ -27,15 +27,15 @@ public class CarrierDriverBindVehicleVO {
/**
/**
* 司机帐号状态:1-正常、2-停用
* 司机帐号状态:1-正常、2-停用
*/
*/
private
String
driverAccountStatus
;
private
Integer
driverAccountStatus
;
/**
/**
* 司机帐号创建来源:1-平台创建、2-自行注册
* 司机帐号创建来源:1-平台创建、2-自行注册
*/
*/
private
String
driverSourceType
;
private
Integer
driverSourceType
;
/**
/**
* 司机帐号审核状态(字典表):0-待审核、1-审核成功,2-审核失败
* 司机帐号审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
*/
private
String
driverAuditStatus
;
private
Integer
driverAuditStatus
;
/**
/**
* 司机姓名
* 司机姓名
*/
*/
...
@@ -44,19 +44,19 @@ public class CarrierDriverBindVehicleVO {
...
@@ -44,19 +44,19 @@ public class CarrierDriverBindVehicleVO {
/**
/**
* 车辆ID
* 车辆ID
*/
*/
private
Stri
ng
vehicleId
;
private
Lo
ng
vehicleId
;
/**
/**
* 车辆状态:1-正常、2-停用
* 车辆状态:1-正常、2-停用
*/
*/
private
String
vehicleStatus
;
private
Integer
vehicleStatus
;
/**
/**
* 车辆审核状态(字典表):0-待审核、1-审核成功,2-审核失败
* 车辆审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
*/
private
String
vehicleAuditStatus
;
private
Integer
vehicleAuditStatus
;
/**
/**
* 车辆创建来源:1-平台创建、2-司机创建
* 车辆创建来源:1-平台创建、2-司机创建
*/
*/
private
String
vehicleSourceType
;
private
Integer
vehicleSourceType
;
/**
/**
* 车辆车牌号
* 车辆车牌号
*/
*/
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/form/AccountInfoForm.java
View file @
112e7a59
...
@@ -41,8 +41,8 @@ public class AccountInfoForm {
...
@@ -41,8 +41,8 @@ public class AccountInfoForm {
/**
/**
* 货主类型:1-个人、2-企业
* 货主类型:1-个人、2-企业
*/
*/
@Range
(
min
=
1
,
max
=
2
,
message
=
"参数ownerType不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@Range
(
min
=
1
,
max
=
2
,
message
=
"参数ownerType不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数ownerType不能为空"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotNull
(
message
=
"参数ownerType不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
ownerType
;
private
Integer
ownerType
;
/**
/**
* 客户名称
* 客户名称
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/AccountServiceImpl.java
View file @
112e7a59
...
@@ -138,6 +138,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
...
@@ -138,6 +138,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
auditHistoryEntity
.
setAccountId
(
accountId
);
auditHistoryEntity
.
setAccountId
(
accountId
);
auditHistoryEntity
.
setAuditStatus
(
GoodsOwnerConstants
.
OWNER_AUDIT_STATUS_SUCCESS
);
auditHistoryEntity
.
setAuditStatus
(
GoodsOwnerConstants
.
OWNER_AUDIT_STATUS_SUCCESS
);
auditHistoryEntity
.
setOperateUser
(
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
USER_ACCOUNT
));
auditHistoryEntity
.
setOperateUser
(
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
USER_ACCOUNT
));
auditHistoryEntity
.
setRemark
(
"平台创建自动审核"
);
auditHistoryService
.
getBaseMapper
().
insert
(
auditHistoryEntity
);
auditHistoryService
.
getBaseMapper
().
insert
(
auditHistoryEntity
);
return
accountId
;
return
accountId
;
...
@@ -165,6 +166,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
...
@@ -165,6 +166,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
// 3.更新表:goods_owner_info
// 3.更新表:goods_owner_info
InfoEntity
infoEntity
=
new
InfoEntity
();
InfoEntity
infoEntity
=
new
InfoEntity
();
BeanUtils
.
copyProperties
(
form
,
infoEntity
);
BeanUtils
.
copyProperties
(
form
,
infoEntity
);
// 货主类型不允许修改
infoEntity
.
setOwnerType
(
null
);
// 货主为个人
// 货主为个人
if
(
GoodsOwnerConstants
.
OWNER_TYPE_PERSONAL
.
equals
(
form
.
getOwnerType
()))
{
if
(
GoodsOwnerConstants
.
OWNER_TYPE_PERSONAL
.
equals
(
form
.
getOwnerType
()))
{
infoEntity
.
setOwnerFullName
(
null
);
infoEntity
.
setOwnerFullName
(
null
);
...
...
src/main/java/com/esv/freight/customer/module/vehicle/controller/VehicleController.java
View file @
112e7a59
...
@@ -220,4 +220,19 @@ public class VehicleController {
...
@@ -220,4 +220,19 @@ public class VehicleController {
public
EResponse
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
VehicleQueryForm
form
)
throws
EException
{
public
EResponse
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
VehicleQueryForm
form
)
throws
EException
{
return
EResponse
.
ok
(
vehicleService
.
getVehicle4Page
(
form
));
return
EResponse
.
ok
(
vehicleService
.
getVehicle4Page
(
form
));
}
}
/**
* description 查询所有可用车辆列表
* param []
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/13 20:02
**/
@PostMapping
(
"/available"
)
public
EResponse
available
()
throws
EException
{
VehicleQueryForm
form
=
new
VehicleQueryForm
();
form
.
setAuditStatus
(
VehicleConstants
.
VEHICLE_AUDIT_STATUS_SUCCESS
);
form
.
setVehicleStatus
(
VehicleConstants
.
VEHICLE_ACCOUNT_STATUS_UNBLOCK
);
return
EResponse
.
ok
(
vehicleService
.
getVehicle4List
(
form
));
}
}
}
src/main/java/com/esv/freight/customer/module/vehicle/dao/VehicleDao.java
View file @
112e7a59
...
@@ -7,6 +7,8 @@ import com.esv.freight.customer.module.vehicle.entity.VehicleEntity;
...
@@ -7,6 +7,8 @@ import com.esv.freight.customer.module.vehicle.entity.VehicleEntity;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
/**
* 车辆表
* 车辆表
*
*
...
@@ -34,5 +36,14 @@ public interface VehicleDao extends BaseMapper<VehicleEntity> {
...
@@ -34,5 +36,14 @@ public interface VehicleDao extends BaseMapper<VehicleEntity> {
* createTime 2020/04/27 19:48
* createTime 2020/04/27 19:48
**/
**/
IPage
selectVehicle4Page
(
IPage
page
,
VehicleQueryForm
queryObj
);
IPage
selectVehicle4Page
(
IPage
page
,
VehicleQueryForm
queryObj
);
/**
* description 查询车辆列表
* param [queryObj]
* return java.util.List<com.esv.freight.customer.module.vehicle.dto.VehicleDetailDto>
* author Administrator
* createTime 2020/05/13 19:55
**/
List
<
VehicleDetailDto
>
selectVehicle4List
(
VehicleQueryForm
queryObj
);
}
}
src/main/java/com/esv/freight/customer/module/vehicle/dao/VehicleDriverDao.java
View file @
112e7a59
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.dao;
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.vehicle.entity.VehicleDriverEntity
;
import
com.esv.freight.customer.module.vehicle.entity.VehicleDriverEntity
;
...
@@ -57,5 +58,14 @@ public interface VehicleDriverDao extends BaseMapper<VehicleDriverEntity> {
...
@@ -57,5 +58,14 @@ public interface VehicleDriverDao extends BaseMapper<VehicleDriverEntity> {
* createTime 2020/05/13 10:32
* createTime 2020/05/13 10:32
**/
**/
IPage
selectVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
);
IPage
selectVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
);
/**
* description 查询司机与车辆绑定列表
* param [page, queryObj]
* return com.baomidou.mybatisplus.core.metadata.IPage
* author Administrator
* createTime 2020/05/13 19:04
**/
IPage
selectDriverVehicle4Params
(
IPage
page
,
DriverVehicleQueryForm
queryObj
);
}
}
src/main/java/com/esv/freight/customer/module/vehicle/service/VehicleDriverService.java
View file @
112e7a59
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.service;
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.vehicle.entity.VehicleDriverEntity
;
import
com.esv.freight.customer.module.vehicle.entity.VehicleDriverEntity
;
...
@@ -55,5 +56,14 @@ public interface VehicleDriverService extends IService<VehicleDriverEntity> {
...
@@ -55,5 +56,14 @@ public interface VehicleDriverService extends IService<VehicleDriverEntity> {
**/
**/
IPage
getVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
);
IPage
getVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
);
/**
* description 查询司机与车辆绑定列表
* param [page, queryObj]
* return com.baomidou.mybatisplus.core.metadata.IPage
* author Administrator
* createTime 2020/05/13 19:05
**/
IPage
selectDriverVehicle4Params
(
IPage
page
,
DriverVehicleQueryForm
queryObj
);
}
}
src/main/java/com/esv/freight/customer/module/vehicle/service/VehicleService.java
View file @
112e7a59
...
@@ -7,6 +7,9 @@ import com.esv.freight.customer.module.vehicle.entity.VehicleEntity;
...
@@ -7,6 +7,9 @@ import com.esv.freight.customer.module.vehicle.entity.VehicleEntity;
import
com.esv.freight.customer.module.vehicle.form.VehicleAuditForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleAuditForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleInfoForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleInfoForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
com.esv.freight.customer.module.vehicle.vo.VehicleAllVO
;
import
java.util.List
;
/**
/**
* 车辆表
* 车辆表
...
@@ -88,6 +91,15 @@ public interface VehicleService extends IService<VehicleEntity> {
...
@@ -88,6 +91,15 @@ public interface VehicleService extends IService<VehicleEntity> {
* createTime 2020/04/27 19:52
* createTime 2020/04/27 19:52
**/
**/
PageResultVO
getVehicle4Page
(
VehicleQueryForm
queryObj
);
PageResultVO
getVehicle4Page
(
VehicleQueryForm
queryObj
);
/**
* description 查询车辆列表
* param [queryObj]
* return java.util.List<com.esv.freight.customer.module.vehicle.vo.VehicleAllVO>
* author Administrator
* createTime 2020/05/13 19:58
**/
List
<
VehicleAllVO
>
getVehicle4List
(
VehicleQueryForm
queryObj
);
}
}
src/main/java/com/esv/freight/customer/module/vehicle/service/impl/VehicleDriverServiceImpl.java
View file @
112e7a59
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.service.impl;
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.vehicle.service.impl;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.dto.DriverVehicleDto
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.DriverVehicleListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.driver.vo.VehicleDriverListVO
;
import
com.esv.freight.customer.module.vehicle.dao.VehicleDriverDao
;
import
com.esv.freight.customer.module.vehicle.dao.VehicleDriverDao
;
...
@@ -36,4 +37,9 @@ public class VehicleDriverServiceImpl extends ServiceImpl<VehicleDriverDao, Vehi
...
@@ -36,4 +37,9 @@ public class VehicleDriverServiceImpl extends ServiceImpl<VehicleDriverDao, Vehi
public
IPage
getVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
)
{
public
IPage
getVehicleCanBindDriverList
(
IPage
page
,
Map
<
String
,
Object
>
queryObj
)
{
return
this
.
baseMapper
.
selectVehicleCanBindDriverList
(
page
,
queryObj
);
return
this
.
baseMapper
.
selectVehicleCanBindDriverList
(
page
,
queryObj
);
}
}
@Override
public
IPage
selectDriverVehicle4Params
(
IPage
page
,
DriverVehicleQueryForm
queryObj
)
{
return
this
.
baseMapper
.
selectDriverVehicle4Params
(
page
,
queryObj
);
}
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/vehicle/service/impl/VehicleServiceImpl.java
View file @
112e7a59
...
@@ -28,6 +28,7 @@ import com.esv.freight.customer.module.vehicle.service.AttachmentService;
...
@@ -28,6 +28,7 @@ import com.esv.freight.customer.module.vehicle.service.AttachmentService;
import
com.esv.freight.customer.module.vehicle.service.VehicleAuditHistoryService
;
import
com.esv.freight.customer.module.vehicle.service.VehicleAuditHistoryService
;
import
com.esv.freight.customer.module.vehicle.service.VehicleDriverService
;
import
com.esv.freight.customer.module.vehicle.service.VehicleDriverService
;
import
com.esv.freight.customer.module.vehicle.service.VehicleService
;
import
com.esv.freight.customer.module.vehicle.service.VehicleService
;
import
com.esv.freight.customer.module.vehicle.vo.VehicleAllVO
;
import
com.esv.freight.customer.module.vehicle.vo.VehicleListVO
;
import
com.esv.freight.customer.module.vehicle.vo.VehicleListVO
;
import
com.esv.gateway.common.GatewayHeaders
;
import
com.esv.gateway.common.GatewayHeaders
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -304,4 +305,26 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleDao, VehicleEntity> i
...
@@ -304,4 +305,26 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleDao, VehicleEntity> i
return
new
PageResultVO
(
page
,
targetRecordList
);
return
new
PageResultVO
(
page
,
targetRecordList
);
}
}
@Override
public
List
<
VehicleAllVO
>
getVehicle4List
(
VehicleQueryForm
queryObj
)
{
// 1:查询
List
<
VehicleDetailDto
>
dtoList
=
this
.
baseMapper
.
selectVehicle4List
(
queryObj
);
// 2:数据转换
List
<
VehicleAllVO
>
voList
=
new
ArrayList
<>();
for
(
VehicleDetailDto
dto
:
dtoList
)
{
VehicleAllVO
vo
=
new
VehicleAllVO
();
BeanUtils
.
copyProperties
(
dto
,
vo
);
if
(
CarrierConstants
.
CARRIER_TYPE_COMPANY
.
equals
(
dto
.
getCarrierType
()))
{
vo
.
setCarrierName
(
dto
.
getCarrierFullName
());
}
else
{
vo
.
setCarrierName
(
dto
.
getCarrierContactor
());
}
vo
.
setVehicleId
(
dto
.
getId
());
voList
.
add
(
vo
);
}
return
voList
;
}
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/vehicle/vo/VehicleAllVO.java
0 → 100644
View file @
112e7a59
package
com
.
esv
.
freight
.
customer
.
module
.
vehicle
.
vo
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.vehicle.vo.VehicleAllVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/27 13:40
* @version:1.0
*/
@Data
public
class
VehicleAllVO
{
/**
* 承运商ID
*/
private
Long
carrierId
;
/**
* 承运商名称
*/
private
String
carrierName
;
/**
* 车辆ID
*/
private
Long
vehicleId
;
/**
* 车牌号
*/
private
String
licenseNumber
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/mapper/goodsowner/AccountDao.xml
View file @
112e7a59
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
and a.account_status = #{queryObj.accountStatus}
and a.account_status = #{queryObj.accountStatus}
</if>
</if>
<if
test=
"queryObj.account != null"
>
<if
test=
"queryObj.account != null"
>
and a.account
= #{queryObj.account}
and a.account
like CONCAT('%',#{queryObj.account},'%')
</if>
</if>
<if
test=
"queryObj.name != null"
>
<if
test=
"queryObj.name != null"
>
and (b.owner_full_name like CONCAT('%',#{queryObj.name},'%')
and (b.owner_full_name like CONCAT('%',#{queryObj.name},'%')
...
...
src/main/resources/mapper/vehicle/VehicleDao.xml
View file @
112e7a59
...
@@ -101,4 +101,37 @@
...
@@ -101,4 +101,37 @@
ORDER BY a.update_time DESC, a.license_number ASC
ORDER BY a.update_time DESC, a.license_number ASC
</select>
</select>
<!-- 查询车辆列表 -->
<select
id=
"selectVehicle4List"
parameterType=
"com.esv.freight.customer.module.vehicle.form.VehicleQueryForm"
resultType=
"com.esv.freight.customer.module.vehicle.dto.VehicleDetailDto"
>
select a.*, c.carrier_type as carrierType, c.carrier_full_name as carrierFullName, c.contactor as carrierContactor
from vehicle a, carrier_info c
where a.carrier_id = c.account_id
<if
test=
"licenseNumber != null"
>
and a.license_number like CONCAT('%', #{licenseNumber}, '%')
</if>
<if
test=
"vehicleType != null"
>
and a.vehicle_type = #{vehicleType}
</if>
<if
test=
"vehicleType2 != null"
>
and a.vehicle_type2 = #{vehicleType2}
</if>
<if
test=
"vehicleStatus != null"
>
and a.vehicle_status = #{vehicleStatus}
</if>
<if
test=
"auditStatus != null"
>
and a.audit_status = #{auditStatus}
</if>
<if
test=
"sourceType != null"
>
and a.source_type = #{sourceType}
</if>
<if
test=
"vehicleLicenseNumber != null"
>
and a.vehicle_license_number like CONCAT('%', #{vehicleLicenseNumber}, '%')
</if>
<if
test=
"roadCertificateNumber != null"
>
and a.road_certificate_number like CONCAT('%', #{roadCertificateNumber}, '%')
</if>
ORDER BY a.license_number ASC
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/vehicle/VehicleDriverDao.xml
View file @
112e7a59
...
@@ -78,4 +78,30 @@
...
@@ -78,4 +78,30 @@
order by carrierId asc, vehicleLicenseNumber asc
order by carrierId asc, vehicleLicenseNumber asc
</select>
</select>
<!-- 根据查询条件-分页查询司机与车辆绑定列表 -->
<select
id=
"selectDriverVehicle4Params"
parameterType=
"com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm"
resultType=
"com.esv.freight.customer.module.driver.dto.DriverVehicleDto"
>
select ab.*,
c.account as driverAccount, c.account_status as driverAccountStatus, c.source_type as driverSourceType, c.audit_status as driverAuditStatus,
d.name as driverName,
e.vehicle_status as vehicleStatus, e.source_type as vehicleSourceType, e.audit_status as vehicleAuditStatus, e.license_number as vehicleLicenseNumber
from (
select a.vehicle_id as vehicleId, a.driver_id as driverId,
b.account_id as carrierId, b.carrier_type as carrierType, b.carrier_full_name as carrierFullName, b.contactor as carrierContactor
from vehicle_driver a, carrier_info b
where a.carrier_id = b.account_id
<if
test=
"queryObj.id != null"
>
and a.carrier_id = #{queryObj.id}
</if>
)ab
left join driver_account c on ab.carrierId = c.carrier_id and ab.driverId = c.id
left join driver_info d on ab.carrierId = d.carrier_id and ab.driverId = d.driver_id
left join vehicle e on ab.carrierId = e.carrier_id and ab.vehicleId = e.id
where 1 = 1
<if
test=
"queryObj.licenseNumber != null"
>
and e.license_number like CONCAT('%', #{queryObj.licenseNumber}, '%')
</if>
order by vehicleLicenseNumber asc
</select>
</mapper>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/driver/controller/DriverVehicleControllerTest.java
View file @
112e7a59
...
@@ -6,6 +6,7 @@ import com.esv.freight.customer.common.response.ECode;
...
@@ -6,6 +6,7 @@ import com.esv.freight.customer.common.response.ECode;
import
com.esv.freight.customer.module.driver.form.CarrierForm
;
import
com.esv.freight.customer.module.driver.form.CarrierForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleQueryForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
com.esv.freight.customer.module.vehicle.form.VehicleQueryForm
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.Assert
;
...
@@ -478,4 +479,34 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -478,4 +479,34 @@ public class DriverVehicleControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
}
/**
* 查询司机与车辆绑定列表
**/
@Test
public
void
h1_query_success_test
()
throws
Exception
{
String
url
=
"/carrier/driver/vehicle/query"
;
// 构造数据
DriverVehicleQueryForm
form
=
new
DriverVehicleQueryForm
();
form
.
setId
(
2L
);
form
.
setLicenseNumber
(
"辽A"
);
form
.
setPageNum
(
1
);
form
.
setPageSize
(
10
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertTrue
(
null
!=
result
.
getJSONObject
(
"data"
));
}
}
}
src/test/java/com/esv/freight/customer/module/vehicle/controller/VehicleControllerTest.java
View file @
112e7a59
...
@@ -480,4 +480,30 @@ public class VehicleControllerTest extends BaseTestController {
...
@@ -480,4 +480,30 @@ public class VehicleControllerTest extends BaseTestController {
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertTrue
(
result
.
getJSONObject
(
"data"
).
containsKey
(
"records"
));
Assert
.
assertTrue
(
result
.
getJSONObject
(
"data"
).
containsKey
(
"records"
));
}
}
/**
* 查询所有可用车辆列表
**/
@Test
public
void
g1_available_success_test
()
throws
Exception
{
String
url
=
"/carrier/vehicle/available"
;
// 构造数据
VehicleQueryForm
form
=
new
VehicleQueryForm
();
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertTrue
(
null
!=
result
.
getJSONArray
(
"data"
));
}
}
}
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