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
4f8a5329
Commit
4f8a5329
authored
May 20, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线下文本合同:货主合同-分页查询
parent
461b64dc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
199 additions
and
3 deletions
+199
-3
ContractOfflineGoodsOwnerController.java
...tract/controller/ContractOfflineGoodsOwnerController.java
+14
-0
ContractOfflineGoodsOwnerDao.java
...mer/module/contract/dao/ContractOfflineGoodsOwnerDao.java
+12
-0
ContractOfflineGoodsOwnerDto.java
...mer/module/contract/dto/ContractOfflineGoodsOwnerDto.java
+2
-2
ContractOfflineGoodsOwnerQueryForm.java
...ule/contract/form/ContractOfflineGoodsOwnerQueryForm.java
+47
-0
ContractOfflineGoodsOwnerService.java
...le/contract/service/ContractOfflineGoodsOwnerService.java
+12
-0
ContractOfflineGoodsOwnerServiceImpl.java
...ct/service/impl/ContractOfflineGoodsOwnerServiceImpl.java
+36
-0
ContractOfflineGoodsOwnerVO.java
...tomer/module/contract/vo/ContractOfflineGoodsOwnerVO.java
+1
-1
ContractOfflineGoodsOwnerDao.xml
...esources/mapper/contract/ContractOfflineGoodsOwnerDao.xml
+15
-0
ContractOfflineGoodsOwnerControllerTest.java
...t/controller/ContractOfflineGoodsOwnerControllerTest.java
+60
-0
No files found.
src/main/java/com/esv/freight/customer/module/contract/controller/ContractOfflineGoodsOwnerController.java
View file @
4f8a5329
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.esv.freight.customer.common.exception.EException
;
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.ValidatorInsert
;
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.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineGoodsOwnerService
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineGoodsOwnerService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -77,4 +79,16 @@ public class ContractOfflineGoodsOwnerController {
...
@@ -77,4 +79,16 @@ public class ContractOfflineGoodsOwnerController {
contractOfflineGoodsOwnerService
.
deleteOfflineContract
(
form
);
contractOfflineGoodsOwnerService
.
deleteOfflineContract
(
form
);
return
EResponse
.
ok
();
return
EResponse
.
ok
();
}
}
/**
* description 分页查询合同列表
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 11:19
**/
@PostMapping
(
"/list"
)
public
EResponse
list
(
@RequestBody
@Validated
(
ValidatorList
.
class
)
ContractOfflineGoodsOwnerQueryForm
form
)
throws
EException
{
return
EResponse
.
ok
(
contractOfflineGoodsOwnerService
.
selectContractList
(
form
));
}
}
}
src/main/java/com/esv/freight/customer/module/contract/dao/ContractOfflineGoodsOwnerDao.java
View file @
4f8a5329
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
dao
;
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
dao
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
com.esv.freight.customer.module.goodsowner.form.AccountQueryForm
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
/**
...
@@ -14,4 +17,13 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -14,4 +17,13 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
ContractOfflineGoodsOwnerDao
extends
BaseMapper
<
ContractOfflineGoodsOwnerEntity
>
{
public
interface
ContractOfflineGoodsOwnerDao
extends
BaseMapper
<
ContractOfflineGoodsOwnerEntity
>
{
/**
* description 分页查询合同列表
* param [page, queryObj]
* return com.baomidou.mybatisplus.core.metadata.IPage
* author Administrator
* createTime 2020/05/20 11:17
**/
IPage
selectContractList
(
IPage
page
,
ContractOfflineGoodsOwnerQueryForm
queryObj
);
}
}
src/main/java/com/esv/freight/customer/module/contract/dto/ContractOfflineGoodsOwnerDto.java
View file @
4f8a5329
...
@@ -78,11 +78,11 @@ public class ContractOfflineGoodsOwnerDto {
...
@@ -78,11 +78,11 @@ public class ContractOfflineGoodsOwnerDto {
/**
/**
* 创建时间
* 创建时间
*/
*/
private
Long
createTime
;
private
Date
createTime
;
/**
/**
* 修改时间
* 修改时间
*/
*/
private
Long
updateTime
;
private
Date
updateTime
;
/**
/**
* 货主类型:1-个人、2-企业
* 货主类型:1-个人、2-企业
...
...
src/main/java/com/esv/freight/customer/module/contract/form/ContractOfflineGoodsOwnerQueryForm.java
0 → 100644
View file @
4f8a5329
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.ContractOfflineGoodsOwnerQueryForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/05/20 11:06
* @version:1.0
*/
@Data
public
class
ContractOfflineGoodsOwnerQueryForm
{
/**
* 关键字
*/
@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/ContractOfflineGoodsOwnerService.java
View file @
4f8a5329
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
;
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
com.esv.freight.customer.module.goodsowner.form.AccountQueryForm
;
/**
/**
* 线下文本合同(货主)
* 线下文本合同(货主)
...
@@ -40,5 +43,14 @@ public interface ContractOfflineGoodsOwnerService extends IService<ContractOffli
...
@@ -40,5 +43,14 @@ public interface ContractOfflineGoodsOwnerService extends IService<ContractOffli
**/
**/
Integer
deleteOfflineContract
(
ContractOfflineGoodsOwnerForm
form
);
Integer
deleteOfflineContract
(
ContractOfflineGoodsOwnerForm
form
);
/**
* description 分页查询合同列表
* param [queryForm]
* return com.esv.freight.customer.common.vo.PageResultVO
* author Administrator
* createTime 2020/05/20 11:18
**/
PageResultVO
selectContractList
(
ContractOfflineGoodsOwnerQueryForm
queryForm
);
}
}
src/main/java/com/esv/freight/customer/module/contract/service/impl/ContractOfflineGoodsOwnerServiceImpl.java
View file @
4f8a5329
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
.
impl
;
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.component.ErrorMessageComponent
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.util.DateUtils
;
import
com.esv.freight.customer.common.util.DateUtils
;
import
com.esv.freight.customer.common.vo.PageResultVO
;
import
com.esv.freight.customer.module.contract.dao.ContractOfflineGoodsOwnerDao
;
import
com.esv.freight.customer.module.contract.dao.ContractOfflineGoodsOwnerDao
;
import
com.esv.freight.customer.module.contract.dto.ContractOfflineGoodsOwnerDto
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.esv.freight.customer.module.contract.entity.ContractOfflineGoodsOwnerEntity
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineGoodsOwnerService
;
import
com.esv.freight.customer.module.contract.service.ContractOfflineGoodsOwnerService
;
import
com.esv.freight.customer.module.contract.vo.ContractOfflineGoodsOwnerVO
;
import
com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.entity.GoodsOwnerAccountEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.GoodsOwnerAccountEntity
;
import
com.esv.freight.customer.module.goodsowner.service.GoodsOwnerAccountService
;
import
com.esv.freight.customer.module.goodsowner.service.GoodsOwnerAccountService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"contractOfflineGoodsOwnerService"
)
@Service
(
"contractOfflineGoodsOwnerService"
)
public
class
ContractOfflineGoodsOwnerServiceImpl
extends
ServiceImpl
<
ContractOfflineGoodsOwnerDao
,
ContractOfflineGoodsOwnerEntity
>
implements
ContractOfflineGoodsOwnerService
{
public
class
ContractOfflineGoodsOwnerServiceImpl
extends
ServiceImpl
<
ContractOfflineGoodsOwnerDao
,
ContractOfflineGoodsOwnerEntity
>
implements
ContractOfflineGoodsOwnerService
{
...
@@ -89,4 +99,30 @@ public class ContractOfflineGoodsOwnerServiceImpl extends ServiceImpl<ContractOf
...
@@ -89,4 +99,30 @@ public class ContractOfflineGoodsOwnerServiceImpl extends ServiceImpl<ContractOf
return
this
.
baseMapper
.
deleteById
(
form
.
getId
());
return
this
.
baseMapper
.
deleteById
(
form
.
getId
());
}
}
@Override
public
PageResultVO
selectContractList
(
ContractOfflineGoodsOwnerQueryForm
queryForm
)
{
IPage
<
ContractOfflineGoodsOwnerDto
>
page
=
new
Page
<>(
queryForm
.
getPageNum
(),
queryForm
.
getPageSize
());
this
.
baseMapper
.
selectContractList
(
page
,
queryForm
);
// 数据转换
List
<
ContractOfflineGoodsOwnerDto
>
dtoList
=
page
.
getRecords
();
List
<
ContractOfflineGoodsOwnerVO
>
targetRecordList
=
new
ArrayList
<>();
for
(
ContractOfflineGoodsOwnerDto
dto
:
dtoList
)
{
ContractOfflineGoodsOwnerVO
vo
=
new
ContractOfflineGoodsOwnerVO
();
BeanUtils
.
copyProperties
(
dto
,
vo
);
if
(
GoodsOwnerConstants
.
OWNER_TYPE_COMPANY
.
equals
(
dto
.
getOwnerType
()))
{
vo
.
setGoodsOwnerName
(
dto
.
getOwnerFullName
());
}
else
{
vo
.
setGoodsOwnerName
(
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/ContractOfflineGoodsOwnerVO.java
View file @
4f8a5329
...
@@ -65,6 +65,6 @@ public class ContractOfflineGoodsOwnerVO {
...
@@ -65,6 +65,6 @@ public class ContractOfflineGoodsOwnerVO {
/**
/**
* 客户名称
* 客户名称
*/
*/
private
String
o
wnerName
;
private
String
goodsO
wnerName
;
}
}
src/main/resources/mapper/contract/ContractOfflineGoodsOwnerDao.xml
View file @
4f8a5329
...
@@ -23,5 +23,20 @@
...
@@ -23,5 +23,20 @@
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</resultMap>
<!-- 分页查询合同列表 -->
<select
id=
"selectContractList"
parameterType=
"com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm"
resultType=
"com.esv.freight.customer.module.contract.dto.ContractOfflineGoodsOwnerDto"
>
select a.*, b.owner_type as ownerType, b.owner_full_name as ownerFullName, b.contactor as contactor
from contract_offline_goods_owner a, goods_owner_info b
where a.goods_owner_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.owner_full_name like CONCAT('%',#{queryObj.keywords},'%')
or b.contactor like CONCAT('%',#{queryObj.keywords},'%'))
</if>
ORDER BY a.update_time DESC
</select>
</mapper>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOfflineGoodsOwnerControllerTest.java
View file @
4f8a5329
...
@@ -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.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerForm
;
import
com.esv.freight.customer.module.contract.form.ContractOfflineGoodsOwnerQueryForm
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.FixMethodOrder
;
import
org.junit.FixMethodOrder
;
...
@@ -298,4 +299,63 @@ public class ContractOfflineGoodsOwnerControllerTest extends BaseTestController
...
@@ -298,4 +299,63 @@ public class ContractOfflineGoodsOwnerControllerTest 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
@Rollback
public
void
d1_list_success_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/list"
;
// 构造数据
ContractOfflineGoodsOwnerQueryForm
form
=
new
ContractOfflineGoodsOwnerQueryForm
();
form
.
setPageNum
(
1
);
form
.
setPageSize
(
10
);
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
(
"totalSize"
));
}
/**
* 货主合同-分页查询
**/
@Test
@Rollback
public
void
d2_list_with_params_success_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/list"
;
// 构造数据
ContractOfflineGoodsOwnerQueryForm
form
=
new
ContractOfflineGoodsOwnerQueryForm
();
form
.
setKeywords
(
"2020"
);
form
.
setPageNum
(
1
);
form
.
setPageSize
(
10
);
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
(
"totalSize"
));
}
}
}
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