使用spring doc代替spring fox,openapi 3.0规范

This commit is contained in:
FrozenWatermelon 2023-02-21 11:45:40 +08:00
parent a906a9c369
commit 53a2d9644b
98 changed files with 788 additions and 1044 deletions

View File

@ -45,22 +45,21 @@ uni-apphttps://gitee.com/gz-yami/mall4uni
## 技术选型
| 技术 | 版本 | 说明 |
| ---------------------- | ------ | --------------------------------------- |
| Spring Boot | 2.7.0 | MVC核心框架 |
| Spring Security oauth2 | 2.7.0 | 认证和授权框架 |
| MyBatis | 3.5.0 | ORM框架 |
| MyBatisPlus | 3.1.0 | 基于mybatis使用lambda表达式的 |
| Swagger-UI | 2.9.2 | 文档生产工具 |
| Hibernator-Validator | 6.0.17 | 验证框架 |
| redisson | 3.10.6 | 对redis进行封装、集成分布式锁等 |
| hikari | 3.2.0 | 数据库连接池 |
| log4j2 | 2.11.2 | 更快的log日志工具 |
| fst | 2.57 | 更快的序列化和反序列化工具 |
| orika | 1.5.4 | 更快的bean复制工具 |
| lombok | 1.18.8 | 简化对象封装工具 |
| hutool | 5.7.22 | 更适合国人的java工具集 |
| knife4j | 3.0.3 | 基于swagger更便于国人使用的swagger ui |
| 技术 | 版本 | 说明 |
|------------------------|--------|------------------------------|
| Spring Boot | 2.7.0 | MVC核心框架 |
| Spring Security oauth2 | 2.7.0 | 认证和授权框架 |
| MyBatis | 3.5.0 | ORM框架 |
| MyBatisPlus | 3.1.0 | 基于mybatis使用lambda表达式的 |
| spring-doc | 1.6.9 | 接口文档工具 |
| Hibernator-Validator | 6.0.17 | 验证框架 |
| redisson | 3.10.6 | 对redis进行封装、集成分布式锁等 |
| hikari | 3.2.0 | 数据库连接池 |
| logback | 1.2.11 | log日志工具 |
| orika | 1.5.4 | 更快的bean复制工具 |
| lombok | 1.18.8 | 简化对象封装工具 |
| hutool | 5.7.22 | 更适合国人的java工具集 |
| knife4j | 4.0.0 | 基于swagger更便于国人使用的swagger ui |

View File

@ -1,208 +0,0 @@
> 有很多人不清楚我们的swagger ui的路径由于我们使用了更为好用的`swagger-bootstrap-ui`,实际上使 域名+端口 +/doc.htmlhttp://localhost:8086/doc.html
在没有Swagger之前我们需要自己手写文档手写文档的出现问题
1. 文档更新时需要要与前端人员进行对接,文档存在更新不及时
2. 接口文档多,没有进行分组管理,增加管理难度
3. 不能直接在线接口调试通常需要借助工具如postman,效率大大降低
4. 接口说明与返回结果不明确
而通过swagger就能轻松解决这些问题而且`spirngboot`整合swagger也相对简单
[swagger官网](https://swagger.io/)
## 添加依赖
```
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>2.9.2</version>
</dependency>
```
## 添加配置类并开启
在**yami-shop-api**工程中的**config**文件下有swagger相应的配置类只要了解具体能配置哪些东西就好了毕竟这个东西配置一次之后就不用再动了
```java
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket baseRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("基础版")
.select()
.apis(RequestHandlerSelectors.basePackage("com.yami.shop.api"))
.paths(PathSelectors.any())
.build();
}
@Bean
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("mall4j商城接口文档")
.description("mall4j商城接口文档Swagger版")
.termsOfServiceUrl("http://www.gz-yami.com/")
.contact(new Contact("广州市蓝海创新科技有限公司","https://www.mall4j.com/", ""))
.version("1.0")
.build();
}
}
```
特别要注意的是里面配置了api文件也就是controller包的路径不然生成的文档扫描不到接口
```java
apis(RequestHandlerSelectors.basePackage("com.yami.shop.api"))
```
`@Configuration`注解该类让spring托管这个类`@Bean`标注方法等价于XML中配置bean
`@EnableSwagger2`标识要开启`Swagger2`
## 接口使用
在配置好之后我们就可以对swagger进行使用,比如在`AreaController`类中
```java
@RestController
@RequestMapping("/p/area")
@Api(tags="省市区接口")
public class AreaController {
@Autowired
private AreaService areaService;
@GetMapping("/listByPid")
@ApiOperation(value="获取省市区信息", notes="根据省市区的pid获取地址信息")
@ApiImplicitParam(name = "pid", value = "省市区的pid(pid为0获取所有省份)", required = true, dataType = "String")
public ResponseEntity<List<Area>> listByPid(Long pid){
List<Area> list = areaService.listByPid(pid);
return ResponseEntity.ok(list);
}
}
```
`@Api(tags="省市区接口")`定义标签分组接口,在这个类下定义的所有接口将位于这个标签之下
`@ApiOperation()`定义具体的接口标题信息notes可以为这个标签添加注释
`@ApiImplicitParam()`对应的参数列表信息,用户告诉前端开发人员,这个接口需要传递什么参数及参数的说明
如有多个参数需要说明,可使用`@ApiImplicitParams()`下面可包含多个`@ApiImplicitParam()`
## 实体类
```java
@Data
@TableName("tz_area")
public class Area implements Serializable {
private static final long serialVersionUID = -6013320537436191451L;
@TableId
@ApiModelProperty(value = "地区id",required=true)
private Long areaId;
@ApiModelProperty(value = "地区名称",required=true)
private String areaName;
@ApiModelProperty(value = "地区上级id",required=true)
private Long parentId;
@ApiModelProperty(value = "地区层级",required=true)
private Integer level;
@TableField(exist=false)
private List<Area> areas;
}
```
`@ApiModelProperty()`利用这个注解可以告诉前端开发人员该字段代表的含义
## 常用注解
| 注解 | 作用 |
| ------------------ | ------------------------------------ |
| @Api | 修饰整个类描述Controller的作用 |
| @ApiOperation | 描述一个类的一个方法,或者说一个接口 |
| @ApiParam | 单个参数描述 |
| @ApiModel | 用对象来接收参数 |
| @ApiProperty | 用对象接收参数时,描述对象的一个字段 |
| @ApiResponse | HTTP响应其中1个描述 |
| @ApiResponses | HTTP响应整体描述 |
| @ApiIgnore | 使用该注解忽略这个API |
| @ApiError | 发生错误返回的信息 |
| @ApiImplicitParam | 一个请求参数 |
| @ApiImplicitParams | 多个请求参数 |
## 分页参数的文档以及关于swagger文档的骚操作
我们仔细留意swagger文档可以发现 swagger文档返回接口数据的url为`/v2/api-docs` 。这个url被 `springfox.documentation.swagger2.web.Swagger2Controlle#getDocumentation()` 关联。通过`jsonSerializer.toJson(swagger)` 生成特定的json文档。
当我们使用`PageParam<T>` 这个分页参数生成文档的时候,总是会返回泛型里面的对象信息,我们根据无论使用`@ApiParam(hidden = true)` 又或者是 `@JsonIgnore` 都无效,所以我们可以修改自己的`jsonSerializer`生成的响应的json
自定义Swagger 的序列化去除分页参数中的records值
```java
public class SpringfoxJsonSerializer extends JsonSerializer {
public SpringfoxJsonSerializer(List<JacksonModuleRegistrar> modules) {
super(modules);
}
@Override
public Json toJson(Object toSerialize) {
if (!(toSerialize instanceof Swagger)) {
return super.toJson(toSerialize);
}
Swagger swagger = (Swagger)toSerialize;
swagger.getPaths().forEach((key, path) ->{
Operation get = path.getGet();
if (get != null) {
List<Parameter> parameters = get.getParameters();
if (parameters != null) {
parameters.removeIf(parameter -> parameter.getName().startsWith("records[0]."));
}
}
});
return super.toJson(swagger);
}
}
```
新序列化的bean
```java
@Configuration
public class SpringFoxJsonSerializerConfig {
@Bean
@Primary
public JsonSerializer yamiSpringfoxJsonSerializer(List<JacksonModuleRegistrar> moduleRegistrars) {
return new SpringfoxJsonSerializer(moduleRegistrars);
}
}
```

View File

@ -15,7 +15,7 @@
```java
@PostMapping("/info")
@ApiOperation(value = "获取用户购物车信息", notes = "获取用户购物车信息,参数为用户选中的活动项数组,以购物车id为key")
@Operation(summary = "获取用户购物车信息" , description = "获取用户购物车信息,参数为用户选中的活动项数组,以购物车id为key")
public ResponseEntity<List<ShopCartDto>> info(@RequestBody Map<Long, ShopCartParam> basketIdShopCartParamMap) {
String userId = SecurityUtils.getUser().getUserId();
@ -47,13 +47,13 @@
@Data
public class ShopCartDto implements Serializable {
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "购物车满减活动携带的商品", required = true)
@Schema(description = "购物车满减活动携带的商品" , required = true)
private List<ShopCartItemDiscountDto> shopCartItemDiscounts;
}
@ -64,10 +64,10 @@ public class ShopCartDto implements Serializable {
```java
public class ShopCartItemDiscountDto implements Serializable {
@ApiModelProperty(value = "已选满减项", required = true)
@Schema(description = "已选满减项" , required = true)
private ChooseDiscountItemDto chooseDiscountItemDto;
@ApiModelProperty(value = "商品列表")
@Schema(description = "商品列表" )
private List<ShopCartItemDto> shopCartItems;
}
```
@ -75,7 +75,7 @@ public class ShopCartItemDiscountDto implements Serializable {
我们再留意`ShopCartItemDto` 这个`bean` ,发现还有这个东西:
```java
@ApiModelProperty("参与满减活动列表")
@Schema(description = "参与满减活动列表" )
private List<DiscountDto> discounts = new ArrayList<>();
```

View File

@ -17,10 +17,10 @@
```java
public class OrderParam {
@ApiModelProperty(value = "购物车id 数组")
@Schema(description = "购物车id 数组" )
private List<Long> basketIds;
@ApiModelProperty(value = "立即购买时提交的商品项")
@Schema(description = "立即购买时提交的商品项" )
private OrderItemParam orderItem;
}
```
@ -38,7 +38,7 @@ public class OrderParam {
```java
@PostMapping("/confirm")
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
@Operation(summary = "结算,生成订单信息" , description = "传入下单所需要的参数进行下单")
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
// 根据店铺组装购车中的商品信息,返回每个店铺中的购物车商品信息
List<ShopCartDto> shopCarts = basketService.getShopCarts(shopCartItems);
@ -61,14 +61,14 @@ public class OrderParam {
```java
public class OrderParam {
@ApiModelProperty(value = "地址ID0为默认地址",required=true)
@Schema(description = "地址ID0为默认地址" ,required=true)
@NotNull(message = "地址不能为空")
private Long addrId;
@ApiModelProperty(value = "用户是否改变了优惠券的选择,如果用户改变了优惠券的选择,则完全根据传入参数进行优惠券的选择")
@Schema(description = "用户是否改变了优惠券的选择,如果用户改变了优惠券的选择,则完全根据传入参数进行优惠券的选择" )
private Integer userChangeCoupon;
@ApiModelProperty(value = "优惠券id数组")
@Schema(description = "优惠券id数组" )
private List<Long> couponIds;
}
```
@ -81,7 +81,7 @@ public class OrderParam {
```java
@PostMapping("/confirm")
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
@Operation(summary = "结算,生成订单信息" , description = "传入下单所需要的参数进行下单")
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
for (ShopCartDto shopCart : shopCarts) {
applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems));
@ -167,25 +167,25 @@ public class ConfirmOrderListener {
@Data
public class ShopCartOrderMergerDto implements Serializable{
@ApiModelProperty(value = "实际总值", required = true)
@Schema(description = "实际总值" , required = true)
private Double actualTotal;
@ApiModelProperty(value = "商品总值", required = true)
@Schema(description = "商品总值" , required = true)
private Double total;
@ApiModelProperty(value = "商品总数", required = true)
@Schema(description = "商品总数" , required = true)
private Integer totalCount;
@ApiModelProperty(value = "订单优惠金额(所有店铺优惠金额相加)", required = true)
@Schema(description = "订单优惠金额(所有店铺优惠金额相加)" , required = true)
private Double orderReduce;
@ApiModelProperty(value = "地址Dto", required = true)
@Schema(description = "地址Dto" , required = true)
private UserAddrDto userAddr;
@ApiModelProperty(value = "每个店铺的购物车信息", required = true)
@Schema(description = "每个店铺的购物车信息" , required = true)
private List<ShopCartOrderDto> shopCartOrders;
@ApiModelProperty(value = "整个订单可以使用的优惠券列表", required = true)
@Schema(description = "整个订单可以使用的优惠券列表" , required = true)
private List<CouponOrderDto> coupons;
}
@ -194,7 +194,7 @@ public class ShopCartOrderMergerDto implements Serializable{
这里又有一段我们熟悉的代码:
```java
@ApiModelProperty(value = "每个店铺的购物车信息", required = true)
@Schema(description = "每个店铺的购物车信息" , required = true)
private List<ShopCartOrderDto> shopCartOrders;
```
没错这里返回的数据格式,和购物车的格式是一样的,因为第一步当中已经说明,订单来自于购物车的计算,所以会在基础上条件新的数据,基本上就是返回给前端的数据了。

View File

@ -9,7 +9,7 @@
我们返回确认订单的接口,看到这样一行代码:
```java
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
@Operation(summary = "结算,生成订单信息" , description = "传入下单所需要的参数进行下单")
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
orderService.putConfirmOrderCache(userId,shopCartOrderMergerDto);
}
@ -21,7 +21,7 @@
```java
@PostMapping("/submit")
@ApiOperation(value = "提交订单,返回支付流水号", notes = "根据传入的参数判断是否为购物车提交订单,同时对购物车进行删除,用户开始进行支付")
@Operation(summary = "提交订单,返回支付流水号" , description = "根据传入的参数判断是否为购物车提交订单,同时对购物车进行删除,用户开始进行支付")
public ResponseEntity<OrderNumbersDto> submitOrders(@Valid @RequestBody SubmitOrderParam submitOrderParam) {
ShopCartOrderMergerDto mergerOrder = orderService.getConfirmOrderCache(userId);
if (mergerOrder == null) {

16
pom.xml
View File

@ -38,7 +38,7 @@
<redisson.version>3.12.5</redisson.version>
<transmittable-thread-local.version>2.12.1</transmittable-thread-local.version>
<log4j.version>2.17.2</log4j.version>
<knife4j.version>3.0.3</knife4j.version>
<knife4j.version>4.0.0</knife4j.version>
<xxl-job.version>2.3.1</xxl-job.version>
<spring-cloud-commons.version>3.1.1</spring-cloud-commons.version>
</properties>
@ -52,6 +52,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-dependencies</artifactId>
<version>${knife4j.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
@ -168,8 +175,11 @@
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>
</dependencies>

View File

@ -10,47 +10,36 @@
package com.yami.shop.admin.config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger文档只有在测试环境才会使用
* @author LGH
*/
//@Profile("dev")
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("基础版")
.select()
.apis(RequestHandlerSelectors.basePackage("com.yami.shop.admin"))
.paths(PathSelectors.any())
.build();
}
@Bean
public GroupedOpenApi baseRestApi() {
return GroupedOpenApi.builder()
.group("基础版")
.packagesToScan("com.yami.shop.api")
.build();
}
@Bean
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("mall4j管理系统接口文档")
.description("mall4j商城接口文档Swagger版")
.termsOfServiceUrl("https://www.mall4j.com/")
.contact(new Contact("广州市蓝海创新科技有限公司","https://www.mall4j.com/", ""))
.version("1.0")
.build();
}
}
@Bean
public OpenAPI springShopOpenAPI() {
return new OpenAPI()
.info(new Info().title("Mall4j接口文档")
.description("Mall4j接口文档openapi3.0 接口,用于前端对接")
.version("v0.0.1")
.license(new License().name("使用请遵守AGPL3.0授权协议").url("https://www.mall4j.com")));
}
}

View File

@ -27,8 +27,8 @@ import com.yami.shop.sys.model.SysMenu;
import com.yami.shop.sys.model.SysUser;
import com.yami.shop.sys.service.SysMenuService;
import com.yami.shop.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@ -47,7 +47,7 @@ import java.util.stream.Collectors;
* @date 2020/6/30
*/
@RestController
@Api(tags = "登录")
@Tag(name = "登录")
public class AdminLoginController {
@Autowired
@ -69,7 +69,7 @@ public class AdminLoginController {
private PasswordManager passwordManager;
@PostMapping("/adminLogin")
@ApiOperation(value = "账号密码 + 验证码登录(用于后台登录)", notes = "通过账号/手机号/用户名密码登录")
@Operation(summary = "账号密码 + 验证码登录(用于后台登录)" , description = "通过账号/手机号/用户名密码登录")
public ResponseEntity<?> login(
@Valid @RequestBody CaptchaAuthenticationDTO captchaAuthenticationDTO) {
// 登陆后台登录需要再校验一遍验证码

View File

@ -11,9 +11,6 @@ spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
mvc:
pathmatch:
matching-strategy: ANT_PATH_MATCHER
# mybaits-plus配置
mybatis-plus:
# MyBatis Mapper所对应的XML文件位置

View File

@ -10,47 +10,36 @@
package com.yami.shop.api.config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger文档只有在测试环境才会使用
* @author LGH
*/
//@Profile("dev")
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket baseRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("基础版")
.select()
.apis(RequestHandlerSelectors.basePackage("com.yami.shop.api"))
.paths(PathSelectors.any())
.build();
}
@Bean
public GroupedOpenApi createRestApi() {
return GroupedOpenApi.builder()
.group("接口文档")
.packagesToScan("com.yami")
.build();
}
@Bean
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("mall4j商城接口文档")
.description("mall4j商城接口文档Swagger版")
.termsOfServiceUrl("http://www.mall4j.com/")
.contact(new Contact("广州市蓝海创新科技有限公司","https://www.mall4j.com/", ""))
.version("1.0")
.build();
}
}
@Bean
public OpenAPI springShopOpenApi() {
return new OpenAPI()
.info(new Info().title("Mall4j接口文档")
.description("Mall4j接口文档openapi3.0 接口,用于前端对接")
.version("v0.0.1")
.license(new License().name("使用请遵守AGPL3.0授权协议").url("https://www.mall4j.com")));
}
}

View File

@ -17,9 +17,9 @@ import com.yami.shop.bean.model.UserAddr;
import com.yami.shop.common.exception.YamiShopBindException;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.UserAddrService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +33,7 @@ import java.util.List;
@RestController
@RequestMapping("/p/address")
@Api(tags = "地址接口")
@Tag(name = "地址接口")
@AllArgsConstructor
public class AddrController {
@ -46,7 +46,7 @@ public class AddrController {
* 选择订单配送地址
*/
@GetMapping("/list")
@ApiOperation(value = "用户地址列表", notes = "获取用户的所有地址信息")
@Operation(summary = "用户地址列表" , description = "获取用户的所有地址信息")
public ResponseEntity<List<UserAddrDto>> dvyList() {
String userId = SecurityUtils.getUser().getUserId();
List<UserAddr> userAddrs = userAddrService.list(new LambdaQueryWrapper<UserAddr>().eq(UserAddr::getUserId, userId).orderByDesc(UserAddr::getCommonAddr).orderByDesc(UserAddr::getUpdateTime));
@ -54,7 +54,7 @@ public class AddrController {
}
@PostMapping("/addAddr")
@ApiOperation(value = "新增用户地址", notes = "新增用户地址")
@Operation(summary = "新增用户地址" , description = "新增用户地址")
public ResponseEntity<String> addAddr(@Valid @RequestBody AddrParam addrParam) {
String userId = SecurityUtils.getUser().getUserId();
@ -85,7 +85,7 @@ public class AddrController {
* 修改订单配送地址
*/
@PutMapping("/updateAddr")
@ApiOperation(value = "修改订单用户地址", notes = "修改用户地址")
@Operation(summary = "修改订单用户地址" , description = "修改用户地址")
public ResponseEntity<String> updateAddr(@Valid @RequestBody AddrParam addrParam) {
String userId = SecurityUtils.getUser().getUserId();
@ -109,8 +109,8 @@ public class AddrController {
* 删除订单配送地址
*/
@DeleteMapping("/deleteAddr/{addrId}")
@ApiOperation(value = "删除订单用户地址", notes = "根据地址id删除用户地址")
@ApiImplicitParam(name = "addrId", value = "地址ID", required = true, dataType = "Long")
@Operation(summary = "删除订单用户地址" , description = "根据地址id删除用户地址")
@Parameter(name = "addrId", description = "地址ID" , required = true)
public ResponseEntity<String> deleteDvy(@PathVariable("addrId") Long addrId) {
String userId = SecurityUtils.getUser().getUserId();
UserAddr userAddr = userAddrService.getUserAddrByUserId(addrId, userId);
@ -129,7 +129,7 @@ public class AddrController {
* 设置默认地址
*/
@PutMapping("/defaultAddr/{addrId}")
@ApiOperation(value = "设置默认地址", notes = "根据地址id设置默认地址")
@Operation(summary = "设置默认地址" , description = "根据地址id设置默认地址")
public ResponseEntity<String> defaultAddr(@PathVariable("addrId") Long addrId) {
String userId = SecurityUtils.getUser().getUserId();
@ -144,8 +144,8 @@ public class AddrController {
* 获取地址信息订单配送地址
*/
@GetMapping("/addrInfo/{addrId}")
@ApiOperation(value = "获取地址信息", notes = "根据地址id获取地址信息")
@ApiImplicitParam(name = "addrId", value = "地址ID", required = true, dataType = "Long")
@Operation(summary = "获取地址信息" , description = "根据地址id获取地址信息")
@Parameter(name = "addrId", description = "地址ID" , required = true)
public ResponseEntity<UserAddrDto> addrInfo(@PathVariable("addrId") Long addrId) {
String userId = SecurityUtils.getUser().getUserId();
UserAddr userAddr = userAddrService.getUserAddrByUserId(addrId, userId);

View File

@ -21,9 +21,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.yami.shop.bean.model.Area;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
/**
*
@ -31,7 +31,7 @@ import io.swagger.annotations.ApiOperation;
*/
@RestController
@RequestMapping("/p/area")
@Api(tags="省市区接口")
@Tag(name = "省市区接口")
public class AreaController {
@Autowired
@ -41,8 +41,8 @@ public class AreaController {
* 分页获取
*/
@GetMapping("/listByPid")
@ApiOperation(value="获取省市区信息", notes="根据省市区的pid获取地址信息")
@ApiImplicitParam(name = "pid", value = "省市区的pid(pid为0获取所有省份)", required = true, dataType = "String")
@Operation(summary = "获取省市区信息" , description = "根据省市区的pid获取地址信息")
@Parameter(name = "pid", description = "省市区的pid(pid为0获取所有省份)" , required = true)
public ResponseEntity<List<Area>> listByPid(Long pid){
List<Area> list = areaService.listByPid(pid);
return ResponseEntity.ok(list);

View File

@ -23,14 +23,14 @@ import com.yami.shop.bean.app.dto.CategoryDto;
import com.yami.shop.bean.model.Category;
import com.yami.shop.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
@RestController
@RequestMapping("/category")
@Api(tags = "分类接口")
@Tag(name = "分类接口")
public class CategoryController {
@Autowired
@ -43,8 +43,8 @@ public class CategoryController {
* 分类信息列表接口
*/
@GetMapping("/categoryInfo")
@ApiOperation(value = "分类信息列表", notes = "获取所有的产品分类信息顶级分类的parentId为0,默认为顶级分类")
@ApiImplicitParam(name = "parentId", value = "分类ID", required = false, dataType = "Long")
@Operation(summary = "分类信息列表" , description = "获取所有的产品分类信息顶级分类的parentId为0,默认为顶级分类")
@Parameter(name = "parentId", description = "分类ID", required = false)
public ResponseEntity<List<CategoryDto>> categoryInfo(@RequestParam(value = "parentId", defaultValue = "0") Long parentId) {
List<Category> categories = categoryService.listByParentId(parentId);
List<CategoryDto> categoryDtos = mapperFacade.mapAsList(categories, CategoryDto.class);

View File

@ -24,13 +24,13 @@ import com.yami.shop.common.util.Json;
import com.yami.shop.service.DeliveryService;
import cn.hutool.http.HttpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
@RestController
@RequestMapping("/delivery")
@Api(tags="查看物流接口")
@Tag(name = "查看物流接口")
public class DeliveryController {
@Autowired
@ -42,8 +42,8 @@ public class DeliveryController {
* 查看物流接口
*/
@GetMapping("/check")
@ApiOperation(value="查看物流", notes="根据订单号查看物流")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
@Operation(summary = "查看物流" , description = "根据订单号查看物流")
@Parameter(name = "orderNumber", description = "订单号" , required = true)
public ResponseEntity<DeliveryDto> checkDelivery(String orderNumber) {
Order order = orderService.getOrderByOrderNumber(orderNumber);

View File

@ -13,9 +13,9 @@ package com.yami.shop.api.controller;
import com.yami.shop.bean.app.dto.IndexImgDto;
import com.yami.shop.bean.model.IndexImg;
import com.yami.shop.service.IndexImgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Api(tags = "首页轮播图接口")
@Tag(name = "首页轮播图接口")
public class IndexImgController {
@Autowired
private MapperFacade mapperFacade;
@ -38,7 +38,7 @@ public class IndexImgController {
* 首页轮播图接口
*/
@GetMapping("/indexImgs")
@ApiOperation(value = "首页轮播图", notes = "获取首页轮播图列表信息")
@Operation(summary = "首页轮播图" , description = "获取首页轮播图列表信息")
public ResponseEntity<List<IndexImgDto>> indexImgs() {
List<IndexImg> indexImgList = indexImgService.listIndexImgs();
List<IndexImgDto> indexImgDtos = mapperFacade.mapAsList(indexImgList, IndexImgDto.class);

View File

@ -22,10 +22,10 @@ import com.yami.shop.common.util.Arith;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.http.ResponseEntity;
@ -37,7 +37,7 @@ import java.util.Objects;
@RestController
@RequestMapping("/p/myOrder")
@Api(tags = "我的订单接口")
@Tag(name = "我的订单接口")
@AllArgsConstructor
public class MyOrderController {
@ -62,8 +62,8 @@ public class MyOrderController {
* 订单详情信息接口
*/
@GetMapping("/orderDetail")
@ApiOperation(value = "订单详情信息", notes = "根据订单号获取订单详情信息")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
@Operation(summary = "订单详情信息" , description = "根据订单号获取订单详情信息")
@Parameter(name = "orderNumber", description = "订单号" , required = true)
public ResponseEntity<OrderShopDto> orderDetail(@RequestParam(value = "orderNumber", required = true) String orderNumber) {
String userId = SecurityUtils.getUser().getUserId();
@ -112,9 +112,9 @@ public class MyOrderController {
* 订单列表接口
*/
@GetMapping("/myOrder")
@ApiOperation(value = "订单列表信息", notes = "根据订单状态获取订单列表信息状态为0时获取所有订单")
@ApiImplicitParams({
@ApiImplicitParam(name = "status", value = "订单状态 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败", required = false, dataType = "Integer")
@Operation(summary = "订单列表信息" , description = "根据订单状态获取订单列表信息状态为0时获取所有订单")
@Parameters({
@Parameter(name = "status", description = "订单状态 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败")
})
public ResponseEntity<IPage<MyOrderDto>> myOrder(@RequestParam(value = "status") Integer status,PageParam<MyOrderDto> page) {
@ -127,8 +127,8 @@ public class MyOrderController {
* 取消订单
*/
@PutMapping("/cancel/{orderNumber}")
@ApiOperation(value = "根据订单号取消订单", notes = "根据订单号取消订单")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
@Operation(summary = "根据订单号取消订单" , description = "根据订单号取消订单")
@Parameter(name = "orderNumber", description = "订单号" , required = true)
public ResponseEntity<String> cancel(@PathVariable("orderNumber") String orderNumber) {
String userId = SecurityUtils.getUser().getUserId();
Order order = orderService.getOrderByOrderNumber(orderNumber);
@ -156,7 +156,7 @@ public class MyOrderController {
* 确认收货
*/
@PutMapping("/receipt/{orderNumber}")
@ApiOperation(value = "根据订单号确认收货", notes = "根据订单号确认收货")
@Operation(summary = "根据订单号确认收货" , description = "根据订单号确认收货")
public ResponseEntity<String> receipt(@PathVariable("orderNumber") String orderNumber) {
String userId = SecurityUtils.getUser().getUserId();
Order order = orderService.getOrderByOrderNumber(orderNumber);
@ -182,8 +182,8 @@ public class MyOrderController {
* 删除订单
*/
@DeleteMapping("/{orderNumber}")
@ApiOperation(value = "根据订单号删除订单", notes = "根据订单号删除订单")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
@Operation(summary = "根据订单号删除订单" , description = "根据订单号删除订单")
@Parameter(name = "orderNumber", description = "订单号" , required = true)
public ResponseEntity<String> delete(@PathVariable("orderNumber") String orderNumber) {
String userId = SecurityUtils.getUser().getUserId();
@ -208,7 +208,7 @@ public class MyOrderController {
* 获取我的订单订单数量
*/
@GetMapping("/orderCount")
@ApiOperation(value = "获取我的订单订单数量", notes = "获取我的订单订单数量")
@Operation(summary = "获取我的订单订单数量" , description = "获取我的订单订单数量")
public ResponseEntity<OrderCountData> getOrderCount() {
String userId = SecurityUtils.getUser().getUserId();
OrderCountData orderCountMap = orderService.getOrderCount(userId);

View File

@ -16,9 +16,9 @@ import com.yami.shop.bean.app.dto.NoticeDto;
import com.yami.shop.bean.model.Notice;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.service.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.http.ResponseEntity;
@ -31,7 +31,7 @@ import java.util.List;
@RestController
@RequestMapping("/shop/notice")
@Api(tags = "公告管理接口")
@Tag(name = "公告管理接口")
@AllArgsConstructor
public class NoticeController {
@ -43,7 +43,7 @@ public class NoticeController {
* 置顶公告列表接口
*/
@GetMapping("/topNoticeList")
@ApiOperation(value = "置顶公告列表信息", notes = "获取所有置顶公告列表信息")
@Operation(summary = "置顶公告列表信息" , description = "获取所有置顶公告列表信息")
@JsonView(NoticeDto.NoContent.class)
public ResponseEntity<List<NoticeDto>> getTopNoticeList() {
List<Notice> noticeList = noticeService.listNotice();
@ -55,7 +55,7 @@ public class NoticeController {
* 获取公告详情
*/
@GetMapping("/info/{id}")
@ApiOperation(value = "公告详情", notes = "获取公告id公告详情")
@Operation(summary = "公告详情" , description = "获取公告id公告详情")
@JsonView(NoticeDto.WithContent.class)
public ResponseEntity<NoticeDto> getNoticeById(@PathVariable("id") Long id) {
Notice notice = noticeService.getNoticeById(id);
@ -67,8 +67,8 @@ public class NoticeController {
* 公告列表
*/
@GetMapping("/noticeList")
@ApiOperation(value = "公告列表信息", notes = "获取所有公告列表信息")
@ApiImplicitParams({
@Operation(summary = "公告列表信息" , description = "获取所有公告列表信息")
@Parameters({
})
public ResponseEntity<IPage<NoticeDto>> pageNotice(PageParam<NoticeDto> page) {

View File

@ -22,8 +22,8 @@ import com.yami.shop.common.exception.YamiShopBindException;
import com.yami.shop.common.util.Arith;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -40,7 +40,7 @@ import java.util.Objects;
@RestController
@RequestMapping("/p/order")
@Api(tags = "订单接口")
@Tag(name = "订单接口")
public class OrderController {
@Autowired
@ -63,7 +63,7 @@ public class OrderController {
* 生成订单
*/
@PostMapping("/confirm")
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
@Operation(summary = "结算,生成订单信息" , description = "传入下单所需要的参数进行下单")
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
String userId = SecurityUtils.getUser().getUserId();
@ -139,7 +139,7 @@ public class OrderController {
* 购物车/立即购买 提交订单,根据店铺拆单
*/
@PostMapping("/submit")
@ApiOperation(value = "提交订单,返回支付流水号", notes = "根据传入的参数判断是否为购物车提交订单,同时对购物车进行删除,用户开始进行支付")
@Operation(summary = "提交订单,返回支付流水号" , description = "根据传入的参数判断是否为购物车提交订单,同时对购物车进行删除,用户开始进行支付")
public ResponseEntity<OrderNumbersDto> submitOrders(@Valid @RequestBody SubmitOrderParam submitOrderParam) {
String userId = SecurityUtils.getUser().getUserId();
ShopCartOrderMergerDto mergerOrder = orderService.getConfirmOrderCache(userId);

View File

@ -16,8 +16,8 @@ import com.yami.shop.bean.pay.PayInfoDto;
import com.yami.shop.security.api.model.YamiUser;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.http.ResponseEntity;
@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/p/order")
@Api(tags = "订单接口")
@Tag(name = "订单接口")
@AllArgsConstructor
public class PayController {
@ -38,7 +38,7 @@ public class PayController {
* 支付接口
*/
@PostMapping("/pay")
@ApiOperation(value = "根据订单号进行支付", notes = "根据订单号进行支付")
@Operation(summary = "根据订单号进行支付" , description = "根据订单号进行支付")
@SneakyThrows
public ResponseEntity<WxPayMpOrderResult> pay(@RequestBody PayParam payParam) {
YamiUser user = SecurityUtils.getUser();
@ -54,7 +54,7 @@ public class PayController {
* 普通支付接口
*/
@PostMapping("/normalPay")
@ApiOperation(value = "根据订单号进行支付", notes = "根据订单号进行支付")
@Operation(summary = "根据订单号进行支付" , description = "根据订单号进行支付")
@SneakyThrows
public ResponseEntity<Boolean> normalPay(@RequestBody PayParam payParam) {

View File

@ -13,9 +13,9 @@ package com.yami.shop.api.controller;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import io.swagger.v3.oas.annotations.Hidden;
@ApiIgnore
@Hidden
@RestController
@RequestMapping("/notice/pay")
@AllArgsConstructor
@ -42,4 +42,4 @@ public class PayNoticeController {
//
// return ResponseEntity.ok().build();
// }
}
}

View File

@ -19,10 +19,10 @@ import com.yami.shop.bean.model.ProdComm;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.ProdCommService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -31,7 +31,7 @@ import java.util.Date;
@RestController
@RequestMapping("/prodComm")
@Api(tags = "评论接口")
@Tag(name = "评论接口")
@AllArgsConstructor
public class ProdCommController {
@ -39,29 +39,29 @@ public class ProdCommController {
@GetMapping("/prodCommData")
@ApiOperation(value = "返回商品评论数据(好评率 好评数量 中评数 差评数)", notes = "根据商品id获取")
@Operation(summary = "返回商品评论数据(好评率 好评数量 中评数 差评数)" , description = "根据商品id获取")
public ResponseEntity<ProdCommDataDto> getProdCommData(Long prodId) {
return ResponseEntity.ok(prodCommService.getProdCommDataByProdId(prodId));
}
@GetMapping("/prodCommPageByUser")
@ApiOperation(value = "根据用户返回评论分页数据", notes = "传入页码")
@Operation(summary = "根据用户返回评论分页数据" , description = "传入页码")
public ResponseEntity<IPage<ProdCommDto>> getProdCommPage(PageParam page) {
return ResponseEntity.ok(prodCommService.getProdCommDtoPageByUserId(page, SecurityUtils.getUser().getUserId()));
}
@GetMapping("/prodCommPageByProd")
@ApiOperation(value = "根据商品返回评论分页数据", notes = "传入商品id和页码")
@ApiImplicitParams({
@ApiImplicitParam(name = "prodId", value = "商品id", required = true, dataType = "Long"),
@ApiImplicitParam(name = "evaluate", value = "-1或null 全部0好评 1中评 2差评 3有图", required = true, dataType = "Long"),
@Operation(summary = "根据商品返回评论分页数据" , description = "传入商品id和页码")
@Parameters({
@Parameter(name = "prodId", description = "商品id" , required = true),
@Parameter(name = "evaluate", description = "-1或null 全部0好评 1中评 2差评 3有图" , required = true),
})
public ResponseEntity<IPage<ProdCommDto>> getProdCommPageByProdId(PageParam page, Long prodId, Integer evaluate) {
return ResponseEntity.ok(prodCommService.getProdCommDtoPageByProdId(page, prodId, evaluate));
}
@PostMapping
@ApiOperation(value = "添加评论")
@Operation(summary = "添加评论")
public ResponseEntity<Void> saveProdCommPage(ProdCommParam prodCommParam) {
ProdComm prodComm = new ProdComm();
prodComm.setProdId(prodCommParam.getProdId());
@ -79,7 +79,7 @@ public class ProdCommController {
}
@DeleteMapping
@ApiOperation(value = "删除评论", notes = "根据id删除")
@Operation(summary = "删除评论" , description = "根据id删除")
public ResponseEntity<Void> deleteProdComm(Long prodCommId) {
prodCommService.removeById(prodCommId);
return ResponseEntity.ok().build();

View File

@ -21,10 +21,10 @@ import com.yami.shop.common.util.PageParam;
import com.yami.shop.service.ProductService;
import com.yami.shop.service.SkuService;
import com.yami.shop.service.TransportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@ -41,7 +41,7 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("/prod")
@Api(tags = "商品接口")
@Tag(name = "商品接口")
public class ProdController {
@Autowired
@ -58,9 +58,9 @@ public class ProdController {
@GetMapping("/pageProd")
@ApiOperation(value = "通过分类id商品列表信息", notes = "根据分类ID获取该分类下所有的商品列表信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryId", value = "分类ID", required = true, dataType = "Long"),
@Operation(summary = "通过分类id商品列表信息" , description = "根据分类ID获取该分类下所有的商品列表信息")
@Parameters({
@Parameter(name = "categoryId", description = "分类ID" , required = true),
})
public ResponseEntity<IPage<ProductDto>> prodList(
@RequestParam(value = "categoryId") Long categoryId,PageParam<ProductDto> page) {
@ -69,8 +69,8 @@ public class ProdController {
}
@GetMapping("/prodInfo")
@ApiOperation(value = "商品详情信息", notes = "根据商品IDprodId获取商品信息")
@ApiImplicitParam(name = "prodId", value = "商品ID", required = true, dataType = "Long")
@Operation(summary = "商品详情信息" , description = "根据商品IDprodId获取商品信息")
@Parameter(name = "prodId", description = "商品ID" , required = true)
public ResponseEntity<ProductDto> prodInfo(Long prodId) {
Product product = prodService.getProductByProdId(prodId);
@ -97,8 +97,8 @@ public class ProdController {
}
@GetMapping("/lastedProdPage")
@ApiOperation(value = "新品推荐", notes = "获取新品推荐商品列表")
@ApiImplicitParams({
@Operation(summary = "新品推荐" , description = "获取新品推荐商品列表")
@Parameters({
})
public ResponseEntity<IPage<ProductDto>> lastedProdPage(PageParam<ProductDto> page) {
IPage<ProductDto> productPage = prodService.pageByPutawayTime(page);
@ -106,9 +106,9 @@ public class ProdController {
}
@GetMapping("/prodListByTagId")
@ApiOperation(value = "通过分组标签获取商品列表", notes = "通过分组标签idtagId获取商品列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "tagId", value = "当前页默认为1", required = true, dataType = "Long"),
@Operation(summary = "通过分组标签获取商品列表" , description = "通过分组标签idtagId获取商品列表")
@Parameters({
@Parameter(name = "tagId", description = "当前页默认为1" , required = true),
})
public ResponseEntity<IPage<ProductDto>> prodListByTagId(
@RequestParam(value = "tagId") Long tagId,PageParam<ProductDto> page) {
@ -117,15 +117,15 @@ public class ProdController {
}
@GetMapping("/moreBuyProdList")
@ApiOperation(value = "每日疯抢", notes = "获取销量最多的商品列表")
@ApiImplicitParams({})
@Operation(summary = "每日疯抢" , description = "获取销量最多的商品列表")
@Parameters({})
public ResponseEntity<IPage<ProductDto>> moreBuyProdList(PageParam<ProductDto> page) {
IPage<ProductDto> productPage = prodService.moreBuyProdList(page);
return ResponseEntity.ok(productPage);
}
@GetMapping("/tagProdList")
@ApiOperation(value = "首页所有标签商品接口", notes = "获取首页所有标签商品接口")
@Operation(summary = "首页所有标签商品接口" , description = "获取首页所有标签商品接口")
public ResponseEntity<List<TagProductDto>> getTagProdList() {
List<TagProductDto> productDtoList = prodService.tagProdList();
return ResponseEntity.ok(productDtoList);

View File

@ -14,8 +14,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yami.shop.bean.app.dto.ProdTagDto;
import com.yami.shop.bean.model.ProdTag;
import com.yami.shop.service.ProdTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.http.ResponseEntity;
@ -27,7 +27,7 @@ import java.util.List;
@RestController
@RequestMapping("/prod/tag")
@Api(tags = "商品分组标签接口")
@Tag(name = "商品分组标签接口")
@AllArgsConstructor
public class ProdTagController {
@ -39,7 +39,7 @@ public class ProdTagController {
* 商品分组标签列表接口
*/
@GetMapping("/prodTagList")
@ApiOperation(value = "商品分组标签列表", notes = "获取所有的商品分组列表")
@Operation(summary = "商品分组标签列表" , description = "获取所有的商品分组列表")
public ResponseEntity<List<ProdTagDto>> getProdTagList() {
List<ProdTag> prodTagList = prodTagService.listProdTag();
List<ProdTagDto> prodTagDtoList = mapperFacade.mapAsList(prodTagList, ProdTagDto.class);

View File

@ -19,10 +19,10 @@ import com.yami.shop.bean.dto.SearchProdDto;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.service.HotSearchService;
import com.yami.shop.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
@ -34,7 +34,7 @@ import java.util.List;
@RestController
@RequestMapping("/search")
@Api(tags = "搜索接口")
@Tag(name = "搜索接口")
@AllArgsConstructor
public class SearchController {
@ -43,11 +43,11 @@ public class SearchController {
private final ProductService productService;
@GetMapping("/hotSearchByShopId")
@ApiOperation(value = "查看店铺热搜", notes = "根据店铺id,热搜数量获取热搜")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopId", value = "店铺id", required = true, dataType = "Long"),
@ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
@Operation(summary = "查看店铺热搜" , description = "根据店铺id,热搜数量获取热搜")
@Parameters({
@Parameter(name = "shopId", description = "店铺id" , required = true),
@Parameter(name = "number", description = "取数" , required = true),
@Parameter(name = "sort", description = "是否按照顺序(0 否 1是)"),
})
public ResponseEntity<List<HotSearchDto>> hotSearchByShopId(Long shopId,Integer number,Integer sort) {
List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(shopId);
@ -56,10 +56,10 @@ public class SearchController {
}
@GetMapping("/hotSearch")
@ApiOperation(value = "查看全局热搜", notes = "根据店铺id,热搜数量获取热搜")
@ApiImplicitParams({
@ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
@Operation(summary = "查看全局热搜" , description = "根据店铺id,热搜数量获取热搜")
@Parameters({
@Parameter(name = "number", description = "取数" , required = true),
@Parameter(name = "sort", description = "是否按照顺序(0 否 1是)", required = false ),
})
public ResponseEntity<List<HotSearchDto>> hotSearch(Integer number,Integer sort) {
List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(0L);
@ -77,12 +77,12 @@ public class SearchController {
}
@GetMapping("/searchProdPage")
@ApiOperation(value = "分页排序搜索商品", notes = "根据商品名搜索")
@ApiImplicitParams({
@ApiImplicitParam(name = "prodName", value = "商品名", required = true, dataType = "String"),
@ApiImplicitParam(name = "sort", value = "排序(0 默认排序 1销量排序 2价格排序)", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "orderBy", value = "排序(0升序 1降序)", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "shopId", value = "店铺id", required = true, dataType = "Long"),
@Operation(summary = "分页排序搜索商品" , description = "根据商品名搜索")
@Parameters({
@Parameter(name = "prodName", description = "商品名" , required = true),
@Parameter(name = "sort", description = "排序(0 默认排序 1销量排序 2价格排序)"),
@Parameter(name = "orderBy", description = "排序(0升序 1降序)"),
@Parameter(name = "shopId", description = "店铺id" , required = true),
})
public ResponseEntity<IPage<SearchProdDto>> searchProdPage(PageParam page, String prodName, Integer sort, Integer orderBy, Long shopId) {

View File

@ -25,8 +25,8 @@ import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.BasketService;
import com.yami.shop.service.ProductService;
import com.yami.shop.service.SkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.context.ApplicationContext;
import org.springframework.http.ResponseEntity;
@ -41,7 +41,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/p/shopCart")
@Api(tags = "购物车接口")
@Tag(name = "购物车接口")
@AllArgsConstructor
public class ShopCartController {
@ -60,7 +60,7 @@ public class ShopCartController {
* @return
*/
@PostMapping("/info")
@ApiOperation(value = "获取用户购物车信息", notes = "获取用户购物车信息,参数为用户选中的活动项数组,以购物车id为key")
@Operation(summary = "获取用户购物车信息" , description = "获取用户购物车信息,参数为用户选中的活动项数组,以购物车id为key")
public ResponseEntity<List<ShopCartDto>> info(@RequestBody Map<Long, ShopCartParam> basketIdShopCartParamMap) {
String userId = SecurityUtils.getUser().getUserId();
@ -76,7 +76,7 @@ public class ShopCartController {
}
@DeleteMapping("/deleteItem")
@ApiOperation(value = "删除用户购物车物品", notes = "通过购物车id删除用户购物车物品")
@Operation(summary = "删除用户购物车物品" , description = "通过购物车id删除用户购物车物品")
public ResponseEntity<Void> deleteItem(@RequestBody List<Long> basketIds) {
String userId = SecurityUtils.getUser().getUserId();
basketService.deleteShopCartItemsByBasketIds(userId, basketIds);
@ -84,7 +84,7 @@ public class ShopCartController {
}
@DeleteMapping("/deleteAll")
@ApiOperation(value = "清空用户购物车所有物品", notes = "清空用户购物车所有物品")
@Operation(summary = "清空用户购物车所有物品" , description = "清空用户购物车所有物品")
public ResponseEntity<String> deleteAll() {
String userId = SecurityUtils.getUser().getUserId();
basketService.deleteAllShopCartItems(userId);
@ -92,7 +92,7 @@ public class ShopCartController {
}
@PostMapping("/changeItem")
@ApiOperation(value = "添加、修改用户购物车物品", notes = "通过商品id(prodId)、skuId、店铺Id(shopId),添加/修改用户购物车商品,并传入改变的商品个数(count)" +
@Operation(summary = "添加、修改用户购物车物品", description = "通过商品id(prodId)、skuId、店铺Id(shopId),添加/修改用户购物车商品,并传入改变的商品个数(count)" +
"当count为正值时增加商品数量当count为负值时将减去商品的数量当最终count值小于0时会将商品从购物车里面删除")
public ResponseEntity<String> addItem(@Valid @RequestBody ChangeShopCartParam param) {
@ -145,7 +145,7 @@ public class ShopCartController {
}
@GetMapping("/prodCount")
@ApiOperation(value = "获取购物车商品数量", notes = "获取所有购物车商品数量")
@Operation(summary = "获取购物车商品数量" , description = "获取所有购物车商品数量")
public ResponseEntity<Integer> prodCount() {
String userId = SecurityUtils.getUser().getUserId();
List<ShopCartItemDto> shopCartItems = basketService.getShopCartItems(userId);
@ -157,7 +157,7 @@ public class ShopCartController {
}
@GetMapping("/expiryProdList")
@ApiOperation(value = "获取购物车失效商品信息", notes = "获取购物车失效商品列表")
@Operation(summary = "获取购物车失效商品信息" , description = "获取购物车失效商品列表")
public ResponseEntity<List<ShopCartExpiryItemDto>> expiryProdList() {
String userId = SecurityUtils.getUser().getUserId();
List<ShopCartItemDto> shopCartItems = basketService.getShopCartExpiryItems(userId);
@ -183,7 +183,7 @@ public class ShopCartController {
}
@DeleteMapping("/cleanExpiryProdList")
@ApiOperation(value = "清空用户失效商品", notes = "清空用户失效商品")
@Operation(summary = "清空用户失效商品" , description = "清空用户失效商品")
public ResponseEntity<Void> cleanExpiryProdList() {
String userId = SecurityUtils.getUser().getUserId();
basketService.cleanExpiryProdList(userId);
@ -191,7 +191,7 @@ public class ShopCartController {
}
@PostMapping("/totalPay")
@ApiOperation(value = "获取选中购物项总计、选中的商品数量", notes = "获取选中购物项总计、选中的商品数量,参数为购物车id数组")
@Operation(summary = "获取选中购物项总计、选中的商品数量" , description = "获取选中购物项总计、选中的商品数量,参数为购物车id数组")
public ResponseEntity<ShopCartAmountDto> getTotalPay(@RequestBody List<Long> basketIds) {
// 拿到购物车的所有item

View File

@ -14,9 +14,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yami.shop.bean.app.dto.SkuDto;
import com.yami.shop.bean.model.Sku;
import com.yami.shop.service.SkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.http.ResponseEntity;
@ -28,7 +28,7 @@ import java.util.List;
@RestController
@RequestMapping("/sku")
@Api(tags = "sku规格接口")
@Tag(name = "sku规格接口")
@AllArgsConstructor
public class SkuController {
@ -37,8 +37,8 @@ public class SkuController {
private final MapperFacade mapperFacade;
@GetMapping("/getSkuList")
@ApiOperation(value = "通过prodId获取商品全部规格列表", notes = "通过prodId获取商品全部规格列表")
@ApiImplicitParam(name = "prodId", value = "商品id", dataType = "Long")
@Operation(summary = "通过prodId获取商品全部规格列表" , description = "通过prodId获取商品全部规格列表")
@Parameter(name = "prodId", description = "商品id" )
public ResponseEntity<List<SkuDto>> getSkuListByProdId(Long prodId) {
List<Sku> skus = skuService.list(new LambdaQueryWrapper<Sku>()
.eq(Sku::getStatus, 1)

View File

@ -15,8 +15,8 @@ import com.yami.shop.bean.app.param.SendSmsParam;
import com.yami.shop.bean.enums.SmsType;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.SmsLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/p/sms")
@Api(tags="发送验证码接口")
@Tag(name = "发送验证码接口")
public class SmsController {
@Autowired
@ -35,7 +35,7 @@ public class SmsController {
* 发送验证码接口
*/
@PostMapping("/send")
@ApiOperation(value="发送验证码", notes="用户的发送验证码")
@Operation(summary = "发送验证码" , description = "用户的发送验证码")
public ResponseEntity<Void> audit(@RequestBody SendSmsParam sendSmsParam) {
String userId = SecurityUtils.getUser().getUserId();
smsLogService.sendSms(SmsType.VALID, userId, sendSmsParam.getMobile(),Maps.newHashMap());

View File

@ -22,9 +22,9 @@ import com.yami.shop.common.util.PageParam;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.ProductService;
import com.yami.shop.service.UserCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -34,7 +34,7 @@ import java.util.Objects;
@RestController
@RequestMapping("/p/user/collection")
@Api(tags = "收藏接口")
@Tag(name = "收藏接口")
@AllArgsConstructor
public class UserCollectionController {
@ -43,13 +43,13 @@ public class UserCollectionController {
private final ProductService productService;
@GetMapping("/page")
@ApiOperation(value = "分页返回收藏数据", notes = "根据用户id获取")
@Operation(summary = "分页返回收藏数据" , description = "根据用户id获取")
public ResponseEntity<IPage<UserCollectionDto>> getUserCollectionDtoPageByUserId(PageParam page) {
return ResponseEntity.ok(userCollectionService.getUserCollectionDtoPageByUserId(page, SecurityUtils.getUser().getUserId()));
}
@GetMapping("isCollection")
@ApiOperation(value = "根据商品id获取该商品是否在收藏夹中", notes = "传入收藏商品id")
@Operation(summary = "根据商品id获取该商品是否在收藏夹中" , description = "传入收藏商品id")
public ResponseEntity<Boolean> isCollection(Long prodId) {
if (productService.count(new LambdaQueryWrapper<Product>()
.eq(Product::getProdId, prodId)) < 1) {
@ -61,8 +61,8 @@ public class UserCollectionController {
}
@PostMapping("/addOrCancel")
@ApiOperation(value = "添加/取消收藏", notes = "传入收藏商品id,如果商品未收藏则收藏商品,已收藏则取消收藏")
@ApiImplicitParam(name = "prodId", value = "商品id", required = true, dataType = "Long")
@Operation(summary = "添加/取消收藏" , description = "传入收藏商品id,如果商品未收藏则收藏商品,已收藏则取消收藏")
@Parameter(name = "prodId", description = "商品id" , required = true)
public ResponseEntity<Void> addOrCancel(@RequestBody Long prodId) {
if (Objects.isNull(productService.getProductByProdId(prodId))) {
throw new YamiShopBindException("该商品不存在");
@ -88,14 +88,14 @@ public class UserCollectionController {
* 查询用户收藏商品数量
*/
@GetMapping("count")
@ApiOperation(value = "查询用户收藏商品数量", notes = "查询用户收藏商品数量")
@Operation(summary = "查询用户收藏商品数量" , description = "查询用户收藏商品数量")
public int findUserCollectionCount() {
String userId = SecurityUtils.getUser().getUserId();
return userCollectionService.count(new LambdaQueryWrapper<UserCollection>().eq(UserCollection::getUserId, userId));
}
@GetMapping("/prods")
@ApiOperation(value = "获取用户收藏商品列表", notes = "获取用户收藏商品列表")
@Operation(summary = "获取用户收藏商品列表" , description = "获取用户收藏商品列表")
public ResponseEntity<IPage<ProductDto>> collectionProds(PageParam page) {
String userId = SecurityUtils.getUser().getUserId();
IPage<ProductDto> productDtoIPage = productService.collectionProds(page, userId);

View File

@ -16,8 +16,8 @@ import com.yami.shop.bean.app.param.UserInfoParam;
import com.yami.shop.bean.model.User;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.http.ResponseEntity;
@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/p/user")
@Api(tags="用户接口")
@Tag(name = "用户接口")
@AllArgsConstructor
public class UserController {
@ -36,7 +36,7 @@ public class UserController {
* 查看用户接口
*/
@GetMapping("/userInfo")
@ApiOperation(value="查看用户信息", notes="根据用户IDuserId获取用户信息")
@Operation(summary = "查看用户信息" , description = "根据用户IDuserId获取用户信息")
public ResponseEntity<UserDto> userInfo() {
String userId = SecurityUtils.getUser().getUserId();
User user = userService.getById(userId);
@ -45,7 +45,7 @@ public class UserController {
}
@PutMapping("/setUserInfo")
@ApiOperation(value="设置用户信息", notes="设置用户信息")
@Operation(summary = "设置用户信息" , description = "设置用户信息")
public ResponseEntity<Void> setUserInfo(@RequestBody UserInfoParam userInfoParam) {
String userId = SecurityUtils.getUser().getUserId();
User user = new User();

View File

@ -13,8 +13,8 @@ import com.yami.shop.security.common.manager.PasswordManager;
import com.yami.shop.security.common.manager.TokenStore;
import com.yami.shop.security.common.vo.TokenInfoVO;
import com.yami.shop.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
@ -30,7 +30,7 @@ import java.util.Date;
*/
@RestController
@RequestMapping("/user")
@Api(tags = "用户注册相关接口")
@Tag(name = "用户注册相关接口")
@AllArgsConstructor
public class UserRegisterController {
@ -43,7 +43,7 @@ public class UserRegisterController {
private final PasswordManager passwordManager;
@PostMapping("/register")
@ApiOperation(value = "注册", notes = "用户注册或绑定手机号接口")
@Operation(summary = "注册" , description = "用户注册或绑定手机号接口")
public ResponseEntity<TokenInfoVO> register(@Valid @RequestBody UserRegisterParam userRegisterParam) {
if (StrUtil.isBlank(userRegisterParam.getNickName())) {
userRegisterParam.setNickName(userRegisterParam.getUserName());
@ -76,7 +76,7 @@ public class UserRegisterController {
@PutMapping("/updatePwd")
@ApiOperation(value = "修改密码", notes = "修改密码")
@Operation(summary = "修改密码" , description = "修改密码")
public ResponseEntity<Void> updatePwd(@Valid @RequestBody UserRegisterParam userPwdUpdateParam) {
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getNickName, userPwdUpdateParam.getNickName()));
if (user == null) {

View File

@ -11,9 +11,6 @@ spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
mvc:
pathmatch:
matching-strategy: ANT_PATH_MATCHER
# mybaits-plus配置
mybatis-plus:
# MyBatis Mapper所对应的XML文件位置

View File

@ -13,7 +13,7 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -22,10 +22,10 @@ import java.util.List;
@Data
public class BasketItemDto implements Serializable {
@ApiModelProperty(value = "购物车ID", required = true)
@Schema(description = "购物车ID" , required = true)
private Long basketId;
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
/**
@ -34,35 +34,35 @@ public class BasketItemDto implements Serializable {
@JsonIgnore
private String shopName;
@ApiModelProperty(value = "产品ID", required = true)
@Schema(description = "产品ID" , required = true)
private Long prodId;
@ApiModelProperty(value = "skuID", required = true)
@Schema(description = "skuID" , required = true)
private Long skuId;
@ApiModelProperty(value = "产品个数", required = true)
@Schema(description = "产品个数" , required = true)
private Integer prodCount;
@ApiModelProperty(value = "产品名称", required = true)
@Schema(description = "产品名称" , required = true)
private String prodName;
@ApiModelProperty(value = "产品主图", required = true)
@Schema(description = "产品主图" , required = true)
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "产品现价", required = true)
@Schema(description = "产品现价" , required = true)
private Double price;
@ApiModelProperty(value = "产品原价", required = true)
@Schema(description = "产品原价" , required = true)
private Double oriPrice;
@ApiModelProperty(value = "产品简介", required = true)
@Schema(description = "产品简介" , required = true)
private String brief;
@ApiModelProperty(value = "产品sku信息", required = true)
@Schema(description = "产品sku信息" , required = true)
private String skuName;
@ApiModelProperty("参与满减活动列表")
@Schema(description = "参与满减活动列表" )
private List<DiscountDto> discounts;
}

View File

@ -12,22 +12,22 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CategoryDto {
@ApiModelProperty(value = "分类id",required=true)
@Schema(description = "分类id" ,required=true)
private Long categoryId;
@ApiModelProperty(value = "分类父id",required=true)
@Schema(description = "分类父id" ,required=true)
private Long parentId;
@ApiModelProperty(value = "分类名称",required=true)
@Schema(description = "分类名称" ,required=true)
private String categoryName;
@ApiModelProperty(value = "分类图片",required=true)
@Schema(description = "分类图片" ,required=true)
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;

View File

@ -11,7 +11,7 @@
package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;

View File

@ -12,22 +12,22 @@ package com.yami.shop.bean.app.dto;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class DeliveryDto {
@ApiModelProperty(value = "物流公司名称",required=true)
@Schema(description = "物流公司名称" ,required=true)
private String companyName;
@ApiModelProperty(value = "物流公司官网",required=true)
@Schema(description = "物流公司官网" ,required=true)
private String companyHomeUrl;
@ApiModelProperty(value = "物流订单号",required=true)
@Schema(description = "物流订单号" ,required=true)
private String dvyFlowId;
@ApiModelProperty(value = "查询出的物流信息",required=true)
@Schema(description = "查询出的物流信息" ,required=true)
private List<DeliveryInfoDto> data;
}

View File

@ -10,21 +10,21 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class DeliveryInfoDto {
@ApiModelProperty(value = "详细信息",required=true)
@Schema(description = "详细信息" ,required=true)
private String context;
private String ftime;
@ApiModelProperty(value = "快递所在区域",required=true)
@Schema(description = "快递所在区域" ,required=true)
private String location;
@ApiModelProperty(value = "物流更新时间",required=true)
@Schema(description = "物流更新时间" ,required=true)
private String time;
}

View File

@ -12,13 +12,12 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@ApiModel("首页图片对象")
@Schema(description = "首页图片对象")
@Data
public class IndexImgDto {
@ -26,31 +25,31 @@ public class IndexImgDto {
* 图片
*/
@JsonSerialize(using = ImgJsonSerializer.class)
@ApiModelProperty(value = "图片Url", required = true)
@Schema(description = "图片Url" , required = true)
private String imgUrl;
/**
* 顺序
*/
@ApiModelProperty(value = "图片顺序", required = true)
@Schema(description = "图片顺序" , required = true)
private Integer seq;
/**
* 上传时间
*/
@ApiModelProperty(value = "上传时间", required = true)
@Schema(description = "上传时间" , required = true)
private Date uploadTime;
/**
* 类型
*/
@ApiModelProperty(value = "类型", required = true)
@Schema(description = "类型" , required = true)
private int type;
/**
* 关联id
*/
@ApiModelProperty(value = "关联id", required = true)
@Schema(description = "关联id" , required = true)
private Long relation;

View File

@ -12,24 +12,23 @@ package com.yami.shop.bean.app.dto;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel("我的订单")
@Schema(description = "我的订单")
public class MyOrderDto {
@ApiModelProperty(value = "订单项",required=true)
@Schema(description = "订单项" ,required=true)
private List<MyOrderItemDto> orderItemDtos;
@ApiModelProperty(value = "订单号",required=true)
@Schema(description = "订单号" ,required=true)
private String orderNumber;
@ApiModelProperty(value = "总价",required=true)
@Schema(description = "总价" ,required=true)
private Double actualTotal;
@ApiModelProperty(value = "订单状态",required=true)
@Schema(description = "订单状态" ,required=true)
private Integer status;
}

View File

@ -12,28 +12,27 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ApiModel("我的订单-订单项")
@Schema(description = "我的订单-订单项")
@Data
public class MyOrderItemDto {
@ApiModelProperty(value = "商品图片", required = true)
@Schema(description = "商品图片" , required = true)
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "商品名称", required = true)
@Schema(description = "商品名称" , required = true)
private String prodName;
@ApiModelProperty(value = "商品数量", required = true)
@Schema(description = "商品数量" , required = true)
private Integer prodCount;
@ApiModelProperty(value = "商品价格", required = true)
@Schema(description = "商品价格" , required = true)
private Double price;
@ApiModelProperty(value = "skuName", required = true)
@Schema(description = "skuName" , required = true)
private String skuName;
}

View File

@ -11,34 +11,33 @@
package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@ApiModel("公告对象")
@Schema(description = "公告对象")
@Data
public class NoticeDto {
@JsonView(NoContent.class)
@ApiModelProperty(value = "公告id")
@Schema(description = "公告id" )
private Long id;
@JsonView(NoContent.class)
@ApiModelProperty(value = "店铺id")
@Schema(description = "店铺id" )
private Long shopId;
@JsonView(NoContent.class)
@ApiModelProperty(value = "标题")
@Schema(description = "标题" )
private String title;
@ApiModelProperty(value = "公告内容")
@Schema(description = "公告内容" )
@JsonView(WithContent.class)
private String content;
@JsonView(NoContent.class)
@ApiModelProperty(value = "公告发布时间")
@Schema(description = "公告发布时间" )
private Date publishTime;
public static interface NoContent{}

View File

@ -10,33 +10,32 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel("我的订单数量")
@Schema(description = "我的订单数量")
public class OrderCountData {
@ApiModelProperty(value = "所有订单数量")
@Schema(description = "所有订单数量" )
private Integer allCount;
@ApiModelProperty(value = "待付款")
@Schema(description = "待付款" )
private Integer unPay;
@ApiModelProperty(value = "待发货")
@Schema(description = "待发货" )
private Integer payed;
@ApiModelProperty(value = "待收货")
@Schema(description = "待收货" )
private Integer consignment;
@ApiModelProperty(value = "待评价")
@Schema(description = "待评价" )
private Integer confirm;
@ApiModelProperty(value = "成功")
@Schema(description = "成功" )
private Integer success;
@ApiModelProperty(value = "失败")
@Schema(description = "失败" )
private Integer close;

View File

@ -10,13 +10,13 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class OrderNumbersDto {
@ApiModelProperty(value = "多个订单号拼接的字符串",required=true)
@Schema(description = "多个订单号拼接的字符串" ,required=true)
private String orderNumbers;
public OrderNumbersDto(String orderNumbers) {

View File

@ -17,7 +17,7 @@ import java.util.List;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 订单下的每个店铺
@ -30,58 +30,58 @@ public class OrderShopDto implements Serializable {
/**
* 店铺ID
**/
@ApiModelProperty(value = "店铺id", required = true)
@Schema(description = "店铺id" , required = true)
private Long shopId;
/**
* 店铺名称
**/
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "实际总值", required = true)
@Schema(description = "实际总值" , required = true)
private Double actualTotal;
@ApiModelProperty(value = "商品总值", required = true)
@Schema(description = "商品总值" , required = true)
private Double total;
@ApiModelProperty(value = "商品总数", required = true)
@Schema(description = "商品总数" , required = true)
private Integer totalNum;
@ApiModelProperty(value = "地址Dto", required = true)
@Schema(description = "地址Dto" , required = true)
private UserAddrDto userAddrDto;
@ApiModelProperty(value = "产品信息", required = true)
@Schema(description = "产品信息" , required = true)
private List<OrderItemDto> orderItemDtos;
@ApiModelProperty(value = "运费", required = true)
@Schema(description = "运费" , required = true)
private Double transfee;
@ApiModelProperty(value = "优惠总额", required = true)
@Schema(description = "优惠总额" , required = true)
private Double reduceAmount;
@ApiModelProperty(value = "促销活动优惠金额", required = true)
@Schema(description = "促销活动优惠金额" , required = true)
private Double discountMoney;
@ApiModelProperty(value = "优惠券优惠金额", required = true)
@Schema(description = "优惠券优惠金额" , required = true)
private Double couponMoney;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "订单创建时间", required = true)
@Schema(description = "订单创建时间" , required = true)
private Date createTime;
/**
* 订单备注信息
*/
@ApiModelProperty(value = "订单备注信息", required = true)
@Schema(description = "订单备注信息" , required = true)
private String remarks;
/**
* 订单状态
*/
@ApiModelProperty(value = "订单状态", required = true)
@Schema(description = "订单状态" , required = true)
private Integer status;
}

View File

@ -10,31 +10,30 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ApiModel("商品评论数据")
@Schema(description = "商品评论数据")
@Data
public class ProdCommDataDto {
@ApiModelProperty(value = "好评率")
@Schema(description = "好评率" )
private Double positiveRating;
@ApiModelProperty(value = "评论数量")
@Schema(description = "评论数量" )
private Integer number;
@ApiModelProperty(value = "好评数")
@Schema(description = "好评数" )
private Integer praiseNumber;
@ApiModelProperty(value = "中评数")
@Schema(description = "中评数" )
private Integer secondaryNumber;
@ApiModelProperty(value = "差评数")
@Schema(description = "差评数" )
private Integer negativeNumber;
@ApiModelProperty(value = "有图数")
@Schema(description = "有图数" )
private Integer picNumber;
}

View File

@ -14,43 +14,42 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.EmojiJsonSerializer;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
@ApiModel("评论对象")
@Schema(description = "评论对象")
@Data
public class ProdCommDto {
@ApiModelProperty(value = "id")
@Schema(description = "id" )
private Long prodCommId;
/**
* 得分0-5分
*/
@ApiModelProperty(value = "得分0-5分")
@Schema(description = "得分0-5分" )
private Integer score;
/**
* 是否匿名(1: 0:)
*/
@ApiModelProperty(value = "是否匿名(1:是 0:否)")
@Schema(description = "是否匿名(1:是 0:否)" )
private Integer isAnonymous;
/**
* 掌柜回复
*/
@ApiModelProperty(value = "掌柜回复")
@Schema(description = "掌柜回复" )
private String replyContent;
/**
* 记录时间
*/
@ApiModelProperty(value = "记录时间")
@Schema(description = "记录时间" )
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date recTime;
@ -58,40 +57,40 @@ public class ProdCommDto {
/**
* 回复时间
*/
@ApiModelProperty(value = "回复时间")
@Schema(description = "回复时间" )
@JsonFormat(pattern = "yyyy-MM-dd")
private Date replyTime;
@JsonSerialize(using = EmojiJsonSerializer.class)
@ApiModelProperty(value = "用户昵称")
@Schema(description = "用户昵称" )
private String nickName;
/**
* 头像图片路径
*/
@ApiModelProperty(value = "头像图片路径")
@Schema(description = "头像图片路径" )
private String pic;
/**
* 是否回复 0:未回复 1:已回复
*/
@ApiModelProperty(value = "商家是否回复 0:未回复 1:已回复")
@Schema(description = "商家是否回复 0:未回复 1:已回复" )
private Integer replySts;
/**
* 评论图片
*/
@JsonSerialize(using = ImgJsonSerializer.class)
@ApiModelProperty(value = "评论图片")
@Schema(description = "评论图片" )
private String pics;
/**
* 评价等级
*/
@ApiModelProperty(value = "0好评 1中评 2差评")
@Schema(description = "0好评 1中评 2差评" )
private Byte evaluate;
@ApiModelProperty(value = "评论内容")
@Schema(description = "评论内容" )
private String content;
}

View File

@ -10,22 +10,22 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ProdTagDto {
@ApiModelProperty(value = "分组标签id")
@Schema(description = "分组标签id" )
private Long id;
@ApiModelProperty(value = "分组标签标题")
@Schema(description = "分组标签标题" )
private String title;
@ApiModelProperty(value = "排序(数值越高越靠前)")
@Schema(description = "排序(数值越高越靠前)" )
private String seq;
@ApiModelProperty(value = "列表样式(0:一列一个,1:一列两个,2:一列三个)")
@Schema(description = "列表样式(0:一列一个,1:一列两个,2:一列三个)" )
private String style;
}

View File

@ -16,7 +16,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.bean.model.Transport;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ -24,78 +24,78 @@ public class ProductDto {
/**
* 店铺ID
*/
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
/**
* 店铺名称
*/
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
/**
* 商品ID
*/
@ApiModelProperty(value = "商品ID", required = true)
@Schema(description = "商品ID" , required = true)
private Long prodId;
/**
* 商品名称
*/
@ApiModelProperty(value = "商品名称")
@Schema(description = "商品名称" )
private String prodName;
/**
* 商品价格
*/
@ApiModelProperty(value = "商品价格", required = true)
@Schema(description = "商品价格" , required = true)
private Double price;
/**
* 商品详情
*/
@ApiModelProperty(value = "详细描述")
@Schema(description = "详细描述" )
private String content;
/**
* 商品原价
*/
@ApiModelProperty(value = "商品原价", required = true)
@Schema(description = "商品原价" , required = true)
private Double oriPrice;
/**
* 库存量
*/
@ApiModelProperty(value = "库存量", required = true)
@Schema(description = "库存量" , required = true)
private Integer totalStocks;
/**
* 简要描述,卖点等
*/
@ApiModelProperty(value = "简要描述,卖点等", required = true)
@Schema(description = "简要描述,卖点等" , required = true)
private String brief;
/**
* 商品主图
*/
@JsonSerialize(using = ImgJsonSerializer.class)
@ApiModelProperty(value = "商品主图", required = true)
@Schema(description = "商品主图" , required = true)
private String pic;
@JsonSerialize(using = ImgJsonSerializer.class)
@ApiModelProperty(value = "商品图片列表,以逗号分割", required = true)
@Schema(description = "商品图片列表,以逗号分割" , required = true)
private String imgs;
/**
* 商品分类
*/
@ApiModelProperty(value = "商品分类id", required = true)
@Schema(description = "商品分类id" , required = true)
private Long categoryId;
@ApiModelProperty(value = "sku列表")
@Schema(description = "sku列表" )
private List<SkuDto> skuList;
@ApiModelProperty(value = "运费信息", required = true)
@Schema(description = "运费信息" , required = true)
private Transport transport;
public static interface WithNoContent{}

View File

@ -13,7 +13,7 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -26,43 +26,43 @@ import java.util.List;
@Data
public class ProductItemDto implements Serializable {
@ApiModelProperty(value = "产品名称",required=true)
@Schema(description = "产品名称" ,required=true)
private String prodName;
@ApiModelProperty(value = "产品个数",required=true)
@Schema(description = "产品个数" ,required=true)
private Integer prodCount;
@ApiModelProperty(value = "产品图片路径",required=true)
@Schema(description = "产品图片路径" ,required=true)
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "产品价格",required=true)
@Schema(description = "产品价格" ,required=true)
private Double price;
@ApiModelProperty(value = "商品总金额",required=true)
@Schema(description = "商品总金额" ,required=true)
private Double productTotalAmount;
@ApiModelProperty(value = "产品ID",required=true)
@Schema(description = "产品ID" ,required=true)
private Long prodId;
@ApiModelProperty(value = "skuId",required=true)
@Schema(description = "skuId" ,required=true)
private Long skuId;
@ApiModelProperty(value = "规格名称", required = true)
@Schema(description = "规格名称" , required = true)
private String skuName;
@ApiModelProperty(value = "basketId",required=true)
@Schema(description = "basketId" ,required=true)
private Long basketId;
@ApiModelProperty(value = "商品实际金额 = 商品总金额 - 分摊的优惠金额")
@Schema(description = "商品实际金额 = 商品总金额 - 分摊的优惠金额" )
private Double actualTotal;
@ApiModelProperty(value = "满减满折优惠id0不主动参与活动用户没有主动参与该活动-1主动不参与活动")
@Schema(description = "满减满折优惠id0不主动参与活动用户没有主动参与该活动-1主动不参与活动" )
private Long discountId = 0L;
@ApiModelProperty(value = "分摊的优惠金额")
@Schema(description = "分摊的优惠金额" )
private Double shareReduce;
@ApiModelProperty("参与满减活动列表")
@Schema(description = "参与满减活动列表" )
private List<DiscountDto> discounts = new ArrayList<>();
}

View File

@ -10,23 +10,22 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel("购物车合计")
@Schema(description = "购物车合计")
public class ShopCartAmountDto {
@ApiModelProperty("总额")
@Schema(description = "总额" )
private Double totalMoney;
@ApiModelProperty("总计")
@Schema(description = "总计" )
private Double finalMoney;
@ApiModelProperty("减额")
@Schema(description = "减额" )
private Double subtractMoney;
@ApiModelProperty("商品数量")
@Schema(description = "商品数量" )
private Integer count;
}

View File

@ -10,7 +10,7 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -19,13 +19,13 @@ import java.util.List;
@Data
public class ShopCartDto implements Serializable {
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "购物车商品", required = true)
@Schema(description = "购物车商品" , required = true)
private List<ShopCartItemDiscountDto> shopCartItemDiscounts;

View File

@ -10,22 +10,21 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("购物车失效商品对象")
@Schema(description = "购物车失效商品对象")
public class ShopCartExpiryItemDto {
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "商品项", required = true)
@Schema(description = "商品项" , required = true)
private List<ShopCartItemDto> shopCartItemDtoList;
}

View File

@ -10,7 +10,7 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -20,9 +20,9 @@ import java.util.List;
public class ShopCartItemDiscountDto implements Serializable {
@ApiModelProperty(value = "已选满减项", required = true)
@Schema(description = "已选满减项" , required = true)
private ChooseDiscountItemDto chooseDiscountItemDto;
@ApiModelProperty(value = "商品列表")
@Schema(description = "商品列表" )
private List<ShopCartItemDto> shopCartItems;
}

View File

@ -12,7 +12,7 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -29,24 +29,24 @@ import java.util.List;
public class ShopCartItemDto extends ProductItemDto implements Serializable {
private static final long serialVersionUID = -8284981156242930909L;
@ApiModelProperty(value = "购物车ID", required = true)
@Schema(description = "购物车ID" , required = true)
private Long basketId;
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
@ApiModelProperty(value = "规格名称", required = true)
@Schema(description = "规格名称" , required = true)
private String skuName;
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "商品原价", required = true)
@Schema(description = "商品原价" , required = true)
private Double oriPrice;
@ApiModelProperty(value = "推广员使用的推销卡号")
@Schema(description = "推广员使用的推销卡号" )
private String distributionCardNo;
@ApiModelProperty(value = "加入购物车的时间")
@Schema(description = "加入购物车的时间" )
private Date basketDate;
}

View File

@ -10,7 +10,7 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -22,42 +22,42 @@ import java.util.List;
@Data
public class ShopCartOrderDto implements Serializable{
@ApiModelProperty(value = "店铺id", required = true)
@Schema(description = "店铺id" , required = true)
private Long shopId;
@ApiModelProperty(value = "店铺名称", required = true)
@Schema(description = "店铺名称" , required = true)
private String shopName;
@ApiModelProperty(value = "实际总值", required = true)
@Schema(description = "实际总值" , required = true)
private Double actualTotal;
@ApiModelProperty(value = "商品总值", required = true)
@Schema(description = "商品总值" , required = true)
private Double total;
@ApiModelProperty(value = "商品总数", required = true)
@Schema(description = "商品总数" , required = true)
private Integer totalCount;
@ApiModelProperty(value = "运费", required = true)
@Schema(description = "运费" , required = true)
private Double transfee;
@ApiModelProperty(value = "促销活动优惠金额", required = true)
@Schema(description = "促销活动优惠金额" , required = true)
private Double discountReduce;
@ApiModelProperty(value = "优惠券优惠金额", required = true)
@Schema(description = "优惠券优惠金额" , required = true)
private Double couponReduce;
@ApiModelProperty(value = "店铺优惠金额(促销活动 + 优惠券 + 其他)", required = true)
@Schema(description = "店铺优惠金额(促销活动 + 优惠券 + 其他)" , required = true)
private Double shopReduce = 0.0;
@ApiModelProperty(value = "订单备注信息", required = true)
@Schema(description = "订单备注信息" , required = true)
private String remarks;
@ApiModelProperty(value = "购物车商品", required = true)
@Schema(description = "购物车商品" , required = true)
private List<ShopCartItemDiscountDto> shopCartItemDiscounts;
@ApiModelProperty(value = "整个店铺可以使用的优惠券列表", required = true)
@Schema(description = "整个店铺可以使用的优惠券列表" , required = true)
private List<CouponOrderDto> coupons;
@ApiModelProperty(value = "订单编号", required = true)
@Schema(description = "订单编号" , required = true)
private String orderNumber;
}

View File

@ -10,7 +10,7 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -23,24 +23,24 @@ import java.util.List;
@Data
public class ShopCartOrderMergerDto implements Serializable{
@ApiModelProperty(value = "实际总值", required = true)
@Schema(description = "实际总值" , required = true)
private Double actualTotal;
@ApiModelProperty(value = "商品总值", required = true)
@Schema(description = "商品总值" , required = true)
private Double total;
@ApiModelProperty(value = "商品总数", required = true)
@Schema(description = "商品总数" , required = true)
private Integer totalCount;
@ApiModelProperty(value = "订单优惠金额(所有店铺优惠金额相加)", required = true)
@Schema(description = "订单优惠金额(所有店铺优惠金额相加)" , required = true)
private Double orderReduce;
@ApiModelProperty(value = "地址Dto", required = true)
@Schema(description = "地址Dto" , required = true)
private UserAddrDto userAddr;
@ApiModelProperty(value = "每个店铺的购物车信息", required = true)
@Schema(description = "每个店铺的购物车信息" , required = true)
private List<ShopCartOrderDto> shopCartOrders;
@ApiModelProperty(value = "整个订单可以使用的优惠券列表", required = true)
@Schema(description = "整个订单可以使用的优惠券列表" , required = true)
private List<CouponOrderDto> coupons;
}

View File

@ -12,7 +12,7 @@ package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -22,23 +22,23 @@ public class SkuDto implements Serializable {
private static final long serialVersionUID = 6457261945829470666L;
@ApiModelProperty(value = "skuId", required = true)
@Schema(description = "skuId" , required = true)
private Long skuId;
@ApiModelProperty(value = "价格", required = true)
@Schema(description = "价格" , required = true)
private Double price;
@ApiModelProperty(value = "原价")
@Schema(description = "原价" )
private Double oriPrice;
@ApiModelProperty(value = "库存(-1表示无穷)", required = true)
@Schema(description = "库存(-1表示无穷)" , required = true)
private Integer stocks;
@ApiModelProperty(value = "sku名称", required = true)
@Schema(description = "sku名称" , required = true)
private String skuName;
@ApiModelProperty(value = "图片")
@Schema(description = "图片" )
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "销售属性组合字符串,格式是p1:v1;p2:v2", required = true)
@Schema(description = "销售属性组合字符串,格式是p1:v1;p2:v2" , required = true)
private String properties;
}

View File

@ -11,7 +11,7 @@
package com.yami.shop.bean.app.dto;
import com.yami.shop.bean.model.ProdTag;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@ -19,16 +19,16 @@ import java.util.List;
@Data
public class TagProductDto {
@ApiModelProperty(value = "分组标签id")
@Schema(description = "分组标签id" )
private Long id;
@ApiModelProperty(value = "分组标签标题")
@Schema(description = "分组标签标题" )
private String title;
@ApiModelProperty(value = "排序(数值越高越靠前)")
@Schema(description = "排序(数值越高越靠前)" )
private String seq;
@ApiModelProperty(value = "列表样式(0:一列一个,1:一列两个,2:一列三个)")
@Schema(description = "列表样式(0:一列一个,1:一列两个,2:一列三个)" )
private String style;
private List<ProductDto> productDtoList;

View File

@ -10,52 +10,52 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class UserAddrDto implements Serializable {
@ApiModelProperty(value = "地址id", required = true)
@Schema(description = "地址id" , required = true)
private Long addrId;
@ApiModelProperty(value = "收货人", required = true)
@Schema(description = "收货人" , required = true)
private String receiver;
@ApiModelProperty(value = "", required = true)
@Schema(description = "" , required = true)
private String province;
@ApiModelProperty(value = "城市", required = true)
@Schema(description = "城市" , required = true)
private String city;
@ApiModelProperty(value = "", required = true)
@Schema(description = "" , required = true)
private String area;
@ApiModelProperty(value = "地址", required = true)
@Schema(description = "地址" , required = true)
private String addr;
@ApiModelProperty(value = "手机", required = true)
@Schema(description = "手机" , required = true)
private String mobile;
@ApiModelProperty(value = "是否默认地址1:是 0 ", required = true)
@Schema(description = "是否默认地址1:是 0 " , required = true)
private Integer commonAddr;
/**
* 省ID
*/
@ApiModelProperty(value = "省ID", required = true)
@Schema(description = "省ID" , required = true)
private Long provinceId;
/**
* 城市ID
*/
@ApiModelProperty(value = "城市ID", required = true)
@Schema(description = "城市ID" , required = true)
private Long cityId;
/**
* 区域ID
*/
@ApiModelProperty(value = "区域ID", required = true)
@Schema(description = "区域ID" , required = true)
private Long areaId;
}

View File

@ -10,23 +10,22 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@ApiModel("收藏对象")
@Schema(description = "收藏对象")
@Data
public class UserCollectionDto {
@ApiModelProperty(value = "收藏id")
@Schema(description = "收藏id" )
private Long id;
@ApiModelProperty(value = "商品名称")
@Schema(description = "商品名称" )
private String prodName;
@ApiModelProperty(value = "收藏时间")
@Schema(description = "收藏时间" )
private Date createTime;
}

View File

@ -10,14 +10,14 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class UserDto {
@ApiModelProperty(value = "用户状态0禁用 1正常",required=true)
@Schema(description = "用户状态0禁用 1正常" ,required=true)
private Integer status;
@ApiModelProperty(value = "token",required=true)
@Schema(description = "token" ,required=true)
private String token;
public Integer getStatus() {
@ -33,4 +33,4 @@ public class UserDto {
this.token = token;
}
}
}

View File

@ -12,52 +12,51 @@ package com.yami.shop.bean.app.param;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ApiModel(value= "地址参数")
@Schema(description = "地址参数")
public class AddrParam {
@ApiModelProperty(value = "地址ID",required=true)
@Schema(description = "地址ID" ,required=true)
private Long addrId;
@NotNull(message = "收货人不能为空")
@ApiModelProperty(value = "收货人",required=true)
@Schema(description = "收货人" ,required=true)
private String receiver;
@NotNull(message = "地址不能为空")
@ApiModelProperty(value = "地址",required=true)
@Schema(description = "地址" ,required=true)
private String addr;
@ApiModelProperty(value = "邮编",required=false)
@Schema(description = "邮编" ,required=false)
private String postCode;
@NotNull(message = "手机不能为空")
@ApiModelProperty(value = "手机",required=true)
@Schema(description = "手机" ,required=true)
private String mobile;
@NotNull(message = "省ID不能为空")
@ApiModelProperty(value = "省ID",required=true)
@Schema(description = "省ID" ,required=true)
private Long provinceId;
@NotNull(message = "城市ID不能为空")
@ApiModelProperty(value = "城市ID",required=true)
@Schema(description = "城市ID" ,required=true)
private Long cityId;
@NotNull(message = "区ID不能为空")
@ApiModelProperty(value = "区ID",required=true)
@Schema(description = "区ID" ,required=true)
private Long areaId;
@NotNull(message = "省不能为空")
@ApiModelProperty(value = "",required=true)
@Schema(description = "" ,required=true)
private String province;
@NotNull(message = "城市不能为空")
@ApiModelProperty(value = "城市",required=true)
@Schema(description = "城市" ,required=true)
private String city;
@NotNull(message = "区不能为空")
@ApiModelProperty(value = "",required=true)
@Schema(description = "" ,required=true)
private String area;

View File

@ -12,7 +12,7 @@ package com.yami.shop.bean.app.param;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@ -21,25 +21,25 @@ import lombok.Data;
@Data
public class ChangeShopCartParam {
@ApiModelProperty(value = "购物车ID", required = true)
@Schema(description = "购物车ID" , required = true)
private Long basketId;
@NotNull(message = "商品ID不能为空")
@ApiModelProperty(value = "商品ID", required = true)
@Schema(description = "商品ID" , required = true)
private Long prodId;
@NotNull(message = "skuId不能为空")
@ApiModelProperty(value = "skuId", required = true)
@Schema(description = "skuId" , required = true)
private Long skuId;
@NotNull(message = "店铺ID不能为空")
@ApiModelProperty(value = "店铺ID", required = true)
@Schema(description = "店铺ID" , required = true)
private Long shopId;
@NotNull(message = "商品个数不能为空")
@ApiModelProperty(value = "商品个数", required = true)
@Schema(description = "商品个数" , required = true)
private Integer count;
@ApiModelProperty(value = "分销推广人卡号")
@Schema(description = "分销推广人卡号" )
private String distributionCardNo;
}

View File

@ -10,17 +10,16 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ApiModel(value= "登陆参数")
@Schema(description = "登陆参数")
public class LoginParam {
@ApiModelProperty(value = "小程序登陆时返回的code(使用code登陆必填)",required=true)
@Schema(description = "小程序登陆时返回的code(使用code登陆必填)" ,required=true)
private String code;
@ApiModelProperty(value = "登陆时的用户名(账号密码登陆必填)",required=true)
@Schema(description = "登陆时的用户名(账号密码登陆必填)" ,required=true)
private String mobile;
@ApiModelProperty(value = "登陆时的密码(账号密码登陆必填)",required=true)
@Schema(description = "登陆时的密码(账号密码登陆必填)" ,required=true)
private String password;
public String getCode() {

View File

@ -13,31 +13,30 @@ package com.yami.shop.bean.app.param;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel(value= "购物车物品参数")
@Schema(description = "购物车物品参数")
public class OrderItemParam {
@NotNull(message = "产品ID不能为空")
@ApiModelProperty(value = "产品ID",required=true)
@Schema(description = "产品ID" ,required=true)
private Long prodId;
@NotNull(message = "skuId不能为空")
@ApiModelProperty(value = "skuId",required=true)
@Schema(description = "skuId" ,required=true)
private Long skuId;
@NotNull(message = "产品数量不能为空")
@Min(value = 1,message = "产品数量不能为空")
@ApiModelProperty(value = "产品数量",required=true)
@Schema(description = "产品数量" ,required=true)
private Integer prodCount;
@NotNull(message = "店铺id不能为空")
@ApiModelProperty(value = "店铺id",required=true)
@Schema(description = "店铺id" ,required=true)
private Long shopId;
@ApiModelProperty(value = "推广员使用的推销卡号")
@Schema(description = "推广员使用的推销卡号" )
private String distributionCardNo;
}

View File

@ -16,34 +16,33 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.yami.shop.bean.enums.OrderEntry;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel(value= "订单参数")
@Schema(description = "订单参数")
public class OrderParam {
@ApiModelProperty(value = "购物车id 数组")
@Schema(description = "购物车id 数组" )
private List<Long> basketIds;
@ApiModelProperty(value = "立即购买时提交的商品项")
@Schema(description = "立即购买时提交的商品项" )
private OrderItemParam orderItem;
@ApiModelProperty(value = "地址ID0为默认地址",required=true)
@Schema(description = "地址ID0为默认地址" ,required=true)
@NotNull(message = "地址不能为空")
private Long addrId;
@ApiModelProperty(value = "用户是否改变了优惠券的选择,如果用户改变了优惠券的选择,则完全根据传入参数进行优惠券的选择")
@Schema(description = "用户是否改变了优惠券的选择,如果用户改变了优惠券的选择,则完全根据传入参数进行优惠券的选择" )
private Integer userChangeCoupon;
@ApiModelProperty(value = "优惠券id数组")
@Schema(description = "优惠券id数组" )
private List<Long> couponIds;
// @ApiModelProperty(value = "每次订单提交时的uuid")
// @Schema(description = "每次订单提交时的uuid" )
// private String uuid;
// @ApiModelProperty(value = "订单入口 SHOP_CART购物车BUY_NOW立即购买")
// @Schema(description = "订单入口 SHOP_CART购物车BUY_NOW立即购买" )
// private OrderEntry orderEntry;

View File

@ -1,6 +1,6 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@ -8,15 +8,15 @@ import javax.validation.constraints.NotEmpty;
@Data
public class OrderRefundExpressParam {
@ApiModelProperty(value = "退款编号名称", required = true)
@Schema(description = "退款编号名称" , required = true)
@NotEmpty(message = "退款编号不能为空")
private String refundSn;
@ApiModelProperty(value = "物流公司名称", required = true)
@Schema(description = "物流公司名称" , required = true)
@NotEmpty(message = "物流公司名称不能为空")
private String expressName;
@ApiModelProperty(value = "物流单号", required = true)
@Schema(description = "物流单号" , required = true)
@NotEmpty(message = "物流单号不能为空")
private String expressNo;

View File

@ -1,6 +1,6 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@ -9,30 +9,30 @@ import javax.validation.constraints.NotNull;
@Data
public class OrderRefundParam {
@ApiModelProperty(value = "订单编号", required = true)
@Schema(description = "订单编号" , required = true)
@NotEmpty(message = "订单编号不能为空")
private String orderNumber;
@ApiModelProperty(value = "申请类型(1:仅退款 2退款退货)", required = true)
@Schema(description = "申请类型(1:仅退款 2退款退货)" , required = true)
@NotNull(message = "申请类型不能为空")
private Integer applyType;
// @ApiModelProperty(value = "订单金额", required = true)
// @Schema(description = "订单金额" , required = true)
// @NotNull(message = "订单金额不能为空")
// private Double orderAmount;
@ApiModelProperty(value = "订单项id(全部退款是0)", required = true)
@Schema(description = "订单项id(全部退款是0)" , required = true)
@NotNull(message = "订单项id不能为空")
private Long orderItemId;
// @ApiModelProperty(value = "退款金额", required = true)
// @Schema(description = "退款金额" , required = true)
// @NotNull(message = "退款金额不能为空")
// private BigDecimal refundAmount;
@ApiModelProperty(value = "凭证图片列表", required = true)
@Schema(description = "凭证图片列表" , required = true)
private String photoFiles;
@ApiModelProperty(value = "申请原因", required = true)
@Schema(description = "申请原因" , required = true)
@NotEmpty(message = "订单编号不能为空")
private String buyerMsg;

View File

@ -10,18 +10,18 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class OrderShopParam {
/** 店铺ID **/
@ApiModelProperty(value = "店铺id",required=true)
@Schema(description = "店铺id" ,required=true)
private Long shopId;
/**
* 订单备注信息
*/
@ApiModelProperty(value = "订单备注信息",required=true)
@Schema(description = "订单备注信息" ,required=true)
private String remarks;
public Long getShopId() {

View File

@ -13,24 +13,23 @@ package com.yami.shop.bean.app.param;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ApiModel(value= "支付参数")
@Schema(description = "支付参数")
public class PayParam {
/**
* 订单号
*/
@NotBlank(message="订单号不能为空")
@ApiModelProperty(value = "订单号",required=true)
@Schema(description = "订单号" ,required=true)
private String orderNumbers;
/**
* 支付方式
*/
@NotNull(message="支付方式不能为空")
@ApiModelProperty(value = "支付方式 (1:微信支付 2:支付宝)",required=true)
@Schema(description = "支付方式 (1:微信支付 2:支付宝)" ,required=true)
private Integer payType;
public Integer getPayType() {

View File

@ -12,48 +12,47 @@ package com.yami.shop.bean.app.param;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value= "添加评论信息")
@Schema(description = "添加评论信息")
public class ProdCommParam {
/**
* 商品ID
*/
@ApiModelProperty(value = "商品id")
@Schema(description = "商品id" )
private Long prodId;
/**
* 订单项ID
*/
@ApiModelProperty(value = "订单项ID")
@Schema(description = "订单项ID" )
private Long orderItemId;
/**
* 评价0-5分
*/
@ApiModelProperty(value = "评价0-5分",required=true)
@Schema(description = "评价0-5分" ,required=true)
@NotNull(message = "评价不能为空")
private Integer score;
@ApiModelProperty(value = "评论内容",required=true)
@Schema(description = "评论内容" ,required=true)
private String content;
@ApiModelProperty(value = "评论图片, 用逗号分隔")
@Schema(description = "评论图片, 用逗号分隔" )
private String pics;
/**
* 是否匿名(1: 0:)
*/
@ApiModelProperty(value = "是否匿名(1:是 0:否) 默认为否")
@Schema(description = "是否匿名(1:是 0:否) 默认为否" )
private Integer isAnonymous;
@ApiModelProperty(value = "* 评价(0好评 1中评 2差评)")
@Schema(description = "* 评价(0好评 1中评 2差评)" )
private Integer evaluate;
}

View File

@ -12,13 +12,12 @@ package com.yami.shop.bean.app.param;
import javax.validation.constraints.Pattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ApiModel(value= "发送验证码参数")
@Schema(description = "发送验证码参数")
public class SendSmsParam {
@ApiModelProperty(value = "手机号")
@Schema(description = "手机号" )
@Pattern(regexp="1[0-9]{10}",message = "请输入正确的手机号")
private String mobile;

View File

@ -10,17 +10,16 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ApiModel(value= "购物车参数")
@Schema(description = "购物车参数")
@Data
public class ShopCartParam {
@ApiModelProperty(value = "购物项id")
@Schema(description = "购物项id" )
private Long basketId;
@ApiModelProperty(value = "活动id,传0则不参与该活动")
@Schema(description = "活动id,传0则不参与该活动" )
private Long discountId;
}

View File

@ -12,13 +12,12 @@ package com.yami.shop.bean.app.param;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel(value= "提交订单参数")
@Schema(description = "提交订单参数")
public class SubmitOrderParam {
@ApiModelProperty(value = "每个店铺提交的订单信息",required=true)
@Schema(description = "每个店铺提交的订单信息" ,required=true)
private List<OrderShopParam> orderShopParam;
}

View File

@ -10,18 +10,17 @@
package com.yami.shop.bean.app.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel(value= "设置用户信息")
@Schema(description = "设置用户信息")
public class UserInfoParam {
@ApiModelProperty(value = "用户昵称")
@Schema(description = "用户昵称" )
private String nickName;
@ApiModelProperty(value = "用户头像")
@Schema(description = "用户头像" )
private String avatarUrl;
}

View File

@ -11,23 +11,22 @@
package com.yami.shop.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ApiModel("热搜数据")
@Schema(description = "热搜数据")
@Data
public class HotSearchDto implements Serializable {
@ApiModelProperty("热搜id")
@Schema(description = "热搜id" )
private Long hotSearchId;
@ApiModelProperty("标题")
@Schema(description = "标题" )
private String title;
@ApiModelProperty("内容")
@Schema(description = "内容" )
private String content;
}

View File

@ -12,35 +12,34 @@ package com.yami.shop.bean.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ApiModel("搜索商品数据")
@Schema(description = "搜索商品数据")
public class SearchProdDto {
@ApiModelProperty(value = "商品id")
@Schema(description = "商品id" )
private Long prodId;
@ApiModelProperty(value = "商品照片")
@Schema(description = "商品照片" )
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "商品名字")
@Schema(description = "商品名字" )
private String prodName;
@ApiModelProperty(value = "商品价格")
@Schema(description = "商品价格" )
private Double price;
@ApiModelProperty(value = "商品评论数量")
@Schema(description = "商品评论数量" )
private Integer prodCommNumber;
@ApiModelProperty(value = "好评率")
@Schema(description = "好评率" )
private Double positiveRating;
@ApiModelProperty(value = "好评数量")
@Schema(description = "好评数量" )
private Integer praiseNumber;
}

View File

@ -15,7 +15,7 @@ import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ -23,16 +23,16 @@ import lombok.Data;
public class Area implements Serializable {
private static final long serialVersionUID = -6013320537436191451L;
@TableId
@ApiModelProperty(value = "地区id",required=true)
@Schema(description = "地区id" ,required=true)
private Long areaId;
@ApiModelProperty(value = "地区名称",required=true)
@Schema(description = "地区名称" ,required=true)
private String areaName;
@ApiModelProperty(value = "地区上级id",required=true)
@Schema(description = "地区上级id" ,required=true)
private Long parentId;
@ApiModelProperty(value = "地区层级",required=true)
@Schema(description = "地区层级" ,required=true)
private Integer level;
@TableField(exist=false)

View File

@ -15,7 +15,7 @@ import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ -26,46 +26,46 @@ public class Transfee implements Serializable {
* 运费项id
*/
@TableId
@ApiModelProperty(value = "运费项id",required=true)
@Schema(description = "运费项id" ,required=true)
private Long transfeeId;
/**
* 运费模板id
*/
@ApiModelProperty(value = "运费模板id",required=true)
@Schema(description = "运费模板id" ,required=true)
private Long transportId;
/**
* 续件数量
*/
@ApiModelProperty(value = "续件数量",required=true)
@Schema(description = "续件数量" ,required=true)
private Double continuousPiece;
/**
* 首件数量
*/
@ApiModelProperty(value = "首件数量",required=true)
@Schema(description = "首件数量" ,required=true)
private Double firstPiece;
/**
* 续件费用
*/
@ApiModelProperty(value = "续件费用",required=true)
@Schema(description = "续件费用" ,required=true)
private Double continuousFee;
/**
* 首件费用
*/
@ApiModelProperty(value = "首件费用",required=true)
@Schema(description = "首件费用" ,required=true)
private Double firstFee;
@TableField(exist=false)
@ApiModelProperty(value = "指定条件运费城市项",required=true)
@Schema(description = "指定条件运费城市项" ,required=true)
private List<Area> cityList;
}

View File

@ -16,7 +16,7 @@ import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@ -27,39 +27,39 @@ public class TransfeeFree implements Serializable {
* 指定条件包邮项id
*/
@TableId
@ApiModelProperty(value = "指定条件包邮项id",required=true)
@Schema(description = "指定条件包邮项id" ,required=true)
private Long transfeeFreeId;
/**
* 运费模板id
*/
@ApiModelProperty(value = "运费模板id",required=true)
@Schema(description = "运费模板id" ,required=true)
private Long transportId;
/**
* 包邮方式 0 满x件/重量/体积包邮 1满金额包邮 2满x件/重量/体积且满金额包邮
*/
@ApiModelProperty(value = "包邮方式 0 满x件/重量/体积包邮 1满金额包邮 2满x件/重量/体积且满金额包邮)",required=true)
@Schema(description = "包邮方式 0 满x件/重量/体积包邮 1满金额包邮 2满x件/重量/体积且满金额包邮)" ,required=true)
private Integer freeType;
/**
* 需满金额
*/
@ApiModelProperty(value = "需满金额",required=true)
@Schema(description = "需满金额" ,required=true)
private Double amount;
/**
* 包邮x件/重量/体积
*/
@ApiModelProperty(value = "包邮x件/重量/体积",required=true)
@Schema(description = "包邮x件/重量/体积" ,required=true)
private Double piece;
/**
* 指定条件包邮城市项
*/
@TableField(exist=false)
@ApiModelProperty(value = "指定条件包邮城市项",required=true)
@Schema(description = "指定条件包邮城市项" ,required=true)
private List<Area> freeCityList;
}

View File

@ -21,7 +21,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@Data
@TableName("tz_transport")
@ -31,14 +31,14 @@ public class Transport implements Serializable {
* 运费模板id
*/
@TableId
@ApiModelProperty(value = "运费模板id",required=true)
@Schema(description = "运费模板id" ,required=true)
private Long transportId;
/**
* 运费模板名称
*/
@ApiModelProperty(value = "运费模板名称",required=true)
@Schema(description = "运费模板名称" ,required=true)
private String transName;
/**
@ -46,48 +46,48 @@ public class Transport implements Serializable {
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间",required=true)
@Schema(description = "创建时间" ,required=true)
private Date createTime;
/**
* 店铺id
*/
@ApiModelProperty(value = "店铺id",required=true)
@Schema(description = "店铺id" ,required=true)
private Long shopId;
/**
* 参考 TransportChargeType
* 收费方式0 按件数,1 按重量 2 按体积
*/
@ApiModelProperty(value = "收费方式0 按件数,1 按重量 2 按体积)",required=true)
@Schema(description = "收费方式0 按件数,1 按重量 2 按体积)" ,required=true)
private Integer chargeType;
/**
* 是否包邮 0:不包邮 1:包邮
*/
@ApiModelProperty(value = "是否包邮 0:不包邮 1:包邮",required=true)
@Schema(description = "是否包邮 0:不包邮 1:包邮" ,required=true)
private Integer isFreeFee;
/**
* 是否含有包邮条件
*/
@ApiModelProperty(value = "是否含有包邮条件",required=true)
@Schema(description = "是否含有包邮条件" ,required=true)
private Integer hasFreeCondition;
/**
* 指定条件包邮项
*/
@TableField(exist=false)
@ApiModelProperty(value = "指定条件包邮项",required=true)
@Schema(description = "指定条件包邮项" ,required=true)
private List<TransfeeFree> transfeeFrees;
/**
* 运费项
*/
@TableField(exist=false)
@ApiModelProperty(value = "运费项",required=true)
@Schema(description = "运费项" ,required=true)
private List<Transfee> transfees;
}

View File

@ -12,20 +12,20 @@ package com.yami.shop.bean.param;
import javax.validation.constraints.NotBlank;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
public class DeliveryOrderParam {
@NotBlank(message="订单号不能为空")
@ApiModelProperty(value = "订单号",required=true)
@Schema(description = "订单号" ,required=true)
private String orderNumber;
@NotBlank(message="快递公司id不能为空")
@ApiModelProperty(value = "快递公司",required=true)
@Schema(description = "快递公司" ,required=true)
private Long dvyId;
@NotBlank(message="物流单号不能为空")
@ApiModelProperty(value = "物流单号",required=true)
@Schema(description = "物流单号" ,required=true)
private String dvyFlowId;

View File

@ -10,41 +10,40 @@
package com.yami.shop.bean.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author lh
*/
@Data
@ApiModel(value= "设置用户信息")
@Schema(description = "设置用户信息")
public class UserRegisterParam {
@ApiModelProperty(value = "密码")
@Schema(description = "密码" )
private String passWord;
@ApiModelProperty(value = "邮箱")
@Schema(description = "邮箱" )
private String userMail;
@ApiModelProperty(value = "昵称")
@Schema(description = "昵称" )
private String nickName;
@ApiModelProperty(value = "用户名")
@Schema(description = "用户名" )
private String userName;
@ApiModelProperty(value = "手机号")
@Schema(description = "手机号" )
private String mobile;
@ApiModelProperty(value = "头像")
@Schema(description = "头像" )
private String img;
@ApiModelProperty(value = "校验登陆注册验证码成功的标识")
@Schema(description = "校验登陆注册验证码成功的标识" )
private String checkRegisterSmsFlag;
@ApiModelProperty(value = "当账户未绑定时临时的uid")
@Schema(description = "当账户未绑定时临时的uid" )
private String tempUid;
@ApiModelProperty(value = "用户id")
@Schema(description = "用户id" )
private Long userId;
}

View File

@ -1,17 +1,29 @@
package com.yami.shop.common.config;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yami.shop.common.util.PageParam;
import io.swagger.v3.oas.annotations.Hidden;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.springdoc.api.annotations.ParameterObject;
import org.springdoc.core.DelegatingMethodParameter;
import org.springdoc.core.GenericParameterService;
import org.springdoc.core.PropertyResolverUtils;
import org.springdoc.core.SpringDocUtils;
import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
import org.springdoc.core.providers.ObjectMapperProvider;
import org.springdoc.core.providers.WebConversionServiceProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
import org.springframework.core.MethodParameter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author FrozenWatermelon
@ -20,36 +32,68 @@ import java.util.stream.Collectors;
@Configuration
public class Swagger2Config {
static {
SpringDocUtils.getConfig().addAnnotationsToIgnore(JsonIgnore.class);
}
@Bean
public static BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return new BeanPostProcessor() {
public GenericParameterService parameterBuilder(PropertyResolverUtils propertyResolverUtils, Optional<WebConversionServiceProvider> optionalWebConversionServiceProvider, ObjectMapperProvider objectMapperProvider) {
return new GenericParameterService(propertyResolverUtils, delegatingMethodParameterCustomizer(),
optionalWebConversionServiceProvider,objectMapperProvider);
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
}
return bean;
// 解决@ParameterObject和@Hidden, JsonIgnore同时使用不生效的问题
private Optional<DelegatingMethodParameterCustomizer> delegatingMethodParameterCustomizer() { // NOSONAR
return Optional.of((originalMethodParam, methodParam) -> {
// 这个方法类拥有的注解
Annotation[] annotations = originalMethodParam.getParameterType().getAnnotations();
boolean typeContainParameterObject = false;
if (annotations.length > 0) {
List<? extends Class<? extends Annotation>> annotationTypes = Arrays.stream(annotations).map(Annotation::annotationType).collect(Collectors.toList());
typeContainParameterObject = annotationTypes.contains(ParameterObject.class);
}
private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) {
List<T> copy = mappings.stream()
.filter(mapping -> mapping.getPatternParser() == null)
.collect(Collectors.toList());
mappings.clear();
mappings.addAll(copy);
}
@SuppressWarnings("unchecked")
private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) {
if (typeContainParameterObject
|| (originalMethodParam.hasParameterAnnotations() && originalMethodParam.hasParameterAnnotation(ParameterObject.class))) {
try {
Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings");
field.setAccessible(true);
return (List<RequestMappingInfoHandlerMapping>) field.get(bean);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IllegalStateException(e);
if (isParameterIgnore(originalMethodParam, methodParam)) {
Field field = FieldUtils.getDeclaredField(DelegatingMethodParameter.class, "additionalParameterAnnotations", true);
try {
field.set(methodParam, new Annotation[] {new Hidden() { // NOSONAR
@Override
public Class<? extends Annotation> annotationType() {
return Hidden.class;
}}
});
} catch (IllegalArgumentException|IllegalAccessException e) {
e.printStackTrace();
}
}
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
}
};
});
}
private boolean isParameterIgnore(MethodParameter originalMethodParam, MethodParameter methodParam) throws NoSuchFieldException, SecurityException {
String parameterName = StrUtil.isBlank(methodParam.getParameterName())? "":methodParam.getParameterName();
String fieldName = parameterName.indexOf('.') == -1 ? parameterName : parameterName.substring(0, parameterName.indexOf('.'));
// 解决mybatis-plus返回的查询参数污染的问题
if (originalMethodParam.getParameterType().isAssignableFrom(PageParam.class)) {
if ("searchCount".equals(fieldName)) {
return true;
}
}
Field declaredField;
try {
declaredField = originalMethodParam.getParameterType().getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
e.printStackTrace();
declaredField = originalMethodParam.getParameterType().getSuperclass().getDeclaredField(fieldName);
}
return Stream.of(declaredField.getAnnotations())
.filter(annot -> Arrays.asList(Hidden.class, JsonIgnore.class).contains(annot.annotationType())).count() > 0;
}
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.yami.shop.common.serializer.springfox;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import springfox.documentation.spring.web.json.JacksonModuleRegistrar;
import springfox.documentation.spring.web.json.JsonSerializer;
import java.util.List;
/**
* @author LGH
*/
@Configuration
public class SpringFoxJsonSerializerConfig {
@Bean
@Primary
public JsonSerializer yamiSpringfoxJsonSerializer(List<JacksonModuleRegistrar> moduleRegistrars) {
return new SpringfoxJsonSerializer(moduleRegistrars);
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.yami.shop.common.serializer.springfox;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
import io.swagger.models.parameters.Parameter;
import springfox.documentation.spring.web.json.JacksonModuleRegistrar;
import springfox.documentation.spring.web.json.Json;
import springfox.documentation.spring.web.json.JsonSerializer;
import java.util.List;
/**
* 自定义Swagger 的序列化去除分页参数中的records值
* @author LGH
*/
public class SpringfoxJsonSerializer extends JsonSerializer {
public SpringfoxJsonSerializer(List<JacksonModuleRegistrar> modules) {
super(modules);
}
@Override
public Json toJson(Object toSerialize) {
if (!(toSerialize instanceof Swagger)) {
return super.toJson(toSerialize);
}
Swagger swagger = (Swagger)toSerialize;
swagger.getPaths().forEach((key, path) ->{
Operation get = path.getGet();
if (get != null) {
List<Parameter> parameters = get.getParameters();
if (parameters != null) {
parameters.removeIf(parameter -> parameter.getName().startsWith("records[0]."));
}
}
});
return super.toJson(swagger);
// return super.toJson(toSerialize);
}
}

View File

@ -11,42 +11,56 @@
package com.yami.shop.common.util;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiParam;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springdoc.api.annotations.ParameterObject;
import java.util.Collections;
import java.util.List;
@Schema
@ParameterObject
public class PageParam<T> extends Page<T> {
/**
* 查询数据列表
*/
@ApiParam(hidden = true)
private List<T> records;
/**
* 总数
*/
@ApiParam(hidden = true)
private long total = 0;
/**
* 每页显示条数默认 10
*/
@ApiParam(value = "每页大小,默认10",required = false, defaultValue = "10")
@Schema(description = "每页大小默认10")
private long size = 10;
/**
* 当前页
*/
@ApiParam(value = "当前页,默认1",required = false,defaultValue = "1")
@Schema(description = "当前页,默认1")
private long current = 1;
/**
* 查询数据列表
*/
@Hidden
private List<T> records;
/**
* 总数
*/
@Hidden
private long total = 0;
/**
* 是否进行 count 查询
*/
@ApiParam(hidden = true)
@JsonIgnore
private boolean isSearchCount = true;
@JsonIgnore
private String countId;
@JsonIgnore
private Long maxLimit;
@JsonIgnore
private boolean optimizeCountSql;
@Override
@ApiParam(hidden = true)
public List<T> getRecords() {
return this.records;
}
@ -68,7 +82,7 @@ public class PageParam<T> extends Page<T> {
return this;
}
@ApiParam(hidden = true)
@JsonIgnore
public boolean getSearchCount() {
if (total < 0) {
return false;
@ -77,7 +91,6 @@ public class PageParam<T> extends Page<T> {
}
@Override
@ApiParam(hidden = true)
public boolean isSearchCount() {
if (total < 0) {
return false;
@ -98,7 +111,11 @@ public class PageParam<T> extends Page<T> {
@Override
public Page<T> setSize(long size) {
this.size = size;
if (size > 100) {
this.size = 100;
} else {
this.size = size;
}
return this;
}
@ -112,4 +129,24 @@ public class PageParam<T> extends Page<T> {
this.current = current;
return this;
}
/** @deprecated */
@Deprecated
public String getCountId() {
return this.countId;
}
/** @deprecated */
@Deprecated
public Long getMaxLimit() {
return this.maxLimit;
}
/** @deprecated */
@Deprecated
public boolean isOptimizeCountSql() {
return this.optimizeCountSql;
}
}

View File

@ -15,7 +15,7 @@ public class ResourceServerAdapter extends DefaultAuthConfigAdapter {
public static final List<String> EXCLUDE_PATH = Arrays.asList(
"/webjars/**",
"/swagger/**",
"/v2/api-docs",
"/v3/api-docs/**",
"/doc.html",
"/swagger-ui.html",
"/swagger-resources/**",

View File

@ -1,7 +1,7 @@
package com.yami.shop.security.admin.dto;
import com.yami.shop.security.common.dto.AuthenticationDTO;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@ -12,6 +12,6 @@ import lombok.Data;
@Data
public class CaptchaAuthenticationDTO extends AuthenticationDTO {
@ApiModelProperty(value = "验证码", required = true)
@Schema(description = "验证码" , required = true)
private String captchaVerification;
}

View File

@ -12,8 +12,8 @@ import com.yami.shop.security.common.manager.PasswordCheckManager;
import com.yami.shop.security.common.manager.PasswordManager;
import com.yami.shop.security.common.manager.TokenStore;
import com.yami.shop.security.common.vo.TokenInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@ -27,7 +27,7 @@ import javax.validation.Valid;
* @date 2022/3/28 15:20
*/
@RestController
@Api(tags = "登录")
@Tag(name = "登录")
public class LoginController {
@Autowired
private TokenStore tokenStore;
@ -42,7 +42,7 @@ public class LoginController {
private PasswordManager passwordManager;
@PostMapping("/login")
@ApiOperation(value = "账号密码(用于前端登录)", notes = "通过账号/手机号/用户名密码登录,还要携带用户的类型,也就是用户所在的系统")
@Operation(summary = "账号密码(用于前端登录)" , description = "通过账号/手机号/用户名密码登录,还要携带用户的类型,也就是用户所在的系统")
public ResponseEntity<TokenInfoVO> login(
@Valid @RequestBody AuthenticationDTO authenticationDTO) {
String mobileOrUserName = authenticationDTO.getUserName();

View File

@ -13,7 +13,7 @@ import com.anji.captcha.model.common.RepCodeEnum;
import com.anji.captcha.model.common.ResponseModel;
import com.anji.captcha.model.vo.CaptchaVO;
import com.anji.captcha.service.CaptchaService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/captcha")
@Api(tags = "验证码")
@Tag(name = "验证码")
public class CaptchaController {
private final CaptchaService captchaService;

View File

@ -11,8 +11,8 @@ package com.yami.shop.security.common.controller;
import cn.hutool.core.util.StrUtil;
import com.yami.shop.security.common.manager.TokenStore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@ -25,14 +25,14 @@ import javax.servlet.http.HttpServletRequest;
* @date 2022/3/25 17:33
*/
@RestController
@Api(tags = "注销")
@Tag(name = "注销")
public class LogoutController {
@Autowired
private TokenStore tokenStore;
@PostMapping("/logOut")
@ApiOperation(value = "退出登陆", notes = "点击退出登陆清除token清除菜单缓存")
@Operation(summary = "退出登陆" , description = "点击退出登陆清除token清除菜单缓存")
public ResponseEntity<Void> logOut(HttpServletRequest request) {
String accessToken = request.getHeader("Authorization");
if (StrUtil.isBlank(accessToken)) {

View File

@ -13,7 +13,7 @@ import com.yami.shop.security.common.bo.TokenInfoBO;
import com.yami.shop.security.common.dto.RefreshTokenDTO;
import com.yami.shop.security.common.manager.TokenStore;
import com.yami.shop.security.common.vo.TokenInfoVO;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@ -28,7 +28,7 @@ import javax.validation.Valid;
* @date 2022/3/25 17:33
*/
@RestController
@Api(tags = "token")
@Tag(name = "token")
public class TokenController {
@Autowired

View File

@ -9,7 +9,7 @@
*/
package com.yami.shop.security.common.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -27,14 +27,14 @@ public class AuthenticationDTO {
* 用户名
*/
@NotBlank(message = "userName不能为空")
@ApiModelProperty(value = "用户名/邮箱/手机号", required = true)
@Schema(description = "用户名/邮箱/手机号" , required = true)
protected String userName;
/**
* 密码
*/
@NotBlank(message = "passWord不能为空")
@ApiModelProperty(value = "一般用作密码", required = true)
@Schema(description = "一般用作密码" , required = true)
protected String passWord;
}

View File

@ -9,7 +9,7 @@
*/
package com.yami.shop.security.common.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
@ -25,7 +25,7 @@ public class RefreshTokenDTO {
* refreshToken
*/
@NotBlank(message = "refreshToken不能为空")
@ApiModelProperty(value = "refreshToken", required = true)
@Schema(description = "refreshToken" , required = true)
private String refreshToken;
public String getRefreshToken() {

View File

@ -9,7 +9,7 @@
*/
package com.yami.shop.security.common.vo;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@ -21,12 +21,12 @@ import lombok.Data;
@Data
public class TokenInfoVO {
@ApiModelProperty("accessToken")
@Schema(description = "accessToken" )
private String accessToken;
@ApiModelProperty("refreshToken")
@Schema(description = "refreshToken" )
private String refreshToken;
@ApiModelProperty("在多少秒后过期")
@Schema(description = "在多少秒后过期" )
private Integer expiresIn;
}

View File

@ -19,7 +19,7 @@ import com.yami.shop.sys.constant.Constant;
import com.yami.shop.sys.constant.MenuType;
import com.yami.shop.sys.model.SysMenu;
import com.yami.shop.sys.service.SysMenuService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@ -43,7 +43,7 @@ public class SysMenuController{
@GetMapping("/nav")
@ApiOperation(value="获取用户所拥有的菜单和权限", notes="通过登陆用户的userId获取用户所拥有的菜单和权限")
@Operation(summary = "获取用户所拥有的菜单和权限" , description = "通过登陆用户的userId获取用户所拥有的菜单和权限")
public ResponseEntity<Map<Object, Object>> nav(){
List<SysMenu> menuList = sysMenuService.listMenuByUserId(SecurityUtils.getSysUser().getUserId());
@ -64,7 +64,7 @@ public class SysMenuController{
* 所有菜单列表(用于新建修改角色时 获取菜单的信息)
*/
@GetMapping("/list")
@ApiOperation(value="获取用户所拥有的菜单(不包括按钮)", notes="通过登陆用户的userId获取用户所拥有的菜单和权限")
@Operation(summary = "获取用户所拥有的菜单(不包括按钮)" , description = "通过登陆用户的userId获取用户所拥有的菜单和权限")
public ResponseEntity<List<SysMenu>> list(){
List<SysMenu> sysMenuList= sysMenuService.listSimpleMenuNoButton();
return ResponseEntity.ok(sysMenuList);

View File

@ -27,7 +27,7 @@ import com.yami.shop.sys.dto.UpdatePasswordDto;
import com.yami.shop.sys.model.SysUser;
import com.yami.shop.sys.service.SysRoleService;
import com.yami.shop.sys.service.SysUserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@ -81,7 +81,7 @@ public class SysUserController {
*/
@SysLog("修改密码")
@PostMapping("/password")
@ApiOperation(value="修改密码", notes="修改当前登陆用户的密码")
@Operation(summary = "修改密码" , description = "修改当前登陆用户的密码")
public ResponseEntity<String> password(@RequestBody @Valid UpdatePasswordDto param){
Long userId = SecurityUtils.getSysUser().getUserId();

View File

@ -10,24 +10,23 @@
package com.yami.shop.sys.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Data
@ApiModel(value= "更新密码参数")
@Schema(description = "更新密码参数")
public class UpdatePasswordDto {
@NotBlank(message="旧密码不能为空")
@Size(max = 50)
@ApiModelProperty(value = "旧密码",required=true)
@Schema(description = "旧密码" ,required=true)
private String password;
@NotBlank(message="新密码不能为空")
@Size(max = 50)
@ApiModelProperty(value = "新密码",required=true)
@Schema(description = "新密码" ,required=true)
private String newPassword;
}