完成订单 售后模块等
This commit is contained in:
@ -82,6 +82,10 @@
|
||||
<artifactId>yshop-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
</dependencies>
|
||||
|
@ -1,28 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.api.address;
|
||||
|
||||
import co.yixiang.yshop.module.member.api.address.dto.AddressRespDTO;
|
||||
import co.yixiang.yshop.module.member.convert.address.AddressConvert;
|
||||
import co.yixiang.yshop.module.member.service.address.AddressService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 用户收件地址 API 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AddressApiImpl implements AddressApi {
|
||||
|
||||
@Resource
|
||||
private AddressService addressService;
|
||||
|
||||
@Override
|
||||
public AddressRespDTO getAddress(Long id, Long userId) {
|
||||
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
|
||||
}
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.address;
|
@ -0,0 +1,87 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserPageReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.convert.user.UserConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import co.yixiang.yshop.module.member.service.user.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 用户")
|
||||
@RestController
|
||||
@RequestMapping("/member/user")
|
||||
@Validated
|
||||
public class MemberUserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:create')")
|
||||
public CommonResult<Long> createUser(@Valid @RequestBody UserCreateReqVO createReqVO) {
|
||||
return success(userService.createUser(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
public CommonResult<Boolean> updateUser(@Valid @RequestBody UserUpdateReqVO updateReqVO) {
|
||||
userService.updateUser(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:user:delete')")
|
||||
public CommonResult<Boolean> deleteUser(@RequestParam("id") Long id) {
|
||||
userService.deleteUser(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
MemberUserDO user = userService.getUser(id);
|
||||
return success(UserConvert.INSTANCE.convert(user,true));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<List<UserRespVO>> getUserList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<MemberUserDO> list = userService.getUserList(ids);
|
||||
return success(UserConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<PageResult<UserRespVO>> getUserPage(@Valid UserPageReqVO pageVO) {
|
||||
PageResult<MemberUserDO> pageResult = userService.getUserPage(pageVO);
|
||||
return success(UserConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user;
|
@ -0,0 +1,79 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 用户 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class UserBaseVO {
|
||||
|
||||
@Schema(description = "用户账户(跟accout一样)", example = "王五")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "用户昵称", example = "李四")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "添加ip")
|
||||
private String addIp;
|
||||
|
||||
@Schema(description = "用户余额", required = true)
|
||||
@NotNull(message = "用户余额不能为空")
|
||||
private BigDecimal nowMoney;
|
||||
|
||||
@Schema(description = "佣金金额", required = true, example = "14395")
|
||||
@NotNull(message = "佣金金额不能为空")
|
||||
private BigDecimal brokeragePrice;
|
||||
|
||||
@Schema(description = "用户剩余积分", required = true)
|
||||
@NotNull(message = "用户剩余积分不能为空")
|
||||
private BigDecimal integral;
|
||||
|
||||
@Schema(description = "1为正常,0为禁止", required = true, example = "2")
|
||||
@NotNull(message = "1为正常,0为禁止不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为推广员", required = true)
|
||||
@NotNull(message = "是否为推广员不能为空")
|
||||
private Byte isPromoter;
|
||||
|
||||
@Schema(description = "用户购买次数", example = "16061")
|
||||
private Integer payCount;
|
||||
|
||||
@Schema(description = "下级人数", example = "4960")
|
||||
private Integer spreadCount;
|
||||
|
||||
@Schema(description = "详细地址", required = true)
|
||||
@NotNull(message = "详细地址不能为空")
|
||||
private String addres;
|
||||
|
||||
@Schema(description = "管理员编号 ", example = "29490")
|
||||
private Integer adminid;
|
||||
|
||||
@Schema(description = "用户登陆类型,h5,wechat,routine", required = true, example = "2")
|
||||
@NotNull(message = "用户登陆类型,h5,wechat,routine不能为空")
|
||||
private String loginType;
|
||||
|
||||
@Schema(description = "微信用户json信息")
|
||||
private String wxProfile;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserCreateReqVO extends UserBaseVO {
|
||||
|
||||
@Schema(description = "用户密码(跟pwd)")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "生日")
|
||||
private Integer birthday;
|
||||
|
||||
@Schema(description = "身份证号码", example = "29961")
|
||||
private String cardId;
|
||||
|
||||
@Schema(description = "用户备注")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "合伙人id", example = "4234")
|
||||
private Integer partnerId;
|
||||
|
||||
@Schema(description = "用户分组id", example = "12625")
|
||||
private Integer groupId;
|
||||
|
||||
@Schema(description = "最后一次登录ip")
|
||||
private String lastIp;
|
||||
|
||||
@Schema(description = "连续签到天数", required = true)
|
||||
@NotNull(message = "连续签到天数不能为空")
|
||||
private Integer signNum;
|
||||
|
||||
@Schema(description = "等级", required = true)
|
||||
@NotNull(message = "等级不能为空")
|
||||
private Byte level;
|
||||
|
||||
@Schema(description = "推广元id", example = "5747")
|
||||
private Long spreadUid;
|
||||
|
||||
@Schema(description = "推广员关联时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime spreadTime;
|
||||
|
||||
@Schema(description = "用户类型", required = true, example = "1")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private String userType;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户 Excel 导出 Request VO,参数和 UserPageReqVO 是一致的")
|
||||
@Data
|
||||
public class UserExportReqVO {
|
||||
|
||||
@Schema(description = "用户账户(跟accout一样)", example = "王五")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "用户昵称", example = "李四")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户账户(跟accout一样)", example = "王五")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "用户昵称", example = "李四")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserRespVO extends UserBaseVO {
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "16370")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserUpdateReqVO extends UserBaseVO {
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "16370")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户密码(跟pwd)")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "生日")
|
||||
private Integer birthday;
|
||||
|
||||
@Schema(description = "身份证号码", example = "29961")
|
||||
private String cardId;
|
||||
|
||||
@Schema(description = "用户备注")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "合伙人id", example = "4234")
|
||||
private Integer partnerId;
|
||||
|
||||
@Schema(description = "用户分组id", example = "12625")
|
||||
private Integer groupId;
|
||||
|
||||
@Schema(description = "最后一次登录ip")
|
||||
private String lastIp;
|
||||
|
||||
@Schema(description = "连续签到天数", required = true)
|
||||
@NotNull(message = "连续签到天数不能为空")
|
||||
private Integer signNum;
|
||||
|
||||
@Schema(description = "等级", required = true)
|
||||
@NotNull(message = "等级不能为空")
|
||||
private Byte level;
|
||||
|
||||
@Schema(description = "推广元id", example = "5747")
|
||||
private Long spreadUid;
|
||||
|
||||
@Schema(description = "推广员关联时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime spreadTime;
|
||||
|
||||
@Schema(description = "用户类型", required = true, example = "1")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private String userType;
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.UserAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.UserAddressPageReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.UserAddressRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.UserAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.convert.useraddress.UserAddressConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import co.yixiang.yshop.module.member.service.useraddress.UserAddressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 用户地址")
|
||||
@RestController
|
||||
@RequestMapping("/member/user-address")
|
||||
@Validated
|
||||
public class UserAddressController {
|
||||
|
||||
@Resource
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户地址")
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:create')")
|
||||
public CommonResult<Long> createUserAddress(@Valid @RequestBody UserAddressCreateReqVO createReqVO) {
|
||||
return success(userAddressService.createUserAddress(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户地址")
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:update')")
|
||||
public CommonResult<Boolean> updateUserAddress(@Valid @RequestBody UserAddressUpdateReqVO updateReqVO) {
|
||||
userAddressService.updateUserAddress(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户地址")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:delete')")
|
||||
public CommonResult<Boolean> deleteUserAddress(@RequestParam("id") Long id) {
|
||||
userAddressService.deleteUserAddress(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户地址")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:query')")
|
||||
public CommonResult<UserAddressRespVO> getUserAddress(@RequestParam("id") Long id) {
|
||||
UserAddressDO userAddress = userAddressService.getUserAddress(id);
|
||||
return success(UserAddressConvert.INSTANCE.convert(userAddress));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户地址列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:query')")
|
||||
public CommonResult<List<UserAddressRespVO>> getUserAddressList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<UserAddressDO> list = userAddressService.getUserAddressList(ids);
|
||||
return success(UserAddressConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户地址分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:user-address:query')")
|
||||
public CommonResult<PageResult<UserAddressRespVO>> getUserAddressPage(@Valid UserAddressPageReqVO pageVO) {
|
||||
PageResult<UserAddressDO> pageResult = userAddressService.getUserAddressPage(pageVO);
|
||||
return success(UserAddressConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 用户地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class UserAddressBaseVO {
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "25124")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "收货人姓名", required = true, example = "李四")
|
||||
@NotNull(message = "收货人姓名不能为空")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "收货人电话", required = true)
|
||||
@NotNull(message = "收货人电话不能为空")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "收货人所在省", required = true)
|
||||
@NotNull(message = "收货人所在省不能为空")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "收货人所在市", required = true)
|
||||
@NotNull(message = "收货人所在市不能为空")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "城市id", example = "15595")
|
||||
private Integer cityId;
|
||||
|
||||
@Schema(description = "收货人所在区", required = true)
|
||||
@NotNull(message = "收货人所在区不能为空")
|
||||
private String district;
|
||||
|
||||
@Schema(description = "收货人详细地址", required = true)
|
||||
@NotNull(message = "收货人详细地址不能为空")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "邮编", required = true)
|
||||
@NotNull(message = "邮编不能为空")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "经度", required = true)
|
||||
@NotNull(message = "经度不能为空")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度", required = true)
|
||||
@NotNull(message = "纬度不能为空")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "是否默认", required = true)
|
||||
@NotNull(message = "是否默认不能为空")
|
||||
private Byte isDefault;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户地址创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserAddressCreateReqVO extends UserAddressBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户地址 Excel 导出 Request VO,参数和 UserAddressPageReqVO 是一致的")
|
||||
@Data
|
||||
public class UserAddressExportReqVO {
|
||||
|
||||
@Schema(description = "用户id", example = "25124")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "收货人姓名", example = "李四")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "收货人电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "收货人所在省")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "收货人所在市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "城市id", example = "15595")
|
||||
private Integer cityId;
|
||||
|
||||
@Schema(description = "收货人所在区")
|
||||
private String district;
|
||||
|
||||
@Schema(description = "收货人详细地址")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "邮编")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "是否默认")
|
||||
private Byte isDefault;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户地址分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserAddressPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户id", example = "25124")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "收货人姓名", example = "李四")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "收货人电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "收货人所在省")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "收货人所在市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "城市id", example = "15595")
|
||||
private Integer cityId;
|
||||
|
||||
@Schema(description = "收货人所在区")
|
||||
private String district;
|
||||
|
||||
@Schema(description = "收货人详细地址")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "邮编")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "是否默认")
|
||||
private Byte isDefault;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户地址 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserAddressRespVO extends UserAddressBaseVO {
|
||||
|
||||
@Schema(description = "用户地址id", required = true, example = "24169")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "添加时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.useraddress.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户地址更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserAddressUpdateReqVO extends UserAddressBaseVO {
|
||||
|
||||
@Schema(description = "用户地址id", required = true, example = "24169")
|
||||
@NotNull(message = "用户地址id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.member.controller.admin.userbill.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.userbill.UserBillDO;
|
||||
import co.yixiang.yshop.module.member.convert.userbill.UserBillConvert;
|
||||
import co.yixiang.yshop.module.member.service.userbill.UserBillService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户账单")
|
||||
@RestController
|
||||
@RequestMapping("/member/user-bill")
|
||||
@Validated
|
||||
public class UserBillController {
|
||||
|
||||
@Resource
|
||||
private UserBillService userBillService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 用户账单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class UserBillBaseVO {
|
||||
|
||||
@Schema(description = "用户uid", required = true, example = "9419")
|
||||
@NotNull(message = "用户uid不能为空")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "关联id", required = true, example = "18439")
|
||||
@NotNull(message = "关联id不能为空")
|
||||
private String linkId;
|
||||
|
||||
@Schema(description = "0 = 支出 1 = 获得", required = true)
|
||||
@NotNull(message = "0 = 支出 1 = 获得不能为空")
|
||||
private Byte pm;
|
||||
|
||||
@Schema(description = "账单标题", required = true)
|
||||
@NotNull(message = "账单标题不能为空")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "明细种类", required = true)
|
||||
@NotNull(message = "明细种类不能为空")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "明细类型", required = true, example = "2")
|
||||
@NotNull(message = "明细类型不能为空")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "明细数字", required = true)
|
||||
@NotNull(message = "明细数字不能为空")
|
||||
private BigDecimal number;
|
||||
|
||||
@Schema(description = "剩余", required = true)
|
||||
@NotNull(message = "剩余不能为空")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Schema(description = "备注", required = true)
|
||||
@NotNull(message = "备注不能为空")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "0 = 带确定 1 = 有效 -1 = 无效", required = true, example = "1")
|
||||
@NotNull(message = "0 = 带确定 1 = 有效 -1 = 无效不能为空")
|
||||
private Boolean status;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户账单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserBillCreateReqVO extends UserBillBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户账单 Excel 导出 Request VO,参数和 UserBillPageReqVO 是一致的")
|
||||
@Data
|
||||
public class UserBillExportReqVO {
|
||||
|
||||
@Schema(description = "用户uid", example = "9419")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "关联id", example = "18439")
|
||||
private String linkId;
|
||||
|
||||
@Schema(description = "0 = 支出 1 = 获得")
|
||||
private Byte pm;
|
||||
|
||||
@Schema(description = "账单标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "明细种类")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "明细类型", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "明细数字")
|
||||
private BigDecimal number;
|
||||
|
||||
@Schema(description = "剩余")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "0 = 带确定 1 = 有效 -1 = 无效", example = "1")
|
||||
private Boolean status;
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户账单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserBillPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户uid", example = "9419")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "关联id", example = "18439")
|
||||
private String linkId;
|
||||
|
||||
@Schema(description = "0 = 支出 1 = 获得")
|
||||
private Byte pm;
|
||||
|
||||
@Schema(description = "账单标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "明细种类")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "明细类型", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "明细数字")
|
||||
private BigDecimal number;
|
||||
|
||||
@Schema(description = "剩余")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "0 = 带确定 1 = 有效 -1 = 无效", example = "1")
|
||||
private Boolean status;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户账单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserBillRespVO extends UserBillBaseVO {
|
||||
|
||||
@Schema(description = "用户账单id", required = true, example = "22559")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "添加时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.userbill.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户账单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserBillUpdateReqVO extends UserBillBaseVO {
|
||||
|
||||
@Schema(description = "用户账单id", required = true, example = "22559")
|
||||
@NotNull(message = "用户账单id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
### 请求 /create 接口 => 成功
|
||||
POST {{appApi}}//member/address/create
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
||||
|
||||
{
|
||||
"name": "yunai",
|
||||
"mobile": "15601691300",
|
||||
"areaId": "610632",
|
||||
"postCode": "200000",
|
||||
"detailAddress": "yshop 233 号 666 室",
|
||||
"defaulted": true
|
||||
}
|
||||
|
||||
### 请求 /update 接口 => 成功
|
||||
PUT {{appApi}}//member/address/update
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
||||
|
||||
{
|
||||
"id": "1",
|
||||
"name": "yunai888",
|
||||
"mobile": "15601691300",
|
||||
"areaId": "610632",
|
||||
"postCode": "200000",
|
||||
"detailAddress": "yshop 233 号 666 室",
|
||||
"defaulted": false
|
||||
}
|
||||
|
||||
### 请求 /delete 接口 => 成功
|
||||
DELETE {{appApi}}//member/address/delete?id=2
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
||||
|
||||
### 请求 /get 接口 => 成功
|
||||
GET {{appApi}}//member/address/get?id=1
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
||||
|
||||
### 请求 /get-default 接口 => 成功
|
||||
GET {{appApi}}//member/address/get-default
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
||||
|
||||
### 请求 /list 接口 => 成功
|
||||
GET {{appApi}}//member/address/list
|
||||
Content-Type: application/json
|
||||
tenant-id: {{appTenentId}}
|
||||
Authorization: Bearer {{appToken}}
|
@ -1,75 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.convert.address.AddressConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
import co.yixiang.yshop.module.member.service.address.AddressService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "用户 APP - 用户收件地址")
|
||||
@RestController
|
||||
@RequestMapping("/member/address")
|
||||
@Validated
|
||||
public class AppAddressController {
|
||||
|
||||
@Resource
|
||||
private AddressService addressService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户收件地址")
|
||||
public CommonResult<Long> createAddress(@Valid @RequestBody AppAddressCreateReqVO createReqVO) {
|
||||
return success(addressService.createAddress(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户收件地址")
|
||||
public CommonResult<Boolean> updateAddress(@Valid @RequestBody AppAddressUpdateReqVO updateReqVO) {
|
||||
addressService.updateAddress(getLoginUserId(), updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户收件地址")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteAddress(@RequestParam("id") Long id) {
|
||||
addressService.deleteAddress(getLoginUserId(), id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户收件地址")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<AppAddressRespVO> getAddress(@RequestParam("id") Long id) {
|
||||
AddressDO address = addressService.getAddress(getLoginUserId(), id);
|
||||
return success(AddressConvert.INSTANCE.convert(address));
|
||||
}
|
||||
|
||||
@GetMapping("/get-default")
|
||||
@Operation(summary = "获得默认的用户收件地址")
|
||||
public CommonResult<AppAddressRespVO> getDefaultUserAddress() {
|
||||
AddressDO address = addressService.getDefaultUserAddress(getLoginUserId());
|
||||
return success(AddressConvert.INSTANCE.convert(address));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户收件地址列表")
|
||||
public CommonResult<List<AppAddressRespVO>> getAddressList() {
|
||||
List<AddressDO> list = addressService.getAddressList(getLoginUserId());
|
||||
return success(AddressConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2022
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.yshop.module.member.controller.app.address;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.ip.core.Area;
|
||||
import co.yixiang.yshop.framework.ip.core.utils.AreaUtils;
|
||||
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.param.AppAddressParam;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppUserAddressQueryVo;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AreaNodeRespVO;
|
||||
import co.yixiang.yshop.module.member.convert.useraddress.AreaConvert;
|
||||
import co.yixiang.yshop.module.member.service.useraddress.AppUserAddressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.USER_ADDRESS_PARAM_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户地前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2023-6-28
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Tag(name = "用户 APP - 用户地址")
|
||||
@RequestMapping("/address")
|
||||
public class AppUserAddressController {
|
||||
|
||||
private final AppUserAddressService appUserAddressService;
|
||||
|
||||
|
||||
@GetMapping("/city_list")
|
||||
@Operation(summary = "城市列表")
|
||||
public CommonResult<List<AreaNodeRespVO>> getTest() {
|
||||
Area area = AreaUtils.getArea(Area.ID_CHINA);
|
||||
Assert.notNull(area, "获取不到中国");
|
||||
return success(AreaConvert.INSTANCE.convertList(area.getChildren()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或修改地址
|
||||
*/
|
||||
@PreAuthenticated
|
||||
@PostMapping("/addAndEdit")
|
||||
@Operation(summary = "添加或修改地址")
|
||||
public CommonResult<Long> addYxUserAddress(@Valid @RequestBody AppAddressParam param){
|
||||
Long uid = getLoginUserId();
|
||||
Long id = appUserAddressService.addAndEdit(uid,param);
|
||||
return success(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
*/
|
||||
@PreAuthenticated
|
||||
@PostMapping("/default/set/{id}")
|
||||
@Parameter(name = "id", description = "地址id", required = true)
|
||||
@Operation(summary = "设置默认地址")
|
||||
public CommonResult<Boolean> setDefault(@PathVariable String id){
|
||||
Long uid = getLoginUserId();
|
||||
appUserAddressService.setDefault(uid,id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户地址
|
||||
*/
|
||||
@PreAuthenticated
|
||||
@PostMapping("/del/{id}")
|
||||
@Operation(summary = "删除用户地址")
|
||||
public CommonResult<Boolean> deleteYxUserAddress(@PathVariable String id){
|
||||
if(StrUtil.isBlank(id) || !NumberUtil.isNumber(id)){
|
||||
throw exception(USER_ADDRESS_PARAM_NOT_EXISTS);
|
||||
}
|
||||
appUserAddressService.removeById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户地址列表
|
||||
*/
|
||||
@PreAuthenticated
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "用户地址列表")
|
||||
public CommonResult<List<AppUserAddressQueryVo>> getYxUserAddressPageList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||
Long uid = getLoginUserId();
|
||||
return success(appUserAddressService.getList(uid,page,limit));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.param;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName AddressDetailParam
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2023/6/28
|
||||
**/
|
||||
@Data
|
||||
public class AddressDetailParam implements Serializable {
|
||||
|
||||
@Schema(description = "城市ID", required = true)
|
||||
private Integer cityId;
|
||||
|
||||
@Schema(description = "城市", required = true)
|
||||
private String city;
|
||||
|
||||
@Schema(description = "地区", required = true)
|
||||
private String district;
|
||||
|
||||
@Schema(description = "省份", required = true)
|
||||
private String province;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName AddressParam
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2023/6/28
|
||||
**/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class AppAddressParam implements Serializable {
|
||||
|
||||
@Schema(description = "地址ID", required = true)
|
||||
private String id;
|
||||
|
||||
@NotBlank
|
||||
@Size(min = 1, max = 30,message = "长度超过了限制")
|
||||
@Schema(description = "收货地址真实名字", required = true)
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "收货地址邮编", required = true)
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "是否默认收货地址 1是 0否", required = true)
|
||||
private Integer isDefault;
|
||||
|
||||
@NotBlank
|
||||
@Size(min = 1, max = 60,message = "长度超过了限制")
|
||||
@Schema(description = "收货详细地址", required = true)
|
||||
private String detail;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "收货手机号码", required = true)
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "收货地址详情", required = true)
|
||||
private AddressDetailParam address;
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class AppAddressBaseVO {
|
||||
|
||||
@Schema(description = "收件人名称", required = true)
|
||||
@NotNull(message = "收件人名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号", required = true)
|
||||
@NotNull(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区编号", required = true)
|
||||
@NotNull(message = "地区编号不能为空")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "邮编", required = true)
|
||||
@NotEmpty(message = "邮编不能为空")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "收件详细地址", required = true)
|
||||
@NotNull(message = "收件详细地址不能为空")
|
||||
private String detailAddress;
|
||||
|
||||
@Schema(description = "是否默认地址", required = true)
|
||||
@NotNull(message = "是否默认地址不能为空")
|
||||
private Boolean defaulted;
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "用户 APP - 用户收件地址创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AppAddressCreateReqVO extends AppAddressBaseVO {
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "用户 APP - 用户收件地址 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AppAddressRespVO extends AppAddressBaseVO {
|
||||
|
||||
@Schema(description = "编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "用户 APP - 用户收件地址更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AppAddressUpdateReqVO extends AppAddressBaseVO {
|
||||
|
||||
@Schema(description = "编号", required = true)
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户地址表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023-6-28
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户地址表查询参数")
|
||||
public class AppUserAddressQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户地址id", required = true, example = "24169")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "24169")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "收货人姓名", required = true, example = "24169")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "收货人电话", required = true, example = "24169")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "收货人所在省", required = true, example = "24169")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "收货人所在市", required = true, example = "24169")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "收货人所在区", required = true, example = "24169")
|
||||
private String district;
|
||||
|
||||
@Schema(description = "收货人详细地址", required = true, example = "24169")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "邮编", required = true, example = "24169")
|
||||
private Integer postCode;
|
||||
|
||||
@Schema(description = "经度", required = true, example = "24169")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度", required = true, example = "24169")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "是否默认", required = true, example = "24169")
|
||||
private Integer isDefault;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.address.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 地区节点 Response VO")
|
||||
@Data
|
||||
public class AreaNodeRespVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "110000")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名字", required = true, example = "北京")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<AreaNodeRespVO> children;
|
||||
|
||||
}
|
@ -7,6 +7,8 @@ import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserUpdateMobile
|
||||
import co.yixiang.yshop.module.member.convert.user.UserConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import co.yixiang.yshop.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -33,10 +35,17 @@ public class AppUserController {
|
||||
private MemberUserService userService;
|
||||
|
||||
@PutMapping("/update-nickname")
|
||||
@Operation(summary = "修改用户昵称")
|
||||
@Operation(summary = "修改用户昵称或者生日")
|
||||
@Parameters({
|
||||
@Parameter(name = "nickname", description = "用户昵称",
|
||||
required = true, example = "wang"),
|
||||
@Parameter(name = "birthday", description = "生日",
|
||||
required = true, example = "2023-11-12")
|
||||
})
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> updateUserNickname(@RequestParam("nickname") String nickname) {
|
||||
userService.updateUserNickname(getLoginUserId(), nickname);
|
||||
public CommonResult<Boolean> updateUserNickname(@RequestParam("nickname") String nickname,
|
||||
@RequestParam("birthday") String birthday) {
|
||||
userService.updateUserNickname(getLoginUserId(), nickname,birthday);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
public class AppUserInfoRespVO {
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "yshop")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", required = true, example = "yshop")
|
||||
private String nickname;
|
||||
|
||||
@ -19,4 +22,7 @@ public class AppUserInfoRespVO {
|
||||
|
||||
@Schema(description = "用户手机号", required = true, example = "15601691300")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "生日", required = true, example = "2023-10-11")
|
||||
private String birthday;
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName OrderCountDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2023/6/18
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Schema(description = "用户 APP - 用户 OrderCountDTO")
|
||||
public class AppUserOrderCountVo implements Serializable {
|
||||
|
||||
/**订单支付没有退款 数量*/
|
||||
@Schema(description = "订单支付没有退款数量", required = true)
|
||||
private Long orderCount;
|
||||
|
||||
/**订单支付没有退款 支付总金额*/
|
||||
@Schema(description = "订单支付没有退款支付总金额", required = true)
|
||||
private Double sumPrice;
|
||||
|
||||
/**订单待支付 数量*/
|
||||
@Schema(description = "订单待支付数量", required = true)
|
||||
private Long unpaidCount;
|
||||
|
||||
/**订单待发货数量*/
|
||||
@Schema(description = "订单待发货数量", required = true)
|
||||
private Long unshippedCount;
|
||||
|
||||
/**订单待收货数量*/
|
||||
@Schema(description = "订单待收货数量", required = true)
|
||||
private Long receivedCount;
|
||||
|
||||
/**订单待评价数量*/
|
||||
@Schema(description = "订单待评价数量", required = true)
|
||||
private Long evaluatedCount;
|
||||
|
||||
/**订单已完成数量*/
|
||||
@Schema(description = "订单已完成数量", required = true)
|
||||
private Long completeCount;
|
||||
|
||||
/**订单退款数量*/
|
||||
@Schema(description = "订单退款数量", required = true)
|
||||
private Long refundCount;
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package co.yixiang.yshop.module.member.controller.app.user.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023-6-18
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户 APP - 用户表查 Response VO")
|
||||
public class AppUserQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户id", required = true)
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "用户账户(跟accout一样)\"", required = true)
|
||||
private String username;
|
||||
|
||||
@Schema(description = "用户账号", required = true)
|
||||
private String account;
|
||||
|
||||
@Schema(description = "优惠券数量", required = true)
|
||||
private Long couponCount = 0L;
|
||||
|
||||
@Schema(description = "订单详情数据", required = true)
|
||||
private AppUserOrderCountVo orderStatusNum;
|
||||
|
||||
|
||||
private Integer statu;
|
||||
|
||||
@Schema(description = "总的签到天数", required = true)
|
||||
private Long sumSignDay;
|
||||
|
||||
@Schema(description = "当天是否签到", required = true)
|
||||
private Boolean isDaySign;
|
||||
|
||||
@Schema(description = "昨天是否签到", required = true)
|
||||
private Boolean isYesterDaySign;
|
||||
|
||||
@Schema(description = "核销权限", required = true)
|
||||
private Boolean checkStatus;
|
||||
|
||||
@Schema(description = "用户昵称", required = true)
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户头像", required = true)
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "手机号码", required = true)
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "用户余额", required = true)
|
||||
private BigDecimal nowMoney;
|
||||
|
||||
@Schema(description = "佣金金额", required = true)
|
||||
private BigDecimal brokeragePrice;
|
||||
|
||||
@Schema(description = "用户剩余积分", required = true)
|
||||
private BigDecimal integral;
|
||||
|
||||
@Schema(description = "连续签到天数", required = true)
|
||||
private Integer signNum;
|
||||
|
||||
@Schema(description = "推广元id", required = true)
|
||||
private Long spreadUid;
|
||||
|
||||
@Schema(description = "用户类型", required = true)
|
||||
private String userType;
|
||||
|
||||
@Schema(description = "是否为推广员", required = true)
|
||||
private Integer isPromoter;
|
||||
|
||||
@Schema(description = "用户购买次数", required = true)
|
||||
private Integer payCount;
|
||||
|
||||
@Schema(description = "下级人数", required = true)
|
||||
private Integer spreadCount;
|
||||
|
||||
@Schema(description = "详细地址", required = true)
|
||||
private String addres;
|
||||
|
||||
|
||||
@Schema(description = "用户登陆类型,h5,wechat,routine", required = true)
|
||||
private String loginType;
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.convert.address;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.member.api.address.dto.AddressRespDTO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface AddressConvert {
|
||||
|
||||
AddressConvert INSTANCE = Mappers.getMapper(AddressConvert.class);
|
||||
|
||||
AddressDO convert(AppAddressCreateReqVO bean);
|
||||
|
||||
AddressDO convert(AppAddressUpdateReqVO bean);
|
||||
|
||||
AppAddressRespVO convert(AddressDO bean);
|
||||
|
||||
List<AppAddressRespVO> convertList(List<AddressDO> list);
|
||||
|
||||
PageResult<AppAddressRespVO> convertPage(PageResult<AddressDO> page);
|
||||
|
||||
AddressRespDTO convert02(AddressDO bean);
|
||||
|
||||
}
|
@ -1,7 +1,12 @@
|
||||
package co.yixiang.yshop.module.member.convert.user;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserInfoRespVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserQueryVo;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@ -17,6 +22,18 @@ public interface UserConvert {
|
||||
|
||||
MemberUserRespDTO convert2(MemberUserDO bean);
|
||||
|
||||
AppUserQueryVo convert3(MemberUserDO bean);
|
||||
|
||||
List<MemberUserRespDTO> convertList2(List<MemberUserDO> list);
|
||||
|
||||
MemberUserDO convert(UserCreateReqVO bean);
|
||||
|
||||
MemberUserDO convert(UserUpdateReqVO bean);
|
||||
|
||||
UserRespVO convert(MemberUserDO bean,Boolean bool);
|
||||
|
||||
List<UserRespVO> convertList(List<MemberUserDO> list);
|
||||
|
||||
PageResult<UserRespVO> convertPage(PageResult<MemberUserDO> page);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package co.yixiang.yshop.module.member.convert.useraddress;
|
||||
|
||||
import co.yixiang.yshop.framework.ip.core.Area;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AreaNodeRespVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AreaConvert {
|
||||
|
||||
AreaConvert INSTANCE = Mappers.getMapper(AreaConvert.class);
|
||||
|
||||
List<AreaNodeRespVO> convertList(List<Area> list);
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package co.yixiang.yshop.module.member.convert.useraddress;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppUserAddressQueryVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
|
||||
/**
|
||||
* 用户地址 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressConvert {
|
||||
|
||||
UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class);
|
||||
|
||||
UserAddressDO convert(UserAddressCreateReqVO bean);
|
||||
|
||||
UserAddressDO convert(UserAddressUpdateReqVO bean);
|
||||
|
||||
UserAddressRespVO convert(UserAddressDO bean);
|
||||
|
||||
List<UserAddressRespVO> convertList(List<UserAddressDO> list);
|
||||
|
||||
List<AppUserAddressQueryVo> convertList02(List<UserAddressDO> list);
|
||||
|
||||
PageResult<UserAddressRespVO> convertPage(PageResult<UserAddressDO> page);
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package co.yixiang.yshop.module.member.convert.userbill;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import co.yixiang.yshop.module.member.controller.admin.userbill.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.userbill.UserBillDO;
|
||||
|
||||
/**
|
||||
* 用户账单 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserBillConvert {
|
||||
|
||||
UserBillConvert INSTANCE = Mappers.getMapper(UserBillConvert.class);
|
||||
|
||||
UserBillDO convert(UserBillCreateReqVO bean);
|
||||
|
||||
UserBillDO convert(UserBillUpdateReqVO bean);
|
||||
|
||||
UserBillRespVO convert(UserBillDO bean);
|
||||
|
||||
List<UserBillRespVO> convertList(List<UserBillDO> list);
|
||||
|
||||
PageResult<UserBillRespVO> convertPage(PageResult<UserBillDO> page);
|
||||
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
<https://www.yixiang.co/Spring-Boot/MapStruct/?yshop>
|
@ -1,58 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.dal.dataobject.address;
|
||||
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 用户收件地址 DO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("member_address")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AddressDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 地区编号
|
||||
*/
|
||||
private Long areaId;
|
||||
/**
|
||||
* 邮编
|
||||
*/
|
||||
private String postCode;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
/**
|
||||
* 是否默认
|
||||
*
|
||||
* true - 默认收件地址
|
||||
*/
|
||||
private Boolean defaulted;
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@ -17,7 +18,7 @@ import java.time.LocalDateTime;
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName(value = "member_user", autoResultMap = true)
|
||||
@TableName(value = "yshop_user", autoResultMap = true)
|
||||
@KeySequence("member_user_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -69,10 +70,104 @@ public class MemberUserDO extends TenantBaseDO {
|
||||
*/
|
||||
private LocalDateTime loginDate;
|
||||
|
||||
// TODO yshop:name 真实名字;
|
||||
// TODO yshop:email 邮箱;
|
||||
// TODO yshop:gender 性别;
|
||||
// TODO yshop:score 积分;
|
||||
// TODO yshop:payPassword 支付密码;
|
||||
/**
|
||||
* 用户账户(跟accout一样)
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
private String realName;
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private String birthday;
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String cardId;
|
||||
/**
|
||||
* 用户备注
|
||||
*/
|
||||
private String mark;
|
||||
/**
|
||||
* 合伙人id
|
||||
*/
|
||||
private Integer partnerId;
|
||||
/**
|
||||
* 用户分组id
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 添加ip
|
||||
*/
|
||||
private String addIp;
|
||||
/**
|
||||
* 最后一次登录ip
|
||||
*/
|
||||
private String lastIp;
|
||||
/**
|
||||
* 用户余额
|
||||
*/
|
||||
private BigDecimal nowMoney;
|
||||
/**
|
||||
* 佣金金额
|
||||
*/
|
||||
private BigDecimal brokeragePrice;
|
||||
/**
|
||||
* 用户剩余积分
|
||||
*/
|
||||
private BigDecimal integral;
|
||||
/**
|
||||
* 连续签到天数
|
||||
*/
|
||||
private Integer signNum;
|
||||
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 推广元id
|
||||
*/
|
||||
private Long spreadUid;
|
||||
/**
|
||||
* 推广员关联时间
|
||||
*/
|
||||
private LocalDateTime spreadTime;
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
/**
|
||||
* 是否为推广员
|
||||
*/
|
||||
private Integer isPromoter;
|
||||
/**
|
||||
* 用户购买次数
|
||||
*/
|
||||
private Integer payCount;
|
||||
/**
|
||||
* 下级人数
|
||||
*/
|
||||
private Integer spreadCount;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String addres;
|
||||
/**
|
||||
* 管理员编号
|
||||
*/
|
||||
private Integer adminid;
|
||||
/**
|
||||
* 用户登陆类型,h5,wechat,routine
|
||||
*/
|
||||
private String loginType;
|
||||
/**
|
||||
* 微信用户json信息
|
||||
*/
|
||||
private String wxProfile;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
package co.yixiang.yshop.module.member.dal.dataobject.useraddress;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户地址 DO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("yshop_user_address")
|
||||
@KeySequence("yshop_user_address_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserAddressDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 用户地址id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long uid;
|
||||
/**
|
||||
* 收货人姓名
|
||||
*/
|
||||
private String realName;
|
||||
/**
|
||||
* 收货人电话
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 收货人所在省
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 收货人所在市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 城市id
|
||||
*/
|
||||
private Integer cityId;
|
||||
/**
|
||||
* 收货人所在区
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 收货人详细地址
|
||||
*/
|
||||
private String detail;
|
||||
/**
|
||||
* 邮编
|
||||
*/
|
||||
private String postCode;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package co.yixiang.yshop.module.member.dal.dataobject.userbill;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户账单 DO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("yshop_user_bill")
|
||||
@KeySequence("yshop_user_bill_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserBillDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 用户账单id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户uid
|
||||
*/
|
||||
private Long uid;
|
||||
/**
|
||||
* 关联id
|
||||
*/
|
||||
private String linkId;
|
||||
/**
|
||||
* 0 = 支出 1 = 获得
|
||||
*/
|
||||
private Integer pm;
|
||||
/**
|
||||
* 账单标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 明细种类
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 明细类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 明细数字
|
||||
*/
|
||||
private BigDecimal number;
|
||||
/**
|
||||
* 剩余
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String mark;
|
||||
/**
|
||||
* 0 = 带确定 1 = 有效 -1 = 无效
|
||||
*/
|
||||
private Boolean status;
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.dal.mysql.address;
|
||||
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AddressMapper extends BaseMapperX<AddressDO> {
|
||||
|
||||
default AddressDO selectByIdAndUserId(Long id, Long userId) {
|
||||
return selectOne(AddressDO::getId, id, AddressDO::getUserId, userId);
|
||||
}
|
||||
|
||||
default List<AddressDO> selectListByUserIdAndDefaulted(Long userId, Boolean defaulted) {
|
||||
return selectList(new LambdaQueryWrapperX<AddressDO>().eq(AddressDO::getUserId, userId)
|
||||
.eqIfPresent(AddressDO::getDefaulted, defaulted));
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,16 @@
|
||||
package co.yixiang.yshop.module.member.dal.mysql.user;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserExportReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.UserPageReqVO;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -24,4 +30,32 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
|
||||
.likeIfPresent(MemberUserDO::getNickname, nickname));
|
||||
}
|
||||
|
||||
default PageResult<MemberUserDO> selectPage(UserPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberUserDO>()
|
||||
.likeIfPresent(MemberUserDO::getUsername, reqVO.getUsername())
|
||||
.likeIfPresent(MemberUserDO::getRealName, reqVO.getRealName())
|
||||
.likeIfPresent(MemberUserDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(MemberUserDO::getMobile, reqVO.getPhone())
|
||||
.betweenIfPresent(MemberUserDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberUserDO::getId));
|
||||
}
|
||||
|
||||
default List<MemberUserDO> selectList(UserExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MemberUserDO>()
|
||||
.likeIfPresent(MemberUserDO::getUsername, reqVO.getUsername())
|
||||
.likeIfPresent(MemberUserDO::getRealName, reqVO.getRealName())
|
||||
.likeIfPresent(MemberUserDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(MemberUserDO::getMobile, reqVO.getPhone())
|
||||
.betweenIfPresent(MemberUserDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberUserDO::getId));
|
||||
}
|
||||
|
||||
@Update("update yshop_user set now_money=now_money-#{payPrice}" +
|
||||
" where id=#{uid}")
|
||||
int decPrice(@Param("payPrice") BigDecimal payPrice, @Param("uid") Long uid);
|
||||
|
||||
@Update("update yshop_user set pay_count=pay_count+1" +
|
||||
" where id=#{uid}")
|
||||
int incPayCount(@Param("uid") Long uid);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package co.yixiang.yshop.module.member.dal.mysql.useraddress;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.*;
|
||||
|
||||
/**
|
||||
* 用户地址 Mapper
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressMapper extends BaseMapperX<UserAddressDO> {
|
||||
|
||||
default PageResult<UserAddressDO> selectPage(UserAddressPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<UserAddressDO>()
|
||||
.eqIfPresent(UserAddressDO::getUid, reqVO.getUid())
|
||||
.likeIfPresent(UserAddressDO::getRealName, reqVO.getRealName())
|
||||
.eqIfPresent(UserAddressDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(UserAddressDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(UserAddressDO::getCity, reqVO.getCity())
|
||||
.eqIfPresent(UserAddressDO::getCityId, reqVO.getCityId())
|
||||
.eqIfPresent(UserAddressDO::getDistrict, reqVO.getDistrict())
|
||||
.eqIfPresent(UserAddressDO::getDetail, reqVO.getDetail())
|
||||
.eqIfPresent(UserAddressDO::getPostCode, reqVO.getPostCode())
|
||||
.eqIfPresent(UserAddressDO::getLongitude, reqVO.getLongitude())
|
||||
.eqIfPresent(UserAddressDO::getLatitude, reqVO.getLatitude())
|
||||
.eqIfPresent(UserAddressDO::getIsDefault, reqVO.getIsDefault())
|
||||
.betweenIfPresent(UserAddressDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(UserAddressDO::getId));
|
||||
}
|
||||
|
||||
default List<UserAddressDO> selectList(UserAddressExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<UserAddressDO>()
|
||||
.eqIfPresent(UserAddressDO::getUid, reqVO.getUid())
|
||||
.likeIfPresent(UserAddressDO::getRealName, reqVO.getRealName())
|
||||
.eqIfPresent(UserAddressDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(UserAddressDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(UserAddressDO::getCity, reqVO.getCity())
|
||||
.eqIfPresent(UserAddressDO::getCityId, reqVO.getCityId())
|
||||
.eqIfPresent(UserAddressDO::getDistrict, reqVO.getDistrict())
|
||||
.eqIfPresent(UserAddressDO::getDetail, reqVO.getDetail())
|
||||
.eqIfPresent(UserAddressDO::getPostCode, reqVO.getPostCode())
|
||||
.eqIfPresent(UserAddressDO::getLongitude, reqVO.getLongitude())
|
||||
.eqIfPresent(UserAddressDO::getLatitude, reqVO.getLatitude())
|
||||
.eqIfPresent(UserAddressDO::getIsDefault, reqVO.getIsDefault())
|
||||
.betweenIfPresent(UserAddressDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(UserAddressDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.module.member.dal.mysql.userbill;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.userbill.UserBillDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import co.yixiang.yshop.module.member.controller.admin.userbill.vo.*;
|
||||
|
||||
/**
|
||||
* 用户账单 Mapper
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserBillMapper extends BaseMapperX<UserBillDO> {
|
||||
|
||||
default PageResult<UserBillDO> selectPage(UserBillPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<UserBillDO>()
|
||||
.eqIfPresent(UserBillDO::getUid, reqVO.getUid())
|
||||
.eqIfPresent(UserBillDO::getLinkId, reqVO.getLinkId())
|
||||
.eqIfPresent(UserBillDO::getPm, reqVO.getPm())
|
||||
.eqIfPresent(UserBillDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(UserBillDO::getCategory, reqVO.getCategory())
|
||||
.eqIfPresent(UserBillDO::getType, reqVO.getType())
|
||||
.eqIfPresent(UserBillDO::getNumber, reqVO.getNumber())
|
||||
.eqIfPresent(UserBillDO::getBalance, reqVO.getBalance())
|
||||
.eqIfPresent(UserBillDO::getMark, reqVO.getMark())
|
||||
.betweenIfPresent(UserBillDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(UserBillDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(UserBillDO::getId));
|
||||
}
|
||||
|
||||
default List<UserBillDO> selectList(UserBillExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<UserBillDO>()
|
||||
.eqIfPresent(UserBillDO::getUid, reqVO.getUid())
|
||||
.eqIfPresent(UserBillDO::getLinkId, reqVO.getLinkId())
|
||||
.eqIfPresent(UserBillDO::getPm, reqVO.getPm())
|
||||
.eqIfPresent(UserBillDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(UserBillDO::getCategory, reqVO.getCategory())
|
||||
.eqIfPresent(UserBillDO::getType, reqVO.getType())
|
||||
.eqIfPresent(UserBillDO::getNumber, reqVO.getNumber())
|
||||
.eqIfPresent(UserBillDO::getBalance, reqVO.getBalance())
|
||||
.eqIfPresent(UserBillDO::getMark, reqVO.getMark())
|
||||
.betweenIfPresent(UserBillDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(UserBillDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(UserBillDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.service.address;
|
||||
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface AddressService {
|
||||
|
||||
/**
|
||||
* 创建用户收件地址
|
||||
*
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAddress(Long userId, @Valid AppAddressCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户收件地址
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAddress(Long userId, @Valid AppAddressUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户收件地址
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAddress(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 获得用户收件地址
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户收件地址
|
||||
*/
|
||||
AddressDO getAddress(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 获得用户收件地址列表
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @return 用户收件地址列表
|
||||
*/
|
||||
List<AddressDO> getAddressList(Long userId);
|
||||
|
||||
/**
|
||||
* 获得用户默认的收件地址
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @return 用户收件地址
|
||||
*/
|
||||
AddressDO getDefaultUserAddress(Long userId);
|
||||
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.service.address;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.convert.address.AddressConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.address.AddressMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.ADDRESS_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AddressServiceImpl implements AddressService {
|
||||
|
||||
@Resource
|
||||
private AddressMapper addressMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createAddress(Long userId, AppAddressCreateReqVO createReqVO) {
|
||||
// 如果添加的是默认收件地址,则将原默认地址修改为非默认
|
||||
if (Boolean.TRUE.equals(createReqVO.getDefaulted())) {
|
||||
List<AddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||
addresses.forEach(address -> addressMapper.updateById(new AddressDO().setId(address.getId()).setDefaulted(false)));
|
||||
}
|
||||
|
||||
// 插入
|
||||
AddressDO address = AddressConvert.INSTANCE.convert(createReqVO);
|
||||
address.setUserId(userId);
|
||||
addressMapper.insert(address);
|
||||
// 返回
|
||||
return address.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAddress(Long userId, AppAddressUpdateReqVO updateReqVO) {
|
||||
// 校验存在,校验是否能够操作
|
||||
validAddressExists(userId, updateReqVO.getId());
|
||||
|
||||
// 如果修改的是默认收件地址,则将原默认地址修改为非默认
|
||||
if (Boolean.TRUE.equals(updateReqVO.getDefaulted())) {
|
||||
List<AddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||
addresses.stream().filter(u -> !u.getId().equals(updateReqVO.getId())) // 排除自己
|
||||
.forEach(address -> addressMapper.updateById(new AddressDO().setId(address.getId()).setDefaulted(false)));
|
||||
}
|
||||
|
||||
// 更新
|
||||
AddressDO updateObj = AddressConvert.INSTANCE.convert(updateReqVO);
|
||||
addressMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAddress(Long userId, Long id) {
|
||||
// 校验存在,校验是否能够操作
|
||||
validAddressExists(userId, id);
|
||||
// 删除
|
||||
addressMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validAddressExists(Long userId, Long id) {
|
||||
AddressDO addressDO = getAddress(userId, id);
|
||||
if (addressDO == null) {
|
||||
throw exception(ADDRESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressDO getAddress(Long userId, Long id) {
|
||||
return addressMapper.selectByIdAndUserId(id, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AddressDO> getAddressList(Long userId) {
|
||||
return addressMapper.selectListByUserIdAndDefaulted(userId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressDO getDefaultUserAddress(Long userId) {
|
||||
List<AddressDO> addresses = addressMapper.selectListByUserIdAndDefaulted(userId, true);
|
||||
return CollUtil.getFirst(addresses);
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,13 @@
|
||||
package co.yixiang.yshop.module.member.service.user;
|
||||
|
||||
import co.yixiang.yshop.framework.common.validation.Mobile;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserQueryVo;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -13,7 +16,8 @@ import java.util.List;
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface MemberUserService {
|
||||
public interface MemberUserService extends IService<MemberUserDO> {
|
||||
|
||||
|
||||
/**
|
||||
* 通过手机查询用户
|
||||
@ -57,6 +61,29 @@ public interface MemberUserService {
|
||||
*/
|
||||
MemberUserDO getUser(Long id);
|
||||
|
||||
/**
|
||||
* 通过用户 ID 查询用户
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
AppUserQueryVo getAppUser(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 减去用户余额
|
||||
* @param uid uid
|
||||
* @param payPrice 金额
|
||||
*/
|
||||
void decPrice(Long uid, BigDecimal payPrice);
|
||||
|
||||
|
||||
/**
|
||||
* 增加购买次数
|
||||
* @param uid uid
|
||||
*/
|
||||
void incPayCount(Long uid);
|
||||
|
||||
/**
|
||||
* 通过用户 ID 查询用户们
|
||||
*
|
||||
@ -70,7 +97,7 @@ public interface MemberUserService {
|
||||
* @param userId 用户id
|
||||
* @param nickname 用户新昵称
|
||||
*/
|
||||
void updateUserNickname(Long userId, String nickname);
|
||||
void updateUserNickname(Long userId, String nickname,String birthday);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
|
@ -4,21 +4,26 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import co.yixiang.yshop.framework.common.enums.CommonStatusEnum;
|
||||
import co.yixiang.yshop.module.infra.api.file.FileApi;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserQueryVo;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
import co.yixiang.yshop.module.member.convert.user.UserConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import co.yixiang.yshop.module.system.api.sms.SmsCodeApi;
|
||||
import co.yixiang.yshop.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import co.yixiang.yshop.module.system.enums.sms.SmsSceneEnum;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -36,7 +41,7 @@ import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.USER_NOT_E
|
||||
@Service
|
||||
@Valid
|
||||
@Slf4j
|
||||
public class MemberUserServiceImpl implements MemberUserService {
|
||||
public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper,MemberUserDO> implements MemberUserService {
|
||||
|
||||
@Resource
|
||||
private MemberUserMapper memberUserMapper;
|
||||
@ -49,6 +54,8 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public MemberUserDO getUserByMobile(String mobile) {
|
||||
return memberUserMapper.selectByMobile(mobile);
|
||||
@ -94,21 +101,48 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
return memberUserMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserQueryVo getAppUser(Long id){
|
||||
return UserConvert.INSTANCE.convert3(memberUserMapper.selectById(id));
|
||||
}
|
||||
/**
|
||||
* 减去用户余额
|
||||
* @param uid uid
|
||||
* @param payPrice 金额
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public void decPrice(Long uid, BigDecimal payPrice) {
|
||||
memberUserMapper.decPrice(payPrice,uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加购买次数
|
||||
* @param uid uid
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public void incPayCount(Long uid) {
|
||||
memberUserMapper.incPayCount(uid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MemberUserDO> getUserList(Collection<Long> ids) {
|
||||
return memberUserMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserNickname(Long userId, String nickname) {
|
||||
public void updateUserNickname(Long userId, String nickname,String birthday) {
|
||||
MemberUserDO user = this.checkUserExists(userId);
|
||||
// 仅当新昵称不等于旧昵称时进行修改
|
||||
if (nickname.equals(user.getNickname())){
|
||||
return;
|
||||
}
|
||||
// if (nickname.equals(user.getNickname())){
|
||||
// return;
|
||||
// }
|
||||
MemberUserDO userDO = new MemberUserDO();
|
||||
userDO.setId(user.getId());
|
||||
userDO.setNickname(nickname);
|
||||
userDO.setBirthday(birthday);
|
||||
memberUserMapper.updateById(userDO);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
package co.yixiang.yshop.module.member.service.user;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createUser(@Valid UserCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateUser(@Valid UserUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteUser(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户
|
||||
*/
|
||||
MemberUserDO getUser(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<MemberUserDO> getUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户分页
|
||||
*/
|
||||
PageResult<MemberUserDO> getUserPage(UserPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<MemberUserDO> getUserList(UserExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package co.yixiang.yshop.module.member.service.user;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.user.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.member.convert.user.UserConvert;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.user.MemberUserMapper;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Resource
|
||||
private MemberUserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public Long createUser(UserCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberUserDO user = UserConvert.INSTANCE.convert(createReqVO);
|
||||
userMapper.insert(user);
|
||||
// 返回
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(UserUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateUserExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberUserDO updateObj = UserConvert.INSTANCE.convert(updateReqVO);
|
||||
userMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(Long id) {
|
||||
// 校验存在
|
||||
validateUserExists(id);
|
||||
// 删除
|
||||
userMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateUserExists(Long id) {
|
||||
if (userMapper.selectById(id) == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberUserDO getUser(Long id) {
|
||||
return userMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberUserDO> getUserList(Collection<Long> ids) {
|
||||
return userMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberUserDO> getUserPage(UserPageReqVO pageReqVO) {
|
||||
return userMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberUserDO> getUserList(UserExportReqVO exportReqVO) {
|
||||
return userMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package co.yixiang.yshop.module.member.service.useraddress;
|
||||
|
||||
import co.yixiang.yshop.module.member.controller.app.address.param.AppAddressParam;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppUserAddressQueryVo;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface AppUserAddressService extends IService<UserAddressDO> {
|
||||
|
||||
/**
|
||||
* 添加或者修改地址
|
||||
* @param uid uid
|
||||
* @param param AddressParam
|
||||
*/
|
||||
Long addAndEdit(Long uid, AppAddressParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param uid uid
|
||||
* @param addressId 地址id
|
||||
*/
|
||||
void setDefault(Long uid,String addressId);
|
||||
|
||||
/**
|
||||
* 获取用户地址
|
||||
* @param uid uid
|
||||
* @param page page
|
||||
* @param limit limit
|
||||
* @return List
|
||||
*/
|
||||
List<AppUserAddressQueryVo> getList(Long uid, int page, int limit);
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package co.yixiang.yshop.module.member.service.useraddress;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.yshop.framework.common.enums.ShopCommonEnum;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.param.AppAddressParam;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppUserAddressQueryVo;
|
||||
import co.yixiang.yshop.module.member.convert.useraddress.UserAddressConvert;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.useraddress.UserAddressMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.USER_ADDRESS_NOT_EXISTS;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.USER_ADDRESS_PARAM_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 用户地址 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AppUserAddressServiceImpl extends ServiceImpl<UserAddressMapper,UserAddressDO> implements AppUserAddressService {
|
||||
|
||||
@Resource
|
||||
private UserAddressMapper userAddressMapper;
|
||||
|
||||
/**
|
||||
* 添加或者修改地址
|
||||
* @param uid uid
|
||||
* @param param AddressParam
|
||||
* @return id 地址id
|
||||
*/
|
||||
@Override
|
||||
public Long addAndEdit(Long uid, AppAddressParam param){
|
||||
UserAddressDO userAddress = UserAddressDO.builder()
|
||||
.city(param.getAddress().getCity())
|
||||
.cityId(param.getAddress().getCityId())
|
||||
.district(param.getAddress().getDistrict())
|
||||
.province(param.getAddress().getProvince())
|
||||
.detail(param.getDetail())
|
||||
.uid(uid)
|
||||
.isDefault(param.getIsDefault())
|
||||
.phone(param.getPhone())
|
||||
.postCode(param.getPostCode())
|
||||
.realName(param.getRealName())
|
||||
.build();
|
||||
if(StrUtil.isBlank(param.getId())){
|
||||
this.save(userAddress);
|
||||
}else{
|
||||
userAddress.setId(Long.valueOf(param.getId()));
|
||||
this.updateById(userAddress);
|
||||
}
|
||||
|
||||
return userAddress.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param uid uid
|
||||
* @param addressId 地址id
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(Long uid,String addressId){
|
||||
if(StrUtil.isBlank(addressId) || !NumberUtil.isNumber(addressId)){
|
||||
throw exception(USER_ADDRESS_PARAM_NOT_EXISTS);
|
||||
}
|
||||
UserAddressDO address = new UserAddressDO();
|
||||
address.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue());
|
||||
userAddressMapper.update(address,
|
||||
new LambdaQueryWrapper<UserAddressDO>().eq(UserAddressDO::getUid,uid));
|
||||
|
||||
UserAddressDO userAddress = new UserAddressDO();
|
||||
userAddress.setIsDefault(ShopCommonEnum.DEFAULT_1.getValue());
|
||||
userAddress.setId(Long.valueOf(addressId));
|
||||
userAddressMapper.updateById(userAddress);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户地址
|
||||
* @param uid uid
|
||||
* @param page page
|
||||
* @param limit limit
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<AppUserAddressQueryVo> getList(Long uid, int page, int limit){
|
||||
Page<UserAddressDO> pageModel = new Page<>(page, limit);
|
||||
IPage<UserAddressDO> pageList = this.lambdaQuery().eq(UserAddressDO::getUid,uid).page(pageModel);
|
||||
return UserAddressConvert.INSTANCE.convertList02(pageList.getRecords());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package co.yixiang.yshop.module.member.service.useraddress;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户地址 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface UserAddressService {
|
||||
|
||||
/**
|
||||
* 创建用户地址
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createUserAddress(@Valid UserAddressCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户地址
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateUserAddress(@Valid UserAddressUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户地址
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteUserAddress(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户地址
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户地址
|
||||
*/
|
||||
UserAddressDO getUserAddress(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户地址列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户地址列表
|
||||
*/
|
||||
List<UserAddressDO> getUserAddressList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户地址分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户地址分页
|
||||
*/
|
||||
PageResult<UserAddressDO> getUserAddressPage(UserAddressPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户地址列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户地址列表
|
||||
*/
|
||||
List<UserAddressDO> getUserAddressList(UserAddressExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package co.yixiang.yshop.module.member.service.useraddress;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.useraddress.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.useraddress.UserAddressDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.member.convert.useraddress.UserAddressConvert;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.useraddress.UserAddressMapper;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户地址 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class UserAddressServiceImpl implements UserAddressService {
|
||||
|
||||
@Resource
|
||||
private UserAddressMapper userAddressMapper;
|
||||
|
||||
@Override
|
||||
public Long createUserAddress(UserAddressCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
UserAddressDO userAddress = UserAddressConvert.INSTANCE.convert(createReqVO);
|
||||
userAddressMapper.insert(userAddress);
|
||||
// 返回
|
||||
return userAddress.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserAddress(UserAddressUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateUserAddressExists(updateReqVO.getId());
|
||||
// 更新
|
||||
UserAddressDO updateObj = UserAddressConvert.INSTANCE.convert(updateReqVO);
|
||||
userAddressMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserAddress(Long id) {
|
||||
// 校验存在
|
||||
validateUserAddressExists(id);
|
||||
// 删除
|
||||
userAddressMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateUserAddressExists(Long id) {
|
||||
if (userAddressMapper.selectById(id) == null) {
|
||||
throw exception(USER_ADDRESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAddressDO getUserAddress(Long id) {
|
||||
return userAddressMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAddressDO> getUserAddressList(Collection<Long> ids) {
|
||||
return userAddressMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<UserAddressDO> getUserAddressPage(UserAddressPageReqVO pageReqVO) {
|
||||
return userAddressMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAddressDO> getUserAddressList(UserAddressExportReqVO exportReqVO) {
|
||||
return userAddressMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package co.yixiang.yshop.module.member.service.userbill;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.userbill.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.userbill.UserBillDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户账单 Service 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface UserBillService {
|
||||
|
||||
/**
|
||||
* 增加支出流水
|
||||
* @param uid uid
|
||||
* @param title 账单标题
|
||||
* @param category 明细种类
|
||||
* @param type 明细类型
|
||||
* @param number 明细数字
|
||||
* @param balance 剩余
|
||||
* @param mark 备注
|
||||
*/
|
||||
void expend(Long uid,String title,String category,String type,double number,double balance,String mark);
|
||||
|
||||
/**
|
||||
* 增加收入/支入流水
|
||||
* @param uid uid
|
||||
* @param title 账单标题
|
||||
* @param category 明细种类
|
||||
* @param type 明细类型
|
||||
* @param number 明细数字
|
||||
* @param balance 剩余
|
||||
* @param mark 备注
|
||||
* @param linkid 关联id
|
||||
*/
|
||||
void income(Long uid,String title,String category,String type,double number,
|
||||
double balance,String mark,String linkid);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package co.yixiang.yshop.module.member.service.userbill;
|
||||
|
||||
import co.yixiang.yshop.module.member.enums.BillEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import co.yixiang.yshop.module.member.controller.admin.userbill.vo.*;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.userbill.UserBillDO;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.member.convert.userbill.UserBillConvert;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.userbill.UserBillMapper;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户账单 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class UserBillServiceImpl implements UserBillService {
|
||||
|
||||
@Resource
|
||||
private UserBillMapper userBillMapper;
|
||||
|
||||
/**
|
||||
* 增加支出流水
|
||||
* @param uid uid
|
||||
* @param title 账单标题
|
||||
* @param category 明细种类
|
||||
* @param type 明细类型
|
||||
* @param number 明细数字
|
||||
* @param balance 剩余
|
||||
* @param mark 备注
|
||||
*/
|
||||
@Override
|
||||
public void expend(Long uid,String title,String category,String type,double number,double balance,String mark){
|
||||
UserBillDO userBill = UserBillDO.builder()
|
||||
.uid(uid)
|
||||
.title(title)
|
||||
.category(category)
|
||||
.type(type)
|
||||
.number(BigDecimal.valueOf(number))
|
||||
.balance(BigDecimal.valueOf(balance))
|
||||
.mark(mark)
|
||||
.pm(BillEnum.PM_0.getValue())
|
||||
.build();
|
||||
|
||||
userBillMapper.insert(userBill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加收入/支入流水
|
||||
* @param uid uid
|
||||
* @param title 账单标题
|
||||
* @param category 明细种类
|
||||
* @param type 明细类型
|
||||
* @param number 明细数字
|
||||
* @param balance 剩余
|
||||
* @param mark 备注
|
||||
* @param linkid 关联id
|
||||
*/
|
||||
@Override
|
||||
public void income(Long uid,String title,String category,String type,double number,
|
||||
double balance,String mark,String linkid){
|
||||
UserBillDO userBill = UserBillDO.builder()
|
||||
.uid(uid)
|
||||
.title(title)
|
||||
.category(category)
|
||||
.type(type)
|
||||
.number(BigDecimal.valueOf(number))
|
||||
.balance(BigDecimal.valueOf(balance))
|
||||
.mark(mark)
|
||||
.pm(BillEnum.PM_1.getValue())
|
||||
.linkId(linkid)
|
||||
.build();
|
||||
|
||||
userBillMapper.insert(userBill);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package co.yixiang.yshop.module.member.service.address;
|
||||
|
||||
import co.yixiang.yshop.framework.test.core.ut.BaseDbUnitTest;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import co.yixiang.yshop.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||
import co.yixiang.yshop.module.member.dal.dataobject.address.AddressDO;
|
||||
import co.yixiang.yshop.module.member.dal.mysql.address.AddressMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static co.yixiang.yshop.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static co.yixiang.yshop.framework.test.core.util.AssertUtils.assertServiceException;
|
||||
import static co.yixiang.yshop.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static co.yixiang.yshop.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static co.yixiang.yshop.module.member.enums.ErrorCodeConstants.ADDRESS_NOT_EXISTS;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
/**
|
||||
* {@link AddressServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Import(AddressServiceImpl.class)
|
||||
public class AddressServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private AddressServiceImpl addressService;
|
||||
|
||||
@Resource
|
||||
private AddressMapper addressMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateAddress_success() {
|
||||
// 准备参数
|
||||
AppAddressCreateReqVO reqVO = randomPojo(AppAddressCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long addressId = addressService.createAddress(randomLongId(), reqVO);
|
||||
// 断言
|
||||
assertNotNull(addressId);
|
||||
// 校验记录的属性是否正确
|
||||
AddressDO address = addressMapper.selectById(addressId);
|
||||
assertPojoEquals(reqVO, address);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateAddress_success() {
|
||||
// mock 数据
|
||||
AddressDO dbAddress = randomPojo(AddressDO.class);
|
||||
addressMapper.insert(dbAddress);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
AppAddressUpdateReqVO reqVO = randomPojo(AppAddressUpdateReqVO.class, o -> {
|
||||
o.setId(dbAddress.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
addressService.updateAddress(dbAddress.getUserId(), reqVO);
|
||||
// 校验是否更新正确
|
||||
AddressDO address = addressMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, address);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateAddress_notExists() {
|
||||
// 准备参数
|
||||
AppAddressUpdateReqVO reqVO = randomPojo(AppAddressUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> addressService.updateAddress(randomLongId(), reqVO), ADDRESS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAddress_success() {
|
||||
// mock 数据
|
||||
AddressDO dbAddress = randomPojo(AddressDO.class);
|
||||
addressMapper.insert(dbAddress);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbAddress.getId();
|
||||
|
||||
// 调用
|
||||
addressService.deleteAddress(dbAddress.getUserId(), id);
|
||||
// 校验数据不存在了
|
||||
assertNull(addressMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAddress_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> addressService.deleteAddress(randomLongId(), id), ADDRESS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
}
|
@ -67,7 +67,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
String newNickName = randomString();
|
||||
|
||||
// 调用接口修改昵称
|
||||
memberUserService.updateUserNickname(userDO.getId(),newNickName);
|
||||
memberUserService.updateUserNickname(userDO.getId(),newNickName,"");
|
||||
// 查询新修改后的昵称
|
||||
String nickname = memberUserService.getUser(userDO.getId()).getNickname();
|
||||
// 断言
|
||||
|
Reference in New Issue
Block a user