修改 address 提交参数

This commit is contained in:
YunaiV 2020-07-24 09:12:38 +08:00
parent 84d4e604b1
commit e0edc2d2d9
15 changed files with 46 additions and 134 deletions

View File

@ -30,20 +30,10 @@ public class UserAddressCreateReqDTO implements Serializable {
@NotEmpty(message = "手机号不能为空") @NotEmpty(message = "手机号不能为空")
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
@NotNull(message = "省份编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
/**
* 区域编号
*/
@NotNull(message = "区域编号不能为空")
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -30,17 +30,9 @@ public class UserAddressRespDTO implements Serializable {
*/ */
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
private Integer cityCode;
/**
* 区域编号
*/
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -41,20 +41,10 @@ public class UserAddressUpdateReqDTO implements Serializable {
@Mobile @Mobile
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
@NotNull(message = "省份编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
/**
* 区域编号
*/
@NotNull(message = "区域编号不能为空")
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -38,17 +38,9 @@ public class UserAddressDO extends DeletableDO {
*/ */
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
private Integer cityCode;
/**
* 区域编号
*/
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -12,7 +12,7 @@ import java.util.List;
public interface UserAddressMapper extends BaseMapper<UserAddressDO> { public interface UserAddressMapper extends BaseMapper<UserAddressDO> {
default List<UserAddressDO> selectListByUserIdAndType(Integer userId, @Nullable Integer type) { default List<UserAddressDO> selectListByUserIdAndType(Integer userId, @Nullable Integer type) {
return selectList(new QueryWrapperX<UserAddressDO>().eq("userId", userId) return selectList(new QueryWrapperX<UserAddressDO>().eq("user_id", userId)
.eqIfPresent("type", type)); .eqIfPresent("type", type));
} }

View File

@ -29,17 +29,9 @@ public class UserAddressBO {
*/ */
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
private Integer cityCode;
/**
* 区域编号
*/
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */
@ -52,13 +44,5 @@ public class UserAddressBO {
* 创建时间 * 创建时间
*/ */
private Date createTime; private Date createTime;
/**
* 最后更新时间
*/
private Date updateTime;
/**
* 删除状态
*/
private Integer deleted;
} }

View File

@ -31,20 +31,10 @@ public class UserAddressCreateBO {
@Mobile @Mobile
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
@NotNull(message = "省份编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
/**
* 区域编号
*/
@NotNull(message = "区域编号不能为空")
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -34,20 +34,10 @@ public class UserAddressUpdateBO {
@NotEmpty(message = "手机号不能为空") @NotEmpty(message = "手机号不能为空")
private String mobile; private String mobile;
/** /**
* 省份编号 * 地区编码
*/ */
@NotNull(message = "省份编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer provinceCode; private Integer areaCode;
/**
* 城市编号
*/
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
/**
* 区域编号
*/
@NotNull(message = "区域编号不能为空")
private Integer countyCode;
/** /**
* 收件详细地址 * 收件详细地址
*/ */

View File

@ -38,6 +38,8 @@ dubbo:
version: 1.0.0 version: 1.0.0
UserSmsCodeRpc: UserSmsCodeRpc:
version: 1.0.0 version: 1.0.0
UserAddressRpc:
version: 1.0.0
# Dubbo 服务消费者的配置 # Dubbo 服务消费者的配置
consumer: consumer:
OAuth2Rpc: OAuth2Rpc:

View File

@ -23,7 +23,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
* 用户收件地址 Controller * 用户收件地址 Controller
*/ */
@RestController @RestController
@RequestMapping("/user_address") @RequestMapping("/user-address")
@Api(tags = "用户收件地址") @Api(tags = "用户收件地址")
@Validated @Validated
public class UserAddressController { public class UserAddressController {
@ -65,10 +65,9 @@ public class UserAddressController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获得用户收件地址列表") @ApiOperation("获得用户收件地址列表")
@ApiImplicitParam(name = "userAddressIds", value = "用户收件地址编号列表", required = true)
@RequiresPermissions @RequiresPermissions
public CommonResult<List<UserAddressRespVO>> listUserAddresses(@RequestParam("userAddressIds") List<Integer> userAddressIds) { public CommonResult<List<UserAddressRespVO>> listUserAddresses() {
return success(userAddressManager.listUserAddresses(UserSecurityContextHolder.getUserId(), userAddressIds)); return success(userAddressManager.listUserAddresses(UserSecurityContextHolder.getUserId()));
} }
} }

View File

@ -19,15 +19,9 @@ public class UserAddressCreateReqVO {
@ApiModelProperty(value = "手机号", required = true, example = "15601691300") @ApiModelProperty(value = "手机号", required = true, example = "15601691300")
@NotEmpty(message = "手机号不能为空") @NotEmpty(message = "手机号不能为空")
private String mobile; private String mobile;
@ApiModelProperty(value = "省份编号", required = true, example = "230000")
@NotNull(message = "省份编号不能为空")
private Integer provinceCode;
@ApiModelProperty(value = "城市编号", required = true, example = "469031")
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
@ApiModelProperty(value = "区域编号", required = true, example = "610632") @ApiModelProperty(value = "区域编号", required = true, example = "610632")
@NotNull(message = "区域编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer countyCode; private Integer areaCode;
@ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室")
@NotEmpty(message = "收件详细地址不能为空") @NotEmpty(message = "收件详细地址不能为空")
private String detailAddress; private String detailAddress;

View File

@ -1,35 +1,31 @@
package cn.iocoder.mall.userweb.controller.address.vo; package cn.iocoder.mall.userweb.controller.address.vo;
import lombok.*; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.*; import io.swagger.annotations.ApiModelProperty;
import java.util.*; import lombok.Data;
import java.util.Date;
@ApiModel("用户收件地址 Response VO") @ApiModel("用户收件地址 Response VO")
@Data @Data
public class UserAddressRespVO { public class UserAddressRespVO {
@ApiModelProperty(value = "收件地址编号", required = true) @ApiModelProperty(value = "收件地址编号", required = true, example = "1024")
private Integer id; private Integer id;
@ApiModelProperty(value = "用户编号", required = true) @ApiModelProperty(value = "用户编号", required = true, example = "2048")
private Integer userId; private Integer userId;
@ApiModelProperty(value = "收件人名称", required = true) @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿")
private String name; private String name;
@ApiModelProperty(value = "手机号", required = true) @ApiModelProperty(value = "手机号", required = true, example = "15601691300")
private String mobile; private String mobile;
@ApiModelProperty(value = "省份编号", required = true) @ApiModelProperty(value = "区域编号", required = true, example = "610632")
private Integer provinceCode; private Integer areaCode;
@ApiModelProperty(value = "城市编号", required = true) @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室")
private Integer cityCode;
@ApiModelProperty(value = "区域编号", required = true)
private Integer countyCode;
@ApiModelProperty(value = "收件详细地址", required = true)
private String detailAddress; private String detailAddress;
@ApiModelProperty(value = "地址类型", required = true) @ApiModelProperty(value = "地址类型", required = true, example = "1", notes = "参见 UserAddressType 枚举类")
private Integer type; private Integer type;
@ApiModelProperty(value = "创建时间", required = true) @ApiModelProperty(value = "创建时间", required = true)
private Date createTime; private Date createTime;
@ApiModelProperty(value = "最后更新时间", required = true)
private Date updateTime;
} }

View File

@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class UserAddressUpdateReqVO { public class UserAddressUpdateReqVO {
@ApiModelProperty(value = "收件地址编号", required = true) @ApiModelProperty(value = "收件地址编号", required = true, example = "1024")
@NotNull(message = "收件地址编号不能为空") @NotNull(message = "收件地址编号不能为空")
private Integer id; private Integer id;
@ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿")
@ -22,15 +22,9 @@ public class UserAddressUpdateReqVO {
@ApiModelProperty(value = "手机号", required = true, example = "15601691300") @ApiModelProperty(value = "手机号", required = true, example = "15601691300")
@NotEmpty(message = "手机号不能为空") @NotEmpty(message = "手机号不能为空")
private String mobile; private String mobile;
@ApiModelProperty(value = "省份编号", required = true, example = "230000")
@NotNull(message = "省份编号不能为空")
private Integer provinceCode;
@ApiModelProperty(value = "城市编号", required = true, example = "469031")
@NotNull(message = "城市编号不能为空")
private Integer cityCode;
@ApiModelProperty(value = "区域编号", required = true, example = "610632") @ApiModelProperty(value = "区域编号", required = true, example = "610632")
@NotNull(message = "区域编号不能为空") @NotNull(message = "地区编码不能为空")
private Integer countyCode; private Integer areaCode;
@ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室")
@NotEmpty(message = "收件详细地址不能为空") @NotEmpty(message = "收件详细地址不能为空")
private String detailAddress; private String detailAddress;

View File

@ -85,14 +85,11 @@ public class UserAddressManager {
* 获得用户收件地址列表 * 获得用户收件地址列表
* *
* @param userId 用户编号 * @param userId 用户编号
* @param userAddressIds 用户收件地址编号列表
* @return 用户收件地址列表 * @return 用户收件地址列表
*/ */
public List<UserAddressRespVO> listUserAddresses(Integer userId, List<Integer> userAddressIds) { public List<UserAddressRespVO> listUserAddresses(Integer userId) {
CommonResult<List<UserAddressRespDTO>> listUserAddressResult = userAddressRpc.listUserAddresses(userAddressIds); CommonResult<List<UserAddressRespDTO>> listUserAddressResult = userAddressRpc.listUserAddresses(userId, null);
listUserAddressResult.checkError(); listUserAddressResult.checkError();
// 校验是否能够操作
listUserAddressResult.getData().forEach(userAddressRespDTO -> check(userId, userAddressRespDTO));
return UserAddressConvert.INSTANCE.convertList(listUserAddressResult.getData()); return UserAddressConvert.INSTANCE.convertList(listUserAddressResult.getData());
} }

View File

@ -35,6 +35,8 @@ dubbo:
version: 1.0.0 version: 1.0.0
SystemExceptionLogRpc: SystemExceptionLogRpc:
version: 1.0.0 version: 1.0.0
UserAddressRpc:
version: 1.0.0
# Swagger 配置项 # Swagger 配置项
swagger: swagger: