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
d7e1df8b
Commit
d7e1df8b
authored
Apr 18, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口:查看货主帐号审核历史
parent
23eee501
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
4 deletions
+148
-4
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+3
-0
GoodsOwnerController.java
...er/module/goodsowner/controller/GoodsOwnerController.java
+31
-0
AccountForm.java
.../freight/customer/module/goodsowner/form/AccountForm.java
+2
-3
AccountService.java
...ht/customer/module/goodsowner/service/AccountService.java
+10
-0
AccountServiceImpl.java
...er/module/goodsowner/service/impl/AccountServiceImpl.java
+17
-0
ValidatorAuditHistory.java
...le/goodsowner/validator/groups/ValidatorAuditHistory.java
+15
-0
AuditHistoryVO.java
...freight/customer/module/goodsowner/vo/AuditHistoryVO.java
+40
-0
application-dev.yml
src/main/resources/application-dev.yml
+3
-1
GoodsOwnerControllerTest.java
...odule/goodsowner/controller/GoodsOwnerControllerTest.java
+27
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
d7e1df8b
...
...
@@ -40,4 +40,7 @@ public class ErrorMessageComponent {
@Value
(
"${error-message.goodsowner.account.audit.1002}"
)
private
String
goodsOwnerAccountAudit1002
;
@Value
(
"${error-message.goodsowner.account.audit-history.1001}"
)
private
String
goodsOwnerAccountAuditHistory1001
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerController.java
View file @
d7e1df8b
...
...
@@ -9,14 +9,18 @@ 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.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
import
com.esv.freight.customer.module.goodsowner.form.AccountForm
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
import
com.esv.freight.customer.module.goodsowner.service.AccountService
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAudit
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAuditHistory
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorBlock
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorUnblock
;
import
com.esv.freight.customer.module.goodsowner.vo.AuditHistoryVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -24,6 +28,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
...
...
@@ -141,4 +148,28 @@ public class GoodsOwnerController {
accountService
.
auditAccount
(
form
);
return
EResponse
.
ok
();
}
/**
* description 查看帐号的审核历史
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/18 16:50
**/
@PostMapping
(
"/audit/history"
)
public
EResponse
getAccountAuditHistory
(
@RequestBody
@Validated
(
ValidatorAuditHistory
.
class
)
AccountForm
form
)
throws
EException
{
// 查询审核历史
List
<
AuditHistoryEntity
>
auditHistoryEntityList
=
accountService
.
getAuditHistory
(
form
.
getId
());
// 数据转换
List
<
AuditHistoryVO
>
auditHistoryVOList
=
new
ArrayList
<>();
auditHistoryEntityList
.
forEach
(
auditHistoryEntity
->
{
AuditHistoryVO
auditHistoryVO
=
new
AuditHistoryVO
();
BeanUtils
.
copyProperties
(
auditHistoryEntity
,
auditHistoryVO
);
auditHistoryVO
.
setOperateTime
(
auditHistoryEntity
.
getOperateTime
().
getTime
());
auditHistoryVOList
.
add
(
auditHistoryVO
);
});
return
EResponse
.
ok
(
auditHistoryVOList
);
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/form/AccountForm.java
View file @
d7e1df8b
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAudit
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAuditHistory
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorBlock
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorUnblock
;
import
lombok.Data
;
...
...
@@ -24,7 +23,7 @@ import javax.validation.constraints.NotNull;
@Data
public
class
AccountForm
{
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorBlock
.
class
,
ValidatorUnblock
.
class
,
ValidatorAudit
.
class
})
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorBlock
.
class
,
ValidatorUnblock
.
class
,
ValidatorAudit
.
class
,
ValidatorAuditHistory
.
class
})
private
Long
id
;
@NotNull
(
message
=
"参数auditStatus不能为空"
,
groups
=
{
ValidatorAudit
.
class
})
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/service/AccountService.java
View file @
d7e1df8b
...
...
@@ -2,6 +2,7 @@ package com.esv.freight.customer.module.goodsowner.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
import
com.esv.freight.customer.module.goodsowner.form.AccountForm
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
...
...
@@ -79,5 +80,14 @@ public interface AccountService extends IService<AccountEntity> {
**/
void
auditAccount
(
AccountForm
form
);
/**
* description 获取帐号审核历史
* param [id]
* return java.util.List<com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity>
* author Administrator
* createTime 2020/04/18 16:31
**/
List
<
AuditHistoryEntity
>
getAuditHistory
(
Long
id
);
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/AccountServiceImpl.java
View file @
d7e1df8b
...
...
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -231,7 +232,23 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
AuditHistoryEntity
auditHistoryEntity
=
new
AuditHistoryEntity
();
auditHistoryEntity
.
setAccountId
(
accountId
);
auditHistoryEntity
.
setAuditStatus
(
form
.
getAuditStatus
());
auditHistoryEntity
.
setRemark
(
form
.
getRemark
());
auditHistoryEntity
.
setOperateUser
(
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
USER_ACCOUNT
));
auditHistoryService
.
getBaseMapper
().
insert
(
auditHistoryEntity
);
}
@Override
public
List
<
AuditHistoryEntity
>
getAuditHistory
(
Long
id
)
{
// 判断帐号是否存在
AccountEntity
accountEntity
=
this
.
getAccountRecordById
(
id
);
if
(
null
==
accountEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getGoodsOwnerAccountAuditHistory1001
());
}
// 查询审核历史
QueryWrapper
<
AuditHistoryEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"account_id"
,
id
);
queryWrapper
.
orderByAsc
(
"operate_time"
);
return
this
.
auditHistoryService
.
getBaseMapper
().
selectList
(
queryWrapper
);
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/validator/groups/ValidatorAuditHistory.java
0 → 100644
View file @
d7e1df8b
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
validator
.
groups
;
import
javax.validation.groups.Default
;
/**
* @description: 参数校验分组:审核历史
* @project: SpringCloudTemplate
* @name: com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAuditHistory
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/03/12 17:58
* @version:1.0
*/
public
interface
ValidatorAuditHistory
extends
Default
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/vo/AuditHistoryVO.java
0 → 100644
View file @
d7e1df8b
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
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.goodsowner.vo.AuditHistoryVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/18 16:46
* @version:1.0
*/
@Data
public
class
AuditHistoryVO
{
/**
* 审核状态:字典表
*/
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 @
d7e1df8b
...
...
@@ -60,4 +60,6 @@ error-message:
1002
:
帐号已启用
audit
:
1001
:
无效的帐号ID
1002
:
帐号已审核通过
\ No newline at end of file
1002
:
帐号已审核通过
audit-history
:
1001
:
无效的帐号ID
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerControllerTest.java
View file @
d7e1df8b
...
...
@@ -371,4 +371,31 @@ public class GoodsOwnerControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
/**
* 查看帐号的审核历史
**/
@Test
public
void
f1_getAccountAuditHistory_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/audit/history"
;
// 构造数据
AccountForm
form
=
new
AccountForm
();
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"
));
}
}
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