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
0b1cf3f7
Commit
0b1cf3f7
authored
May 22, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口:根据合同编号获取合同信息
parent
7aef434a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
278 additions
and
2 deletions
+278
-2
pom.xml
pom.xml
+6
-0
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+3
-0
ContractOnlineRecordController.java
...e/contract/controller/ContractOnlineRecordController.java
+14
-0
ContractOnlineRecordEntity.java
...er/module/contract/entity/ContractOnlineRecordEntity.java
+4
-0
ContractOnlineRecordForm.java
...stomer/module/contract/form/ContractOnlineRecordForm.java
+74
-0
ContractOnlineRecordService.java
.../module/contract/service/ContractOnlineRecordService.java
+11
-0
ContractOnlineRecordServiceImpl.java
...ontract/service/impl/ContractOnlineRecordServiceImpl.java
+37
-0
ContractOnlineRecordVO.java
...t/customer/module/contract/vo/ContractOnlineRecordVO.java
+72
-0
application-dev.yml
src/main/resources/application-dev.yml
+3
-1
ContractOnlineRecordDao.xml
...ain/resources/mapper/contract/ContractOnlineRecordDao.xml
+1
-1
ContractOnlineRecordControllerTest.java
...ntract/controller/ContractOnlineRecordControllerTest.java
+53
-0
No files found.
pom.xml
View file @
0b1cf3f7
...
...
@@ -121,6 +121,12 @@
<groupId>
org.docx4j
</groupId>
<artifactId>
docx4j
</artifactId>
<version>
6.1.2
</version>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.docx4j
</groupId>
...
...
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
0b1cf3f7
...
...
@@ -300,4 +300,7 @@ public class ErrorMessageComponent {
@Value
(
"${error-message.contract.online.goods-owner.sign.1001}"
)
private
String
contractOnlineGoodsOwnerAdd1001
;
@Value
(
"${error-message.contract.online.get-by-number.1001}"
)
private
String
contractOnlineGetByNumber1001
;
}
src/main/java/com/esv/freight/customer/module/contract/controller/ContractOnlineRecordController.java
View file @
0b1cf3f7
...
...
@@ -2,6 +2,8 @@ package com.esv.freight.customer.module.contract.controller;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.EResponse
;
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.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.service.ContractOnlineRecordService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -45,4 +47,16 @@ public class ContractOnlineRecordController {
public
EResponse
goodsOwnerSign
(
@RequestBody
@Validated
ContractOnlineRecordSignGoodsOwnerForm
form
)
throws
EException
{
return
EResponse
.
ok
(
contractOnlineRecordService
.
goodsOwnerSign
(
form
));
}
/**
* description 根据合同编号获取合同信息
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/22 17:20
**/
@PostMapping
(
"/getContractByNumber"
)
public
EResponse
getContractByNumber
(
@RequestBody
@Validated
(
ValidatorDetail
.
class
)
ContractOnlineRecordForm
form
)
throws
EException
{
return
EResponse
.
ok
(
contractOnlineRecordService
.
getContractInfoByNumber
(
form
.
getContractNumber
()));
}
}
src/main/java/com/esv/freight/customer/module/contract/entity/ContractOnlineRecordEntity.java
View file @
0b1cf3f7
...
...
@@ -56,6 +56,10 @@ public class ContractOnlineRecordEntity implements Serializable {
* 业务编号(订单号或运单号)
*/
private
String
businessNumber
;
/**
* 客户ID
*/
private
Long
customerId
;
/**
* 客户(货主或司机)签订时间
*/
...
...
src/main/java/com/esv/freight/customer/module/contract/form/ContractOnlineRecordForm.java
0 → 100644
View file @
0b1cf3f7
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDetail
;
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
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.form.ContractOnlineRecordForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/22 16:52
* @version:1.0
*/
@Data
public
class
ContractOnlineRecordForm
{
/**
*
*/
private
Long
id
;
/**
* 合同类型:1-货主与平台合同、2-司机与平台合同
*/
private
Integer
contractType
;
/**
* 合同文件ID
*/
private
String
contractFileId
;
/**
* 合同文件URL
*/
private
String
contractFileUrl
;
/**
* 合同编号
*/
@Length
(
max
=
64
,
message
=
"参数contractNumber长度不合法"
,
groups
=
{
ValidatorDetail
.
class
})
@NotBlank
(
message
=
"参数contractNumber不能为空"
,
groups
=
{
ValidatorDetail
.
class
})
private
String
contractNumber
;
/**
* 业务编号(订单号或运单号)
*/
private
String
businessNumber
;
/**
* 客户ID
*/
private
Long
customerId
;
/**
* 客户(货主或司机)签订时间
*/
private
Long
customerSignTime
;
/**
* 平台签订时间
*/
private
Long
platformSignTime
;
/**
* 合同签订完成:1-是,2-否
*/
private
Integer
signComplete
;
/**
* 合同生效时间
*/
private
Long
effectiveTime
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/contract/service/ContractOnlineRecordService.java
View file @
0b1cf3f7
...
...
@@ -2,8 +2,10 @@ package com.esv.freight.customer.module.contract.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
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.ContractOnlineRecordSignGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignGoodsOwnerVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordVO
;
/**
* 线上电子合同记录表
...
...
@@ -23,5 +25,14 @@ public interface ContractOnlineRecordService extends IService<ContractOnlineReco
**/
ContractOnlineRecordSignGoodsOwnerVO
goodsOwnerSign
(
ContractOnlineRecordSignGoodsOwnerForm
form
);
/**
* description 根据合同编号获取合同信息
* param [contractNumber]
* return com.esv.freight.customer.module.contract.vo.ContractOnlineRecordVO
* author Administrator
* createTime 2020/05/22 16:54
**/
ContractOnlineRecordVO
getContractInfoByNumber
(
String
contractNumber
);
}
src/main/java/com/esv/freight/customer/module/contract/service/impl/ContractOnlineRecordServiceImpl.java
View file @
0b1cf3f7
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.deepoove.poi.XWPFTemplate
;
import
com.deepoove.poi.data.PictureRenderData
;
...
...
@@ -21,6 +22,7 @@ import com.esv.freight.customer.module.contract.pojo.ContractOnlineGoodsOwnerPoj
import
com.esv.freight.customer.module.contract.service.ContractOnlineRecordService
;
import
com.esv.freight.customer.module.contract.service.ContractOnlineTemplateService
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordSignGoodsOwnerVO
;
import
com.esv.freight.customer.module.contract.vo.ContractOnlineRecordVO
;
import
com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.dto.AccountInfoDto
;
import
com.esv.freight.customer.module.goodsowner.form.AccountForm
;
...
...
@@ -136,6 +138,7 @@ public class ContractOnlineRecordServiceImpl extends ServiceImpl<ContractOnlineR
onlineRecordEntity
.
setContractFileUrl
(
fileUrl
);
onlineRecordEntity
.
setContractNumber
(
contractNumber
);
onlineRecordEntity
.
setBusinessNumber
(
form
.
getBusinessNumber
());
onlineRecordEntity
.
setCustomerId
(
form
.
getGoodsOwnerId
());
onlineRecordEntity
.
setCustomerSignTime
(
new
Date
());
onlineRecordEntity
.
setSignComplete
(
ContractConstants
.
CONTRACT_SIGN_COMPLETE_NO
);
this
.
baseMapper
.
insert
(
onlineRecordEntity
);
...
...
@@ -146,6 +149,40 @@ public class ContractOnlineRecordServiceImpl extends ServiceImpl<ContractOnlineR
return
vo
;
}
@Override
public
ContractOnlineRecordVO
getContractInfoByNumber
(
String
contractNumber
)
{
ContractOnlineRecordEntity
recordEntity
=
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ContractOnlineRecordEntity
>()
.
eq
(
ContractOnlineRecordEntity:
:
getContractNumber
,
contractNumber
));
if
(
null
==
recordEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getContractOnlineGetByNumber1001
());
}
ContractOnlineRecordVO
vo
=
new
ContractOnlineRecordVO
();
BeanUtils
.
copyProperties
(
recordEntity
,
vo
);
// 判断是货主还是司机签订的合同,并获取客户的名称
String
customerName
=
null
;
if
(
ContractConstants
.
CONTRACT_TYPE_GOODS_OWNER
.
equals
(
recordEntity
.
getContractType
()))
{
AccountForm
accountForm
=
new
AccountForm
();
accountForm
.
setId
(
recordEntity
.
getCustomerId
());
AccountInfoDto
accountInfo
=
goodsOwnerAccountService
.
getAccountInfo
(
accountForm
);
if
(
null
!=
accountInfo
)
{
if
(
GoodsOwnerConstants
.
OWNER_TYPE_COMPANY
.
equals
(
accountInfo
.
getOwnerType
()))
{
customerName
=
accountInfo
.
getOwnerFullName
();
}
else
{
customerName
=
accountInfo
.
getContactor
();
}
}
}
else
{
}
vo
.
setCustomerName
(
customerName
);
vo
.
setCustomerSignTime
(
recordEntity
.
getCustomerSignTime
().
getTime
());
vo
.
setPlatformSignTime
(
null
==
recordEntity
.
getPlatformSignTime
()
?
null
:
recordEntity
.
getPlatformSignTime
().
getTime
());
vo
.
setEffectiveTime
(
null
==
recordEntity
.
getEffectiveTime
()
?
null
:
recordEntity
.
getEffectiveTime
().
getTime
());
return
vo
;
}
/**
* description 获取货主签订合同时的数据
* param [form, accountInfo]
...
...
src/main/java/com/esv/freight/customer/module/contract/vo/ContractOnlineRecordVO.java
0 → 100644
View file @
0b1cf3f7
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.ContractOnlineRecordVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/22 16:37
* @version:1.0
*/
@Data
public
class
ContractOnlineRecordVO
{
/**
*
*/
private
Long
id
;
/**
* 合同类型:1-货主与平台合同、2-司机与平台合同
*/
private
Integer
contractType
;
/**
* 合同文件ID
*/
private
String
contractFileId
;
/**
* 合同文件URL
*/
private
String
contractFileUrl
;
/**
* 合同编号
*/
private
String
contractNumber
;
/**
* 业务编号(订单号或运单号)
*/
private
String
businessNumber
;
/**
* 客户ID
*/
private
Long
customerId
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 客户(货主或司机)签订时间
*/
private
Long
customerSignTime
;
/**
* 平台签订时间
*/
private
Long
platformSignTime
;
/**
* 合同签订完成:1-是,2-否
*/
private
Integer
signComplete
;
/**
* 合同生效时间
*/
private
Long
effectiveTime
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/application-dev.yml
View file @
0b1cf3f7
...
...
@@ -248,4 +248,6 @@ error-message:
online
:
goods-owner
:
sign
:
1001
:
无效的货主ID
\ No newline at end of file
1001
:
无效的货主ID
get-by-number
:
1001
:
无效的合同编号
\ No newline at end of file
src/main/resources/mapper/contract/ContractOnlineRecordDao.xml
View file @
0b1cf3f7
...
...
@@ -13,11 +13,11 @@
<result
property=
"contractFileUrl"
column=
"contract_file_url"
/>
<result
property=
"contractNumber"
column=
"contract_number"
/>
<result
property=
"businessNumber"
column=
"business_number"
/>
<result
property=
"customerId"
column=
"customer_id"
/>
<result
property=
"customerSignTime"
column=
"customer_sign_time"
/>
<result
property=
"platformSignTime"
column=
"platform_sign_time"
/>
<result
property=
"signComplete"
column=
"sign_complete"
/>
<result
property=
"effectiveTime"
column=
"effective_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOnlineRecordControllerTest.java
View file @
0b1cf3f7
...
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.contract.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.BaseTestController
;
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.ContractOnlineRecordSignGoodsOwnerForm
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.IOUtils
;
...
...
@@ -128,4 +129,56 @@ public class ContractOnlineRecordControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
/**
* 根据合同编号获取合同信息
**/
@Test
public
void
b1_getContractByNumber_success_test
()
throws
Exception
{
String
url
=
"/contract/online/getContractByNumber"
;
// 构造数据
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
form
.
setContractNumber
(
"HZHT20200522000006"
);
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"
));
}
/**
* 根据合同编号获取合同信息:无效的合同编号
**/
@Test
public
void
b2_getContractByNumber_wrong_contractNumber_failure_test
()
throws
Exception
{
String
url
=
"/contract/online/getContractByNumber"
;
// 构造数据
ContractOnlineRecordForm
form
=
new
ContractOnlineRecordForm
();
form
.
setContractNumber
(
"99999"
);
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