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
6812bc24
Commit
6812bc24
authored
Apr 28, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
承运商接口:新增司机
parent
10a5c931
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1413 additions
and
3 deletions
+1413
-3
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+9
-0
DataPermHandler.java
.../esv/freight/customer/config/mybatis/DataPermHandler.java
+1
-1
DriverConstants.java
...m/esv/freight/customer/module/driver/DriverConstants.java
+44
-0
DriverController.java
...t/customer/module/driver/controller/DriverController.java
+74
-0
DriverAccountDao.java
.../freight/customer/module/driver/dao/DriverAccountDao.java
+17
-0
DriverAuditHistoryDao.java
...ght/customer/module/driver/dao/DriverAuditHistoryDao.java
+17
-0
DriverInfoDao.java
...esv/freight/customer/module/driver/dao/DriverInfoDao.java
+17
-0
DriverAccountEntity.java
...ht/customer/module/driver/entity/DriverAccountEntity.java
+100
-0
DriverAuditHistoryEntity.java
...stomer/module/driver/entity/DriverAuditHistoryEntity.java
+52
-0
DriverInfoEntity.java
...eight/customer/module/driver/entity/DriverInfoEntity.java
+162
-0
DriverInfoForm.java
...v/freight/customer/module/driver/form/DriverInfoForm.java
+199
-0
DriverAccountService.java
.../customer/module/driver/service/DriverAccountService.java
+26
-0
DriverAuditHistoryService.java
...omer/module/driver/service/DriverAuditHistoryService.java
+16
-0
DriverInfoService.java
...ght/customer/module/driver/service/DriverInfoService.java
+16
-0
DriverAccountServiceImpl.java
.../module/driver/service/impl/DriverAccountServiceImpl.java
+106
-0
DriverAuditHistoryServiceImpl.java
...le/driver/service/impl/DriverAuditHistoryServiceImpl.java
+13
-0
DriverInfoServiceImpl.java
...mer/module/driver/service/impl/DriverInfoServiceImpl.java
+13
-0
application-dev.yml
src/main/resources/application-dev.yml
+7
-1
DriverAccountDao.xml
src/main/resources/mapper/driver/DriverAccountDao.xml
+28
-0
DriverAuditHistoryDao.xml
src/main/resources/mapper/driver/DriverAuditHistoryDao.xml
+18
-0
DriverInfoDao.xml
src/main/resources/mapper/driver/DriverInfoDao.xml
+44
-0
BaseTestController.java
...est/java/com/esv/freight/customer/BaseTestController.java
+1
-1
DriverAccountAddTest.java
...stomer/module/driver/controller/DriverAccountAddTest.java
+433
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
6812bc24
...
...
@@ -167,4 +167,13 @@ public class ErrorMessageComponent {
private
String
carrierVehicleUnBlock1001
;
@Value
(
"${error-message.carrier.vehicle.unblock.1002}"
)
private
String
carrierVehicleUnBlock1002
;
@Value
(
"${error-message.carrier.driver.add.1001}"
)
private
String
carrierDriverAdd1001
;
@Value
(
"${error-message.carrier.driver.add.1002}"
)
private
String
carrierDriverAdd1002
;
@Value
(
"${error-message.carrier.driver.add.1003}"
)
private
String
carrierDriverAdd1003
;
@Value
(
"${error-message.carrier.driver.add.1004}"
)
private
String
carrierDriverAdd1004
;
}
src/main/java/com/esv/freight/customer/config/mybatis/DataPermHandler.java
View file @
6812bc24
...
...
@@ -30,7 +30,7 @@ public class DataPermHandler implements TenantHandler {
**/
private
final
List
<
String
>
filterTableNames
=
Arrays
.
asList
(
"goods_owner_info"
,
"goods_owner_audit_history"
,
"goods_owner_delivery_address"
,
"goods_owner_receive_address"
,
"goods_owner_regularly_route"
,
"vehicle_audit_history"
,
"vehicle_attachment"
"vehicle_audit_history"
,
"vehicle_attachment"
,
"driver_info"
,
"driver_audit_history"
);
@Override
...
...
src/main/java/com/esv/freight/customer/module/driver/DriverConstants.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.driver.DriverConstants
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/28 15:00
* @version:1.0
*/
public
class
DriverConstants
{
/**
* 帐号状态:1-正常、2-停用
**/
public
static
final
Integer
ACCOUNT_STATUS_UNBLOCK
=
1
;
public
static
final
Integer
ACCOUNT_STATUS_BLOCK
=
2
;
/**
* 帐号创建来源:1-平台创建、2-自行注册
**/
public
static
final
Integer
ACCOUNT_SOURCE_TYPE_PLATFORM
=
1
;
public
static
final
Integer
ACCOUNT_SOURCE_TYPE_REGISTER
=
2
;
/**
* 帐号认证状态:1-未认证、2-已认证
**/
public
static
final
Integer
ACCOUNT_AUTHENTICATE_STATUS_NO
=
1
;
public
static
final
Integer
ACCOUNT_AUTHENTICATE_STATUS_YES
=
2
;
/**
* 帐号审核状态:0-待审核、1-审核成功,2-审核失败
**/
public
static
final
Integer
ACCOUNT_AUDIT_STATUS_UNAUDITED
=
0
;
public
static
final
Integer
ACCOUNT_AUDIT_STATUS_SUCCESS
=
1
;
public
static
final
Integer
ACCOUNT_AUDIT_STATUS_FAILURE
=
2
;
/**
* 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
**/
public
static
final
Integer
ACCOUNT_DRIVING_VEHICLE_TYPE_1
=
1
;
public
static
final
Integer
ACCOUNT_DRIVING_VEHICLE_TYPE_2
=
2
;
}
src/main/java/com/esv/freight/customer/module/driver/controller/DriverController.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.util.ReqUtils
;
import
com.esv.freight.customer.common.util.VerifyUtils
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.module.driver.DriverConstants
;
import
com.esv.freight.customer.module.driver.form.DriverInfoForm
;
import
com.esv.freight.customer.module.driver.service.DriverAccountService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.driver.controller.DriverController
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/28 17:18
* @version:1.0
*/
@Slf4j
@RestController
@RequestMapping
(
"/carrier/driver"
)
@Validated
public
class
DriverController
{
private
ErrorMessageComponent
errorMessageComponent
;
private
DriverAccountService
driverAccountService
;
@Autowired
public
DriverController
(
ErrorMessageComponent
errorMessageComponent
,
DriverAccountService
driverAccountService
)
{
this
.
errorMessageComponent
=
errorMessageComponent
;
this
.
driverAccountService
=
driverAccountService
;
}
/**
* description 新增司机
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/28 17:24
**/
@PostMapping
(
"/add"
)
public
EResponse
add
(
@RequestBody
@Validated
(
ValidatorInsert
.
class
)
DriverInfoForm
form
)
throws
EException
{
/****************************** 参数校验 ******************************/
// 所驾驶车辆4.5吨以上必填道路运输从业资格证信息
if
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_2
.
equals
(
form
.
getCertificateVehicle
()))
{
String
[]
notBlankParams
=
new
String
[]
{
"certificateEndDate"
,
"certificateNumber"
,
"certificateUrl"
};
ReqUtils
.
checkParamsNotBlank
(
JSONObject
.
parseObject
(
form
.
toString
()),
notBlankParams
);
}
// 校验身份证号码
if
(
StringUtils
.
isNotBlank
(
form
.
getIdCard
())
&&
!
VerifyUtils
.
isValidIdCard18
(
form
.
getIdCard
()))
{
throw
new
EException
(
ECode
.
PARAM_ERROR
.
code
(),
"无效的身份证号码"
);
}
/****************************** 参数校验 ******************************/
Long
id
=
driverAccountService
.
insertDriver
(
form
);
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"id"
,
id
);
return
EResponse
.
ok
(
data
);
}
}
src/main/java/com/esv/freight/customer/module/driver/dao/DriverAccountDao.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
dao
;
import
com.esv.freight.customer.module.driver.entity.DriverAccountEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 司机帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
@Mapper
public
interface
DriverAccountDao
extends
BaseMapper
<
DriverAccountEntity
>
{
}
src/main/java/com/esv/freight/customer/module/driver/dao/DriverAuditHistoryDao.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
dao
;
import
com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 司机审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:00
*/
@Mapper
public
interface
DriverAuditHistoryDao
extends
BaseMapper
<
DriverAuditHistoryEntity
>
{
}
src/main/java/com/esv/freight/customer/module/driver/dao/DriverInfoDao.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
dao
;
import
com.esv.freight.customer.module.driver.entity.DriverInfoEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 司机信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
@Mapper
public
interface
DriverInfoDao
extends
BaseMapper
<
DriverInfoEntity
>
{
}
src/main/java/com/esv/freight/customer/module/driver/entity/DriverAccountEntity.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 司机帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
@Data
@TableName
(
"driver_account"
)
public
class
DriverAccountEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 租户ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Long
tenantId
;
/**
* 部门ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Long
departmentId
;
/**
* 承运商帐号ID
*/
private
Long
carrierId
;
/**
* 登录帐号,司机手机号
*/
private
String
account
;
/**
* 密码
*/
private
String
password
;
/**
* 密码盐
*/
private
String
salt
;
/**
* 帐号状态:1-正常、2-停用
*/
private
Integer
accountStatus
;
/**
* 创建来源:1-平台创建、2-自行注册
*/
private
Integer
sourceType
;
/**
* 审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
private
Integer
auditStatus
;
/**
* 认证状态:1-未认证、2-已认证
*/
private
Integer
authenticateStatus
;
/**
* 上报状态(字典表):0-未上报、1-上报成功、2-上报失败
*/
private
Integer
reportStatus
;
/**
* 上报时间
*/
private
Date
reportTime
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/driver/entity/DriverAuditHistoryEntity.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 司机审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:00
*/
@Data
@TableName
(
"driver_audit_history"
)
public
class
DriverAuditHistoryEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 承运商ID
*/
private
Long
carrierId
;
/**
* 司机id
*/
private
Long
driverId
;
/**
* 审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
private
Integer
auditStatus
;
/**
* 备注
*/
private
String
remark
;
/**
* 操作者
*/
private
String
operateUser
;
/**
* 操作时间
*/
private
Date
operateTime
;
}
src/main/java/com/esv/freight/customer/module/driver/entity/DriverInfoEntity.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 司机信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
@Data
@TableName
(
"driver_info"
)
public
class
DriverInfoEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 承运商帐号ID
*/
private
Long
carrierId
;
/**
* 司机帐号ID
*/
private
Long
driverId
;
/**
* 姓名
*/
private
String
name
;
/**
* 身份证号码
*/
private
String
idCard
;
/**
* 身份证有效期
*/
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
private
String
idCardBackUrl
;
/**
* 结算对象(字典表):1-个人、2-所属承运商
*/
private
Integer
settlementType
;
/**
* 性别(字典表):1-男、2-女、3-未知
*/
private
Integer
sex
;
/**
* 出生日期
*/
private
String
birthDate
;
/**
* 名族
*/
private
String
nation
;
/**
* 籍贯
*/
private
String
nativePlace
;
/**
* 住址-省份代码
*/
private
String
provinceCode
;
/**
* 住址-市代码
*/
private
String
cityCode
;
/**
* 住址-区县代码
*/
private
String
districtCode
;
/**
* 住址-详细地址
*/
private
String
detailAddress
;
/**
* 驾驶证号码
*/
private
String
drivingLicense
;
/**
* 驾驶证类型(字典表):1-A1、2-A2、3-A3、4-A1A2、5-A2E、6-A2D、7-B1、8-B2、9-C1、0-其他
*/
private
Integer
drivingLicenseType
;
/**
* 驾驶证有效期起
*/
private
String
drivingLicenseStartDate
;
/**
* 驾驶证有效期止
*/
private
String
drivingLicenseEndDate
;
/**
* 发证机关
*/
private
String
drivingLicenseIssueDepartment
;
/**
* 初次获得驾驶证日期
*/
private
String
drivingLicenseInitDate
;
/**
* 驾驶证正面图片URL
*/
private
String
drivingLicenseUrl
;
/**
* 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
*/
private
Integer
certificateVehicle
;
/**
* 道路运输从业资格证-有效期止
*/
private
String
certificateEndDate
;
/**
* 道路运输从业资格证-从业资格证号
*/
private
String
certificateNumber
;
/**
* 道路运输从业资格证-正面图片URL
*/
private
String
certificateUrl
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/driver/form/DriverInfoForm.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
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.NotBlank
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.driver.form.DriverInfoForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/28 16:21
* @version:1.0
*/
@Data
public
class
DriverInfoForm
{
/**
*
*/
private
Long
id
;
/**
* 承运商帐号ID
*/
@NotNull
(
message
=
"参数carrierId不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Long
carrierId
;
/**
* 登录帐号,司机手机号
*/
@Length
(
min
=
11
,
max
=
11
,
message
=
"参数account长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数account不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
account
;
/**
* 密码
*/
@Length
(
min
=
32
,
max
=
32
,
message
=
"参数password长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数password不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
password
;
/**
* 帐号状态:1-正常、2-停用
*/
private
Integer
accountStatus
;
/**
* 认证状态:1-未认证、2-已认证
*/
private
Integer
authenticateStatus
;
/**
* 姓名
*/
@Length
(
max
=
20
,
message
=
"参数name长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数name不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
name
;
/**
* 身份证号码
*/
@Length
(
max
=
18
,
message
=
"参数idCard长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCard不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCard
;
/**
* 身份证有效期
*/
@Length
(
max
=
20
,
message
=
"参数idCardExpireDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCardExpireDate不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数idCardFrontUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCardFrontUrl不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数idCardBackUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCardBackUrl不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardBackUrl
;
/**
* 结算对象(字典表):1-个人、2-所属承运商
*/
@Range
(
min
=
1
,
max
=
2
,
message
=
"参数settlementType不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数settlementType不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
settlementType
;
/**
* 性别(字典表):1-男、2-女、3-未知
*/
@Range
(
min
=
1
,
max
=
3
,
message
=
"参数sex不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数sex不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
sex
;
/**
* 出生日期
*/
@Length
(
max
=
20
,
message
=
"参数birthDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
birthDate
;
/**
* 名族
*/
@Length
(
max
=
20
,
message
=
"参数nation长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
nation
;
/**
* 籍贯
*/
@Length
(
max
=
20
,
message
=
"参数nativePlace长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
nativePlace
;
/**
* 住址-省份代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数provinceCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
provinceCode
;
/**
* 住址-市代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数cityCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
cityCode
;
/**
* 住址-区县代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数districtCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
districtCode
;
/**
* 住址-详细地址
*/
@Length
(
max
=
200
,
message
=
"参数detailAddress长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
detailAddress
;
/**
* 驾驶证号码
*/
@Length
(
max
=
20
,
message
=
"参数drivingLicense长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数drivingLicense不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicense
;
/**
* 驾驶证类型(字典表):1-A1、2-A2、3-A3、4-A1A2、5-A2E、6-A2D、7-B1、8-B2、9-C1、0-其他
*/
@Range
(
min
=
0
,
max
=
9
,
message
=
"参数drivingLicenseType不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数drivingLicenseType不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
drivingLicenseType
;
/**
* 驾驶证有效期起
*/
@Length
(
max
=
20
,
message
=
"参数drivingLicenseStartDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicenseStartDate
;
/**
* 驾驶证有效期止
*/
@Length
(
max
=
20
,
message
=
"参数drivingLicenseEndDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicenseEndDate
;
/**
* 发证机关
*/
@Length
(
max
=
50
,
message
=
"参数drivingLicenseIssueDepartment长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicenseIssueDepartment
;
/**
* 初次获得驾驶证日期
*/
@Length
(
max
=
20
,
message
=
"参数drivingLicenseInitDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicenseInitDate
;
/**
* 驾驶证正面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数drivingLicenseUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
drivingLicenseUrl
;
/**
* 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
*/
@Range
(
min
=
1
,
max
=
2
,
message
=
"参数certificateVehicle不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数certificateVehicle不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
certificateVehicle
;
/**
* 道路运输从业资格证-有效期止
*/
@Length
(
max
=
20
,
message
=
"参数certificateEndDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
certificateEndDate
;
/**
* 道路运输从业资格证-从业资格证号
*/
@Length
(
max
=
20
,
message
=
"参数certificateNumber长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
certificateNumber
;
/**
* 道路运输从业资格证-正面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数certificateUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
certificateUrl
;
/**
* 备注
*/
@Length
(
max
=
100
,
message
=
"参数remark长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
remark
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverAccountService.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.driver.entity.DriverAccountEntity
;
import
com.esv.freight.customer.module.driver.form.DriverInfoForm
;
/**
* 司机帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
public
interface
DriverAccountService
extends
IService
<
DriverAccountEntity
>
{
/**
* description 新增司机
* param [form]
* return java.lang.Long
* author Administrator
* createTime 2020/04/28 16:48
**/
Long
insertDriver
(
DriverInfoForm
form
);
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverAuditHistoryService.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity
;
/**
* 司机审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:00
*/
public
interface
DriverAuditHistoryService
extends
IService
<
DriverAuditHistoryEntity
>
{
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverInfoService.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.driver.entity.DriverInfoEntity
;
/**
* 司机信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-28 14:47:01
*/
public
interface
DriverInfoService
extends
IService
<
DriverInfoEntity
>
{
}
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverAccountServiceImpl.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.component.PasswordComponent
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.util.ReqUtils
;
import
com.esv.freight.customer.module.driver.DriverConstants
;
import
com.esv.freight.customer.module.driver.dao.DriverAccountDao
;
import
com.esv.freight.customer.module.driver.entity.DriverAccountEntity
;
import
com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity
;
import
com.esv.freight.customer.module.driver.entity.DriverInfoEntity
;
import
com.esv.freight.customer.module.driver.service.DriverAccountService
;
import
com.esv.freight.customer.module.driver.service.DriverAuditHistoryService
;
import
com.esv.freight.customer.module.driver.service.DriverInfoService
;
import
com.esv.freight.customer.module.driver.form.DriverInfoForm
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
(
"driverAccountService"
)
public
class
DriverAccountServiceImpl
extends
ServiceImpl
<
DriverAccountDao
,
DriverAccountEntity
>
implements
DriverAccountService
{
private
ErrorMessageComponent
errorMessageComponent
;
private
PasswordComponent
passwordComponent
;
private
DriverInfoService
driverInfoService
;
private
DriverAuditHistoryService
driverAuditHistoryService
;
@Autowired
public
DriverAccountServiceImpl
(
ErrorMessageComponent
errorMessageComponent
,
PasswordComponent
passwordComponent
,
DriverInfoService
driverInfoService
,
DriverAuditHistoryService
driverAuditHistoryService
)
{
this
.
errorMessageComponent
=
errorMessageComponent
;
this
.
passwordComponent
=
passwordComponent
;
this
.
driverInfoService
=
driverInfoService
;
this
.
driverAuditHistoryService
=
driverAuditHistoryService
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
insertDriver
(
DriverInfoForm
form
)
{
// 1:校验
// 1.1:校验账号是否已存在
Integer
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
DriverAccountEntity
>().
lambda
()
.
eq
(
DriverAccountEntity:
:
getAccount
,
form
.
getAccount
()));
if
(
0
<
count
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getCarrierDriverAdd1001
());
}
// 1.2:校验身份证号码是否已存在
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
eq
(
DriverInfoEntity:
:
getIdCard
,
form
.
getIdCard
()));
if
(
0
<
count
)
{
throw
new
EException
(
1002
,
errorMessageComponent
.
getCarrierDriverAdd1002
());
}
// 1.3:校验驾驶证号码是否已存在
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
eq
(
DriverInfoEntity:
:
getDrivingLicense
,
form
.
getDrivingLicense
()));
if
(
0
<
count
)
{
throw
new
EException
(
1003
,
errorMessageComponent
.
getCarrierDriverAdd1003
());
}
// 1.4:校验从业资格证号是否已存在
if
(
StringUtils
.
isNotBlank
(
form
.
getCertificateNumber
()))
{
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
eq
(
DriverInfoEntity:
:
getCertificateNumber
,
form
.
getCertificateNumber
()));
if
(
0
<
count
)
{
throw
new
EException
(
1004
,
errorMessageComponent
.
getCarrierDriverAdd1004
());
}
}
// 2:新增司机帐号
DriverAccountEntity
driverAccountEntity
=
new
DriverAccountEntity
();
BeanUtils
.
copyProperties
(
form
,
driverAccountEntity
);
String
salt
=
passwordComponent
.
generateAccountPwdSalt
();
driverAccountEntity
.
setSalt
(
salt
);
driverAccountEntity
.
setPassword
(
passwordComponent
.
generatePwd4Salt
(
form
.
getPassword
(),
salt
));
driverAccountEntity
.
setAccountStatus
(
DriverConstants
.
ACCOUNT_STATUS_UNBLOCK
);
driverAccountEntity
.
setSourceType
(
DriverConstants
.
ACCOUNT_SOURCE_TYPE_PLATFORM
);
driverAccountEntity
.
setAuthenticateStatus
(
DriverConstants
.
ACCOUNT_AUTHENTICATE_STATUS_YES
);
driverAccountEntity
.
setAuditStatus
(
DriverConstants
.
ACCOUNT_AUDIT_STATUS_SUCCESS
);
this
.
baseMapper
.
insert
(
driverAccountEntity
);
Long
driverId
=
driverAccountEntity
.
getId
();
// 3:新增司机信息
DriverInfoEntity
driverInfoEntity
=
new
DriverInfoEntity
();
BeanUtils
.
copyProperties
(
form
,
driverInfoEntity
);
driverInfoEntity
.
setDriverId
(
driverId
);
this
.
driverInfoService
.
getBaseMapper
().
insert
(
driverInfoEntity
);
// 4:新增审核记录
DriverAuditHistoryEntity
driverAuditHistoryEntity
=
new
DriverAuditHistoryEntity
();
driverAuditHistoryEntity
.
setCarrierId
(
form
.
getCarrierId
());
driverAuditHistoryEntity
.
setDriverId
(
driverId
);
driverAuditHistoryEntity
.
setAuditStatus
(
DriverConstants
.
ACCOUNT_AUDIT_STATUS_SUCCESS
);
driverAuditHistoryEntity
.
setRemark
(
"平台创建自动审核"
);
driverAuditHistoryEntity
.
setOperateUser
(
ReqUtils
.
getRequestUserAccount
());
this
.
driverAuditHistoryService
.
getBaseMapper
().
insert
(
driverAuditHistoryEntity
);
return
driverId
;
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverAuditHistoryServiceImpl.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.driver.dao.DriverAuditHistoryDao
;
import
com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity
;
import
com.esv.freight.customer.module.driver.service.DriverAuditHistoryService
;
import
org.springframework.stereotype.Service
;
@Service
(
"driverAuditHistoryService"
)
public
class
DriverAuditHistoryServiceImpl
extends
ServiceImpl
<
DriverAuditHistoryDao
,
DriverAuditHistoryEntity
>
implements
DriverAuditHistoryService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverInfoServiceImpl.java
0 → 100644
View file @
6812bc24
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.driver.dao.DriverInfoDao
;
import
com.esv.freight.customer.module.driver.entity.DriverInfoEntity
;
import
com.esv.freight.customer.module.driver.service.DriverInfoService
;
import
org.springframework.stereotype.Service
;
@Service
(
"driverInfoService"
)
public
class
DriverInfoServiceImpl
extends
ServiceImpl
<
DriverInfoDao
,
DriverInfoEntity
>
implements
DriverInfoService
{
}
\ No newline at end of file
src/main/resources/application-dev.yml
View file @
6812bc24
...
...
@@ -143,4 +143,10 @@ error-message:
1002
:
车辆已停用
unblock
:
1001
:
无效的车辆ID
1002
:
车辆已启用
\ No newline at end of file
1002
:
车辆已启用
driver
:
add
:
1001
:
账号已存在
1002
:
身份证号码已存在
1003
:
驾驶证号码已存在
1004
:
从业资格证号已存在
\ No newline at end of file
src/main/resources/mapper/driver/DriverAccountDao.xml
0 → 100644
View file @
6812bc24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.driver.dao.DriverAccountDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.driver.entity.DriverAccountEntity"
id=
"driverAccountMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"tenantId"
column=
"tenant_id"
/>
<result
property=
"departmentId"
column=
"department_id"
/>
<result
property=
"carrierId"
column=
"carrier_id"
/>
<result
property=
"account"
column=
"account"
/>
<result
property=
"password"
column=
"password"
/>
<result
property=
"salt"
column=
"salt"
/>
<result
property=
"accountStatus"
column=
"account_status"
/>
<result
property=
"sourceType"
column=
"source_type"
/>
<result
property=
"auditStatus"
column=
"audit_status"
/>
<result
property=
"authenticateStatus"
column=
"authenticate_status"
/>
<result
property=
"reportStatus"
column=
"report_status"
/>
<result
property=
"reportTime"
column=
"report_time"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/driver/DriverAuditHistoryDao.xml
0 → 100644
View file @
6812bc24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.driver.dao.DriverAuditHistoryDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity"
id=
"driverAuditHistoryMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"carrierId"
column=
"carrier_id"
/>
<result
property=
"driverId"
column=
"driver_id"
/>
<result
property=
"auditStatus"
column=
"audit_status"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"operateUser"
column=
"operate_user"
/>
<result
property=
"operateTime"
column=
"operate_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/driver/DriverInfoDao.xml
0 → 100644
View file @
6812bc24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.driver.dao.DriverInfoDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.driver.entity.DriverInfoEntity"
id=
"driverInfoMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"carrierId"
column=
"carrier_id"
/>
<result
property=
"driverId"
column=
"driver_id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"idCard"
column=
"id_card"
/>
<result
property=
"idCardExpireDate"
column=
"id_card_expire_date"
/>
<result
property=
"idCardFrontUrl"
column=
"id_card_front_url"
/>
<result
property=
"idCardBackUrl"
column=
"id_card_back_url"
/>
<result
property=
"settlementType"
column=
"settlement_type"
/>
<result
property=
"sex"
column=
"sex"
/>
<result
property=
"birthDate"
column=
"birth_date"
/>
<result
property=
"nation"
column=
"nation"
/>
<result
property=
"nativePlace"
column=
"native_place"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
<result
property=
"cityCode"
column=
"city_code"
/>
<result
property=
"districtCode"
column=
"district_code"
/>
<result
property=
"detailAddress"
column=
"detail_address"
/>
<result
property=
"drivingLicense"
column=
"driving_license"
/>
<result
property=
"drivingLicenseType"
column=
"driving_license_type"
/>
<result
property=
"drivingLicenseStartDate"
column=
"driving_license_start_date"
/>
<result
property=
"drivingLicenseEndDate"
column=
"driving_license_end_date"
/>
<result
property=
"drivingLicenseIssueDepartment"
column=
"driving_license_issue_department"
/>
<result
property=
"drivingLicenseInitDate"
column=
"driving_license_init_date"
/>
<result
property=
"drivingLicenseUrl"
column=
"driving_license_url"
/>
<result
property=
"certificateVehicle"
column=
"certificate_vehicle"
/>
<result
property=
"certificateEndDate"
column=
"certificate_end_date"
/>
<result
property=
"certificateNumber"
column=
"certificate_number"
/>
<result
property=
"certificateUrl"
column=
"certificate_url"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/BaseTestController.java
View file @
6812bc24
...
...
@@ -50,7 +50,7 @@ public class BaseTestController {
httpHeaders
.
add
(
"esv_department_children"
,
"1,2,3"
);
httpHeaders
.
add
(
"esv_user"
,
"1"
);
httpHeaders
.
add
(
"esv_account"
,
"admin"
);
httpHeaders
.
add
(
CommonConstants
.
REQ_SOURCE_TYPE_KEY
,
CommonConstants
.
REQ_SOURCE_TYPE_
ANDROID
);
httpHeaders
.
add
(
CommonConstants
.
REQ_SOURCE_TYPE_KEY
,
CommonConstants
.
REQ_SOURCE_TYPE_
WEB
);
return
httpHeaders
;
}
...
...
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountAddTest.java
0 → 100644
View file @
6812bc24
This diff is collapsed.
Click to expand it.
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