开始迁移用户收件地址,清理部分代码~

pull/3/head
YunaiV 2020-07-23 08:12:42 +08:00
parent 25047e081c
commit 6ae48b6543
37 changed files with 171 additions and 12654 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
package cn.iocoder.mall.userservice.enums.address;
import cn.iocoder.common.framework.core.IntArrayValuable;
import java.util.Arrays;
/**
*
*/
public enum UserAddressType implements IntArrayValuable {
DEFAULT(1, "默认收件地址"),
NORMAL(2, "普通收件地址"), // 即非默认收件笛之爱
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(UserAddressType::getType).toArray();
private final Integer type;
private final String desc;
UserAddressType(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
public String getDesc() {
return desc;
}
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.mall.userservice.dal.mysql.dataobject.address;
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
import cn.iocoder.mall.userservice.enums.address.UserAddressType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
*
*
* @author Sin
* @time 2019-04-06 13:22
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UsersUserAddressDO extends DeletableDO {
/**
*
*/
private Integer id;
/**
*
*/
private Integer userId;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private Integer provinceCode;
/**
*
*/
private Integer cityCode;
/**
*
*/
private Integer countyCode;
/**
*
*/
private String detailAddress;
/**
*
*
* {@link UserAddressType}
*/
private Integer type;
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.mall.userservice.dal.mysql.dataobject.user;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* QQ / /
*
* TODO
*/
@Data
@Accessors(chain = true)
public class UserThirdAuthDO {
/**
*
*
* {@link UserDO#uid}
*/
private Long uid;
// ========== 授权相关字段
/**
*
*/
private String openid;
/**
*
*
* @see cn.iocoder.mall.user.api.constant.ThirdPlatformConstant
*/
private Integer platform;
/**
* 访
*/
private Date accessToken;
/**
*
*/
private Date expireTime;
/**
*
*/
private Date refreshToken;
/**
* 使
*/
private String scopes;
// ========== 基础信息
/**
*
*/
private String nickname;
/**
*
*
* TODO 0-1-2-
*/
private Integer gender;
// TODO https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842
// TODO 芋艿,其他字段,国家/省份/城市/地区等
// TODO 芋艿,头像
// TODO 芋艿,微信独有 unionid
/**
* 使 JSON
*/
private String extras;
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.mall.user.rest.controller;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.web.core.constant.CommonMallConstants;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(CommonMallConstants.ROOT_PATH_USER + "/test")
public class TestController {
@GetMapping("/echo")
public CommonResult<Boolean> echo() {
return CommonResult.success(true);
}
}

View File

@ -1 +0,0 @@
package cn.iocoder.mall.user.rest.controller;

View File

@ -1,37 +0,0 @@
package cn.iocoder.mall.user.rest.convert;
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
import cn.iocoder.mall.user.rest.request.user.UserAddressAddRequest;
import cn.iocoder.mall.user.rest.request.user.UserAddressUpdateRequest;
import cn.iocoder.mall.user.rest.response.user.UserAddressResponse;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* convert
*
* author: sin
* time: 2020/5/8 10:01
*/
@Mapper
public interface UserAddressConvert {
UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class);
@Mappings({})
List<UserAddressResponse> convert(List<UserAddressBO> userAddressBOList);
@Mappings({})
UserAddressResponse convert(UserAddressBO userAddressBO);
@Mappings({})
UserAddressAddDTO convert(UserAddressAddRequest userAddressAddRequest);
@Mappings({})
UserAddressUpdateDTO convert(UserAddressUpdateRequest userAddressUpdateRequest);
}

View File

@ -1 +0,0 @@
package cn.iocoder.mall.user.rest;

View File

@ -1,5 +0,0 @@
/**
* author: sin
* time: 2020/5/8 9:57
*/
package cn.iocoder.mall.user.rest.request;

View File

@ -1,5 +0,0 @@
/**
* author: sin
* time: 2020/5/8 9:57
*/
package cn.iocoder.mall.user.rest.response;

View File

@ -1,5 +0,0 @@
/**
* author: sin
* time: 2020/5/3 8:39
*/
package cn.iocoder.mall.user.rpc;

View File

@ -1,45 +0,0 @@
package cn.iocoder.mall.user.rpc.request.user;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* add
*
* @author Sin
* @time 2019-04-06 13:25
*/
@Data
@Accessors(chain = true)
public class UserAddressAddRequest implements Serializable {
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*
* - 1
* - 2
*/
private Integer hasDefault;
}

View File

@ -1,46 +0,0 @@
package cn.iocoder.mall.user.rpc.request.user;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
*
*
* @author Sin
* @time 2019-04-06 13:28
*/
@Data
@Accessors(chain = true)
public class UserAddressUpdateRequest implements Serializable {
/**
*
*/
private Integer id;
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*/
private Integer hasDefault;
}

View File

@ -1,5 +0,0 @@
/**
* author: sin
* time: 2020/5/3 8:42
*/
package cn.iocoder.mall.user.rpc.response;

View File

@ -1,46 +0,0 @@
package cn.iocoder.mall.user.rpc.response.user;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
*
*
* @author Sin
* @time 2019-04-06 13:28
*/
@Data
@Accessors(chain = true)
public class UserAddressResponse implements Serializable {
/**
*
*/
private Integer id;
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*/
private Integer hasDefault;
}

View File

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>user</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>user-service-api</artifactId>
<dependencies>
<!-- Mall 相关 -->
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>common-framework</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>system-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,31 +0,0 @@
package cn.iocoder.mall.user.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.user.api.bo.UserAddressBO;
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
import java.util.List;
/**
*
*
* @author Sin
* @time 2019-04-06 13:24
*/
public interface UserAddressService {
// TODO FROM 芋艿 to 小范泛型哈。另外Service 不用 CommonResult 返回
CommonResult addAddress(UserAddressAddDTO userAddressAddDTO);
CommonResult updateAddress(UserAddressUpdateDTO userAddressAddDTO);
CommonResult removeAddress(Integer userId, Integer addressId);
CommonResult<List<UserAddressBO>> addressList(Integer userId);
CommonResult<UserAddressBO> getAddress(Integer userId, Integer id);
CommonResult<UserAddressBO> getDefaultAddress(Integer userId);
}

View File

@ -1,43 +0,0 @@
package cn.iocoder.mall.user.api;
import cn.iocoder.common.framework.constant.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.user.api.bo.UserBO;
import cn.iocoder.mall.user.api.bo.UserPageBO;
import cn.iocoder.mall.user.api.dto.UserPageDTO;
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
public interface UserService {
UserPageBO getUserPage(UserPageDTO userPageDTO);
UserBO getUser(Integer userId);
/**
*
*
* @param userUpdateDTO DTO
* @return
*/
Boolean updateUser(UserUpdateDTO userUpdateDTO);
/**
*
*
* @param userId
* @param status
* @return
*/
Boolean updateUserStatus(Integer userId,
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
/**
*
*
* @param userId
* @param mobile
* @return
*/
Boolean updateUserMobile(Integer userId, String mobile);
}

View File

@ -1,44 +0,0 @@
package cn.iocoder.mall.user.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author Sin
* @time 2019-04-06 13:28
*/
@Data
@Accessors(chain = true)
public class UserAddressBO implements Serializable {
/**
*
*/
private Integer id;
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*/
private Integer hasDefault;
}

View File

@ -1,41 +0,0 @@
package cn.iocoder.mall.user.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@Accessors(chain = true)
public class UserBO implements Serializable {
/**
*
*/
private Integer id;
/**
*
*/
private String mobile;
/**
*
*/
private String nickname;
/**
*
*/
private String avatar;
/**
*
*
* 1 -
* 2 -
*/
private Integer status;
/**
*
*/
private Date createTime;
}

View File

@ -1,22 +0,0 @@
package cn.iocoder.mall.user.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@Accessors(chain = true)
public class UserPageBO implements Serializable {
/**
*
*/
private List<UserBO> list;
/**
*
*/
private Integer total;
}

View File

@ -1,13 +0,0 @@
package cn.iocoder.mall.user.api.constant;
public class ThirdPlatformConstant {
public static final int QQ = 1;
public static final int WEIBO = 2;
// WECHAT 可能分成好几个
// ....
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.mall.user.api.constant;
/**
* -
*
* @author Sin
* @time 2019-04-10 22:02
*/
public enum UserAddressHasDefaultEnum {
DEFAULT_ADDRESS_NO (1, "不是默认地址"),
DEFAULT_ADDRESS_YES (2, "不是默认地址")
;
private final int value;
private final String name;
UserAddressHasDefaultEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@ -1,14 +0,0 @@
package cn.iocoder.mall.user.api.constant;
public class UserConstants {
/**
* -
*/
public static final Integer STATUS_ENABLE = 1;
/**
* -
*/
public static final Integer STATUS_DISABLE = 2;
}

View File

@ -1,54 +0,0 @@
package cn.iocoder.mall.user.api.constant;
/**
*
*
* 使 1-001-000-000
*/
public enum UserErrorCodeEnum {
// ========== OAUTH2 模块 ==========
OAUTH2_UNKNOWN(1001001000, "未知错误"), // 预留
OAUTH2_INVALID_GRANT_BAD_CREDENTIALS(1001001001, "密码不正确"), // 暂时没用到
OAUTH2_INVALID_GRANT_USERNAME_NOT_FOUND(1001001002, "账号不存在"), // 暂时没用到
OAUTH2_INVALID_GRANT(1001001010, ""), // 预留
OAUTH_INVALID_ACCESS_TOKEN_NOT_FOUND(1001001011, "访问令牌不存在"),
OAUTH_INVALID_ACCESS_TOKEN_EXPIRED(1001001012, "访问令牌已过期"),
OAUTH_INVALID_ACCESS_TOKEN_INVALID(1001001013, "访问令牌已失效"),
OAUTH_INVALID_REFRESH_TOKEN(1001001020, ""), // 预留
OAUTH_INVALID_REFRESH_TOKEN_NOT_FOUND(1001001021, "刷新令牌不存在"),
OAUTH_INVALID_REFRESH_TOKEN_EXPIRED(1001001022, "访问令牌已过期"),
OAUTH_INVALID_REFRESH_TOKEN_INVALID(1001001023, "刷新令牌已失效"),
// ========== 用户模块 ==========
USER_MOBILE_NOT_REGISTERED(1001002000, "手机号未注册用户"),
USER_MOBILE_ALREADY_REGISTERED(1001002001, "手机号已经注册用户"),
USER_NOT_EXISTS(1001002002, "用户不存在"),
USER_STATUS_EQUALS(1001002003, "账号已经是该状态"),
USER_MOBILE_EQUALS(1001002004, "账号已经是该手机号"),
// ========== 用户地址 ==========
USER_ADDRESS_NOT_EXISTENT(1001004000, "用户地址不存在!"),
USER_ADDRESS_IS_DELETED(1001004001, "用户地址已被删除!"),
USER_GET_ADDRESS_NOT_EXISTS(1001004002, "获取的地址不存在!"),
;
private final int code;
private final String message;
UserErrorCodeEnum(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@ -1,45 +0,0 @@
package cn.iocoder.mall.user.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* add
*
* @author Sin
* @time 2019-04-06 13:25
*/
@Data
@Accessors(chain = true)
public class UserAddressAddDTO implements Serializable {
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*
* - 1
* - 2
*/
private Integer hasDefault;
}

View File

@ -1,46 +0,0 @@
package cn.iocoder.mall.user.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
*
*
* @author Sin
* @time 2019-04-06 13:28
*/
@Data
@Accessors(chain = true)
public class UserAddressUpdateDTO implements Serializable {
/**
*
*/
private Integer id;
/**
*
*/
private Integer userId;
/**
*
*/
private String areaNo;
/**
*
*/
private String name;
/**
*
*/
private String mobile;
/**
*
*/
private String address;
/**
*
*/
private Integer hasDefault;
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.mall.user.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@Data
@Accessors(chain = true)
public class UserPageDTO {
/**
*
*
*
*/
private String nickname;
/**
*
*/
private Integer status;
@NotNull(message = "页码不能为空")
private Integer pageNo;
@NotNull(message = "每页条数不能为空")
private Integer pageSize;
}

View File

@ -1,26 +0,0 @@
package cn.iocoder.mall.user.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* DTO
*/
@Data
@Accessors(chain = true)
public class UserUpdateDTO {
/**
*
*/
private Integer id;
/**
*
*/
private String nickname;
/**
*
*/
private String avatar;
}

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>user</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>user-application</artifactId>
<properties>
</properties>
<dependencies>
<!-- Mall 相关 -->
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>common-framework</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-service-impl</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>system-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!-- 测试相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 提供给 mapstruct 使用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!-- 打包 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,15 +0,0 @@
package cn.iocoder.mall.user.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.user"})
@EnableAsync(proxyTargetClass = true)
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class, args);
}
}

View File

@ -1,79 +0,0 @@
package cn.iocoder.mall.user.application.controller.users;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.user.api.UserAddressService;
import cn.iocoder.mall.user.api.bo.UserAddressBO;
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
import cn.iocoder.mall.user.application.convert.UserAddressConvert;
import cn.iocoder.mall.user.application.po.UserAddressAddPO;
import cn.iocoder.mall.user.application.po.UserAddressUpdatePO;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author Sin
* @time 2019-04-06 14:11
*/
@RestController
@RequestMapping("users/address")
@Api(value = "用户地址API")
public class UserAddressController {
@Reference(validation = "true", version = "${dubbo.provider.UserAddressService.version}")
private UserAddressService userAddressService;
@PostMapping("add")
@ApiOperation(value = "用户地址-添加")
public CommonResult addAddress(@Validated UserAddressAddPO userAddressAddPO) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
UserAddressAddDTO userAddressAddDTO = UserAddressConvert.INSTANCE.convert(userAddressAddPO);
userAddressAddDTO.setUserId(userId);
return userAddressService.addAddress(userAddressAddDTO);
}
@PutMapping("update")
@ApiOperation(value = "用户地址-更新")
public CommonResult updateAddress(@Validated UserAddressUpdatePO userAddressUpdatePO) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
UserAddressUpdateDTO userAddressUpdateDTO = UserAddressConvert.INSTANCE.convert(userAddressUpdatePO);
userAddressUpdateDTO.setUserId(userId);
return userAddressService.updateAddress(userAddressUpdateDTO);
}
@DeleteMapping("remove")
@ApiOperation(value = "用户地址-删除")
public CommonResult removeAddress(@RequestParam("id") Integer id) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userAddressService.removeAddress(userId, id);
}
@GetMapping("list")
@ApiOperation(value = "用户地址列表")
public CommonResult<List<UserAddressBO>> addressList() {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userAddressService.addressList(userId);
}
@GetMapping("address")
@ApiOperation(value = "获取地址")
public CommonResult<UserAddressBO> getAddress(@RequestParam("id") Integer id) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userAddressService.getAddress(userId, id);
}
@GetMapping("default_address")
@ApiOperation(value = "获取默认地址")
public CommonResult<UserAddressBO> getDefaultAddress() {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userAddressService.getDefaultAddress(userId);
}
}

View File

@ -1,59 +0,0 @@
package cn.iocoder.mall.user.application.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* add
*
* @author Sin
* @time 2019-04-06 14:13
*/
@ApiModel("用户地址")
@Data
@Accessors(chain = true)
public class UserAddressAddPO implements Serializable {
/**
*
*/
@ApiModelProperty("区域编号")
@NotNull(message = "区域编号不能为空!")
private String areaNo;
/**
*
*/
@ApiModelProperty("收件人名称")
@NotNull(message = "请填写收人信息!")
private String name;
/**
*
*/
@ApiModelProperty("收件手机号")
@NotNull(message = "手机号为不能为空!")
@Size(min = 11, max = 11, message = "手机号为 11 位!")
private String mobile;
/**
*
*/
@ApiModelProperty("收件详细地址")
@NotEmpty(message = "详细地址不能为空")
@Length(min = 10, max = 100, message = "地址在 10 ~ 100 字之间!")
private String address;
/**
*
*/
@ApiModelProperty("默认地址")
@NotNull(message = "默认地址不能为空")
private Integer hasDefault;
}

View File

@ -1,61 +0,0 @@
package cn.iocoder.mall.user.application.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* add
*
* @author Sin
* @time 2019-04-06 14:13
*/
@ApiModel("用户地址-更新")
@Data
@Accessors(chain = true)
public class UserAddressUpdatePO implements Serializable {
/**
*
*/
@ApiModelProperty("地址编号")
@NotNull(message = "地址编号为空!")
private Integer id;
/**
*
*/
@ApiModelProperty("区域编号")
@NotNull(message = "区域编号不能为空!")
private String areaNo;
/**
*
*/
@ApiModelProperty("收件人名称")
@NotNull(message = "请填写收人信息!")
private String name;
/**
*
*/
@ApiModelProperty("收件手机号")
@NotNull(message = "手机号为不能为空!")
@Size(min = 11, max = 11, message = "手机号为 11 位!")
private String mobile;
/**
*
*/
@ApiModelProperty("收件详细地址")
@NotNull(message = "详细地址不能为空")
@Size(min = 10, max = 100, message = "地址在 10 ~ 100 字之间!")
private String address;
/**
*
*/
@ApiModelProperty("是否设置默认")
@NotNull(message = "是否设置默认不能为空")
private Integer hasDefault;
}

View File

@ -1,6 +0,0 @@
swagger:
enable: true
title: 用户子系统
description: 用户子系统
version: 1.0.0
base-package: cn.iocoder.mall.user.application.controller

View File

@ -1,32 +0,0 @@
spring:
application:
name: user-application
# Spring Cloud 配置项
cloud:
# Spring Cloud Sentinel 配置项
sentinel:
transport:
dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: true # 项目启动时,直接连接到 Sentinel
# server
server:
port: 18082
servlet:
context-path: /user-api/
swagger:
enable: true # 暂时不去掉
title: 用户子系统
description: 用户子系统
version: 1.0.0
base-package: cn.iocoder.mall.user.application.controller
management:
endpoints:
web:
exposure:
include: health,info,env,metrics,prometheus
metrics:
enabled: true