diff --git a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressCreateReqDTO.java b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressCreateReqDTO.java index c5cb42cf2..0698e1216 100644 --- a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressCreateReqDTO.java +++ b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressCreateReqDTO.java @@ -30,20 +30,10 @@ public class UserAddressCreateReqDTO implements Serializable { @NotEmpty(message = "手机号不能为空") private String mobile; /** - * 省份编号 + * 地区编码 */ - @NotNull(message = "省份编号不能为空") - private Integer provinceCode; - /** - * 城市编号 - */ - @NotNull(message = "城市编号不能为空") - private Integer cityCode; - /** - * 区域编号 - */ - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressRespDTO.java b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressRespDTO.java index 93c5b95fd..2668fcffb 100644 --- a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressRespDTO.java +++ b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressRespDTO.java @@ -30,17 +30,9 @@ public class UserAddressRespDTO implements Serializable { */ private String mobile; /** - * 省份编号 + * 地区编码 */ - private Integer provinceCode; - /** - * 城市编号 - */ - private Integer cityCode; - /** - * 区域编号 - */ - private Integer countyCode; + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressUpdateReqDTO.java b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressUpdateReqDTO.java index 5ff0b9865..212a4a81b 100644 --- a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressUpdateReqDTO.java +++ b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/address/dto/UserAddressUpdateReqDTO.java @@ -41,20 +41,10 @@ public class UserAddressUpdateReqDTO implements Serializable { @Mobile private String mobile; /** - * 省份编号 + * 地区编码 */ - @NotNull(message = "省份编号不能为空") - private Integer provinceCode; - /** - * 城市编号 - */ - @NotNull(message = "城市编号不能为空") - private Integer cityCode; - /** - * 区域编号 - */ - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/address/UserAddressDO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/address/UserAddressDO.java index eb24f7be1..47a5ece8f 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/address/UserAddressDO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/address/UserAddressDO.java @@ -38,17 +38,9 @@ public class UserAddressDO extends DeletableDO { */ private String mobile; /** - * 省份编号 + * 地区编码 */ - private Integer provinceCode; - /** - * 城市编号 - */ - private Integer cityCode; - /** - * 区域编号 - */ - private Integer countyCode; + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java index c67b9cedf..83dbff4a7 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java @@ -12,7 +12,7 @@ import java.util.List; public interface UserAddressMapper extends BaseMapper { default List selectListByUserIdAndType(Integer userId, @Nullable Integer type) { - return selectList(new QueryWrapperX().eq("userId", userId) + return selectList(new QueryWrapperX().eq("user_id", userId) .eqIfPresent("type", type)); } diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressBO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressBO.java index 2bae5cb6b..de7451bda 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressBO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressBO.java @@ -29,17 +29,9 @@ public class UserAddressBO { */ private String mobile; /** - * 省份编号 + * 地区编码 */ - private Integer provinceCode; - /** - * 城市编号 - */ - private Integer cityCode; - /** - * 区域编号 - */ - private Integer countyCode; + private Integer areaCode; /** * 收件详细地址 */ @@ -52,13 +44,5 @@ public class UserAddressBO { * 创建时间 */ private Date createTime; - /** - * 最后更新时间 - */ - private Date updateTime; - /** - * 删除状态 - */ - private Integer deleted; } diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressCreateBO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressCreateBO.java index 1a6a72b79..cabe00ec9 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressCreateBO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressCreateBO.java @@ -31,20 +31,10 @@ public class UserAddressCreateBO { @Mobile private String mobile; /** - * 省份编号 + * 地区编码 */ - @NotNull(message = "省份编号不能为空") - private Integer provinceCode; - /** - * 城市编号 - */ - @NotNull(message = "城市编号不能为空") - private Integer cityCode; - /** - * 区域编号 - */ - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressUpdateBO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressUpdateBO.java index 75b12772d..6321b16dc 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressUpdateBO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/address/bo/UserAddressUpdateBO.java @@ -34,20 +34,10 @@ public class UserAddressUpdateBO { @NotEmpty(message = "手机号不能为空") private String mobile; /** - * 省份编号 + * 地区编码 */ - @NotNull(message = "省份编号不能为空") - private Integer provinceCode; - /** - * 城市编号 - */ - @NotNull(message = "城市编号不能为空") - private Integer cityCode; - /** - * 区域编号 - */ - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; /** * 收件详细地址 */ diff --git a/user-service-project/user-service-app/src/main/resources/application.yaml b/user-service-project/user-service-app/src/main/resources/application.yaml index d8c2748e8..3ee3026cb 100644 --- a/user-service-project/user-service-app/src/main/resources/application.yaml +++ b/user-service-project/user-service-app/src/main/resources/application.yaml @@ -38,6 +38,8 @@ dubbo: version: 1.0.0 UserSmsCodeRpc: version: 1.0.0 + UserAddressRpc: + version: 1.0.0 # Dubbo 服务消费者的配置 consumer: OAuth2Rpc: diff --git a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/UserAddressController.java b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/UserAddressController.java index 72403e33d..d22d56210 100644 --- a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/UserAddressController.java +++ b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/UserAddressController.java @@ -23,7 +23,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success; * 用户收件地址 Controller */ @RestController -@RequestMapping("/user_address") +@RequestMapping("/user-address") @Api(tags = "用户收件地址") @Validated public class UserAddressController { @@ -65,10 +65,9 @@ public class UserAddressController { @GetMapping("/list") @ApiOperation("获得用户收件地址列表") - @ApiImplicitParam(name = "userAddressIds", value = "用户收件地址编号列表", required = true) @RequiresPermissions - public CommonResult> listUserAddresses(@RequestParam("userAddressIds") List userAddressIds) { - return success(userAddressManager.listUserAddresses(UserSecurityContextHolder.getUserId(), userAddressIds)); + public CommonResult> listUserAddresses() { + return success(userAddressManager.listUserAddresses(UserSecurityContextHolder.getUserId())); } } diff --git a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressCreateReqVO.java b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressCreateReqVO.java index 4b2ae5862..51aa8f303 100644 --- a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressCreateReqVO.java +++ b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressCreateReqVO.java @@ -19,15 +19,9 @@ public class UserAddressCreateReqVO { @ApiModelProperty(value = "手机号", required = true, example = "15601691300") @NotEmpty(message = "手机号不能为空") 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") - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") @NotEmpty(message = "收件详细地址不能为空") private String detailAddress; diff --git a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressRespVO.java b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressRespVO.java index f46089220..6a1681409 100644 --- a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressRespVO.java +++ b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressRespVO.java @@ -1,35 +1,31 @@ package cn.iocoder.mall.userweb.controller.address.vo; -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; @ApiModel("用户收件地址 Response VO") @Data public class UserAddressRespVO { - @ApiModelProperty(value = "收件地址编号", required = true) + @ApiModelProperty(value = "收件地址编号", required = true, example = "1024") private Integer id; - @ApiModelProperty(value = "用户编号", required = true) + @ApiModelProperty(value = "用户编号", required = true, example = "2048") private Integer userId; - @ApiModelProperty(value = "收件人名称", required = true) + @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") private String name; - @ApiModelProperty(value = "手机号", required = true) + @ApiModelProperty(value = "手机号", required = true, example = "15601691300") private String mobile; - @ApiModelProperty(value = "省份编号", required = true) - private Integer provinceCode; - @ApiModelProperty(value = "城市编号", required = true) - private Integer cityCode; - @ApiModelProperty(value = "区域编号", required = true) - private Integer countyCode; - @ApiModelProperty(value = "收件详细地址", required = true) + @ApiModelProperty(value = "区域编号", required = true, example = "610632") + private Integer areaCode; + @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") private String detailAddress; - @ApiModelProperty(value = "地址类型", required = true) + @ApiModelProperty(value = "地址类型", required = true, example = "1", notes = "参见 UserAddressType 枚举类") private Integer type; @ApiModelProperty(value = "创建时间", required = true) private Date createTime; - @ApiModelProperty(value = "最后更新时间", required = true) - private Date updateTime; } diff --git a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressUpdateReqVO.java b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressUpdateReqVO.java index 215b9fad7..853754632 100644 --- a/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressUpdateReqVO.java +++ b/user-web-app/src/main/java/cn/iocoder/mall/userweb/controller/address/vo/UserAddressUpdateReqVO.java @@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull; @Data public class UserAddressUpdateReqVO { - @ApiModelProperty(value = "收件地址编号", required = true) + @ApiModelProperty(value = "收件地址编号", required = true, example = "1024") @NotNull(message = "收件地址编号不能为空") private Integer id; @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") @@ -22,15 +22,9 @@ public class UserAddressUpdateReqVO { @ApiModelProperty(value = "手机号", required = true, example = "15601691300") @NotEmpty(message = "手机号不能为空") 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") - @NotNull(message = "区域编号不能为空") - private Integer countyCode; + @NotNull(message = "地区编码不能为空") + private Integer areaCode; @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") @NotEmpty(message = "收件详细地址不能为空") private String detailAddress; diff --git a/user-web-app/src/main/java/cn/iocoder/mall/userweb/manager/address/UserAddressManager.java b/user-web-app/src/main/java/cn/iocoder/mall/userweb/manager/address/UserAddressManager.java index 062026448..de5657c31 100644 --- a/user-web-app/src/main/java/cn/iocoder/mall/userweb/manager/address/UserAddressManager.java +++ b/user-web-app/src/main/java/cn/iocoder/mall/userweb/manager/address/UserAddressManager.java @@ -85,14 +85,11 @@ public class UserAddressManager { * 获得用户收件地址列表 * * @param userId 用户编号 - * @param userAddressIds 用户收件地址编号列表 * @return 用户收件地址列表 */ - public List listUserAddresses(Integer userId, List userAddressIds) { - CommonResult> listUserAddressResult = userAddressRpc.listUserAddresses(userAddressIds); + public List listUserAddresses(Integer userId) { + CommonResult> listUserAddressResult = userAddressRpc.listUserAddresses(userId, null); listUserAddressResult.checkError(); - // 校验是否能够操作 - listUserAddressResult.getData().forEach(userAddressRespDTO -> check(userId, userAddressRespDTO)); return UserAddressConvert.INSTANCE.convertList(listUserAddressResult.getData()); } diff --git a/user-web-app/src/main/resources/application.yml b/user-web-app/src/main/resources/application.yml index 6fdcf7997..aba33d1f5 100644 --- a/user-web-app/src/main/resources/application.yml +++ b/user-web-app/src/main/resources/application.yml @@ -35,6 +35,8 @@ dubbo: version: 1.0.0 SystemExceptionLogRpc: version: 1.0.0 + UserAddressRpc: + version: 1.0.0 # Swagger 配置项 swagger: