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
9d58d337
Commit
9d58d337
authored
May 26, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口:司机与平台的电子合同-司机签订
parent
99665a71
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
478 additions
and
17 deletions
+478
-17
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+7
-3
ContractOnlineRecordController.java
...e/contract/controller/ContractOnlineRecordController.java
+13
-0
ContractOnlineRecordSignDriverForm.java
...ule/contract/form/ContractOnlineRecordSignDriverForm.java
+104
-0
ContractOnlineDriverPojo.java
...stomer/module/contract/pojo/ContractOnlineDriverPojo.java
+90
-0
ContractOnlineRecordService.java
.../module/contract/service/ContractOnlineRecordService.java
+11
-0
ContractOnlineRecordServiceImpl.java
...ontract/service/impl/ContractOnlineRecordServiceImpl.java
+127
-9
ContractOnlineRecordSignDriverVO.java
.../module/contract/vo/ContractOnlineRecordSignDriverVO.java
+28
-0
application-dev.yml
src/main/resources/application-dev.yml
+5
-1
application-test.yml
src/main/resources/application-test.yml
+5
-1
logback-spring.xml
src/main/resources/logback-spring.xml
+1
-1
ContractOnlineRecordControllerTest.java
...ntract/controller/ContractOnlineRecordControllerTest.java
+87
-2
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
9d58d337
...
@@ -299,11 +299,15 @@ public class ErrorMessageComponent {
...
@@ -299,11 +299,15 @@ public class ErrorMessageComponent {
private
String
contractOfflineCarrierDelete1001
;
private
String
contractOfflineCarrierDelete1001
;
@Value
(
"${error-message.contract.online.goods-owner.sign.1001}"
)
@Value
(
"${error-message.contract.online.goods-owner.sign.1001}"
)
private
String
contractOnlineGoodsOwnerAdd1001
;
private
String
contractOnlineGoodsOwnerSign1001
;
@Value
(
"${error-message.contract.online.driver.sign.1001}"
)
private
String
contractOnlineDriverSign1001
;
@Value
(
"${error-message.contract.online.platform.sign.1001}"
)
private
String
contractOnlinePlatformSign1001
;
@Value
(
"${error-message.contract.online.get-by-number.1001}"
)
@Value
(
"${error-message.contract.online.get-by-number.1001}"
)
private
String
contractOnlineGetByNumber1001
;
private
String
contractOnlineGetByNumber1001
;
@Value
(
"${error-message.contract.online.goods-owner.platform-sign.1001}"
)
private
String
contractOnlineGoodsOwnerPlatformSign1001
;
}
}
src/main/java/com/esv/freight/customer/module/contract/controller/ContractOnlineRecordController.java
View file @
9d58d337
...
@@ -4,6 +4,7 @@ import com.esv.freight.customer.common.exception.EException;
...
@@ -4,6 +4,7 @@ import com.esv.freight.customer.common.exception.EException;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDetail
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDetail
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignDriverForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.service.ContractOnlineRecordService
;
import
com.esv.freight.customer.module.contract.service.ContractOnlineRecordService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -48,6 +49,18 @@ public class ContractOnlineRecordController {
...
@@ -48,6 +49,18 @@ public class ContractOnlineRecordController {
return
EResponse
.
ok
(
contractOnlineRecordService
.
goodsOwnerSign
(
form
));
return
EResponse
.
ok
(
contractOnlineRecordService
.
goodsOwnerSign
(
form
));
}
}
/**
* description 司机与平台的电子合同-司机签订
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/26 15:19
**/
@PostMapping
(
"/driver/sign"
)
public
EResponse
driverSign
(
@RequestBody
@Validated
ContractOnlineRecordSignDriverForm
form
)
throws
EException
{
return
EResponse
.
ok
(
contractOnlineRecordService
.
driverSign
(
form
));
}
/**
/**
* description 电子合同-平台签订
* description 电子合同-平台签订
* param [form]
* param [form]
...
...
src/main/java/com/esv/freight/customer/module/contract/form/ContractOnlineRecordSignDriverForm.java
0 → 100644
View file @
9d58d337
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
form
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignDriverForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/21 17:44
* @version:1.0
*/
@Data
public
class
ContractOnlineRecordSignDriverForm
{
/**
* 司机ID
*/
@NotNull
(
message
=
"参数driverId不能为空"
)
private
Long
driverId
;
/**
* 业务编号(订单号或运单号)
*/
@Length
(
max
=
50
,
message
=
"参数businessNumber长度不合法"
)
@NotBlank
(
message
=
"参数businessNumber不能为空"
)
private
String
businessNumber
;
/**
* 货物名称
*/
@Length
(
max
=
50
,
message
=
"参数goodsName长度不合法"
)
@NotBlank
(
message
=
"参数goodsName不能为空"
)
private
String
goodsName
;
/**
* 货物总量
*/
@Length
(
max
=
50
,
message
=
"参数goodsTotal长度不合法"
)
@NotBlank
(
message
=
"参数goodsTotal不能为空"
)
private
String
goodsTotal
;
/**
* 货物单位
*/
@Length
(
max
=
50
,
message
=
"参数goodsUnit长度不合法"
)
@NotBlank
(
message
=
"参数goodsUnit不能为空"
)
private
String
goodsUnit
;
/**
* 货物单价
*/
@Length
(
max
=
50
,
message
=
"参数goodsUnitPrice长度不合法"
)
@NotBlank
(
message
=
"参数goodsUnitPrice不能为空"
)
private
String
goodsUnitPrice
;
/**
* 货物总价
*/
@Length
(
max
=
50
,
message
=
"参数goodsTotalPrice长度不合法"
)
@NotBlank
(
message
=
"参数goodsTotalPrice不能为空"
)
private
String
goodsTotalPrice
;
/**
* 发货地址
*/
@Length
(
max
=
200
,
message
=
"参数deliverAddress长度不合法"
)
@NotBlank
(
message
=
"参数deliverAddress不能为空"
)
private
String
deliverAddress
;
/**
* 收货地址
*/
@Length
(
max
=
200
,
message
=
"参数receiveAddress长度不合法"
)
@NotBlank
(
message
=
"参数receiveAddress不能为空"
)
private
String
receiveAddress
;
/**
* 发货时间
*/
@Length
(
max
=
50
,
message
=
"参数deliverTime长度不合法"
)
@NotBlank
(
message
=
"参数deliverTime不能为空"
)
private
String
deliverTime
;
/**
* 交货时间
*/
@Length
(
max
=
50
,
message
=
"参数receiveTime长度不合法"
)
@NotBlank
(
message
=
"参数receiveTime不能为空"
)
private
String
receiveTime
;
/**
* 运费
*/
@Length
(
max
=
50
,
message
=
"参数freightCharge长度不合法"
)
@NotBlank
(
message
=
"参数freightCharge不能为空"
)
private
String
freightCharge
;
/**
* 货主签名数据,base64编码
*/
@NotBlank
(
message
=
"参数signData不能为空"
)
private
String
signData
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/contract/pojo/ContractOnlineDriverPojo.java
0 → 100644
View file @
9d58d337
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
pojo
;
import
lombok.Data
;
/**
* @description: 货主与平台签订合同的模板内容项
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.pojo.ContractOnlineDriverPojo
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/22 10:05
* @version:1.0
*/
@Data
public
class
ContractOnlineDriverPojo
{
/**
* 合同编号
*/
private
String
contactNumber
;
/**
* 承运方
*/
private
String
driverName
;
/**
* 承运方身份证号码
*/
private
String
driverId
;
/**
* 承运方
*/
private
String
platformName
;
/**
* 承运方组织机构代码
*/
private
String
platformId
;
/**
* 货物名称
*/
private
String
goodsName
;
/**
* 货物总量
*/
private
String
goodsTotal
;
/**
* 货物单位
*/
private
String
goodsUnit
;
/**
* 货物单价
*/
private
String
goodsUnitPrice
;
/**
* 货物总价
*/
private
String
goodsTotalPrice
;
/**
* 发货地址
*/
private
String
deliverAddress
;
/**
* 收货地址
*/
private
String
receiveAddress
;
/**
* 发货时间
*/
private
String
deliverTime
;
/**
* 交货时间
*/
private
String
receiveTime
;
/**
* 本次运输运费
*/
private
String
freightCharge
;
/**
* 承运方签字
*/
private
Object
driverSignImg
;
/**
* 委托方签字
*/
private
Object
platformFreightSealImg
;
/**
* 生效时间
*/
private
String
effectiveTime
;
}
src/main/java/com/esv/freight/customer/module/contract/service/ContractOnlineRecordService.java
View file @
9d58d337
...
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.module.contract.entity.ContractOnlineRecordEntity
;
import
com.esv.freight.customer.module.contract.entity.ContractOnlineRecordEntity
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignDriverForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignDriverVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignGoodsOwnerVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignGoodsOwnerVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordVO
;
...
@@ -26,6 +28,15 @@ public interface ContractOnlineRecordService extends IService<ContractOnlineReco
...
@@ -26,6 +28,15 @@ public interface ContractOnlineRecordService extends IService<ContractOnlineReco
**/
**/
ContractOnlineRecordSignGoodsOwnerVO
goodsOwnerSign
(
ContractOnlineRecordSignGoodsOwnerForm
form
);
ContractOnlineRecordSignGoodsOwnerVO
goodsOwnerSign
(
ContractOnlineRecordSignGoodsOwnerForm
form
);
/**
* description 司机与平台的电子合同-司机签订
* param [form]
* return com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignDriverVO
* author Administrator
* createTime 2020/05/26 15:03
**/
ContractOnlineRecordSignDriverVO
driverSign
(
ContractOnlineRecordSignDriverForm
form
);
/**
/**
* description 根据合同编号获取合同信息
* description 根据合同编号获取合同信息
* param [contractNumber]
* param [contractNumber]
...
...
src/main/java/com/esv/freight/customer/module/contract/service/impl/ContractOnlineRecordServiceImpl.java
View file @
9d58d337
This diff is collapsed.
Click to expand it.
src/main/java/com/esv/freight/customer/module/contract/vo/ContractOnlineRecordSignDriverVO.java
0 → 100644
View file @
9d58d337
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
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.contract.vo.ContractOnlineRecordSignDriverVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/21 17:54
* @version:1.0
*/
@Data
public
class
ContractOnlineRecordSignDriverVO
{
/**
* 合同编号
*/
private
String
contractNumber
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/application-dev.yml
View file @
9d58d337
...
@@ -249,7 +249,11 @@ error-message:
...
@@ -249,7 +249,11 @@ error-message:
goods-owner
:
goods-owner
:
sign
:
sign
:
1001
:
无效的货主ID
1001
:
无效的货主ID
platform-sign
:
driver
:
sign
:
1001
:
无效的司机ID
platform
:
sign
:
1001
:
无效的合同编号
1001
:
无效的合同编号
get-by-number
:
get-by-number
:
1001
:
无效的合同编号
1001
:
无效的合同编号
\ No newline at end of file
src/main/resources/application-test.yml
View file @
9d58d337
...
@@ -249,7 +249,11 @@ error-message:
...
@@ -249,7 +249,11 @@ error-message:
goods-owner
:
goods-owner
:
sign
:
sign
:
1001
:
无效的货主ID
1001
:
无效的货主ID
platform-sign
:
driver
:
sign
:
1001
:
无效的司机ID
platform
:
sign
:
1001
:
无效的合同编号
1001
:
无效的合同编号
get-by-number
:
get-by-number
:
1001
:
无效的合同编号
1001
:
无效的合同编号
\ No newline at end of file
src/main/resources/logback-spring.xml
View file @
9d58d337
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
<!-- mybatis sql日志 日志的级别需要是DEBUG -->
<!-- mybatis sql日志 日志的级别需要是DEBUG -->
<!-- 日志打印的包的范围,及分类日志文件存储 -->
<!-- 日志打印的包的范围,及分类日志文件存储 -->
<logger
name=
"com.esv"
level=
"
INFO
"
additivity=
"false"
>
<logger
name=
"com.esv"
level=
"
DEBUG
"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE_APPENDER"
/>
<appender-ref
ref=
"CONSOLE_APPENDER"
/>
<appender-ref
ref=
"FILE_APPENDER"
/>
<appender-ref
ref=
"FILE_APPENDER"
/>
</logger>
</logger>
...
...
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOnlineRecordControllerTest.java
View file @
9d58d337
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.esv.freight.customer.BaseTestController
;
import
com.esv.freight.customer.BaseTestController
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignDriverForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOnlineRecordSignGoodsOwnerForm
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
...
@@ -139,7 +140,7 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
...
@@ -139,7 +140,7 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
// 构造数据
// 构造数据
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
form
.
setContractNumber
(
"
HZHT20200526000002
"
);
form
.
setContractNumber
(
"
SJHT20200526000001
"
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
@@ -191,7 +192,7 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
...
@@ -191,7 +192,7 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
// 构造数据
// 构造数据
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
form
.
setContractNumber
(
"
HZHT20200526000002
"
);
form
.
setContractNumber
(
"
SJHT20200526000001
"
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
@@ -234,4 +235,88 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
...
@@ -234,4 +235,88 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
}
/**
* 司机与平台的电子合同-司机签订
**/
@Test
public
void
a1_driverSign_success_test
()
throws
Exception
{
String
url
=
"/contract/online/driver/sign"
;
// 构造数据
ContractOnlineRecordSignDriverForm
form
=
new
ContractOnlineRecordSignDriverForm
();
form
.
setDriverId
(
1L
);
form
.
setBusinessNumber
(
"DD"
+
System
.
currentTimeMillis
());
form
.
setGoodsName
(
"煤炭"
);
form
.
setGoodsTotal
(
"5"
);
form
.
setGoodsUnit
(
"吨"
);
form
.
setGoodsUnitPrice
(
"230"
);
form
.
setGoodsTotalPrice
(
"1150"
);
form
.
setDeliverAddress
(
"辽宁沈阳市沈河区惠工街10号卓越大厦2710"
);
form
.
setDeliverTime
(
"2020-05-28 11:00:00"
);
form
.
setReceiveAddress
(
"辽宁沈阳市沈河区泉园二路85号"
);
form
.
setReceiveTime
(
"2020-05-28 18:00:00"
);
form
.
setFreightCharge
(
"500"
);
String
filepath
=
"D:\\test\\何锋.jpg"
;
File
signFile
=
new
File
(
filepath
);
InputStream
input
=
new
FileInputStream
(
signFile
);
form
.
setSignData
(
Base64
.
getEncoder
().
encodeToString
(
IOUtils
.
toByteArray
(
input
)));
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
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
(
result
.
getJSONObject
(
"data"
).
containsKey
(
"contractNumber"
));
}
/**
* 司机与平台的电子合同-司机签订:无效的司机ID
**/
@Test
@Rollback
public
void
a2_driverSign_failure_test
()
throws
Exception
{
String
url
=
"/contract/online/driver/sign"
;
// 构造数据
ContractOnlineRecordSignDriverForm
form
=
new
ContractOnlineRecordSignDriverForm
();
form
.
setDriverId
(
99999L
);
form
.
setBusinessNumber
(
"DD"
+
System
.
currentTimeMillis
());
form
.
setGoodsName
(
"煤炭"
);
form
.
setGoodsTotal
(
"5"
);
form
.
setGoodsUnit
(
"吨"
);
form
.
setGoodsUnitPrice
(
"230"
);
form
.
setGoodsTotalPrice
(
"1150"
);
form
.
setDeliverAddress
(
"辽宁沈阳市沈河区惠工街10号卓越大厦2710"
);
form
.
setDeliverTime
(
"2020-05-28 11:00:00"
);
form
.
setReceiveAddress
(
"辽宁沈阳市沈河区泉园二路85号"
);
form
.
setReceiveTime
(
"2020-05-28 18:00:00"
);
form
.
setFreightCharge
(
"500"
);
String
filepath
=
"D:\\test\\何锋.jpg"
;
File
signFile
=
new
File
(
filepath
);
InputStream
input
=
new
FileInputStream
(
signFile
);
form
.
setSignData
(
Base64
.
getEncoder
().
encodeToString
(
IOUtils
.
toByteArray
(
input
)));
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
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