Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
pension
Commits
624b77e9
Commit
624b77e9
authored
May 07, 2021
by
Shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.用户地址 修改”添加或修改我的收货地址“接口,改为DTO传入
如果id留空为新增,否则为修改
parent
24f953a3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
7 deletions
+60
-7
PensionConsigneeController.java
...s/serviceOrder/controller/PensionConsigneeController.java
+15
-0
PensionConsigneeAddDTO.java
...hmit/modules/serviceOrder/dto/PensionConsigneeAddDTO.java
+10
-7
PensionConsigneeService.java
...modules/serviceOrder/service/PensionConsigneeService.java
+3
-0
PensionConsigneeServiceImpl.java
...erviceOrder/service/impl/PensionConsigneeServiceImpl.java
+32
-0
No files found.
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionConsigneeController.java
View file @
624b77e9
...
...
@@ -11,6 +11,7 @@ import io.hmit.common.validator.group.AddGroup;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.PensionConsigneeAddDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO
;
import
io.hmit.modules.serviceOrder.service.PensionConsigneeService
;
import
io.swagger.annotations.Api
;
...
...
@@ -98,6 +99,7 @@ public class PensionConsigneeController {
return
new
Result
();
}
@Deprecated
@GetMapping
(
"findByUserId"
)
@ApiOperation
(
"根据用户id查询用户收货地址"
)
public
Result
<
List
<
PensionConsigneeDTO
>>
findAddressByUserId
(
@RequestParam
(
"userId"
)
Long
userId
){
...
...
@@ -105,6 +107,7 @@ public class PensionConsigneeController {
return
new
Result
<
List
<
PensionConsigneeDTO
>>().
ok
(
pensionConsigneeDTOList
);
}
@Deprecated
@Login
@GetMapping
(
"findMyAddress"
)
@ApiOperation
(
"查询本人收货地址"
)
...
...
@@ -121,6 +124,7 @@ public class PensionConsigneeController {
return
new
Result
<
List
<
PensionConsigneeDTO
>>().
ok
(
pensionConsigneeDTOList
);
}
@Deprecated
@Login
@PostMapping
(
"addMyAddress"
)
@ApiOperation
(
"添加我的收货地址"
)
...
...
@@ -140,6 +144,17 @@ public class PensionConsigneeController {
return
new
Result
();
}
@Login
@PostMapping
(
"addMyAddressDTO2"
)
@ApiOperation
(
value
=
"添加或修改我的收货地址"
,
notes
=
"userId留空"
)
public
Result
addMyAddress2
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@RequestBody
PensionConsigneeAddDTO
dto
){
dto
.
setUserId
(
user
.
getId
());
pensionConsigneeService
.
addUserAddress
(
dto
);
return
new
Result
();
}
@Deprecated
@PostMapping
(
"addUserAddress"
)
@ApiOperation
(
"根据用户Id添加收货地址"
)
@ApiImplicitParams
({
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionConsigneeAddDTO.java
View file @
624b77e9
...
...
@@ -26,25 +26,25 @@ public class PensionConsigneeAddDTO implements Serializable {
@ApiModelProperty
(
value
=
"用户ID"
)
private
Long
userId
;
@ApiModelProperty
(
value
=
"收货人姓名"
)
@ApiModelProperty
(
value
=
"收货人姓名"
,
required
=
true
)
private
String
consigneeName
;
@ApiModelProperty
(
value
=
"收货人电话"
)
@ApiModelProperty
(
value
=
"收货人电话"
,
required
=
true
)
private
String
consigneeMobile
;
@ApiModelProperty
(
value
=
"省份"
)
@ApiModelProperty
(
value
=
"省份"
,
required
=
true
)
private
String
consigneeProvince
;
@ApiModelProperty
(
value
=
"城市"
)
@ApiModelProperty
(
value
=
"城市"
,
required
=
true
)
private
String
consigneeCity
;
@ApiModelProperty
(
value
=
"区/县"
)
@ApiModelProperty
(
value
=
"区/县"
,
required
=
true
)
private
String
consigneeDistrict
;
@ApiModelProperty
(
value
=
"详细地址"
)
@ApiModelProperty
(
value
=
"详细地址"
,
required
=
true
)
private
String
consigneeAddress
;
@ApiModelProperty
(
value
=
"邮编"
)
@ApiModelProperty
(
value
=
"邮编"
,
required
=
true
)
private
String
consigneeZip
;
@ApiModelProperty
(
value
=
"是否为默认地址"
)
...
...
@@ -53,6 +53,9 @@ public class PensionConsigneeAddDTO implements Serializable {
@ApiModelProperty
(
value
=
"状态"
)
private
Integer
status
;
public
PensionConsigneeAddDTO
()
{
}
public
PensionConsigneeAddDTO
(
Long
userId
,
String
consigneeName
,
String
consigneeMobile
,
String
consigneeProvince
,
String
consigneeCity
,
String
consigneeDistrict
,
String
consigneeAddress
,
String
consigneeZip
,
Integer
ifDefault
,
Integer
status
)
{
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionConsigneeService.java
View file @
624b77e9
package
io
.
hmit
.
modules
.
serviceOrder
.
service
;
import
io.hmit.common.service.CrudService
;
import
io.hmit.modules.serviceOrder.dto.PensionConsigneeAddDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity
;
...
...
@@ -21,4 +22,6 @@ public interface PensionConsigneeService extends CrudService<PensionConsigneeEnt
void
addUserAddress
(
Map
<
String
,
Object
>
params
);
void
addUserAddress
(
PensionConsigneeAddDTO
dto
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionConsigneeServiceImpl.java
View file @
624b77e9
...
...
@@ -90,4 +90,36 @@ public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigne
pensionConsigneeDTO
.
setCreateDate
(
new
Date
());
save
(
pensionConsigneeDTO
);
}
@Override
public
void
addUserAddress
(
PensionConsigneeAddDTO
dto
)
{
Integer
ifDefault
=
1
;
QueryWrapper
<
PensionConsigneeEntity
>
queryWrapper
=
new
QueryWrapper
<>();
Long
userId
=
dto
.
getUserId
();
queryWrapper
.
eq
(
"user_id"
,
userId
).
eq
(
"if_default"
,
1
);
PensionConsigneeEntity
pensionConsigneeEntity
=
pensionConsigneeDao
.
selectOne
(
queryWrapper
);
if
(
pensionConsigneeEntity
!=
null
)
{
if
(
dto
.
getIfDefault
()
==
0
)
{
//不希望设置为默认地址
ifDefault
=
0
;
}
else
{
//设为默认地址并将其他地址设置为非默认
pensionConsigneeEntity
.
setIfDefault
(
0
);
update
(
ConvertUtils
.
sourceToTarget
(
pensionConsigneeEntity
,
PensionConsigneeDTO
.
class
));
}
}
if
(
null
!=
dto
.
getId
())
{
PensionConsigneeDTO
pensionConsigneeDTO
=
get
(
dto
.
getId
());
BeanUtils
.
copyProperties
(
dto
,
pensionConsigneeDTO
);
pensionConsigneeDTO
.
setIfDefault
(
ifDefault
);
update
(
pensionConsigneeDTO
);
}
else
{
PensionConsigneeDTO
pensionConsigneeDTO
=
new
PensionConsigneeDTO
();
BeanUtils
.
copyProperties
(
dto
,
pensionConsigneeDTO
);
pensionConsigneeDTO
.
setCreateDate
(
new
Date
());
pensionConsigneeDTO
.
setIfDefault
(
ifDefault
);
pensionConsigneeDTO
.
setStatus
(
1
);
save
(
pensionConsigneeDTO
);
}
}
}
\ No newline at end of file
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