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
e33d13e9
Commit
e33d13e9
authored
Apr 20, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口:获取帐号详情
parent
d7e1df8b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
524 additions
and
2 deletions
+524
-2
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+5
-0
GoodsOwnerController.java
...er/module/goodsowner/controller/GoodsOwnerController.java
+24
-0
AccountDao.java
...sv/freight/customer/module/goodsowner/dao/AccountDao.java
+20
-1
AccountInfoDto.java
...reight/customer/module/goodsowner/dto/AccountInfoDto.java
+158
-0
AccountForm.java
.../freight/customer/module/goodsowner/form/AccountForm.java
+4
-0
AccountService.java
...ht/customer/module/goodsowner/service/AccountService.java
+10
-0
AccountServiceImpl.java
...er/module/goodsowner/service/impl/AccountServiceImpl.java
+21
-0
AccountInfoVO.java
.../freight/customer/module/goodsowner/vo/AccountInfoVO.java
+123
-0
application-dev.yml
src/main/resources/application-dev.yml
+4
-1
AccountDao.xml
src/main/resources/mapper/goodsowner/AccountDao.xml
+21
-0
GoodsOwnerControllerTest.java
...odule/goodsowner/controller/GoodsOwnerControllerTest.java
+134
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
e33d13e9
...
...
@@ -43,4 +43,9 @@ public class ErrorMessageComponent {
@Value
(
"${error-message.goodsowner.account.audit-history.1001}"
)
private
String
goodsOwnerAccountAuditHistory1001
;
@Value
(
"${error-message.goodsowner.account.detail.1001}"
)
private
String
goodsOwnerAccountDetail1001
;
@Value
(
"${error-message.goodsowner.account.detail.1002}"
)
private
String
goodsOwnerAccountDetail1002
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerController.java
View file @
e33d13e9
...
...
@@ -6,9 +6,11 @@ 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.ValidatorDetail
;
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.dto.AccountInfoDto
;
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
;
...
...
@@ -17,6 +19,7 @@ import com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAudi
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.AccountInfoVO
;
import
com.esv.freight.customer.module.goodsowner.vo.AuditHistoryVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -172,4 +175,25 @@ public class GoodsOwnerController {
return
EResponse
.
ok
(
auditHistoryVOList
);
}
/**
* description 获取帐号详细信息
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/20 10:12
**/
@PostMapping
(
"/detail"
)
public
EResponse
getAccountDetail
(
@RequestBody
@Validated
(
ValidatorDetail
.
class
)
AccountForm
form
)
throws
EException
{
/****************************** 参数校验 ******************************/
if
(
null
==
form
.
getId
()
&&
null
==
form
.
getAccount
())
{
throw
new
EException
(
ECode
.
PARAM_ERROR
.
code
(),
"参数id、account不能同时为空"
);
}
/****************************** 参数校验 ******************************/
AccountInfoDto
accountInfoDto
=
accountService
.
getAccountInfo
(
form
);
AccountInfoVO
accountInfoVO
=
new
AccountInfoVO
();
BeanUtils
.
copyProperties
(
accountInfoDto
,
accountInfoVO
);
return
EResponse
.
ok
(
accountInfoVO
);
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/AccountDao.java
View file @
e33d13e9
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
org.apache.ibatis.annotations.Mapper
;
/**
...
...
@@ -13,5 +14,23 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
AccountDao
extends
BaseMapper
<
AccountEntity
>
{
/**
* description 通过帐号id获取帐号信息
* param [id]
* return com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
* author Administrator
* createTime 2020/04/20 9:41
**/
AccountInfoDto
getAccountInfoById
(
Long
id
);
/**
* description 通过帐号获取帐号信息
* param [account]
* return com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
* author Administrator
* createTime 2020/04/20 9:41
**/
AccountInfoDto
getAccountInfoByAccount
(
String
account
);
}
src/main/java/com/esv/freight/customer/module/goodsowner/dto/AccountInfoDto.java
0 → 100644
View file @
e33d13e9
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/20 9:24
* @version:1.0
*/
@Data
public
class
AccountInfoDto
{
/**
*
*/
@TableId
private
Long
id
;
/**
* 租户ID
*/
private
Long
tenantId
;
/**
* 部门ID
*/
private
Long
departmentId
;
/**
* 登录帐号,货主手机号
*/
private
String
account
;
/**
* 帐号密码
*/
private
String
password
;
/**
* 密码加盐
*/
private
String
salt
;
/**
* 创建来源:1-平台创建、2-自行注册
*/
private
String
sourceType
;
/**
* 帐号状态:1-正常、2-停用
*/
private
String
accountStatus
;
/**
* 货主帐号审核状态:0-待审核、1-审核成功,2-审核失败,APP自行注册需要平台审核
*/
private
Integer
auditStatus
;
/**
* 上报状态:字典表
*/
private
Integer
uploadStatus
;
/**
* 上报时间
*/
private
Date
uploadTime
;
/**
* 创建者
*/
private
String
createUser
;
/**
* 修改者
*/
private
String
updateUser
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改时间
*/
private
Date
updateTime
;
/**
* 货主类型:1-个人、2-企业
*/
private
String
ownerType
;
/**
* 客户编码
*/
private
String
ownerNumber
;
/**
* 客户名称
*/
private
String
ownerFullName
;
/**
* 客户简称
*/
private
String
ownerBriefName
;
/**
* 统一社会信用代码
*/
private
String
uniCreditCode
;
/**
* 营业期限
*/
private
String
creditExpireDate
;
/**
* 营业执照正本ULR
*/
private
String
creditOriginalUrl
;
/**
* 营业执照副本ULR
*/
private
String
creditCopyUrl
;
/**
* 企业法人姓名
*/
private
String
legalPerson
;
/**
* 企业法人手机号
*/
private
String
legalPhone
;
/**
* 省份代码
*/
private
String
provinceCode
;
/**
* 市代码
*/
private
String
cityCode
;
/**
* 区县代码
*/
private
String
districtCode
;
/**
* 详细地址
*/
private
String
detailAddress
;
/**
* (个人或企业)联系人
*/
private
String
contactor
;
/**
* (个人或企业)身份证号码
*/
private
String
idCard
;
/**
* (个人或企业)身份证有效期
*/
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
private
String
idCardBackUrl
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/form/AccountForm.java
View file @
e33d13e9
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDetail
;
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
;
...
...
@@ -32,6 +33,9 @@ public class AccountForm {
@Length
(
max
=
100
,
message
=
"参数remark长度不合法"
,
groups
=
{
ValidatorAudit
.
class
})
private
String
remark
;
@Length
(
max
=
11
,
message
=
"参数account长度不合法"
,
groups
=
{
ValidatorDetail
.
class
})
private
String
account
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/service/AccountService.java
View file @
e33d13e9
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
;
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
;
...
...
@@ -89,5 +90,14 @@ public interface AccountService extends IService<AccountEntity> {
**/
List
<
AuditHistoryEntity
>
getAuditHistory
(
Long
id
);
/**
* description 获取帐号详细信息
* param [form]
* return com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
* author Administrator
* createTime 2020/04/20 9:47
**/
AccountInfoDto
getAccountInfo
(
AccountForm
form
);
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/AccountServiceImpl.java
View file @
e33d13e9
...
...
@@ -12,6 +12,7 @@ import com.esv.freight.customer.common.util.ReqUtils;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.dao.AccountDao
;
import
com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
;
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.entity.InfoEntity
;
...
...
@@ -251,4 +252,24 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
queryWrapper
.
orderByAsc
(
"operate_time"
);
return
this
.
auditHistoryService
.
getBaseMapper
().
selectList
(
queryWrapper
);
}
@Override
public
AccountInfoDto
getAccountInfo
(
AccountForm
form
)
{
AccountInfoDto
dto
=
null
;
if
(
null
!=
form
.
getId
())
{
dto
=
this
.
baseMapper
.
getAccountInfoById
(
form
.
getId
());
if
(
null
==
dto
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getGoodsOwnerAccountDetail1001
());
}
}
else
if
(
null
!=
form
.
getAccount
())
{
dto
=
this
.
baseMapper
.
getAccountInfoByAccount
(
form
.
getAccount
());
if
(
null
==
dto
)
{
throw
new
EException
(
1002
,
errorMessageComponent
.
getGoodsOwnerAccountDetail1002
());
}
}
else
{
}
return
dto
;
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/vo/AccountInfoVO.java
0 → 100644
View file @
e33d13e9
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
;
import
java.io.Serializable
;
/**
* 货主信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
public
class
AccountInfoVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6178403738228133215L
;
/**
*
*/
private
Long
id
;
/**
* 登录帐号,货主手机号
*/
private
String
account
;
/**
* 创建来源:1-平台创建、2-自行注册
*/
private
String
sourceType
;
/**
* 帐号状态:1-正常、2-停用
*/
private
String
accountStatus
;
/**
* 货主帐号审核状态:0-待审核、1-审核成功,2-审核失败,APP自行注册需要平台审核
*/
private
Integer
auditStatus
;
/**
* 货主类型:1-个人、2-企业
*/
private
String
ownerType
;
/**
* 客户编码
*/
private
String
ownerNumber
;
/**
* 客户名称
*/
private
String
ownerFullName
;
/**
* 客户简称
*/
private
String
ownerBriefName
;
/**
* 统一社会信用代码
*/
private
String
uniCreditCode
;
/**
* 营业期限
*/
private
String
creditExpireDate
;
/**
* 营业执照正本ULR
*/
private
String
creditOriginalUrl
;
/**
* 营业执照副本ULR
*/
private
String
creditCopyUrl
;
/**
* 企业法人姓名
*/
private
String
legalPerson
;
/**
* 企业法人手机号
*/
private
String
legalPhone
;
/**
* 省份代码
*/
private
String
provinceCode
;
/**
* 市代码
*/
private
String
cityCode
;
/**
* 区县代码
*/
private
String
districtCode
;
/**
* 详细地址
*/
private
String
detailAddress
;
/**
* (个人或企业)联系人
*/
private
String
contactor
;
/**
* (个人或企业)身份证号码
*/
private
String
idCard
;
/**
* (个人或企业)身份证有效期
*/
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
private
String
idCardBackUrl
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/application-dev.yml
View file @
e33d13e9
...
...
@@ -62,4 +62,7 @@ error-message:
1001
:
无效的帐号ID
1002
:
帐号已审核通过
audit-history
:
1001
:
无效的帐号ID
\ No newline at end of file
1001
:
无效的帐号ID
detail
:
1001
:
无效的帐号ID
1002
:
无效的手机号
\ No newline at end of file
src/main/resources/mapper/goodsowner/AccountDao.xml
View file @
e33d13e9
...
...
@@ -22,5 +22,26 @@
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"getAccountInfoById"
parameterType=
"java.lang.Long"
resultType=
"com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto"
>
select a.*,
b.owner_type, b.owner_number, b.owner_full_name, b.owner_brief_name, b.uni_credit_code, b.credit_expire_date, b.credit_original_url,
b.credit_copy_url, b.legal_person, b.legal_phone, b.province_code, b.city_code, b.district_code, b.detail_address, b.contactor,
b.id_card, b.id_card_expire_date, b.id_card_front_url, b.id_card_back_url
from goods_owner_account a
left join goods_owner_info b
on a.id = b.account_id
where a.id = #{id}
</select>
<select
id=
"getAccountInfoByAccount"
parameterType=
"java.lang.String"
resultType=
"com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto"
>
select a.*,
b.owner_type, b.owner_number, b.owner_full_name, b.owner_brief_name, b.uni_credit_code, b.credit_expire_date, b.credit_original_url,
b.credit_copy_url, b.legal_person, b.legal_phone, b.province_code, b.city_code, b.district_code, b.detail_address, b.contactor,
b.id_card, b.id_card_expire_date, b.id_card_front_url, b.id_card_back_url
from goods_owner_account a
left join goods_owner_info b
on a.id = b.account_id
where a.account = #{account}
</select>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerControllerTest.java
View file @
e33d13e9
...
...
@@ -398,4 +398,138 @@ public class GoodsOwnerControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
/**
* 获取帐号详细信息:通过帐号id
**/
@Test
public
void
g1_getAccountDetail_by_id_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/detail"
;
// 构造数据
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"
));
}
/**
* 获取帐号详细信息:通过帐号
**/
@Test
public
void
g2_getAccountDetail_by_account_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/detail"
;
// 构造数据
AccountForm
form
=
new
AccountForm
();
form
.
setAccount
(
"18524431581"
);
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"
));
}
/**
* 获取帐号详细信息:未设置参数
**/
@Test
public
void
g3_getAccountDetail_no_param_failure_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/detail"
;
// 构造数据
AccountForm
form
=
new
AccountForm
();
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
.
PARAM_ERROR
.
code
(),
result
.
getIntValue
(
"code"
));
}
/**
* 获取帐号详细信息:无效的帐号ID
**/
@Test
public
void
g4_getAccountDetail_wrong_id_failure_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/detail"
;
// 构造数据
AccountForm
form
=
new
AccountForm
();
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"
));
}
/**
* 获取帐号详细信息:无效的帐号
**/
@Test
public
void
g5_getAccountDetail_wrong_account_failure_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/detail"
;
// 构造数据
AccountForm
form
=
new
AccountForm
();
form
.
setAccount
(
"12012345678"
);
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
(
1002
,
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