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
f8f980d1
Commit
f8f980d1
authored
May 20, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线下文本合同:承运商合同
parent
4f8a5329
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
982 additions
and
0 deletions
+982
-0
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+13
-0
ContractOfflineCarrierController.java
...contract/controller/ContractOfflineCarrierController.java
+94
-0
ContractOfflineCarrierDao.java
...stomer/module/contract/dao/ContractOfflineCarrierDao.java
+12
-0
ContractOfflineCarrierDto.java
...stomer/module/contract/dto/ContractOfflineCarrierDto.java
+100
-0
ContractOfflineCarrierForm.java
...omer/module/contract/form/ContractOfflineCarrierForm.java
+89
-0
ContractOfflineCarrierQueryForm.java
...module/contract/form/ContractOfflineCarrierQueryForm.java
+47
-0
ContractOfflineCarrierService.java
...odule/contract/service/ContractOfflineCarrierService.java
+41
-0
ContractOfflineCarrierServiceImpl.java
...tract/service/impl/ContractOfflineCarrierServiceImpl.java
+114
-0
ContractOfflineCarrierVO.java
...customer/module/contract/vo/ContractOfflineCarrierVO.java
+77
-0
ContractOfflineGoodsOwnerVO.java
...tomer/module/contract/vo/ContractOfflineGoodsOwnerVO.java
+7
-0
application-dev.yml
src/main/resources/application-dev.yml
+9
-0
ContractOfflineCarrierDao.xml
...n/resources/mapper/contract/ContractOfflineCarrierDao.xml
+14
-0
ContractOfflineCarrierControllerTest.java
...ract/controller/ContractOfflineCarrierControllerTest.java
+363
-0
ContractOfflineGoodsOwnerControllerTest.java
...t/controller/ContractOfflineGoodsOwnerControllerTest.java
+2
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
f8f980d1
...
...
@@ -284,4 +284,17 @@ public class ErrorMessageComponent {
@Value
(
"${error-message.contract.offline.goods-owner.delete.1001}"
)
private
String
contractOfflineGoodsOwnerDelete1001
;
@Value
(
"${error-message.contract.offline.carrier.add.1001}"
)
private
String
contractOfflineCarrierAdd1001
;
@Value
(
"${error-message.contract.offline.carrier.add.1002}"
)
private
String
contractOfflineCarrierAdd1002
;
@Value
(
"${error-message.contract.offline.carrier.edit.1001}"
)
private
String
contractOfflineCarrierEdit1001
;
@Value
(
"${error-message.contract.offline.carrier.edit.1002}"
)
private
String
contractOfflineCarrierEdit1002
;
@Value
(
"${error-message.contract.offline.carrier.delete.1001}"
)
private
String
contractOfflineCarrierDelete1001
;
}
src/main/java/com/esv/freight/customer/module/contract/controller/ContractOfflineCarrierController.java
0 → 100644
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorList
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineCarrierService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.controller.ContractOfflineCarrierController
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 15:50
* @version:1.0
*/
@Slf4j
@RestController
@RequestMapping
(
"/contract/offline/carrier"
)
@Validated
public
class
ContractOfflineCarrierController
{
private
ContractOfflineCarrierService
contractOfflineCarrierService
;
@Autowired
public
ContractOfflineCarrierController
(
ContractOfflineCarrierService
contractOfflineCarrierService
)
{
this
.
contractOfflineCarrierService
=
contractOfflineCarrierService
;
}
/**
* description 承运商合同-增加
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 15:52
**/
@PostMapping
(
"/add"
)
public
EResponse
add
(
@RequestBody
@Validated
(
ValidatorInsert
.
class
)
ContractOfflineCarrierForm
form
)
throws
EException
{
Long
id
=
contractOfflineCarrierService
.
addOfflineContract
(
form
);
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"id"
,
id
);
return
EResponse
.
ok
(
data
);
}
/**
* description 承运商合同-编辑
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 15:52
**/
@PostMapping
(
"/edit"
)
public
EResponse
edit
(
@RequestBody
@Validated
(
ValidatorUpdate
.
class
)
ContractOfflineCarrierForm
form
)
throws
EException
{
contractOfflineCarrierService
.
editOfflineContract
(
form
);
return
EResponse
.
ok
();
}
/**
* description 承运商合同-删除
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 15:53
**/
@PostMapping
(
"/delete"
)
public
EResponse
delete
(
@RequestBody
@Validated
(
ValidatorUpdate
.
class
)
ContractOfflineCarrierForm
form
)
throws
EException
{
contractOfflineCarrierService
.
deleteOfflineContract
(
form
);
return
EResponse
.
ok
();
}
/**
* description 承运商合同-分页查询
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 15:54
**/
@PostMapping
(
"/list"
)
public
EResponse
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
ContractOfflineCarrierQueryForm
form
)
throws
EException
{
return
EResponse
.
ok
(
contractOfflineCarrierService
.
selectContractList
(
form
));
}
}
src/main/java/com/esv/freight/customer/module/contract/dao/ContractOfflineCarrierDao.java
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
dao
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineCarrierEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
org.apache.ibatis.annotations.Mapper
;
/**
...
...
@@ -13,5 +16,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
ContractOfflineCarrierDao
extends
BaseMapper
<
ContractOfflineCarrierEntity
>
{
/**
* description 分页查询合同列表
* param [page, queryObj]
* return com.baomidou.mybatisplus.core.metadata.IPage
* author Administrator
* createTime 2020/05/20 15:34
**/
IPage
selectContractList
(
IPage
page
,
ContractOfflineCarrierQueryForm
queryObj
);
}
src/main/java/com/esv/freight/customer/module/contract/dto/ContractOfflineCarrierDto.java
0 → 100644
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
dto
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.dto.ContractOfflineCarrierDto
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 15:21
* @version:1.0
*/
@Data
public
class
ContractOfflineCarrierDto
{
/**
*
*/
private
Long
id
;
/**
* 租户ID
*/
private
Long
tenantId
;
/**
* 部门ID
*/
private
Long
departmentId
;
/**
* 承运商帐号ID
*/
private
Long
carrierId
;
/**
* 合同编号
*/
private
String
contractNumber
;
/**
* 合同名称
*/
private
String
contractName
;
/**
* 合同类型:1-主合同、2-补充合同、3-临时合同
*/
private
Integer
contractType
;
/**
* 合同签订日期
*/
private
Date
signDate
;
/**
* 合同起始日期
*/
private
Date
startDate
;
/**
* 合同截止日期
*/
private
Date
endDate
;
/**
* 合同文件URL
*/
private
String
fileUrl
;
/**
* 删除标识:0-未删除,1-已删除
*/
private
Boolean
deleted
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建者
*/
private
String
createUser
;
/**
* 修改者
*/
private
String
updateUser
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改时间
*/
private
Date
updateTime
;
/**
* 承运商名称
*/
private
String
carrierFullName
;
/**
* 承运商类别:1-企业承运人、2-个体承运人
*/
private
Integer
carrierType
;
/**
* 联系人
*/
private
String
contactor
;
}
src/main/java/com/esv/freight/customer/module/contract/form/ContractOfflineCarrierForm.java
0 → 100644
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDelete
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Range
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.form.ContractOfflineCarrierForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 15:24
* @version:1.0
*/
@Data
public
class
ContractOfflineCarrierForm
{
/**
*
*/
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorUpdate
.
class
,
ValidatorDelete
.
class
})
private
Long
id
;
/**
* 承运商ID
*/
@NotNull
(
message
=
"参数carrierId不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Long
carrierId
;
/**
* 合同编号
*/
@Length
(
max
=
50
,
message
=
"参数contractNumber长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数contractNumber不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
contractNumber
;
/**
* 合同名称
*/
@Length
(
max
=
50
,
message
=
"参数contractName长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数contractName不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
contractName
;
/**
* 合同类型:1-主合同、2-补充合同、3-临时合同
*/
@Range
(
min
=
1
,
max
=
3
,
message
=
"参数contractType不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotNull
(
message
=
"参数contractType不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Integer
contractType
;
/**
* 合同签订日期
*/
@Length
(
min
=
10
,
max
=
10
,
message
=
"参数signDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数signDate不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
signDate
;
/**
* 合同起始日期
*/
@Length
(
min
=
10
,
max
=
10
,
message
=
"参数startDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数startDate不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
startDate
;
/**
* 合同截止日期
*/
@Length
(
min
=
10
,
max
=
10
,
message
=
"参数endDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数endDate不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
endDate
;
/**
* 合同文件URL
*/
@Length
(
max
=
200
,
message
=
"参数fileUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotBlank
(
message
=
"参数fileUrl不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
fileUrl
;
/**
* 备注
*/
@Length
(
max
=
200
,
message
=
"参数remark长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
private
String
remark
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/contract/form/ContractOfflineCarrierQueryForm.java
0 → 100644
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorList
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Range
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 15:26
* @version:1.0
*/
@Data
public
class
ContractOfflineCarrierQueryForm
{
/**
* 关键字
*/
@Length
(
max
=
50
,
message
=
"参数keywords长度不合法"
,
groups
=
{
ValidatorList
.
class
})
private
String
keywords
;
/**
* 页码
**/
@Range
(
min
=
1
,
max
=
65535
,
message
=
"无效的pageNum"
,
groups
=
{
ValidatorList
.
class
})
@NotNull
(
message
=
"参数pageNum不能为空"
,
groups
=
{
ValidatorList
.
class
})
private
Integer
pageNum
;
/**
* 每页记录条数
**/
@Range
(
min
=
1
,
max
=
100
,
message
=
"pageSize"
,
groups
=
{
ValidatorList
.
class
})
@NotNull
(
message
=
"参数pageSize不能为空"
,
groups
=
{
ValidatorList
.
class
})
private
Integer
pageSize
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/contract/service/ContractOfflineCarrierService.java
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineCarrierEntity
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
/**
* 线下文本合同(承运商)
...
...
@@ -12,5 +17,41 @@ import com.esv.freight.customer.module.contract.entity.ContractOfflineCarrierEnt
*/
public
interface
ContractOfflineCarrierService
extends
IService
<
ContractOfflineCarrierEntity
>
{
/**
* description 新增线下文本合同(承运商)
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/05/19 14:49
**/
Long
addOfflineContract
(
ContractOfflineCarrierForm
form
);
/**
* description 编辑线下文本合同(承运商)
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/05/19 19:34
**/
Integer
editOfflineContract
(
ContractOfflineCarrierForm
form
);
/**
* description 删除线下文本合同(承运商)
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/05/20 9:24
**/
Integer
deleteOfflineContract
(
ContractOfflineCarrierForm
form
);
/**
* description 分页查询合同列表
* param [queryForm]
* return com.esv.freight.customer.common.vo.PageResultVO
* author Administrator
* createTime 2020/05/20 11:18
**/
PageResultVO
selectContractList
(
ContractOfflineCarrierQueryForm
queryForm
);
}
src/main/java/com/esv/freight/customer/module/contract/service/impl/ContractOfflineCarrierServiceImpl.java
View file @
f8f980d1
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.util.DateUtils
;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.module.carrier.CarrierConstants
;
import
com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity
;
import
com.esv.freight.customer.module.carrier.service.CarrierAccountService
;
import
com.esv.freight.customer.module.contract.dao.ContractOfflineCarrierDao
;
import
com.esv.freight.customer.module.contract.dto.ContractOfflineCarrierDto
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineCarrierEntity
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineCarrierService
;
import
com.esv.freight.customer.module.contract.vo.ContractOfflineCarrierVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"contractOfflineCarrierService"
)
public
class
ContractOfflineCarrierServiceImpl
extends
ServiceImpl
<
ContractOfflineCarrierDao
,
ContractOfflineCarrierEntity
>
implements
ContractOfflineCarrierService
{
private
ErrorMessageComponent
errorMessageComponent
;
private
CarrierAccountService
carrierAccountService
;
@Autowired
public
ContractOfflineCarrierServiceImpl
(
ErrorMessageComponent
errorMessageComponent
,
CarrierAccountService
carrierAccountService
)
{
this
.
errorMessageComponent
=
errorMessageComponent
;
this
.
carrierAccountService
=
carrierAccountService
;
}
@Override
public
Long
addOfflineContract
(
ContractOfflineCarrierForm
form
)
{
// 1:校验
CarrierAccountEntity
carrierAccountEntity
=
carrierAccountService
.
getCarrierById
(
form
.
getCarrierId
());
if
(
null
==
carrierAccountEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getContractOfflineCarrierAdd1001
());
}
int
count
=
this
.
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ContractOfflineCarrierEntity
>()
.
eq
(
ContractOfflineCarrierEntity:
:
getCarrierId
,
form
.
getCarrierId
())
.
eq
(
ContractOfflineCarrierEntity:
:
getContractNumber
,
form
.
getContractNumber
()));
if
(
0
<
count
)
{
throw
new
EException
(
1002
,
errorMessageComponent
.
getContractOfflineCarrierAdd1002
());
}
// 2:新增记录
ContractOfflineCarrierEntity
contractOfflineCarrierEntity
=
new
ContractOfflineCarrierEntity
();
BeanUtils
.
copyProperties
(
form
,
contractOfflineCarrierEntity
);
contractOfflineCarrierEntity
.
setSignDate
(
DateUtils
.
parse
(
form
.
getSignDate
(),
DateUtils
.
DATE_FORMAT3
));
contractOfflineCarrierEntity
.
setStartDate
(
DateUtils
.
parse
(
form
.
getStartDate
(),
DateUtils
.
DATE_FORMAT3
));
contractOfflineCarrierEntity
.
setEndDate
(
DateUtils
.
parse
(
form
.
getEndDate
(),
DateUtils
.
DATE_FORMAT3
));
this
.
baseMapper
.
insert
(
contractOfflineCarrierEntity
);
return
contractOfflineCarrierEntity
.
getId
();
}
@Override
public
Integer
editOfflineContract
(
ContractOfflineCarrierForm
form
)
{
// 1:校验
ContractOfflineCarrierEntity
dbEntity
=
this
.
baseMapper
.
selectById
(
form
.
getId
());
if
(
null
==
dbEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getContractOfflineCarrierEdit1001
());
}
int
count
=
this
.
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ContractOfflineCarrierEntity
>()
.
ne
(
ContractOfflineCarrierEntity:
:
getId
,
form
.
getId
())
.
eq
(
ContractOfflineCarrierEntity:
:
getCarrierId
,
dbEntity
.
getCarrierId
())
.
eq
(
ContractOfflineCarrierEntity:
:
getContractNumber
,
form
.
getContractNumber
()));
if
(
0
<
count
)
{
throw
new
EException
(
1002
,
errorMessageComponent
.
getContractOfflineCarrierEdit1002
());
}
// 2:更新记录
ContractOfflineCarrierEntity
contractOfflineCarrierEntity
=
new
ContractOfflineCarrierEntity
();
BeanUtils
.
copyProperties
(
form
,
contractOfflineCarrierEntity
);
contractOfflineCarrierEntity
.
setCarrierId
(
null
);
contractOfflineCarrierEntity
.
setSignDate
(
DateUtils
.
parse
(
form
.
getSignDate
(),
DateUtils
.
DATE_FORMAT3
));
contractOfflineCarrierEntity
.
setStartDate
(
DateUtils
.
parse
(
form
.
getStartDate
(),
DateUtils
.
DATE_FORMAT3
));
contractOfflineCarrierEntity
.
setEndDate
(
DateUtils
.
parse
(
form
.
getEndDate
(),
DateUtils
.
DATE_FORMAT3
));
return
this
.
baseMapper
.
updateById
(
contractOfflineCarrierEntity
);
}
@Override
public
Integer
deleteOfflineContract
(
ContractOfflineCarrierForm
form
)
{
ContractOfflineCarrierEntity
dbEntity
=
this
.
baseMapper
.
selectById
(
form
.
getId
());
if
(
null
==
dbEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getContractOfflineCarrierDelete1001
());
}
return
this
.
baseMapper
.
deleteById
(
form
.
getId
());
}
@Override
public
PageResultVO
selectContractList
(
ContractOfflineCarrierQueryForm
queryForm
)
{
IPage
<
ContractOfflineCarrierDto
>
page
=
new
Page
<>(
queryForm
.
getPageNum
(),
queryForm
.
getPageSize
());
this
.
baseMapper
.
selectContractList
(
page
,
queryForm
);
// 数据转换
List
<
ContractOfflineCarrierDto
>
dtoList
=
page
.
getRecords
();
List
<
ContractOfflineCarrierVO
>
targetRecordList
=
new
ArrayList
<>();
for
(
ContractOfflineCarrierDto
dto
:
dtoList
)
{
ContractOfflineCarrierVO
vo
=
new
ContractOfflineCarrierVO
();
BeanUtils
.
copyProperties
(
dto
,
vo
);
if
(
CarrierConstants
.
CARRIER_TYPE_PERSONAL
.
equals
(
dto
.
getCarrierType
()))
{
vo
.
setCarrierName
(
dto
.
getCarrierFullName
());
}
else
{
vo
.
setCarrierName
(
dto
.
getContactor
());
}
vo
.
setSignDate
(
dto
.
getSignDate
().
getTime
());
vo
.
setStartDate
(
dto
.
getStartDate
().
getTime
());
vo
.
setEndDate
(
dto
.
getEndDate
().
getTime
());
vo
.
setCreateTime
(
dto
.
getCreateTime
().
getTime
());
targetRecordList
.
add
(
vo
);
}
return
new
PageResultVO
(
page
,
targetRecordList
);
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/contract/vo/ContractOfflineCarrierVO.java
0 → 100644
View file @
f8f980d1
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.ContractOfflineCarrierVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 15:28
* @version:1.0
*/
@Data
public
class
ContractOfflineCarrierVO
{
/**
*
*/
private
Long
id
;
/**
* 承运商ID
*/
private
Long
carrierId
;
/**
* 合同编号
*/
private
String
contractNumber
;
/**
* 合同名称
*/
private
String
contractName
;
/**
* 合同类型:1-主合同、2-补充合同、3-临时合同
*/
private
Integer
contractType
;
/**
* 合同签订日期
*/
private
Long
signDate
;
/**
* 合同起始日期
*/
private
Long
startDate
;
/**
* 合同截止日期
*/
private
Long
endDate
;
/**
* 合同文件URL
*/
private
String
fileUrl
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建者
*/
private
String
createUser
;
/**
* 创建时间
*/
private
Long
createTime
;
/**
* 客户名称
*/
private
String
carrierName
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/contract/vo/ContractOfflineGoodsOwnerVO.java
View file @
f8f980d1
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:
...
...
@@ -67,4 +69,9 @@ public class ContractOfflineGoodsOwnerVO {
*/
private
String
goodsOwnerName
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/application-dev.yml
View file @
f8f980d1
...
...
@@ -227,5 +227,14 @@ error-message:
edit
:
1001
:
无效的合同ID
1002
:
合同编号已存在
delete
:
1001
:
无效的合同ID
carrier
:
add
:
1001
:
无效的承运商ID
1002
:
合同编号已存在
edit
:
1001
:
无效的合同ID
1002
:
合同编号已存在
delete
:
1001
:
无效的合同ID
\ No newline at end of file
src/main/resources/mapper/contract/ContractOfflineCarrierDao.xml
View file @
f8f980d1
...
...
@@ -23,5 +23,19 @@
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<!-- 分页查询合同列表 -->
<select
id=
"selectContractList"
parameterType=
"com.esv.freight.customer.module.contract.form.ContractOfflineCarrierQueryForm"
resultType=
"com.esv.freight.customer.module.contract.dto.ContractOfflineCarrierDto"
>
select a.*, b.carrier_type as carrierType, b.carrier_full_name as carrierFullName, b.contactor as contactor
from contract_offline_carrier a, carrier_info b
where a.carrier_id = b.account_id
<if
test=
"queryObj.keywords != null"
>
and (a.contract_number like CONCAT('%',#{queryObj.keywords},'%')
or a.contract_name like CONCAT('%',#{queryObj.keywords},'%')
or b.carrier_full_name like CONCAT('%',#{queryObj.keywords},'%')
or b.contactor like CONCAT('%',#{queryObj.keywords},'%'))
</if>
ORDER BY a.update_time DESC
</select>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOfflineCarrierControllerTest.java
0 → 100644
View file @
f8f980d1
This diff is collapsed.
Click to expand it.
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOfflineGoodsOwnerControllerTest.java
View file @
f8f980d1
...
...
@@ -77,6 +77,7 @@ public class ContractOfflineGoodsOwnerControllerTest extends BaseTestController
* 新增合同:无效的货主ID
**/
@Test
@Rollback
public
void
a2_add_wrong_goodsOwnerId_failure_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/add"
;
...
...
@@ -111,6 +112,7 @@ public class ContractOfflineGoodsOwnerControllerTest extends BaseTestController
* 新增合同:合同编号已存在
**/
@Test
@Rollback
public
void
a3_add_wrong_contractNumber_failure_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/add"
;
...
...
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