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
81be4042
Commit
81be4042
authored
Apr 29, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
承运商接口:查看帐号的审核历史
parent
0a48f425
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
156 additions
and
1 deletion
+156
-1
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+3
-0
DriverController.java
...t/customer/module/driver/controller/DriverController.java
+28
-0
DriverAccountService.java
.../customer/module/driver/service/DriverAccountService.java
+12
-0
DriverAccountServiceImpl.java
.../module/driver/service/impl/DriverAccountServiceImpl.java
+13
-0
DriverAuditHistoryVO.java
...eight/customer/module/driver/vo/DriverAuditHistoryVO.java
+40
-0
application-dev.yml
src/main/resources/application-dev.yml
+3
-1
DriverAccountTest.java
.../customer/module/driver/controller/DriverAccountTest.java
+57
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
81be4042
...
...
@@ -210,4 +210,7 @@ public class ErrorMessageComponent {
private
String
carrierDriverRegister1001
;
@Value
(
"${error-message.carrier.driver.register.1002}"
)
private
String
carrierDriverRegister1002
;
@Value
(
"${error-message.carrier.driver.audit-history.1001}"
)
private
String
carrierDriverAuditHistory1001
;
}
src/main/java/com/esv/freight/customer/module/driver/controller/DriverController.java
View file @
81be4042
...
...
@@ -12,11 +12,13 @@ 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.dto.DriverDetailDto
;
import
com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity
;
import
com.esv.freight.customer.module.driver.form.DriverAuditForm
;
import
com.esv.freight.customer.module.driver.form.DriverInfoForm
;
import
com.esv.freight.customer.module.driver.form.DriverQueryForm
;
import
com.esv.freight.customer.module.driver.service.DriverAccountService
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorRegister
;
import
com.esv.freight.customer.module.driver.vo.DriverAuditHistoryVO
;
import
com.esv.freight.customer.module.driver.vo.DriverDetailVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -28,6 +30,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @description:
* @project: freight-customer-service
...
...
@@ -188,4 +193,27 @@ public class DriverController {
return
EResponse
.
ok
(
data
);
}
/**
* description 查看帐号的审核历史
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/29 11:30
**/
@PostMapping
(
"/auditHistory"
)
public
EResponse
auditHistory
(
@RequestBody
@Validated
(
ValidatorDetail
.
class
)
DriverQueryForm
form
)
throws
EException
{
List
<
DriverAuditHistoryEntity
>
entityList
=
driverAccountService
.
getAuditHistory
(
form
.
getId
());
// 数据转换
List
<
DriverAuditHistoryVO
>
voList
=
new
ArrayList
<>();
entityList
.
forEach
(
entity
->
{
DriverAuditHistoryVO
vo
=
new
DriverAuditHistoryVO
();
BeanUtils
.
copyProperties
(
entity
,
vo
);
vo
.
setOperateTime
(
entity
.
getOperateTime
().
getTime
());
voList
.
add
(
vo
);
});
return
EResponse
.
ok
(
voList
);
}
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverAccountService.java
View file @
81be4042
...
...
@@ -3,9 +3,12 @@ package com.esv.freight.customer.module.driver.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.driver.dto.DriverDetailDto
;
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.form.DriverAuditForm
;
import
com.esv.freight.customer.module.driver.form.DriverInfoForm
;
import
java.util.List
;
/**
* 司机帐号表
*
...
...
@@ -77,6 +80,15 @@ public interface DriverAccountService extends IService<DriverAccountEntity> {
* createTime 2020/04/29 10:43
**/
Long
registerDriver
(
DriverInfoForm
form
);
/**
* description 查看帐号的审核历史
* param [id]
* return java.util.List<com.esv.freight.customer.module.driver.entity.DriverAuditHistoryEntity>
* author Administrator
* createTime 2020/04/29 11:21
**/
List
<
DriverAuditHistoryEntity
>
getAuditHistory
(
Long
id
);
}
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverAccountServiceImpl.java
View file @
81be4042
...
...
@@ -26,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
(
"driverAccountService"
)
public
class
DriverAccountServiceImpl
extends
ServiceImpl
<
DriverAccountDao
,
DriverAccountEntity
>
implements
DriverAccountService
{
...
...
@@ -286,4 +288,15 @@ public class DriverAccountServiceImpl extends ServiceImpl<DriverAccountDao, Driv
return
driverId
;
}
@Override
public
List
<
DriverAuditHistoryEntity
>
getAuditHistory
(
Long
id
)
{
DriverAccountEntity
driverAccountEntity
=
this
.
baseMapper
.
selectById
(
id
);
if
(
null
==
driverAccountEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getCarrierDriverAuditHistory1001
());
}
return
this
.
driverAuditHistoryService
.
getBaseMapper
().
selectList
(
new
QueryWrapper
<
DriverAuditHistoryEntity
>().
lambda
()
.
eq
(
DriverAuditHistoryEntity:
:
getDriverId
,
id
).
orderByAsc
(
DriverAuditHistoryEntity:
:
getOperateTime
));
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/driver/vo/DriverAuditHistoryVO.java
0 → 100644
View file @
81be4042
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.DriverAuditHistoryVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/29 11:27
* @version:1.0
*/
@Data
public
class
DriverAuditHistoryVO
{
/**
* 审核状态(字典表):0-待审核、1-审核成功,2-审核失败
*/
private
Integer
auditStatus
;
/**
* 备注
*/
private
String
remark
;
/**
* 操作者
*/
private
String
operateUser
;
/**
* 操作时间
*/
private
Long
operateTime
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/application-dev.yml
View file @
81be4042
...
...
@@ -169,4 +169,6 @@ error-message:
1002
:
帐号已启用
register
:
1001
:
帐号已存在
1002
:
无效的承运商ID
\ No newline at end of file
1002
:
无效的承运商ID
audit-history
:
1001
:
无效的账号ID
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountTest.java
View file @
81be4042
...
...
@@ -481,4 +481,61 @@ public class DriverAccountTest extends BaseTestController {
Assert
.
assertEquals
(
1002
,
result
.
getIntValue
(
"code"
));
}
/**
* 查看帐号的审核历史
**/
@Test
public
void
e1_auditHistory_success_test
()
throws
Exception
{
String
url
=
"/carrier/driver/auditHistory"
;
// 构造数据
DriverQueryForm
form
=
new
DriverQueryForm
();
form
.
setId
(
1L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSONString
()))
.
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"
));
}
/**
* 查看帐号的审核历史:无效的帐号ID
**/
@Test
public
void
e2_auditHistory_wrong_id_failure_test
()
throws
Exception
{
String
url
=
"/carrier/driver/auditHistory"
;
// 构造数据
DriverQueryForm
form
=
new
DriverQueryForm
();
form
.
setId
(
99999L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSONString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
}
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