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
2eda488d
Commit
2eda488d
authored
Apr 28, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
承运商接口:编辑司机信息
parent
6812bc24
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
556 additions
and
27 deletions
+556
-27
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+9
-0
DriverController.java
...t/customer/module/driver/controller/DriverController.java
+26
-0
DriverInfoForm.java
...v/freight/customer/module/driver/form/DriverInfoForm.java
+29
-27
DriverAccountService.java
.../customer/module/driver/service/DriverAccountService.java
+9
-0
DriverAccountServiceImpl.java
.../module/driver/service/impl/DriverAccountServiceImpl.java
+51
-0
application-dev.yml
src/main/resources/application-dev.yml
+5
-0
DriverAccountEditTest.java
...tomer/module/driver/controller/DriverAccountEditTest.java
+427
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
2eda488d
...
...
@@ -176,4 +176,13 @@ public class ErrorMessageComponent {
private
String
carrierDriverAdd1003
;
@Value
(
"${error-message.carrier.driver.add.1004}"
)
private
String
carrierDriverAdd1004
;
@Value
(
"${error-message.carrier.driver.edit.1001}"
)
private
String
carrierDriverEdit1001
;
@Value
(
"${error-message.carrier.driver.edit.1002}"
)
private
String
carrierDriverEdit1002
;
@Value
(
"${error-message.carrier.driver.edit.1003}"
)
private
String
carrierDriverEdit1003
;
@Value
(
"${error-message.carrier.driver.edit.1004}"
)
private
String
carrierDriverEdit1004
;
}
src/main/java/com/esv/freight/customer/module/driver/controller/DriverController.java
View file @
2eda488d
...
...
@@ -8,6 +8,7 @@ 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.common.validator.groups.ValidatorUpdate
;
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
;
...
...
@@ -71,4 +72,29 @@ public class DriverController {
data
.
put
(
"id"
,
id
);
return
EResponse
.
ok
(
data
);
}
/**
* description 编辑司机信息
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/28 19:26
**/
@PostMapping
(
"/edit"
)
public
EResponse
edit
(
@RequestBody
@Validated
(
ValidatorUpdate
.
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
(),
"无效的身份证号码"
);
}
/****************************** 参数校验 ******************************/
driverAccountService
.
updateDriver
(
form
);
return
EResponse
.
ok
();
}
}
src/main/java/com/esv/freight/customer/module/driver/form/DriverInfoForm.java
View file @
2eda488d
This diff is collapsed.
Click to expand it.
src/main/java/com/esv/freight/customer/module/driver/service/DriverAccountService.java
View file @
2eda488d
...
...
@@ -22,5 +22,14 @@ public interface DriverAccountService extends IService<DriverAccountEntity> {
**/
Long
insertDriver
(
DriverInfoForm
form
);
/**
* description 更新司机信息
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/04/28 19:13
**/
Integer
updateDriver
(
DriverInfoForm
form
);
}
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverAccountServiceImpl.java
View file @
2eda488d
package
com
.
esv
.
freight
.
customer
.
module
.
driver
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.component.PasswordComponent
;
...
...
@@ -103,4 +104,54 @@ public class DriverAccountServiceImpl extends ServiceImpl<DriverAccountDao, Driv
return
driverId
;
}
@Override
public
Integer
updateDriver
(
DriverInfoForm
form
)
{
// 1:校验
// 1.1:校验账号ID是否有效
DriverAccountEntity
driverAccountEntity
=
this
.
baseMapper
.
selectById
(
form
.
getId
());
if
(
null
==
driverAccountEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getCarrierDriverEdit1001
());
}
// 1.2:校验身份证号码是否已存在
Integer
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
ne
(
DriverInfoEntity:
:
getDriverId
,
form
.
getId
())
.
eq
(
DriverInfoEntity:
:
getIdCard
,
form
.
getIdCard
()));
if
(
0
<
count
)
{
throw
new
EException
(
1002
,
errorMessageComponent
.
getCarrierDriverEdit1002
());
}
// 1.3:校验驾驶证号码是否已存在
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
ne
(
DriverInfoEntity:
:
getDriverId
,
form
.
getId
())
.
eq
(
DriverInfoEntity:
:
getDrivingLicense
,
form
.
getDrivingLicense
()));
if
(
0
<
count
)
{
throw
new
EException
(
1003
,
errorMessageComponent
.
getCarrierDriverEdit1003
());
}
// 1.4:校验从业资格证号是否已存在
if
(
StringUtils
.
isNotBlank
(
form
.
getCertificateNumber
()))
{
count
=
this
.
driverInfoService
.
getBaseMapper
().
selectCount
(
new
QueryWrapper
<
DriverInfoEntity
>().
lambda
()
.
ne
(
DriverInfoEntity:
:
getDriverId
,
form
.
getId
())
.
eq
(
DriverInfoEntity:
:
getCertificateNumber
,
form
.
getCertificateNumber
()));
if
(
0
<
count
)
{
throw
new
EException
(
1004
,
errorMessageComponent
.
getCarrierDriverEdit1004
());
}
}
// 2:更新密码
int
flag
=
0
;
if
(
StringUtils
.
isNotBlank
(
form
.
getPassword
()))
{
DriverAccountEntity
accountEntity
=
new
DriverAccountEntity
();
accountEntity
.
setId
(
form
.
getId
());
accountEntity
.
setPassword
(
passwordComponent
.
generatePwd4Salt
(
form
.
getPassword
(),
driverAccountEntity
.
getSalt
()));
flag
+=
this
.
baseMapper
.
updateById
(
accountEntity
);
}
// 3:更新帐号信息
DriverInfoEntity
driverInfoEntity
=
new
DriverInfoEntity
();
BeanUtils
.
copyProperties
(
form
,
driverInfoEntity
);
flag
+=
this
.
driverInfoService
.
getBaseMapper
().
update
(
driverInfoEntity
,
new
UpdateWrapper
<
DriverInfoEntity
>().
lambda
()
.
eq
(
DriverInfoEntity:
:
getDriverId
,
form
.
getId
()));
return
flag
;
}
}
\ No newline at end of file
src/main/resources/application-dev.yml
View file @
2eda488d
...
...
@@ -149,4 +149,9 @@ error-message:
1001
:
账号已存在
1002
:
身份证号码已存在
1003
:
驾驶证号码已存在
1004
:
从业资格证号已存在
edit
:
1001
:
无效的账号ID
1002
:
身份证号码已存在
1003
:
驾驶证号码已存在
1004
:
从业资格证号已存在
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountEditTest.java
0 → 100644
View file @
2eda488d
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