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
d3c04e69
Commit
d3c04e69
authored
Apr 21, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增货主接口:获取所有发货地址列表
parent
b552128b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
2 deletions
+74
-2
DeliveryAddressController.java
...dule/goodsowner/controller/DeliveryAddressController.java
+13
-0
DeliveryAddressForm.java
.../customer/module/goodsowner/form/DeliveryAddressForm.java
+2
-1
DeliveryAddressService.java
...mer/module/goodsowner/service/DeliveryAddressService.java
+10
-0
DeliveryAddressServiceImpl.java
...e/goodsowner/service/impl/DeliveryAddressServiceImpl.java
+20
-1
DeliveryAddressControllerTest.java
.../goodsowner/controller/DeliveryAddressControllerTest.java
+29
-0
No files found.
src/main/java/com/esv/freight/customer/module/goodsowner/controller/DeliveryAddressController.java
View file @
d3c04e69
...
@@ -12,6 +12,7 @@ import com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm;
...
@@ -12,6 +12,7 @@ import com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
com.esv.freight.customer.module.goodsowner.service.ReceiveAddressService
;
import
com.esv.freight.customer.module.goodsowner.service.ReceiveAddressService
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.AddressBrief
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -90,6 +91,18 @@ public class DeliveryAddressController {
...
@@ -90,6 +91,18 @@ public class DeliveryAddressController {
return
EResponse
.
ok
(
deliveryAddressService
.
getAddressDetail
(
form
));
return
EResponse
.
ok
(
deliveryAddressService
.
getAddressDetail
(
form
));
}
}
/**
* description 获取所有发货地址列表
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/21 20:08
**/
@PostMapping
(
"/all"
)
public
EResponse
all
(
@RequestBody
@Validated
(
AddressBrief
.
class
)
DeliveryAddressForm
form
)
throws
EException
{
return
EResponse
.
ok
(
deliveryAddressService
.
getAllAddress
(
form
));
}
/**
/**
* description 删除发货地址
* description 删除发货地址
* param [form]
* param [form]
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/form/DeliveryAddressForm.java
View file @
d3c04e69
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.goodsowner.form;
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.goodsowner.form;
import
com.esv.freight.customer.common.validator.groups.ValidatorDetail
;
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.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.module.goodsowner.validator.groups.AddressBrief
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
@@ -27,7 +28,7 @@ public class DeliveryAddressForm {
...
@@ -27,7 +28,7 @@ public class DeliveryAddressForm {
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorUpdate
.
class
,
ValidatorDetail
.
class
})
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorUpdate
.
class
,
ValidatorDetail
.
class
})
private
Long
id
;
private
Long
id
;
@NotNull
(
message
=
"参数ownerId不能为空"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@NotNull
(
message
=
"参数ownerId不能为空"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
,
AddressBrief
.
class
})
private
Long
ownerId
;
private
Long
ownerId
;
@Length
(
max
=
50
,
message
=
"参数addressName长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
@Length
(
max
=
50
,
message
=
"参数addressName长度不合法"
,
groups
=
{
ValidatorInsert
.
class
,
ValidatorUpdate
.
class
})
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/service/DeliveryAddressService.java
View file @
d3c04e69
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressBriefVO
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressVO
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -53,6 +54,15 @@ public interface DeliveryAddressService extends IService<DeliveryAddressEntity>
...
@@ -53,6 +54,15 @@ public interface DeliveryAddressService extends IService<DeliveryAddressEntity>
**/
**/
DeliveryAddressVO
getAddressDetail
(
DeliveryAddressForm
form
);
DeliveryAddressVO
getAddressDetail
(
DeliveryAddressForm
form
);
/**
* description 获取所有发货地址列表
* param [form]
* return java.util.List<com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressBriefVO>
* author Administrator
* createTime 2020/04/21 20:04
**/
List
<
DeliveryAddressBriefVO
>
getAllAddress
(
DeliveryAddressForm
form
);
/**
/**
* description 通过地址名称查询地址记录
* description 通过地址名称查询地址记录
* param [ownerId, addressName]
* param [ownerId, addressName]
...
...
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/DeliveryAddressServiceImpl.java
View file @
d3c04e69
...
@@ -8,11 +8,11 @@ import com.esv.freight.customer.common.exception.EException;
...
@@ -8,11 +8,11 @@ import com.esv.freight.customer.common.exception.EException;
import
com.esv.freight.customer.common.util.FeignUtils
;
import
com.esv.freight.customer.common.util.FeignUtils
;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.module.goodsowner.dao.DeliveryAddressDao
;
import
com.esv.freight.customer.module.goodsowner.dao.DeliveryAddressDao
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.DeliveryAddressForm
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressBriefVO
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressVO
;
import
com.esv.freight.customer.module.goodsowner.vo.DeliveryAddressVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
...
@@ -128,6 +129,24 @@ public class DeliveryAddressServiceImpl extends ServiceImpl<DeliveryAddressDao,
...
@@ -128,6 +129,24 @@ public class DeliveryAddressServiceImpl extends ServiceImpl<DeliveryAddressDao,
return
addressVO
;
return
addressVO
;
}
}
@Override
public
List
<
DeliveryAddressBriefVO
>
getAllAddress
(
DeliveryAddressForm
form
)
{
// 查询
QueryWrapper
<
DeliveryAddressEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"owner_id"
,
form
.
getOwnerId
());
List
<
DeliveryAddressEntity
>
deliveryAddressEntityList
=
this
.
baseMapper
.
selectList
(
queryWrapper
);
// 数据转换
List
<
DeliveryAddressBriefVO
>
addressBriefVOList
=
new
ArrayList
<>();
deliveryAddressEntityList
.
forEach
(
entity
->
{
DeliveryAddressBriefVO
vo
=
new
DeliveryAddressBriefVO
();
BeanUtils
.
copyProperties
(
entity
,
vo
);
addressBriefVOList
.
add
(
vo
);
});
return
addressBriefVOList
;
}
@Override
@Override
public
List
<
DeliveryAddressEntity
>
getAddressByName
(
Long
ownerId
,
String
addressName
)
{
public
List
<
DeliveryAddressEntity
>
getAddressByName
(
Long
ownerId
,
String
addressName
)
{
QueryWrapper
<
DeliveryAddressEntity
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
DeliveryAddressEntity
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
src/test/java/com/esv/freight/customer/module/goodsowner/controller/DeliveryAddressControllerTest.java
View file @
d3c04e69
...
@@ -355,4 +355,33 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -355,4 +355,33 @@ public class DeliveryAddressControllerTest extends BaseTestController {
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
}
/**
* 获取所有发货地址列表
**/
@Test
@Rollback
public
void
e1_all_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/delivery/address/all"
;
// 构造数据
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
form
.
setOwnerId
(
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"
));
Assert
.
assertFalse
(
result
.
getJSONArray
(
"data"
).
isEmpty
());
}
}
}
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