升级支持Spring Cloud 2023+Spring Boot 3.2+JDK 17

This commit is contained in:
macro
2024-08-07 19:31:54 +08:00
parent fd5246c588
commit 9ed14531f5
416 changed files with 7830 additions and 5820 deletions

View File

@@ -14,13 +14,13 @@
> 1. **快速体验项目**[在线访问地址](https://www.macrozheng.com/admin/index.html) 。
> 2. **全套学习教程**[《mall学习教程》](https://www.macrozheng.com) 。
> 3. **视频教程2023最新版**[《mall视频教程》](https://www.macrozheng.com/mall/catalog/mall_video.html) 。
> 3. **视频教程**[《mall视频教程》](https://www.macrozheng.com/mall/catalog/mall_video.html) 。
> 4. **Spring Cloud全套教程**[《SpringCloud学习教程》](https://github.com/macrozheng/springcloud-learning) 。
> 5. **分支说明**`master`分支基于Spring Cloud 2021+Spring Boot 2.7`dev-v3`分支基于Spring Cloud 2023+Spring Boot 3.2
> 5. **分支说明**`master`分支基于Spring Cloud 2023+Spring Boot 3.2`dev-v2`分支基于Spring Cloud 2021+Spring Boot 2.7
## 项目简介
`mall-swarm`是一套微服务商城系统,采用了 Spring Cloud 2021 & Alibaba、Spring Boot 2.7、Oauth2、MyBatis、Elasticsearch、Docker、Kubernetes等核心技术同时提供了基于Vue的管理后台方便快速搭建系统。`mall-swarm`在电商业务的基础集成了注册中心、配置中心、监控中心、网关等系统功能。文档齐全附带全套Spring Cloud教程。
`mall-swarm`是一套微服务商城系统,采用了 Spring Cloud 2023 & Alibaba、Spring Boot 3.2、Sa-Token、MyBatis、Elasticsearch、Docker、Kubernetes等核心技术同时提供了基于Vue的管理后台方便快速搭建系统。`mall-swarm`在电商业务的基础集成了注册中心、配置中心、监控中心、网关等系统功能。文档齐全附带全套Spring Cloud教程。
## 项目演示
@@ -75,7 +75,7 @@ mall
| Spring Cloud | 微服务框架 | https://spring.io/projects/spring-cloud |
| Spring Cloud Alibaba | 微服务框架 | https://github.com/alibaba/spring-cloud-alibaba |
| Spring Boot | 容器+MVC框架 | https://spring.io/projects/spring-boot |
| Spring Security Oauth2 | 认证和授权框架 | https://spring.io/projects/spring-security-oauth |
| Sa-Token | 认证和授权框架 | https://github.com/dromara/Sa-Token |
| MyBatis | ORM框架 | http://www.mybatis.org/mybatis-3/zh/index.html |
| MyBatisGenerator | 数据层代码生成 | http://www.mybatis.org/generator/index.html |
| PageHelper | MyBatis物理分页插件 | http://git.oschina.net/free/Mybatis_PageHelper |
@@ -88,7 +88,6 @@ mall
| Druid | 数据库连接池 | https://github.com/alibaba/druid |
| OSS | 对象存储 | https://github.com/aliyun/aliyun-oss-java-sdk |
| MinIO | 对象存储 | https://github.com/minio/minio |
| JWT | JWT登录支持 | https://github.com/jwtk/jjwt |
| LogStash | 日志收集 | https://github.com/logstash/logstash-logback-encoder |
| Lombok | 简化对象封装工具 | https://github.com/rzwitserloot/lombok |
| Seata | 全局事务管理框架 | https://github.com/seata/seata |
@@ -123,7 +122,7 @@ mall
| 工具 | 版本号 | 下载 |
| ------------- | ------ | ------------------------------------------------------------ |
| JDK | 1.8 | https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
| JDK | 17 | https://www.oracle.com/cn/java/technologies/downloads/#java17 |
| Mysql | 5.7 | https://www.mysql.com/ |
| Redis | 7.0 | https://redis.io/download |
| Elasticsearch | 7.17.3 | https://www.elastic.co/cn/downloads/elasticsearch |
@@ -160,21 +159,21 @@ mall
- 查看注册中心注册服务信息访问地址http://192.168.3.101:8848/nacos/
![](./document/resource/mall_swarm_run_new_01.png)
![](./document/resource/re_mall_swarm_run_01.png)
- 监控中心应用信息访问地址http://192.168.3.101:8101
![](./document/resource/mall_swarm_run_new_02.png)
![](./document/resource/re_mall_swarm_run_02.png)
![](./document/resource/mall_swarm_run_new_04.png)
![](./document/resource/re_mall_swarm_run_03.png)
- API文档信息访问地址http://192.168.3.101:8201
![](./document/resource/mall_swarm_run_05.png)
![](./document/resource/re_mall_swarm_run_04.png)
- 日志收集系统信息访问地址http://192.168.3.101:5601
![](./document/resource/mall_swarm_run_new_06.png)
![](./document/resource/re_mall_swarm_run_05.png)
- 可视化容器管理访问地址http://192.168.3.101:9000

View File

@@ -15,12 +15,13 @@ spring:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: root
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码(默认为空)
timeout: 3000ms # 连接超时时间(毫秒
data:
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
timeout: 3000ms # 连接超时时间(毫秒)
minio:
endpoint: http://localhost:9000 #MinIO服务所在地址
bucketName: mall #存储桶名称

View File

@@ -15,11 +15,12 @@ spring:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: reader
password: 123456
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
data:
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
minio:
endpoint: http://192.168.3.101:9090 #MinIO服务所在地址
bucketName: mall #存储桶名称

View File

@@ -1,15 +1,11 @@
spring:
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码(默认为空)
timeout: 3000ms # 连接超时时间(毫秒
security:
oauth2:
resourceserver:
jwt:
jwk-set-uri: 'http://localhost:8201/mall-auth/rsa/publicKey'
data:
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
timeout: 3000ms # 连接超时时间(毫秒)
logging:
level:
root: info

View File

@@ -1,14 +1,10 @@
spring:
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
security:
oauth2:
resourceserver:
jwt:
jwk-set-uri: 'http://192.168.3.101:8201/mall-auth/rsa/publicKey'
data:
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
logging:
file:
path: /var/logs

View File

@@ -8,11 +8,11 @@ spring:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
rabbitmq:
host: localhost
port: 5672

View File

@@ -8,11 +8,11 @@ spring:
host: mongo
port: 27017
database: mall-port
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: #不设置密码
rabbitmq:
host: rabbit
port: 5672

View File

@@ -43,7 +43,7 @@ filter{
}
output {
elasticsearch {
hosts => "es:9200"
hosts => "localhost:9200"
index => "mall-%{type}-%{+YYYY.MM.dd}"
}
}

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-admin
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-admin:1.0-SNAPSHOT
image: mall/mall-admin:1.0-SNAPSHOT
ports:
- containerPort: 8080
env:

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-auth
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-auth:1.0-SNAPSHOT
image: mall/mall-auth:1.0-SNAPSHOT
ports:
- containerPort: 8401
env:

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-gateway
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-gateway:1.0-SNAPSHOT
image: mall/mall-gateway:1.0-SNAPSHOT
ports:
- containerPort: 8201
env:

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-monitor
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-monitor:1.0-SNAPSHOT
image: mall/mall-monitor:1.0-SNAPSHOT
ports:
- containerPort: 8101
env:

View File

@@ -4,11 +4,12 @@ metadata:
name: mall-monitor-service
namespace: default
spec:
type: ClusterIP
type: NodePort
selector:
app: mall-monitor
ports:
- name: http
protocol: TCP
port: 8101
targetPort: 8101
targetPort: 8101
nodePort: 30101

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-portal
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-portal:1.0-SNAPSHOT
image: mall/mall-portal:1.0-SNAPSHOT
ports:
- containerPort: 8085
env:

View File

@@ -17,8 +17,7 @@ spec:
spec:
containers:
- name: mall-search
# 指定Docker Hub中的镜像地址
image: macrodocker/mall-search:1.0-SNAPSHOT
image: mall/mall-search:1.0-SNAPSHOT
ports:
- containerPort: 8081
env:

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -46,8 +46,24 @@
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-redis-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-jwt</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -4,20 +4,20 @@ import com.macro.mall.service.UmsResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
/**
* 资源与角色访问对应关系操作组件
* 路径与资源访问对应关系操作组件
* Created by macro on 2020/7/17.
*/
@Component
public class ResourceRoleRulesHolder {
public class PathResourceRulesHolder {
@Autowired
private UmsResourceService resourceService;
@PostConstruct
public void initResourceRolesMap(){
resourceService.initResourceRolesMap();
public void initPathResourceMap(){
resourceService.initPathResourceMap();
}
}

View File

@@ -0,0 +1,22 @@
package com.macro.mall.config;
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
import cn.dev33.satoken.stp.StpLogic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @auther macrozheng
* @description Sa-Token相关配置
* @date 2023/11/28
* @github https://github.com/macrozheng
*/
@Configuration
public class SaTokenConfigure {
// Sa-Token 整合 jwt (Simple 简单模式)
@Bean
public StpLogic getStpLogicJwt() {
return new StpLogicJwtForSimple();
}
}

View File

@@ -0,0 +1,68 @@
package com.macro.mall.config;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springdoc.core.customizers.GlobalOpenApiCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* SpringDoc相关配置
* Created by macro on 2024/3/5.
*/
@Configuration
public class SpringDocConfig implements WebMvcConfigurer {
private static final String SECURITY_SCHEME_NAME = "Authorization";
@Bean
public OpenAPI mallAdminOpenAPI() {
return new OpenAPI()
.info(new Info().title("mall后台系统")
.description("mall后台相关接口文档")
.version("v1.0.0")
.license(new License().name("Apache 2.0")
.url("https://github.com/macrozheng/mall-learning")))
.externalDocs(new ExternalDocumentation()
.description("SpringBoot实战电商项目mall60K+Star全套文档")
.url("http://www.macrozheng.com"))
.addSecurityItem(new SecurityRequirement().addList(SECURITY_SCHEME_NAME))
.components(new Components()
.addSecuritySchemes(SECURITY_SCHEME_NAME,
new SecurityScheme()
.name(SECURITY_SCHEME_NAME)
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")));
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
//配置访问`/swagger-ui/`路径时可以直接跳转到`/swagger-ui/index.html`
registry.addViewController("/swagger-ui/").setViewName("redirect:/swagger-ui/index.html");
}
@Bean
public GlobalOpenApiCustomizer orderGlobalOpenApiCustomizer() {
//解决Knife4j配置认证后无法自动添加认证头的问题
return openApi -> {
//全局添加鉴权参数
if (openApi.getPaths() != null) {
openApi.getPaths().forEach((s, pathItem) -> {
pathItem.readOperations().forEach(operation -> {
operation.addSecurityItem(new SecurityRequirement().addList(SECURITY_SCHEME_NAME));
});
});
}
};
}
}

View File

@@ -1,34 +0,0 @@
package com.macro.mall.config;
import com.macro.mall.common.config.BaseSwaggerConfig;
import com.macro.mall.common.domain.SwaggerProperties;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger API文档相关配置
* Created by macro on 2018/4/26.
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.macro.mall.controller")
.title("mall后台系统")
.description("mall后台相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(true)
.build();
}
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return generateBeanPostProcessor();
}
}

View File

@@ -3,8 +3,8 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.CmsPrefrenceArea;
import com.macro.mall.service.CmsPrefrenceAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -18,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/6/1.
*/
@Controller
@Api(tags = "CmsPrefrenceAreaController", description = "商品优选管理")
@Tag(name = "CmsPrefrenceAreaController", description = "商品优选管理")
@RequestMapping("/prefrenceArea")
public class CmsPrefrenceAreaController {
@Autowired
private CmsPrefrenceAreaService prefrenceAreaService;
@ApiOperation("获取所有商品优选")
@Operation(summary = "获取所有商品优选")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<CmsPrefrenceArea>> listAll() {

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.CmsSubject;
import com.macro.mall.service.CmsSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,13 +21,13 @@ import java.util.List;
* Created by macro on 2018/6/1.
*/
@Controller
@Api(tags = "CmsSubjectController", description = "商品专题管理")
@Tag(name = "CmsSubjectController", description = "商品专题管理")
@RequestMapping("/subject")
public class CmsSubjectController {
@Autowired
private CmsSubjectService subjectService;
@ApiOperation("获取全部商品专题")
@Operation(summary = "获取全部商品专题")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<CmsSubject>> listAll() {
@@ -34,7 +35,7 @@ public class CmsSubjectController {
return CommonResult.success(subjectList);
}
@ApiOperation(value = "根据专题名称分页获取专题")
@Operation(summary = "根据专题名称分页获取专题")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<CmsSubject>> getList(@RequestParam(value = "keyword", required = false) String keyword,

View File

@@ -6,8 +6,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.BucketPolicyConfigDto;
import com.macro.mall.dto.MinioUploadDto;
import io.minio.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -22,7 +23,7 @@ import java.util.Date;
* MinIO对象存储管理
* Created by macro on 2019/12/25.
*/
@Api(tags = "MinioController", description = "MinIO对象存储管理")
@Tag(name = "MinioController", description = "MinIO对象存储管理")
@Controller
@RequestMapping("/minio")
public class MinioController {
@@ -37,7 +38,7 @@ public class MinioController {
@Value("${minio.secretKey}")
private String SECRET_KEY;
@ApiOperation("文件上传")
@Operation(summary = "文件上传")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public CommonResult upload(@RequestPart("file") MultipartFile file) {
@@ -95,7 +96,7 @@ public class MinioController {
.build();
}
@ApiOperation("文件删除")
@Operation(summary = "文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {

View File

@@ -3,8 +3,9 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsCompanyAddress;
import com.macro.mall.service.OmsCompanyAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -18,13 +19,13 @@ import java.util.List;
* Created by macro on 2018/10/18.
*/
@Controller
@Api(tags = "OmsCompanyAddressController", description = "收货地址管理")
@Tag(name = "OmsCompanyAddressController", description = "收货地址管理")
@RequestMapping("/companyAddress")
public class OmsCompanyAddressController {
@Autowired
private OmsCompanyAddressService companyAddressService;
@ApiOperation("获取所有收货地址")
@Operation(summary = "获取所有收货地址")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<OmsCompanyAddress>> list() {

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.*;
import com.macro.mall.model.OmsOrder;
import com.macro.mall.service.OmsOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,13 +19,13 @@ import java.util.List;
* Created by macro on 2018/10/11.
*/
@Controller
@Api(tags = "OmsOrderController", description = "订单管理")
@Tag(name = "OmsOrderController", description = "订单管理")
@RequestMapping("/order")
public class OmsOrderController {
@Autowired
private OmsOrderService orderService;
@ApiOperation("查询订单")
@Operation(summary = "查询订单")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrder>> list(OmsOrderQueryParam queryParam,
@@ -34,7 +35,7 @@ public class OmsOrderController {
return CommonResult.success(CommonPage.restPage(orderList));
}
@ApiOperation("批量发货")
@Operation(summary = "批量发货")
@RequestMapping(value = "/update/delivery", method = RequestMethod.POST)
@ResponseBody
public CommonResult delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList) {
@@ -45,7 +46,7 @@ public class OmsOrderController {
return CommonResult.failed();
}
@ApiOperation("批量关闭订单")
@Operation(summary = "批量关闭订单")
@RequestMapping(value = "/update/close", method = RequestMethod.POST)
@ResponseBody
public CommonResult close(@RequestParam("ids") List<Long> ids, @RequestParam String note) {
@@ -56,7 +57,7 @@ public class OmsOrderController {
return CommonResult.failed();
}
@ApiOperation("批量删除订单")
@Operation(summary = "批量删除订单")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -67,7 +68,7 @@ public class OmsOrderController {
return CommonResult.failed();
}
@ApiOperation("获取订单详情:订单信息、商品信息、操作记录")
@Operation(summary = "获取订单详情:订单信息、商品信息、操作记录")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderDetail> detail(@PathVariable Long id) {
@@ -75,7 +76,7 @@ public class OmsOrderController {
return CommonResult.success(orderDetailResult);
}
@ApiOperation("修改收货人信息")
@Operation(summary = "修改收货人信息")
@RequestMapping(value = "/update/receiverInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
@@ -86,7 +87,7 @@ public class OmsOrderController {
return CommonResult.failed();
}
@ApiOperation("修改订单费用信息")
@Operation(summary = "修改订单费用信息")
@RequestMapping(value = "/update/moneyInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
@@ -97,7 +98,7 @@ public class OmsOrderController {
return CommonResult.failed();
}
@ApiOperation("备注订单")
@Operation(summary = "备注订单")
@RequestMapping(value = "/update/note", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNote(@RequestParam("id") Long id,

View File

@@ -7,8 +7,9 @@ import com.macro.mall.dto.OmsReturnApplyQueryParam;
import com.macro.mall.dto.OmsUpdateStatusParam;
import com.macro.mall.model.OmsOrderReturnApply;
import com.macro.mall.service.OmsOrderReturnApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -20,13 +21,13 @@ import java.util.List;
* Created by macro on 2018/10/18.
*/
@Controller
@Api(tags = "OmsOrderReturnApplyController", description = "订单退货申请管理")
@Tag(name = "OmsOrderReturnApplyController", description = "订单退货申请管理")
@RequestMapping("/returnApply")
public class OmsOrderReturnApplyController {
@Autowired
private OmsOrderReturnApplyService returnApplyService;
@ApiOperation("分页查询退货申请")
@Operation(summary = "分页查询退货申请")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnApply>> list(OmsReturnApplyQueryParam queryParam,
@@ -36,7 +37,7 @@ public class OmsOrderReturnApplyController {
return CommonResult.success(CommonPage.restPage(returnApplyList));
}
@ApiOperation("批量删除申请")
@Operation(summary = "批量删除申请")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -47,7 +48,7 @@ public class OmsOrderReturnApplyController {
return CommonResult.failed();
}
@ApiOperation("获取退货申请详情")
@Operation(summary = "获取退货申请详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult getItem(@PathVariable Long id) {
@@ -55,7 +56,7 @@ public class OmsOrderReturnApplyController {
return CommonResult.success(result);
}
@ApiOperation("修改申请状态")
@Operation(summary = "修改申请状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsOrderReturnReason;
import com.macro.mall.service.OmsOrderReturnReasonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/10/17.
*/
@Controller
@Api(tags = "OmsOrderReturnReasonController", description = "退货原因管理")
@Tag(name = "OmsOrderReturnReasonController", description = "退货原因管理")
@RequestMapping("/returnReason")
public class OmsOrderReturnReasonController {
@Autowired
private OmsOrderReturnReasonService orderReturnReasonService;
@ApiOperation("添加退货原因")
@Operation(summary = "添加退货原因")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody OmsOrderReturnReason returnReason) {
@@ -34,7 +35,7 @@ public class OmsOrderReturnReasonController {
return CommonResult.failed();
}
@ApiOperation("修改退货原因")
@Operation(summary = "修改退货原因")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {
@@ -45,7 +46,7 @@ public class OmsOrderReturnReasonController {
return CommonResult.failed();
}
@ApiOperation("批量删除退货原因")
@Operation(summary = "批量删除退货原因")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class OmsOrderReturnReasonController {
return CommonResult.failed();
}
@ApiOperation("分页查询全部退货原因")
@Operation(summary = "分页查询全部退货原因")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnReason>> list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@@ -65,7 +66,7 @@ public class OmsOrderReturnReasonController {
return CommonResult.success(CommonPage.restPage(reasonList));
}
@ApiOperation("获取单个退货原因详情信息")
@Operation(summary = "获取单个退货原因详情信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderReturnReason> getItem(@PathVariable Long id) {
@@ -73,7 +74,7 @@ public class OmsOrderReturnReasonController {
return CommonResult.success(reason);
}
@ApiOperation("修改退货原因启用状态")
@Operation(summary = "修改退货原因启用状态")
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@RequestParam(value = "status") Integer status,

View File

@@ -3,8 +3,9 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsOrderSetting;
import com.macro.mall.service.OmsOrderSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -14,13 +15,13 @@ import org.springframework.web.bind.annotation.*;
* Created by macro on 2018/10/16.
*/
@Controller
@Api(tags = "OmsOrderSettingController", description = "订单设置管理")
@Tag(name = "OmsOrderSettingController", description = "订单设置管理")
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {
@Autowired
private OmsOrderSettingService orderSettingService;
@ApiOperation("获取指定订单设置")
@Operation(summary = "获取指定订单设置")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
@@ -28,7 +29,7 @@ public class OmsOrderSettingController {
return CommonResult.success(orderSetting);
}
@ApiOperation("修改指定订单设置")
@Operation(summary = "修改指定订单设置")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {

View File

@@ -5,26 +5,26 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.OssCallbackResult;
import com.macro.mall.dto.OssPolicyResult;
import com.macro.mall.service.impl.OssServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
/**
* Oss相关操作接口
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "OssController", description = "Oss管理")
@Tag(name = "OssController", description = "Oss管理")
@RequestMapping("/aliyun/oss")
public class OssController {
@Autowired
private OssServiceImpl ossService;
@ApiOperation(value = "oss上传签名生成")
@Operation(summary = "oss上传签名生成")
@RequestMapping(value = "/policy", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OssPolicyResult> policy() {
@@ -32,7 +32,7 @@ public class OssController {
return CommonResult.success(result);
}
@ApiOperation(value = "oss上传成功回调")
@Operation(summary = "oss上传成功回调")
@RequestMapping(value = "callback", method = RequestMethod.POST)
@ResponseBody
public CommonResult<OssCallbackResult> callback(HttpServletRequest request) {

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsBrandParam;
import com.macro.mall.model.PmsBrand;
import com.macro.mall.service.PmsBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
@@ -19,20 +20,20 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsBrandController", description = "商品品牌管理")
@Tag(name = "PmsBrandController", description = "商品品牌管理")
@RequestMapping("/brand")
public class PmsBrandController {
@Autowired
private PmsBrandService brandService;
@ApiOperation(value = "获取全部品牌列表")
@Operation(summary = "获取全部品牌列表")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsBrand>> getList() {
return CommonResult.success(brandService.listAllBrand());
}
@ApiOperation(value = "添加品牌")
@Operation(summary = "添加品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsBrandParam pmsBrand) {
@@ -46,7 +47,7 @@ public class PmsBrandController {
return commonResult;
}
@ApiOperation(value = "更新品牌")
@Operation(summary = "更新品牌")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable("id") Long id,
@@ -61,7 +62,7 @@ public class PmsBrandController {
return commonResult;
}
@ApiOperation(value = "删除品牌")
@Operation(summary = "删除品牌")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable("id") Long id) {
@@ -73,7 +74,7 @@ public class PmsBrandController {
}
}
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@Operation(summary = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
@@ -83,14 +84,14 @@ public class PmsBrandController {
return CommonResult.success(CommonPage.restPage(brandList));
}
@ApiOperation(value = "根据编号查询品牌信息")
@Operation(summary = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
return CommonResult.success(brandService.getBrand(id));
}
@ApiOperation(value = "批量删除品牌")
@Operation(summary = "批量删除品牌")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
public CommonResult deleteBatch(@RequestParam("ids") List<Long> ids) {
@@ -102,7 +103,7 @@ public class PmsBrandController {
}
}
@ApiOperation(value = "批量更新显示状态")
@Operation(summary = "批量更新显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids,
@@ -115,7 +116,7 @@ public class PmsBrandController {
}
}
@ApiOperation(value = "批量更新厂家制造商状态")
@Operation(summary = "批量更新厂家制造商状态")
@RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateFactoryStatus(@RequestParam("ids") List<Long> ids,

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsProductAttributeCategoryItem;
import com.macro.mall.model.PmsProductAttributeCategory;
import com.macro.mall.service.PmsProductAttributeCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,13 +19,13 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductAttributeCategoryController", description = "商品属性分类管理")
@Tag(name = "PmsProductAttributeCategoryController", description = "商品属性分类管理")
@RequestMapping("/productAttribute/category")
public class PmsProductAttributeCategoryController {
@Autowired
private PmsProductAttributeCategoryService productAttributeCategoryService;
@ApiOperation("添加商品属性分类")
@Operation(summary = "添加商品属性分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestParam String name) {
@@ -36,7 +37,7 @@ public class PmsProductAttributeCategoryController {
}
}
@ApiOperation("修改商品属性分类")
@Operation(summary = "修改商品属性分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestParam String name) {
@@ -48,7 +49,7 @@ public class PmsProductAttributeCategoryController {
}
}
@ApiOperation("删除单个商品属性分类")
@Operation(summary = "删除单个商品属性分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -60,7 +61,7 @@ public class PmsProductAttributeCategoryController {
}
}
@ApiOperation("获取单个商品属性分类信息")
@Operation(summary = "获取单个商品属性分类信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttributeCategory> getItem(@PathVariable Long id) {
@@ -68,7 +69,7 @@ public class PmsProductAttributeCategoryController {
return CommonResult.success(productAttributeCategory);
}
@ApiOperation("分页获取所有商品属性分类")
@Operation(summary = "分页获取所有商品属性分类")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttributeCategory>> getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) {
@@ -76,7 +77,7 @@ public class PmsProductAttributeCategoryController {
return CommonResult.success(CommonPage.restPage(productAttributeCategoryList));
}
@ApiOperation("获取所有商品属性分类及其下属性")
@Operation(summary = "获取所有商品属性分类及其下属性")
@RequestMapping(value = "/list/withAttr", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductAttributeCategoryItem>> getListWithAttr() {

View File

@@ -6,10 +6,12 @@ import com.macro.mall.dto.PmsProductAttributeParam;
import com.macro.mall.dto.ProductAttrInfo;
import com.macro.mall.model.PmsProductAttribute;
import com.macro.mall.service.PmsProductAttributeService;
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.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -21,14 +23,14 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductAttributeController", description = "商品属性管理")
@Tag(name = "PmsProductAttributeController", description = "商品属性管理")
@RequestMapping("/productAttribute")
public class PmsProductAttributeController {
@Autowired
private PmsProductAttributeService productAttributeService;
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性1表示参数", required = true, paramType = "query", dataType = "integer")})
@Operation(summary = "根据分类查询属性列表或参数列表")
@Parameters({@Parameter(name = "type", description = "0表示属性1表示参数", required = true,in = ParameterIn.QUERY, schema = @Schema(type = "integer"))})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
@@ -39,7 +41,7 @@ public class PmsProductAttributeController {
return CommonResult.success(CommonPage.restPage(productAttributeList));
}
@ApiOperation("添加商品属性信息")
@Operation(summary = "添加商品属性信息")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductAttributeParam productAttributeParam) {
@@ -51,7 +53,7 @@ public class PmsProductAttributeController {
}
}
@ApiOperation("修改商品属性信息")
@Operation(summary = "修改商品属性信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductAttributeParam productAttributeParam) {
@@ -63,7 +65,7 @@ public class PmsProductAttributeController {
}
}
@ApiOperation("查询单个商品属性")
@Operation(summary = "查询单个商品属性")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
@@ -71,7 +73,7 @@ public class PmsProductAttributeController {
return CommonResult.success(productAttribute);
}
@ApiOperation("批量删除商品属性")
@Operation(summary = "批量删除商品属性")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -83,7 +85,7 @@ public class PmsProductAttributeController {
}
}
@ApiOperation("根据商品分类的id获取商品属性及属性分类")
@Operation(summary = "根据商品分类的id获取商品属性及属性分类")
@RequestMapping(value = "/attrInfo/{productCategoryId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<ProductAttrInfo>> getAttrInfo(@PathVariable Long productCategoryId) {

View File

@@ -6,8 +6,9 @@ import com.macro.mall.dto.PmsProductCategoryParam;
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
import com.macro.mall.model.PmsProductCategory;
import com.macro.mall.service.PmsProductCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
@@ -20,13 +21,13 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductCategoryController", description = "商品分类管理")
@Tag(name = "PmsProductCategoryController", description = "商品分类管理")
@RequestMapping("/productCategory")
public class PmsProductCategoryController {
@Autowired
private PmsProductCategoryService productCategoryService;
@ApiOperation("添加产品分类")
@Operation(summary = "添加产品分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam) {
@@ -38,7 +39,7 @@ public class PmsProductCategoryController {
}
}
@ApiOperation("修改商品分类")
@Operation(summary = "修改商品分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@@ -52,7 +53,7 @@ public class PmsProductCategoryController {
}
}
@ApiOperation("分页查询商品分类")
@Operation(summary = "分页查询商品分类")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
@@ -62,7 +63,7 @@ public class PmsProductCategoryController {
return CommonResult.success(CommonPage.restPage(productCategoryList));
}
@ApiOperation("根据id获取商品分类")
@Operation(summary = "根据id获取商品分类")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
@@ -70,7 +71,7 @@ public class PmsProductCategoryController {
return CommonResult.success(productCategory);
}
@ApiOperation("删除商品分类")
@Operation(summary = "删除商品分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -82,7 +83,7 @@ public class PmsProductCategoryController {
}
}
@ApiOperation("修改导航栏显示状态")
@Operation(summary = "修改导航栏显示状态")
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
@@ -94,7 +95,7 @@ public class PmsProductCategoryController {
}
}
@ApiOperation("修改显示状态")
@Operation(summary = "修改显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
@@ -106,7 +107,7 @@ public class PmsProductCategoryController {
}
}
@ApiOperation("查询所有一级分类及子分类")
@Operation(summary = "查询所有一级分类及子分类")
@RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {

View File

@@ -7,8 +7,9 @@ import com.macro.mall.dto.PmsProductQueryParam;
import com.macro.mall.dto.PmsProductResult;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.service.PmsProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -20,13 +21,13 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductController", description = "商品管理")
@Tag(name = "PmsProductController", description = "商品管理")
@RequestMapping("/product")
public class PmsProductController {
@Autowired
private PmsProductService productService;
@ApiOperation("创建商品")
@Operation(summary = "创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductParam productParam) {
@@ -38,7 +39,7 @@ public class PmsProductController {
}
}
@ApiOperation("根据商品id获取商品编辑信息")
@Operation(summary = "根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
@@ -46,7 +47,7 @@ public class PmsProductController {
return CommonResult.success(productResult);
}
@ApiOperation("更新商品")
@Operation(summary = "更新商品")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam) {
@@ -58,7 +59,7 @@ public class PmsProductController {
}
}
@ApiOperation("查询商品")
@Operation(summary = "查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
@@ -68,7 +69,7 @@ public class PmsProductController {
return CommonResult.success(CommonPage.restPage(productList));
}
@ApiOperation("根据商品名称或货号模糊查询")
@Operation(summary = "根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
@@ -76,7 +77,7 @@ public class PmsProductController {
return CommonResult.success(productList);
}
@ApiOperation("批量修改审核状态")
@Operation(summary = "批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
@@ -90,7 +91,7 @@ public class PmsProductController {
}
}
@ApiOperation("批量上下架")
@Operation(summary = "批量上下架")
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
@@ -103,7 +104,7 @@ public class PmsProductController {
}
}
@ApiOperation("批量推荐商品")
@Operation(summary = "批量推荐商品")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
@@ -116,7 +117,7 @@ public class PmsProductController {
}
}
@ApiOperation("批量设为新品")
@Operation(summary = "批量设为新品")
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
@@ -129,7 +130,7 @@ public class PmsProductController {
}
}
@ApiOperation("批量修改删除状态")
@Operation(summary = "批量修改删除状态")
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,

View File

@@ -3,8 +3,9 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.PmsSkuStock;
import com.macro.mall.service.PmsSkuStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -16,20 +17,20 @@ import java.util.List;
* Created by macro on 2018/4/27.
*/
@Controller
@Api(tags = "PmsSkuStockController", description = "sku商品库存管理")
@Tag(name = "PmsSkuStockController", description = "sku商品库存管理")
@RequestMapping("/sku")
public class PmsSkuStockController {
@Autowired
private PmsSkuStockService skuStockService;
@ApiOperation("根据商品编号及编号模糊搜索sku库存")
@Operation(summary = "根据商品编号及编号模糊搜索sku库存")
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsSkuStock>> getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
List<PmsSkuStock> skuStockList = skuStockService.getList(pid, keyword);
return CommonResult.success(skuStockList);
}
@ApiOperation("批量更新库存信息")
@Operation(summary = "批量更新库存信息")
@RequestMapping(value ="/update/{pid}",method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsCouponParam;
import com.macro.mall.model.SmsCoupon;
import com.macro.mall.service.SmsCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,12 +19,12 @@ import java.util.List;
* Created by macro on 2018/8/28.
*/
@Controller
@Api(tags = "SmsCouponController", description = "优惠券管理")
@Tag(name = "SmsCouponController", description = "优惠券管理")
@RequestMapping("/coupon")
public class SmsCouponController {
@Autowired
private SmsCouponService couponService;
@ApiOperation("添加优惠券")
@Operation(summary = "添加优惠券")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody SmsCouponParam couponParam) {
@@ -34,7 +35,7 @@ public class SmsCouponController {
return CommonResult.failed();
}
@ApiOperation("删除优惠券")
@Operation(summary = "删除优惠券")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -45,7 +46,7 @@ public class SmsCouponController {
return CommonResult.failed();
}
@ApiOperation("修改优惠券")
@Operation(summary = "修改优惠券")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,@RequestBody SmsCouponParam couponParam) {
@@ -56,7 +57,7 @@ public class SmsCouponController {
return CommonResult.failed();
}
@ApiOperation("根据优惠券名称和类型分页获取优惠券列表")
@Operation(summary = "根据优惠券名称和类型分页获取优惠券列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCoupon>> list(
@@ -68,7 +69,7 @@ public class SmsCouponController {
return CommonResult.success(CommonPage.restPage(couponList));
}
@ApiOperation("获取单个优惠券的详细信息")
@Operation(summary = "获取单个优惠券的详细信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsCouponParam> getItem(@PathVariable Long id) {

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsCouponHistory;
import com.macro.mall.service.SmsCouponHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,13 +21,13 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsCouponHistoryController", description = "优惠券领取记录管理")
@Tag(name = "SmsCouponHistoryController", description = "优惠券领取记录管理")
@RequestMapping("/couponHistory")
public class SmsCouponHistoryController {
@Autowired
private SmsCouponHistoryService historyService;
@ApiOperation("根据优惠券id使用状态订单编号分页获取领取记录")
@Operation(summary = "根据优惠券id使用状态订单编号分页获取领取记录")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCouponHistory>> list(@RequestParam(value = "couponId", required = false) Long couponId,

View File

@@ -4,8 +4,8 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsFlashPromotion;
import com.macro.mall.service.SmsFlashPromotionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +17,13 @@ import java.util.List;
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionController", description = "限时购活动管理")
@Tag(name = "SmsFlashPromotionController", description = "限时购活动管理")
@RequestMapping("/flash")
public class SmsFlashPromotionController {
@Autowired
private SmsFlashPromotionService flashPromotionService;
@ApiOperation("添加活动")
@Operation(summary = "添加活动")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotion flashPromotion) {
@@ -34,7 +34,7 @@ public class SmsFlashPromotionController {
return CommonResult.failed();
}
@ApiOperation("编辑活动信息")
@Operation(summary = "编辑活动信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable Long id, @RequestBody SmsFlashPromotion flashPromotion) {
@@ -45,7 +45,7 @@ public class SmsFlashPromotionController {
return CommonResult.failed();
}
@ApiOperation("删除活动信息")
@Operation(summary = "删除活动信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public Object delete(@PathVariable Long id) {
@@ -56,7 +56,7 @@ public class SmsFlashPromotionController {
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@Operation(summary = "修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable Long id, Integer status) {
@@ -67,7 +67,7 @@ public class SmsFlashPromotionController {
return CommonResult.failed();
}
@ApiOperation("获取活动详情")
@Operation(summary = "获取活动详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@PathVariable Long id) {
@@ -75,7 +75,7 @@ public class SmsFlashPromotionController {
return CommonResult.success(flashPromotion);
}
@ApiOperation("根据活动名称分页查询")
@Operation(summary = "根据活动名称分页查询")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@RequestParam(value = "keyword", required = false) String keyword,

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionProduct;
import com.macro.mall.model.SmsFlashPromotionProductRelation;
import com.macro.mall.service.SmsFlashPromotionProductRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,13 +19,13 @@ import java.util.List;
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionProductRelationController", description = "限时购和商品关系管理")
@Tag(name = "SmsFlashPromotionProductRelationController", description = "限时购和商品关系管理")
@RequestMapping("/flashProductRelation")
public class SmsFlashPromotionProductRelationController {
@Autowired
private SmsFlashPromotionProductRelationService relationService;
@ApiOperation("批量选择商品添加关联")
@Operation(summary = "批量选择商品添加关联")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {
@@ -35,7 +36,7 @@ public class SmsFlashPromotionProductRelationController {
return CommonResult.failed();
}
@ApiOperation("修改关联相关信息")
@Operation(summary = "修改关联相关信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionProductRelation relation) {
@@ -46,7 +47,7 @@ public class SmsFlashPromotionProductRelationController {
return CommonResult.failed();
}
@ApiOperation("删除关联")
@Operation(summary = "删除关联")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -57,7 +58,7 @@ public class SmsFlashPromotionProductRelationController {
return CommonResult.failed();
}
@ApiOperation("获取管理商品促销信息")
@Operation(summary = "获取管理商品促销信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionProductRelation> getItem(@PathVariable Long id) {
@@ -65,7 +66,7 @@ public class SmsFlashPromotionProductRelationController {
return CommonResult.success(relation);
}
@ApiOperation("分页查询不同场次关联及商品信息")
@Operation(summary = "分页查询不同场次关联及商品信息")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsFlashPromotionProduct>> list(@RequestParam(value = "flashPromotionId") Long flashPromotionId,

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionSessionDetail;
import com.macro.mall.model.SmsFlashPromotionSession;
import com.macro.mall.service.SmsFlashPromotionSessionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionSessionController", description = "限时购场次管理")
@Tag(name = "SmsFlashPromotionSessionController", description = "限时购场次管理")
@RequestMapping("/flashSession")
public class SmsFlashPromotionSessionController {
@Autowired
private SmsFlashPromotionSessionService flashPromotionSessionService;
@ApiOperation("添加场次")
@Operation(summary = "添加场次")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotionSession promotionSession) {
@@ -34,7 +35,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.failed();
}
@ApiOperation("修改场次")
@Operation(summary = "修改场次")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionSession promotionSession) {
@@ -45,7 +46,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.failed();
}
@ApiOperation("修改启用状态")
@Operation(summary = "修改启用状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
@@ -56,7 +57,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.failed();
}
@ApiOperation("删除场次")
@Operation(summary = "删除场次")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -67,7 +68,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.failed();
}
@ApiOperation("获取场次详情")
@Operation(summary = "获取场次详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionSession> getItem(@PathVariable Long id) {
@@ -75,7 +76,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.success(promotionSession);
}
@ApiOperation("获取全部场次")
@Operation(summary = "获取全部场次")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSession>> list() {
@@ -83,7 +84,7 @@ public class SmsFlashPromotionSessionController {
return CommonResult.success(promotionSessionList);
}
@ApiOperation("获取全部可选场次及其数量")
@Operation(summary = "获取全部可选场次及其数量")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSessionDetail>> selectList(Long flashPromotionId) {

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeAdvertise;
import com.macro.mall.service.SmsHomeAdvertiseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/7.
*/
@Controller
@Api(tags = "SmsHomeAdvertiseController", description = "首页轮播广告管理")
@Tag(name = "SmsHomeAdvertiseController", description = "首页轮播广告管理")
@RequestMapping("/home/advertise")
public class SmsHomeAdvertiseController {
@Autowired
private SmsHomeAdvertiseService advertiseService;
@ApiOperation("添加广告")
@Operation(summary = "添加广告")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsHomeAdvertise advertise) {
@@ -33,7 +34,7 @@ public class SmsHomeAdvertiseController {
return CommonResult.failed();
}
@ApiOperation("删除广告")
@Operation(summary = "删除广告")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -43,7 +44,7 @@ public class SmsHomeAdvertiseController {
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@Operation(summary = "修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
@@ -53,7 +54,7 @@ public class SmsHomeAdvertiseController {
return CommonResult.failed();
}
@ApiOperation("获取广告详情")
@Operation(summary = "获取广告详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsHomeAdvertise> getItem(@PathVariable Long id) {
@@ -61,7 +62,7 @@ public class SmsHomeAdvertiseController {
return CommonResult.success(advertise);
}
@ApiOperation("修改广告")
@Operation(summary = "修改广告")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
@@ -71,7 +72,7 @@ public class SmsHomeAdvertiseController {
return CommonResult.failed();
}
@ApiOperation("分页查询广告")
@Operation(summary = "分页查询广告")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeAdvertise>> list(@RequestParam(value = "name", required = false) String name,

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeBrand;
import com.macro.mall.service.SmsHomeBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeBrandController", description = "首页品牌管理")
@Tag(name = "SmsHomeBrandController", description = "首页品牌管理")
@RequestMapping("/home/brand")
public class SmsHomeBrandController {
@Autowired
private SmsHomeBrandService homeBrandService;
@ApiOperation("添加首页推荐品牌")
@Operation(summary = "添加首页推荐品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeBrand> homeBrandList) {
@@ -34,7 +35,7 @@ public class SmsHomeBrandController {
return CommonResult.failed();
}
@ApiOperation("修改品牌排序")
@Operation(summary = "修改品牌排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
@@ -45,7 +46,7 @@ public class SmsHomeBrandController {
return CommonResult.failed();
}
@ApiOperation("批量删除推荐品牌")
@Operation(summary = "批量删除推荐品牌")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class SmsHomeBrandController {
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@Operation(summary = "批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
@@ -67,7 +68,7 @@ public class SmsHomeBrandController {
return CommonResult.failed();
}
@ApiOperation("分页查询推荐品牌")
@Operation(summary = "分页查询推荐品牌")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeBrand>> list(@RequestParam(value = "brandName", required = false) String brandName,

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeNewProduct;
import com.macro.mall.service.SmsHomeNewProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeNewProductController", description = "首页新品管理")
@Tag(name = "SmsHomeNewProductController", description = "首页新品管理")
@RequestMapping("/home/newProduct")
public class SmsHomeNewProductController {
@Autowired
private SmsHomeNewProductService homeNewProductService;
@ApiOperation("添加首页推荐品牌")
@Operation(summary = "添加首页推荐品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeNewProduct> homeBrandList) {
@@ -34,7 +35,7 @@ public class SmsHomeNewProductController {
return CommonResult.failed();
}
@ApiOperation("修改推荐排序")
@Operation(summary = "修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
@@ -45,7 +46,7 @@ public class SmsHomeNewProductController {
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@Operation(summary = "批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class SmsHomeNewProductController {
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@Operation(summary = "批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
@@ -67,7 +68,7 @@ public class SmsHomeNewProductController {
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@Operation(summary = "分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeNewProduct>> list(@RequestParam(value = "productName", required = false) String productName,

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeRecommendProduct;
import com.macro.mall.service.SmsHomeRecommendProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeRecommendProductController", description = "首页人气推荐管理")
@Tag(name = "SmsHomeRecommendProductController", description = "首页人气推荐管理")
@RequestMapping("/home/recommendProduct")
public class SmsHomeRecommendProductController {
@Autowired
private SmsHomeRecommendProductService recommendProductService;
@ApiOperation("添加首页推荐")
@Operation(summary = "添加首页推荐")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendProduct> homeBrandList) {
@@ -34,7 +35,7 @@ public class SmsHomeRecommendProductController {
return CommonResult.failed();
}
@ApiOperation("修改推荐排序")
@Operation(summary = "修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
@@ -45,7 +46,7 @@ public class SmsHomeRecommendProductController {
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@Operation(summary = "批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class SmsHomeRecommendProductController {
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@Operation(summary = "批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
@@ -67,7 +68,7 @@ public class SmsHomeRecommendProductController {
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@Operation(summary = "分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendProduct>> list(@RequestParam(value = "productName", required = false) String productName,

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeRecommendSubject;
import com.macro.mall.service.SmsHomeRecommendSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeRecommendSubjectController", description = "首页专题推荐管理")
@Tag(name = "SmsHomeRecommendSubjectController", description = "首页专题推荐管理")
@RequestMapping("/home/recommendSubject")
public class SmsHomeRecommendSubjectController {
@Autowired
private SmsHomeRecommendSubjectService recommendSubjectService;
@ApiOperation("添加首页推荐专题")
@Operation(summary = "添加首页推荐专题")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendSubject> homeBrandList) {
@@ -34,7 +35,7 @@ public class SmsHomeRecommendSubjectController {
return CommonResult.failed();
}
@ApiOperation("修改推荐排序")
@Operation(summary = "修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
@@ -45,7 +46,7 @@ public class SmsHomeRecommendSubjectController {
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@Operation(summary = "批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class SmsHomeRecommendSubjectController {
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@Operation(summary = "批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
@@ -67,7 +68,7 @@ public class SmsHomeRecommendSubjectController {
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@Operation(summary = "分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendSubject>> list(@RequestParam(value = "subjectName", required = false) String subjectName,

View File

@@ -1,20 +1,21 @@
package com.macro.mall.controller;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.hutool.core.collection.CollUtil;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.domain.UserDto;
import com.macro.mall.dto.UmsAdminLoginParam;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsRole;
import com.macro.mall.service.UmsAdminService;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -29,15 +30,17 @@ import java.util.stream.Collectors;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "UmsAdminController", description = "后台用户管理")
@Tag(name = "UmsAdminController", description = "后台用户管理")
@RequestMapping("/admin")
public class UmsAdminController {
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsRoleService roleService;
@Value("${sa-token.token-prefix}")
private String tokenHead;
@ApiOperation(value = "用户注册")
@Operation(summary = "用户注册")
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
public CommonResult<UmsAdmin> register(@Validated @RequestBody UmsAdminParam umsAdminParam) {
@@ -48,14 +51,21 @@ public class UmsAdminController {
return CommonResult.success(umsAdmin);
}
@ApiOperation(value = "登录以后返回token")
@Operation(summary = "登录以后返回token")
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public CommonResult login(@Validated @RequestBody UmsAdminLoginParam umsAdminLoginParam) {
return adminService.login(umsAdminLoginParam.getUsername(),umsAdminLoginParam.getPassword());
SaTokenInfo saTokenInfo = adminService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword());
if (saTokenInfo == null) {
return CommonResult.validateFailed("用户名或密码错误");
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", saTokenInfo.getTokenValue() );
tokenMap.put("tokenHead", tokenHead+" ");
return CommonResult.success(tokenMap);
}
@ApiOperation(value = "获取当前登录用户信息")
@Operation(summary = "获取当前登录用户信息")
@RequestMapping(value = "/info", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAdminInfo() {
@@ -72,14 +82,15 @@ public class UmsAdminController {
return CommonResult.success(data);
}
@ApiOperation(value = "登出功能")
@Operation(summary = "登出功能")
@RequestMapping(value = "/logout", method = RequestMethod.POST)
@ResponseBody
public CommonResult logout() {
adminService.logout();
return CommonResult.success(null);
}
@ApiOperation("根据用户名或姓名分页获取用户列表")
@Operation(summary = "根据用户名或姓名分页获取用户列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword,
@@ -89,7 +100,7 @@ public class UmsAdminController {
return CommonResult.success(CommonPage.restPage(adminList));
}
@ApiOperation("获取指定用户信息")
@Operation(summary = "获取指定用户信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsAdmin> getItem(@PathVariable Long id) {
@@ -97,7 +108,7 @@ public class UmsAdminController {
return CommonResult.success(admin);
}
@ApiOperation("修改指定用户信息")
@Operation(summary = "修改指定用户信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) {
@@ -108,7 +119,7 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("修改指定用户密码")
@Operation(summary = "修改指定用户密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePassword(@RequestBody UpdateAdminPasswordParam updatePasswordParam) {
@@ -126,7 +137,7 @@ public class UmsAdminController {
}
}
@ApiOperation("删除指定用户信息")
@Operation(summary = "删除指定用户信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -137,7 +148,7 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("修改帐号状态")
@Operation(summary = "修改帐号状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) {
@@ -150,7 +161,7 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("给用户分配角色")
@Operation(summary = "给用户分配角色")
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRole(@RequestParam("adminId") Long adminId,
@@ -162,19 +173,11 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("获取指定用户的角色")
@Operation(summary = "获取指定用户的角色")
@RequestMapping(value = "/role/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> getRoleList(@PathVariable Long adminId) {
List<UmsRole> roleList = adminService.getRoleList(adminId);
return CommonResult.success(roleList);
}
@ApiOperation("根据用户名获取通用用户信息")
@RequestMapping(value = "/loadByUsername", method = RequestMethod.GET)
@ResponseBody
public UserDto loadUserByUsername(@RequestParam String username) {
UserDto userDTO = adminService.loadUserByUsername(username);
return userDTO;
}
}

View File

@@ -3,8 +3,9 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsMemberLevel;
import com.macro.mall.service.UmsMemberLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,14 +20,14 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "UmsMemberLevelController", description = "会员等级管理")
@Tag(name = "UmsMemberLevelController", description = "会员等级管理")
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {
@Autowired
private UmsMemberLevelService memberLevelService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation("查询所有会员等级")
@Operation(summary = "查询所有会员等级")
@ResponseBody
public CommonResult<List<UmsMemberLevel>> list(@RequestParam("defaultStatus") Integer defaultStatus) {
List<UmsMemberLevel> memberLevelList = memberLevelService.list(defaultStatus);

View File

@@ -5,8 +5,9 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsMenuNode;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.service.UmsMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,14 +19,14 @@ import java.util.List;
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsMenuController", description = "后台菜单管理")
@Tag(name = "UmsMenuController", description = "后台菜单管理")
@RequestMapping("/menu")
public class UmsMenuController {
@Autowired
private UmsMenuService menuService;
@ApiOperation("添加后台菜单")
@Operation(summary = "添加后台菜单")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsMenu umsMenu) {
@@ -37,7 +38,7 @@ public class UmsMenuController {
}
}
@ApiOperation("修改后台菜单")
@Operation(summary = "修改后台菜单")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@@ -50,7 +51,7 @@ public class UmsMenuController {
}
}
@ApiOperation("根据ID获取菜单详情")
@Operation(summary = "根据ID获取菜单详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsMenu> getItem(@PathVariable Long id) {
@@ -58,7 +59,7 @@ public class UmsMenuController {
return CommonResult.success(umsMenu);
}
@ApiOperation("根据ID删除后台菜单")
@Operation(summary = "根据ID删除后台菜单")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -70,7 +71,7 @@ public class UmsMenuController {
}
}
@ApiOperation("分页查询后台菜单")
@Operation(summary = "分页查询后台菜单")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsMenu>> list(@PathVariable Long parentId,
@@ -80,7 +81,7 @@ public class UmsMenuController {
return CommonResult.success(CommonPage.restPage(menuList));
}
@ApiOperation("树形结构返回所有菜单列表")
@Operation(summary = "树形结构返回所有菜单列表")
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenuNode>> treeList() {
@@ -88,7 +89,7 @@ public class UmsMenuController {
return CommonResult.success(list);
}
@ApiOperation("修改菜单显示状态")
@Operation(summary = "修改菜单显示状态")
@RequestMapping(value = "/updateHidden/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateHidden(@PathVariable Long id, @RequestParam("hidden") Integer hidden) {

View File

@@ -3,8 +3,9 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResourceCategory;
import com.macro.mall.service.UmsResourceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -16,13 +17,13 @@ import java.util.List;
* Created by macro on 2020/2/5.
*/
@Controller
@Api(tags = "UmsResourceCategoryController", description = "后台资源分类管理")
@Tag(name = "UmsResourceCategoryController", description = "后台资源分类管理")
@RequestMapping("/resourceCategory")
public class UmsResourceCategoryController {
@Autowired
private UmsResourceCategoryService resourceCategoryService;
@ApiOperation("查询所有后台资源分类")
@Operation(summary = "查询所有后台资源分类")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResourceCategory>> listAll() {
@@ -30,7 +31,7 @@ public class UmsResourceCategoryController {
return CommonResult.success(resourceList);
}
@ApiOperation("添加后台资源分类")
@Operation(summary = "添加后台资源分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResourceCategory umsResourceCategory) {
@@ -42,7 +43,7 @@ public class UmsResourceCategoryController {
}
}
@ApiOperation("修改后台资源分类")
@Operation(summary = "修改后台资源分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@@ -55,7 +56,7 @@ public class UmsResourceCategoryController {
}
}
@ApiOperation("根据ID删除后台资源")
@Operation(summary = "根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResource;
import com.macro.mall.service.UmsResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -18,14 +19,14 @@ import java.util.Map;
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsResourceController", description = "后台资源管理")
@Tag(name = "UmsResourceController", description = "后台资源管理")
@RequestMapping("/resource")
public class UmsResourceController {
@Autowired
private UmsResourceService resourceService;
@ApiOperation("添加后台资源")
@Operation(summary = "添加后台资源")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResource umsResource) {
@@ -37,7 +38,7 @@ public class UmsResourceController {
}
}
@ApiOperation("修改后台资源")
@Operation(summary = "修改后台资源")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@@ -50,7 +51,7 @@ public class UmsResourceController {
}
}
@ApiOperation("根据ID获取资源详情")
@Operation(summary = "根据ID获取资源详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsResource> getItem(@PathVariable Long id) {
@@ -58,7 +59,7 @@ public class UmsResourceController {
return CommonResult.success(umsResource);
}
@ApiOperation("根据ID删除后台资源")
@Operation(summary = "根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
@@ -70,7 +71,7 @@ public class UmsResourceController {
}
}
@ApiOperation("分页模糊查询后台资源")
@Operation(summary = "分页模糊查询后台资源")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsResource>> list(@RequestParam(required = false) Long categoryId,
@@ -82,7 +83,7 @@ public class UmsResourceController {
return CommonResult.success(CommonPage.restPage(resourceList));
}
@ApiOperation("查询所有后台资源")
@Operation(summary = "查询所有后台资源")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listAll() {
@@ -90,11 +91,11 @@ public class UmsResourceController {
return CommonResult.success(resourceList);
}
@ApiOperation("初始化资源角色关联数据")
@RequestMapping(value = "/initResourceRolesMap", method = RequestMethod.GET)
@Operation(summary = "初始化路径和资源的关联数据")
@RequestMapping(value = "/initPathResourceMap", method = RequestMethod.GET)
@ResponseBody
public CommonResult initResourceRolesMap() {
Map<String, List<String>> resourceRolesMap = resourceService.initResourceRolesMap();
return CommonResult.success(resourceRolesMap);
public CommonResult initPathResourceMap() {
Map<String, String> pathResourceMap = resourceService.initPathResourceMap();
return CommonResult.success(pathResourceMap);
}
}

View File

@@ -4,8 +4,9 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -17,13 +18,13 @@ import java.util.List;
* Created by macro on 2018/9/30.
*/
@Controller
@Api(tags = "UmsRoleController", description = "后台用户角色管理")
@Tag(name = "UmsRoleController", description = "后台用户角色管理")
@RequestMapping("/role")
public class UmsRoleController {
@Autowired
private UmsRoleService roleService;
@ApiOperation("添加角色")
@Operation(summary = "添加角色")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsRole role) {
@@ -34,7 +35,7 @@ public class UmsRoleController {
return CommonResult.failed();
}
@ApiOperation("修改角色")
@Operation(summary = "修改角色")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsRole role) {
@@ -45,7 +46,7 @@ public class UmsRoleController {
return CommonResult.failed();
}
@ApiOperation("批量删除角色")
@Operation(summary = "批量删除角色")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
@@ -56,7 +57,7 @@ public class UmsRoleController {
return CommonResult.failed();
}
@ApiOperation("获取所有角色")
@Operation(summary = "获取所有角色")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> listAll() {
@@ -64,7 +65,7 @@ public class UmsRoleController {
return CommonResult.success(roleList);
}
@ApiOperation("根据角色名称分页获取角色列表")
@Operation(summary = "根据角色名称分页获取角色列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsRole>> list(@RequestParam(value = "keyword", required = false) String keyword,
@@ -74,7 +75,7 @@ public class UmsRoleController {
return CommonResult.success(CommonPage.restPage(roleList));
}
@ApiOperation("修改角色状态")
@Operation(summary = "修改角色状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestParam(value = "status") Integer status) {
@@ -87,7 +88,7 @@ public class UmsRoleController {
return CommonResult.failed();
}
@ApiOperation("获取角色相关菜单")
@Operation(summary = "获取角色相关菜单")
@RequestMapping(value = "/listMenu/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenu>> listMenu(@PathVariable Long roleId) {
@@ -95,7 +96,7 @@ public class UmsRoleController {
return CommonResult.success(roleList);
}
@ApiOperation("获取角色相关资源")
@Operation(summary = "获取角色相关资源")
@RequestMapping(value = "/listResource/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listResource(@PathVariable Long roleId) {
@@ -103,7 +104,7 @@ public class UmsRoleController {
return CommonResult.success(roleList);
}
@ApiOperation("给角色分配菜单")
@Operation(summary = "给角色分配菜单")
@RequestMapping(value = "/allocMenu", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocMenu(@RequestParam Long roleId, @RequestParam List<Long> menuIds) {
@@ -111,7 +112,7 @@ public class UmsRoleController {
return CommonResult.success(count);
}
@ApiOperation("给角色分配资源")
@Operation(summary = "给角色分配资源")
@RequestMapping(value = "/allocResource", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocResource(@RequestParam Long roleId, @RequestParam List<Long> resourceIds) {

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,8 +11,8 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class MinioUploadDto {
@ApiModelProperty("文件访问URL")
@Schema(title = "文件访问URL")
private String url;
@ApiModelProperty("文件名称")
@Schema(title = "文件名称")
private String name;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -13,12 +13,12 @@ import java.math.BigDecimal;
@Getter
@Setter
public class OmsMoneyInfoParam {
@ApiModelProperty("订单ID")
@Schema(title = "订单ID")
private Long orderId;
@ApiModelProperty("运费金额")
@Schema(title = "运费金额")
private BigDecimal freightAmount;
@ApiModelProperty("管理员后台调整订单使用的折扣金额")
@Schema(title = "管理员后台调整订单使用的折扣金额")
private BigDecimal discountAmount;
@ApiModelProperty("订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
@Schema(title = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
private Integer status;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -11,10 +11,10 @@ import lombok.Setter;
@Getter
@Setter
public class OmsOrderDeliveryParam {
@ApiModelProperty("订单id")
@Schema(title = "订单id")
private Long orderId;
@ApiModelProperty("物流公司")
@Schema(title = "物流公司")
private String deliveryCompany;
@ApiModelProperty("物流单号")
@Schema(title = "物流单号")
private String deliverySn;
}

View File

@@ -3,7 +3,7 @@ package com.macro.mall.dto;
import com.macro.mall.model.OmsOrder;
import com.macro.mall.model.OmsOrderItem;
import com.macro.mall.model.OmsOrderOperateHistory;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -16,10 +16,10 @@ import java.util.List;
public class OmsOrderDetail extends OmsOrder {
@Getter
@Setter
@ApiModelProperty("订单商品列表")
@Schema(title = "订单商品列表")
private List<OmsOrderItem> orderItemList;
@Getter
@Setter
@ApiModelProperty("订单操作记录列表")
@Schema(title = "订单操作记录列表")
private List<OmsOrderOperateHistory> historyList;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -11,16 +11,16 @@ import lombok.Setter;
@Getter
@Setter
public class OmsOrderQueryParam {
@ApiModelProperty(value = "订单编号")
@Schema(title = "订单编号")
private String orderSn;
@ApiModelProperty(value = "收货人姓名/号码")
@Schema(title = "收货人姓名/号码")
private String receiverKeyword;
@ApiModelProperty(value = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
@Schema(title = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
private Integer status;
@ApiModelProperty(value = "订单类型0->正常订单1->秒杀订单")
@Schema(title = "订单类型0->正常订单1->秒杀订单")
private Integer orderType;
@ApiModelProperty(value = "订单来源0->PC订单1->app订单")
@Schema(title = "订单来源0->PC订单1->app订单")
private Integer sourceType;
@ApiModelProperty(value = "订单提交时间")
@Schema(title = "订单提交时间")
private String createTime;
}

View File

@@ -2,7 +2,7 @@ package com.macro.mall.dto;
import com.macro.mall.model.OmsCompanyAddress;
import com.macro.mall.model.OmsOrderReturnApply;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -13,6 +13,6 @@ import lombok.Setter;
public class OmsOrderReturnApplyResult extends OmsOrderReturnApply {
@Getter
@Setter
@ApiModelProperty(value = "公司收货地址")
@Schema(title = "公司收货地址")
private OmsCompanyAddress companyAddress;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -11,22 +11,22 @@ import lombok.Setter;
@Getter
@Setter
public class OmsReceiverInfoParam {
@ApiModelProperty(value = "订单ID")
@Schema(title = "订单ID")
private Long orderId;
@ApiModelProperty(value = "收货人姓名")
@Schema(title = "收货人姓名")
private String receiverName;
@ApiModelProperty(value = "收货人电话")
@Schema(title = "收货人电话")
private String receiverPhone;
@ApiModelProperty(value = "收货人邮编")
@Schema(title = "收货人邮编")
private String receiverPostCode;
@ApiModelProperty(value = "详细地址")
@Schema(title = "详细地址")
private String receiverDetailAddress;
@ApiModelProperty(value = "省份/直辖市")
@Schema(title = "省份/直辖市")
private String receiverProvince;
@ApiModelProperty(value = "城市")
@Schema(title = "城市")
private String receiverCity;
@ApiModelProperty(value = "")
@Schema(title = "")
private String receiverRegion;
@ApiModelProperty(value = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
@Schema(title = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
private Integer status;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -11,16 +11,16 @@ import lombok.Setter;
@Getter
@Setter
public class OmsReturnApplyQueryParam {
@ApiModelProperty("服务单号")
@Schema(title = "服务单号")
private Long id;
@ApiModelProperty(value = "收货人姓名/号码")
@Schema(title = "收货人姓名/号码")
private String receiverKeyword;
@ApiModelProperty(value = "申请状态0->待处理1->退货中2->已完成3->已拒绝")
@Schema(title = "申请状态0->待处理1->退货中2->已完成3->已拒绝")
private Integer status;
@ApiModelProperty(value = "申请时间")
@Schema(title = "申请时间")
private String createTime;
@ApiModelProperty(value = "处理人员")
@Schema(title = "处理人员")
private String handleMan;
@ApiModelProperty(value = "处理时间")
@Schema(title = "处理时间")
private String handleTime;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -13,20 +13,20 @@ import java.math.BigDecimal;
@Getter
@Setter
public class OmsUpdateStatusParam {
@ApiModelProperty("服务单号")
@Schema(title = "服务单号")
private Long id;
@ApiModelProperty("收货地址关联id")
@Schema(title = "收货地址关联id")
private Long companyAddressId;
@ApiModelProperty("确认退款金额")
@Schema(title = "确认退款金额")
private BigDecimal returnAmount;
@ApiModelProperty("处理备注")
@Schema(title = "处理备注")
private String handleNote;
@ApiModelProperty("处理人")
@Schema(title = "处理人")
private String handleMan;
@ApiModelProperty("收货备注")
@Schema(title = "收货备注")
private String receiveNote;
@ApiModelProperty("收货人")
@Schema(title = "收货人")
private String receiveMan;
@ApiModelProperty("申请状态1->退货中2->已完成3->已拒绝")
@Schema(title = "申请状态1->退货中2->已完成3->已拒绝")
private Integer status;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,10 +11,10 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class OssCallbackParam {
@ApiModelProperty("请求的回调地址")
@Schema(title = "请求的回调地址")
private String callbackUrl;
@ApiModelProperty("回调是传入request中的参数")
@Schema(title = "回调是传入request中的参数")
private String callbackBody;
@ApiModelProperty("回调时传入参数的格式,比如表单提交形式")
@Schema(title = "回调时传入参数的格式,比如表单提交形式")
private String callbackBodyType;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,14 +11,14 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class OssCallbackResult {
@ApiModelProperty("文件名称")
@Schema(title = "文件名称")
private String filename;
@ApiModelProperty("文件大小")
@Schema(title = "文件大小")
private String size;
@ApiModelProperty("文件的mimeType")
@Schema(title = "文件的mimeType")
private String mimeType;
@ApiModelProperty("图片文件的宽")
@Schema(title = "图片文件的宽")
private String width;
@ApiModelProperty("图片文件的高")
@Schema(title = "图片文件的高")
private String height;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,16 +11,16 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class OssPolicyResult {
@ApiModelProperty("访问身份验证中用到用户标识")
@Schema(title = "访问身份验证中用到用户标识")
private String accessKeyId;
@ApiModelProperty("用户表单上传的策略,经过base64编码过的字符串")
@Schema(title = "用户表单上传的策略,经过base64编码过的字符串")
private String policy;
@ApiModelProperty("对policy签名后的字符串")
@Schema(title = "对policy签名后的字符串")
private String signature;
@ApiModelProperty("上传文件夹路径前缀")
@Schema(title = "上传文件夹路径前缀")
private String dir;
@ApiModelProperty("oss对外服务的访问域名")
@Schema(title = "oss对外服务的访问域名")
private String host;
@ApiModelProperty("上传成功后的回调设置")
@Schema(title = "上传成功后的回调设置")
private String callback;
}

View File

@@ -1,12 +1,12 @@
package com.macro.mall.dto;
import com.macro.mall.validator.FlagValidator;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
/**
* 品牌传递参数
@@ -16,24 +16,24 @@ import javax.validation.constraints.NotEmpty;
@EqualsAndHashCode(callSuper = false)
public class PmsBrandParam {
@NotEmpty
@ApiModelProperty(value = "品牌名称",required = true)
@Schema(title = "品牌名称",required = true)
private String name;
@ApiModelProperty(value = "品牌首字母")
@Schema(title = "品牌首字母")
private String firstLetter;
@Min(value = 0)
@ApiModelProperty(value = "排序字段")
@Schema(title = "排序字段")
private Integer sort;
@FlagValidator(value = {"0","1"}, message = "厂家状态不正确")
@ApiModelProperty(value = "是否为厂家制造商")
@Schema(title = "是否为厂家制造商")
private Integer factoryStatus;
@FlagValidator(value = {"0","1"}, message = "显示状态不正确")
@ApiModelProperty(value = "是否进行显示")
@Schema(title = "是否进行显示")
private Integer showStatus;
@NotEmpty
@ApiModelProperty(value = "品牌logo",required = true)
@Schema(title = "品牌logo",required = true)
private String logo;
@ApiModelProperty(value = "品牌大图")
@Schema(title = "品牌大图")
private String bigPic;
@ApiModelProperty(value = "品牌故事")
@Schema(title = "品牌故事")
private String brandStory;
}

View File

@@ -2,7 +2,7 @@ package com.macro.mall.dto;
import com.macro.mall.model.PmsProductAttribute;
import com.macro.mall.model.PmsProductAttributeCategory;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@@ -16,6 +16,6 @@ import java.util.List;
public class PmsProductAttributeCategoryItem extends PmsProductAttributeCategory {
@Getter
@Setter
@ApiModelProperty(value = "商品属性列表")
@Schema(title = "商品属性列表")
private List<PmsProductAttribute> productAttributeList;
}

View File

@@ -1,11 +1,11 @@
package com.macro.mall.dto;
import com.macro.mall.validator.FlagValidator;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
/**
* 商品属性参数
@@ -15,34 +15,34 @@ import javax.validation.constraints.NotEmpty;
@EqualsAndHashCode(callSuper = false)
public class PmsProductAttributeParam {
@NotEmpty
@ApiModelProperty("属性分类ID")
@Schema(title = "属性分类ID")
private Long productAttributeCategoryId;
@NotEmpty
@ApiModelProperty("属性名称")
@Schema(title = "属性名称")
private String name;
@FlagValidator({"0","1","2"})
@ApiModelProperty("属性选择类型0->唯一1->单选2->多选")
@Schema(title = "属性选择类型0->唯一1->单选2->多选")
private Integer selectType;
@FlagValidator({"0","1"})
@ApiModelProperty("属性录入方式0->手工录入1->从列表中选取")
@Schema(title = "属性录入方式0->手工录入1->从列表中选取")
private Integer inputType;
@ApiModelProperty("可选值列表,以逗号隔开")
@Schema(title = "可选值列表,以逗号隔开")
private String inputList;
private Integer sort;
@FlagValidator({"0","1"})
@ApiModelProperty("分类筛选样式0->普通1->颜色")
@Schema(title = "分类筛选样式0->普通1->颜色")
private Integer filterType;
@FlagValidator({"0","1","2"})
@ApiModelProperty("检索类型0->不需要进行检索1->关键字检索2->范围检索")
@Schema(title = "检索类型0->不需要进行检索1->关键字检索2->范围检索")
private Integer searchType;
@FlagValidator({"0","1"})
@ApiModelProperty("相同属性产品是否关联0->不关联1->关联")
@Schema(title = "相同属性产品是否关联0->不关联1->关联")
private Integer relatedStatus;
@FlagValidator({"0","1"})
@ApiModelProperty("是否支持手动新增0->不支持1->支持")
@Schema(title = "是否支持手动新增0->不支持1->支持")
private Integer handAddStatus;
@FlagValidator({"0","1"})
@ApiModelProperty("属性的类型0->规格1->参数")
@Schema(title = "属性的类型0->规格1->参数")
private Integer type;
}

View File

@@ -1,12 +1,12 @@
package com.macro.mall.dto;
import com.macro.mall.validator.FlagValidator;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;
/**
@@ -16,28 +16,28 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class PmsProductCategoryParam {
@ApiModelProperty("父分类的编号")
@Schema(title = "父分类的编号")
private Long parentId;
@NotEmpty
@ApiModelProperty(value = "商品分类名称",required = true)
@Schema(title = "商品分类名称",required = true)
private String name;
@ApiModelProperty("分类单位")
@Schema(title = "分类单位")
private String productUnit;
@FlagValidator(value = {"0","1"},message = "状态只能为0或1")
@ApiModelProperty("是否在导航栏显示")
@Schema(title = "是否在导航栏显示")
private Integer navStatus;
@FlagValidator(value = {"0","1"},message = "状态只能为0或1")
@ApiModelProperty("是否进行显示")
@Schema(title = "是否进行显示")
private Integer showStatus;
@Min(value = 0)
@ApiModelProperty("排序")
@Schema(title = "排序")
private Integer sort;
@ApiModelProperty("图标")
@Schema(title = "图标")
private String icon;
@ApiModelProperty("关键字")
@Schema(title = "关键字")
private String keywords;
@ApiModelProperty("描述")
@Schema(title = "描述")
private String description;
@ApiModelProperty("产品相关筛选属性集合")
@Schema(title = "产品相关筛选属性集合")
private List<Long> productAttributeIdList;
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.dto;
import com.macro.mall.model.PmsProductCategory;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -13,6 +13,6 @@ import java.util.List;
public class PmsProductCategoryWithChildrenItem extends PmsProductCategory {
@Getter
@Setter
@ApiModelProperty("子级分类")
@Schema(title = "子级分类")
private List<PmsProductCategory> children;
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.dto;
import com.macro.mall.model.*;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -14,18 +14,18 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class PmsProductParam extends PmsProduct{
@ApiModelProperty("商品阶梯价格设置")
@Schema(title = "商品阶梯价格设置")
private List<PmsProductLadder> productLadderList;
@ApiModelProperty("商品满减价格设置")
@Schema(title = "商品满减价格设置")
private List<PmsProductFullReduction> productFullReductionList;
@ApiModelProperty("商品会员价格设置")
@Schema(title = "商品会员价格设置")
private List<PmsMemberPrice> memberPriceList;
@ApiModelProperty("商品的sku库存信息")
@Schema(title = "商品的sku库存信息")
private List<PmsSkuStock> skuStockList;
@ApiModelProperty("商品参数及自定义规格属性")
@Schema(title = "商品参数及自定义规格属性")
private List<PmsProductAttributeValue> productAttributeValueList;
@ApiModelProperty("专题和商品关系")
@Schema(title = "专题和商品关系")
private List<CmsSubjectProductRelation> subjectProductRelationList;
@ApiModelProperty("优选专区和商品的关系")
@Schema(title = "优选专区和商品的关系")
private List<CmsPrefrenceAreaProductRelation> prefrenceAreaProductRelationList;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,16 +11,16 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class PmsProductQueryParam {
@ApiModelProperty("上架状态")
@Schema(title = "上架状态")
private Integer publishStatus;
@ApiModelProperty("审核状态")
@Schema(title = "审核状态")
private Integer verifyStatus;
@ApiModelProperty("商品名称模糊关键字")
@Schema(title = "商品名称模糊关键字")
private String keyword;
@ApiModelProperty("商品货号")
@Schema(title = "商品货号")
private String productSn;
@ApiModelProperty("商品分类编号")
@Schema(title = "商品分类编号")
private Long productCategoryId;
@ApiModelProperty("商品品牌编号")
@Schema(title = "商品品牌编号")
private Long brandId;
}

View File

@@ -1,6 +1,6 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -11,6 +11,6 @@ import lombok.Setter;
public class PmsProductResult extends PmsProductParam {
@Getter
@Setter
@ApiModelProperty("商品所选分类的父id")
@Schema(title = "商品所选分类的父id")
private Long cateParentId;
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -12,8 +12,8 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class ProductAttrInfo {
@ApiModelProperty("商品属性ID")
@Schema(title = "商品属性ID")
private Long attributeId;
@ApiModelProperty("商品属性分类ID")
@Schema(title = "商品属性分类ID")
private Long attributeCategoryId;
}

View File

@@ -3,7 +3,7 @@ package com.macro.mall.dto;
import com.macro.mall.model.SmsCoupon;
import com.macro.mall.model.SmsCouponProductCategoryRelation;
import com.macro.mall.model.SmsCouponProductRelation;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -16,10 +16,10 @@ import java.util.List;
public class SmsCouponParam extends SmsCoupon {
@Getter
@Setter
@ApiModelProperty("优惠券绑定的商品")
@Schema(title = "优惠券绑定的商品")
private List<SmsCouponProductRelation> productRelationList;
@Getter
@Setter
@ApiModelProperty("优惠券绑定的商品分类")
@Schema(title = "优惠券绑定的商品分类")
private List<SmsCouponProductCategoryRelation> productCategoryRelationList;
}

View File

@@ -2,7 +2,7 @@ package com.macro.mall.dto;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.model.SmsFlashPromotionProductRelation;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -13,6 +13,6 @@ import lombok.Setter;
public class SmsFlashPromotionProduct extends SmsFlashPromotionProductRelation{
@Getter
@Setter
@ApiModelProperty("关联商品")
@Schema(title = "关联商品")
private PmsProduct product;
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.dto;
import com.macro.mall.model.SmsFlashPromotionSession;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -12,6 +12,6 @@ import lombok.Setter;
public class SmsFlashPromotionSessionDetail extends SmsFlashPromotionSession {
@Setter
@Getter
@ApiModelProperty("商品数量")
@Schema(title = "商品数量")
private Long productCount;
}

View File

@@ -1,10 +1,10 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
/**
* 用户登录参数
@@ -14,9 +14,9 @@ import javax.validation.constraints.NotEmpty;
@EqualsAndHashCode(callSuper = false)
public class UmsAdminLoginParam {
@NotEmpty
@ApiModelProperty(value = "用户名", required = true)
@Schema(title = "用户名", required = true)
private String username;
@NotEmpty
@ApiModelProperty(value = "密码", required = true)
@Schema(title = "密码", required = true)
private String password;
}

View File

@@ -1,11 +1,11 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
/**
* 用户登录参数
@@ -14,19 +14,19 @@ import javax.validation.constraints.NotEmpty;
@Getter
@Setter
public class UmsAdminParam {
@ApiModelProperty(value = "用户名", required = true)
@Schema(title = "用户名", required = true)
@NotEmpty
private String username;
@ApiModelProperty(value = "密码", required = true)
@Schema(title = "密码", required = true)
@NotEmpty
private String password;
@ApiModelProperty(value = "用户头像")
@Schema(title = "用户头像")
private String icon;
@ApiModelProperty(value = "邮箱")
@Schema(title = "邮箱")
@Email
private String email;
@ApiModelProperty(value = "用户昵称")
@Schema(title = "用户昵称")
private String nickName;
@ApiModelProperty(value = "备注")
@Schema(title = "备注")
private String note;
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.dto;
import com.macro.mall.model.UmsMenu;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -14,6 +14,6 @@ import java.util.List;
@Getter
@Setter
public class UmsMenuNode extends UmsMenu {
@ApiModelProperty(value = "子级菜单")
@Schema(title = "子级菜单")
private List<UmsMenuNode> children;
}

View File

@@ -1,10 +1,10 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
/**
* 修改用户名密码参数
@@ -14,12 +14,12 @@ import javax.validation.constraints.NotEmpty;
@Setter
public class UpdateAdminPasswordParam {
@NotEmpty
@ApiModelProperty(value = "用户名", required = true)
@Schema(title = "用户名", required = true)
private String username;
@NotEmpty
@ApiModelProperty(value = "旧密码", required = true)
@Schema(title = "旧密码", required = true)
private String oldPassword;
@NotEmpty
@ApiModelProperty(value = "新密码", required = true)
@Schema(title = "新密码", required = true)
private String newPassword;
}

View File

@@ -1,20 +0,0 @@
package com.macro.mall.service;
import com.macro.mall.common.api.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
/**
* 认证服务远程调用Service
* Created by macro on 2020/7/19.
*/
@FeignClient("mall-auth")
public interface AuthService {
@PostMapping(value = "/oauth/token")
CommonResult getAccessToken(@RequestParam Map<String, String> parameters);
}

View File

@@ -3,7 +3,7 @@ package com.macro.mall.service;
import com.macro.mall.dto.OssCallbackResult;
import com.macro.mall.dto.OssPolicyResult;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
/**
* oss上传管理Service

View File

@@ -1,7 +1,6 @@
package com.macro.mall.service;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.domain.UserDto;
import cn.dev33.satoken.stp.SaTokenInfo;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.model.*;
@@ -28,9 +27,8 @@ public interface UmsAdminService {
* 登录功能
* @param username 用户名
* @param password 密码
* @return 调用认证中心返回结果
*/
CommonResult login(String username, String password);
SaTokenInfo login(String username, String password);
/**
* 根据用户id获取用户
@@ -73,18 +71,13 @@ public interface UmsAdminService {
*/
int updatePassword(UpdateAdminPasswordParam updatePasswordParam);
/**
* 获取用户信息
*/
UserDto loadUserByUsername(String username);
/**
* 获取当前登录后台用户
*/
UmsAdmin getCurrentAdmin();
/**
* 获取缓存服务
* 登出操作
*/
UmsAdminCacheService getCacheService();
void logout();
}

View File

@@ -41,7 +41,7 @@ public interface UmsResourceService {
List<UmsResource> listAll();
/**
* 初始化资源角色规则
* 初始化路径与资源访问规则
*/
Map<String,List<String>> initResourceRolesMap();
Map<String,String> initPathResourceMap();
}

View File

@@ -15,7 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;

View File

@@ -14,8 +14,6 @@ import org.springframework.stereotype.Service;
*/
@Service
public class UmsAdminCacheServiceImpl implements UmsAdminCacheService {
@Autowired
private UmsAdminService adminService;
@Autowired
private RedisService redisService;
@Value("${redis.database}")

View File

@@ -1,5 +1,7 @@
package com.macro.mall.service.impl;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.BCrypt;
@@ -9,7 +11,7 @@ import com.github.pagehelper.PageHelper;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.api.ResultCode;
import com.macro.mall.common.constant.AuthConstant;
import com.macro.mall.common.domain.UserDto;
import com.macro.mall.common.dto.UserDto;
import com.macro.mall.common.exception.Asserts;
import com.macro.mall.dao.UmsAdminRoleRelationDao;
import com.macro.mall.dto.UmsAdminParam;
@@ -18,9 +20,9 @@ import com.macro.mall.mapper.UmsAdminLoginLogMapper;
import com.macro.mall.mapper.UmsAdminMapper;
import com.macro.mall.mapper.UmsAdminRoleRelationMapper;
import com.macro.mall.model.*;
import com.macro.mall.service.AuthService;
import com.macro.mall.service.UmsAdminCacheService;
import com.macro.mall.service.UmsAdminService;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@@ -31,7 +33,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
@@ -51,9 +52,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
@Autowired
private UmsAdminLoginLogMapper loginLogMapper;
@Autowired
private AuthService authService;
@Autowired
private HttpServletRequest request;
private UmsAdminCacheService adminCacheService;
@Override
public UmsAdmin getAdminByUsername(String username) {
@@ -87,30 +86,42 @@ public class UmsAdminServiceImpl implements UmsAdminService {
}
@Override
public CommonResult login(String username, String password) {
public SaTokenInfo login(String username, String password) {
if(StrUtil.isEmpty(username)||StrUtil.isEmpty(password)){
Asserts.fail("用户名或密码不能为空!");
}
Map<String, String> params = new HashMap<>();
params.put("client_id", AuthConstant.ADMIN_CLIENT_ID);
params.put("client_secret","123456");
params.put("grant_type","password");
params.put("username",username);
params.put("password",password);
CommonResult restResult = authService.getAccessToken(params);
if(ResultCode.SUCCESS.getCode()==restResult.getCode()&&restResult.getData()!=null){
// updateLoginTimeByUsername(username);
insertLoginLog(username);
UmsAdmin admin = getAdminByUsername(username);
if(admin==null){
Asserts.fail("找不到该用户!");
}
return restResult;
if (!BCrypt.checkpw(password, admin.getPassword())) {
Asserts.fail("密码不正确!");
}
if(admin.getStatus()!=1){
Asserts.fail("该账号已被禁用!");
}
// 登录校验成功后,一行代码实现登录
StpUtil.login(admin.getId());
UserDto userDto = new UserDto();
userDto.setId(admin.getId());
userDto.setUsername(admin.getUsername());
userDto.setClientId(AuthConstant.ADMIN_CLIENT_ID);
List<UmsResource> resourceList = getResourceList(admin.getId());
List<String> permissionList = resourceList.stream().map(item -> item.getId() + ":" + item.getName()).toList();
userDto.setPermissionList(permissionList);
// 将用户信息存储到Session中
StpUtil.getSession().set(AuthConstant.STP_ADMIN_INFO,userDto);
// 获取当前登录用户Token信息
SaTokenInfo saTokenInfo = StpUtil.getTokenInfo();
// updateLoginTimeByUsername(username);
insertLoginLog(admin);
return saTokenInfo;
}
/**
* 添加登录记录
* @param username 用户名
*/
private void insertLoginLog(String username) {
UmsAdmin admin = getAdminByUsername(username);
private void insertLoginLog(UmsAdmin admin) {
if(admin==null) return;
UmsAdminLoginLog loginLog = new UmsAdminLoginLog();
loginLog.setAdminId(admin.getId());
@@ -165,14 +176,14 @@ public class UmsAdminServiceImpl implements UmsAdminService {
}
}
int count = adminMapper.updateByPrimaryKeySelective(admin);
getCacheService().delAdmin(id);
adminCacheService.delAdmin(id);
return count;
}
@Override
public int delete(Long id) {
int count = adminMapper.deleteByPrimaryKey(id);
getCacheService().delAdmin(id);
adminCacheService.delAdmin(id);
return count;
}
@@ -226,46 +237,26 @@ public class UmsAdminServiceImpl implements UmsAdminService {
}
umsAdmin.setPassword(BCrypt.hashpw(param.getNewPassword()));
adminMapper.updateByPrimaryKey(umsAdmin);
getCacheService().delAdmin(umsAdmin.getId());
adminCacheService.delAdmin(umsAdmin.getId());
return 1;
}
@Override
public UserDto loadUserByUsername(String username){
//获取用户信息
UmsAdmin admin = getAdminByUsername(username);
if (admin != null) {
List<UmsRole> roleList = getRoleList(admin.getId());
UserDto userDTO = new UserDto();
BeanUtils.copyProperties(admin,userDTO);
if(CollUtil.isNotEmpty(roleList)){
List<String> roleStrList = roleList.stream().map(item -> item.getId() + "_" + item.getName()).collect(Collectors.toList());
userDTO.setRoles(roleStrList);
}
return userDTO;
}
return null;
}
@Override
public UmsAdmin getCurrentAdmin() {
String userStr = request.getHeader(AuthConstant.USER_TOKEN_HEADER);
if(StrUtil.isEmpty(userStr)){
Asserts.fail(ResultCode.UNAUTHORIZED);
}
UserDto userDto = JSONUtil.toBean(userStr, UserDto.class);
UmsAdmin admin = getCacheService().getAdmin(userDto.getId());
if(admin!=null){
return admin;
}else{
UserDto userDto = (UserDto) StpUtil.getSession().get(AuthConstant.STP_ADMIN_INFO);
UmsAdmin admin = adminCacheService.getAdmin(userDto.getId());
if (admin == null) {
admin = adminMapper.selectByPrimaryKey(userDto.getId());
getCacheService().setAdmin(admin);
return admin;
adminCacheService.setAdmin(admin);
}
return admin;
}
@Override
public UmsAdminCacheService getCacheService() {
return SpringUtil.getBean(UmsAdminCacheService.class);
public void logout() {
//先清空缓存
UserDto userDto = (UserDto) StpUtil.getSession().get(AuthConstant.STP_ADMIN_INFO);
adminCacheService.delAdmin(userDto.getId());
//再调用sa-token的登出方法
StpUtil.logout();
}
}

View File

@@ -5,17 +5,13 @@ import com.github.pagehelper.PageHelper;
import com.macro.mall.common.constant.AuthConstant;
import com.macro.mall.common.service.RedisService;
import com.macro.mall.mapper.UmsResourceMapper;
import com.macro.mall.mapper.UmsRoleMapper;
import com.macro.mall.mapper.UmsRoleResourceRelationMapper;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsAdminCacheService;
import com.macro.mall.service.UmsResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 后台资源管理Service实现类
@@ -26,10 +22,6 @@ public class UmsResourceServiceImpl implements UmsResourceService {
@Autowired
private UmsResourceMapper resourceMapper;
@Autowired
private UmsRoleMapper roleMapper;
@Autowired
private UmsRoleResourceRelationMapper roleResourceRelationMapper;
@Autowired
private RedisService redisService;
@Value("${spring.application.name}")
private String applicationName;
@@ -37,7 +29,7 @@ public class UmsResourceServiceImpl implements UmsResourceService {
public int create(UmsResource umsResource) {
umsResource.setCreateTime(new Date());
int count = resourceMapper.insert(umsResource);
initResourceRolesMap();
initPathResourceMap();
return count;
}
@@ -45,7 +37,7 @@ public class UmsResourceServiceImpl implements UmsResourceService {
public int update(Long id, UmsResource umsResource) {
umsResource.setId(id);
int count = resourceMapper.updateByPrimaryKeySelective(umsResource);
initResourceRolesMap();
initPathResourceMap();
return count;
}
@@ -57,7 +49,7 @@ public class UmsResourceServiceImpl implements UmsResourceService {
@Override
public int delete(Long id) {
int count = resourceMapper.deleteByPrimaryKey(id);
initResourceRolesMap();
initPathResourceMap();
return count;
}
@@ -84,19 +76,15 @@ public class UmsResourceServiceImpl implements UmsResourceService {
}
@Override
public Map<String,List<String>> initResourceRolesMap() {
Map<String,List<String>> resourceRoleMap = new TreeMap<>();
public Map<String,String> initPathResourceMap() {
Map<String,String> pathResourceMap = new TreeMap<>();
List<UmsResource> resourceList = resourceMapper.selectByExample(new UmsResourceExample());
List<UmsRole> roleList = roleMapper.selectByExample(new UmsRoleExample());
List<UmsRoleResourceRelation> relationList = roleResourceRelationMapper.selectByExample(new UmsRoleResourceRelationExample());
for (UmsResource resource : resourceList) {
Set<Long> roleIds = relationList.stream().filter(item -> item.getResourceId().equals(resource.getId())).map(UmsRoleResourceRelation::getRoleId).collect(Collectors.toSet());
List<String> roleNames = roleList.stream().filter(item -> roleIds.contains(item.getId())).map(item -> item.getId() + "_" + item.getName()).collect(Collectors.toList());
resourceRoleMap.put("/"+applicationName+resource.getUrl(),roleNames);
pathResourceMap.put("/"+applicationName+resource.getUrl(),resource.getId()+":"+resource.getName());
}
redisService.del(AuthConstant.RESOURCE_ROLES_MAP_KEY);
redisService.hSetAll(AuthConstant.RESOURCE_ROLES_MAP_KEY, resourceRoleMap);
return resourceRoleMap;
redisService.del(AuthConstant.PATH_RESOURCE_MAP);
redisService.hSetAll(AuthConstant.PATH_RESOURCE_MAP, pathResourceMap);
return pathResourceMap;
}
}

View File

@@ -50,7 +50,7 @@ public class UmsRoleServiceImpl implements UmsRoleService {
UmsRoleExample example = new UmsRoleExample();
example.createCriteria().andIdIn(ids);
int count = roleMapper.deleteByExample(example);
resourceService.initResourceRolesMap();
resourceService.initPathResourceMap();
return count;
}
@@ -113,7 +113,7 @@ public class UmsRoleServiceImpl implements UmsRoleService {
relation.setResourceId(resourceId);
roleResourceRelationMapper.insert(relation);
}
resourceService.initResourceRolesMap();
resourceService.initPathResourceMap();
return resourceIds.size();
}
}

View File

@@ -1,7 +1,7 @@
package com.macro.mall.validator;
import javax.validation.Constraint;
import javax.validation.Payload;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.*;
/**

View File

@@ -1,7 +1,7 @@
package com.macro.mall.validator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
/**
* 状态标记校验器

View File

@@ -17,17 +17,13 @@ spring:
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码(默认为空)
timeout: 3000ms # 连接超时时间(毫秒
rabbitmq: #rabbitmq相关配置
host: localhost
port: 5672
username: guest
password: guest
data:
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
timeout: 3000ms # 连接超时时间(毫秒)
servlet:
multipart:
enabled: true #开启文件上传
@@ -36,16 +32,22 @@ mybatis:
mapper-locations:
- classpath:dao/*.xml
- classpath*:com/**/mapper/*.xml
management: #开启SpringBoot Admin的监控
management:
endpoints:
web:
exposure:
include: '*'
include: '*' #暴露Actuator的监控端点
endpoint:
health:
show-details: always
show-details: always #显示健康的详细信息
env:
show-values: always #默认Actuator的环境变量会以****显示,这里开启显示
configprops:
show-values: always #默认Actuator的配置属性会以****显示,这里开启显示
info:
enabled: true
redis:
database: mall
database: mall-swarm
key:
admin: 'ums:admin'
expire:
@@ -67,12 +69,45 @@ minio:
bucketName: mall #存储桶名称
accessKey: minioadmin #访问的key
secretKey: minioadmin #访问的秘钥
feign:
okhttp:
springdoc:
swagger-ui:
# 修改Swagger UI路径
path: /swagger-ui.html
# 开启Swagger UI界面
enabled: true
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: basic
# 用于配置tag和operation的展开方式这里配置为都不展开
doc-expansion: 'none'
api-docs:
# 修改api-docs路径
path: /v3/api-docs
# 开启api-docs
enabled: true
group-configs:
- group: 'default'
packages-to-scan: com.macro.mall.controller
default-flat-param-object: false
sa-token:
# token名称 (同时也是cookie名称)
token-name: Authorization
# token有效期单位秒-1代表永不过期
timeout: 604800
# token临时有效期 (指定时间内无操作就视为token过期),单位秒
active-timeout: -1
# 是否允许同一账号并发登录 (为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为false时每次登录新建一个token)
is-share: false
# token风格
token-style: uuid
# 是否输出操作日志
is-log: false
# 是否从cookie中读取token
is-read-cookie: false
# 是否从head中读取token
is-read-header: true
# token前缀
token-prefix: Bearer
# jwt秘钥
jwt-secret-key: sa-secret-key123
# 是否打印banner
is-print: false

View File

@@ -41,26 +41,13 @@
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
<version>${spring-cloud-starter-oauth2.version}</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
</dependencies>

View File

@@ -1,29 +0,0 @@
package com.macro.mall.auth.component;
import com.macro.mall.auth.domain.SecurityUser;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* JWT内容增强器
* Created by macro on 2020/6/19.
*/
@Component
public class JwtTokenEnhancer implements TokenEnhancer {
@Override
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
SecurityUser securityUser = (SecurityUser) authentication.getPrincipal();
Map<String, Object> info = new HashMap<>();
//把用户ID设置到JWT中
info.put("id", securityUser.getId());
info.put("client_id",securityUser.getClientId());
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(info);
return accessToken;
}
}

View File

@@ -1,89 +0,0 @@
package com.macro.mall.auth.config;
import com.macro.mall.auth.component.JwtTokenEnhancer;
import com.macro.mall.auth.service.impl.UserServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
import org.springframework.security.oauth2.provider.token.TokenEnhancerChain;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.rsa.crypto.KeyStoreKeyFactory;
import java.security.KeyPair;
import java.util.ArrayList;
import java.util.List;
/**
* 认证服务器配置
* Created by macro on 2020/6/19.
*/
@AllArgsConstructor
@Configuration
@EnableAuthorizationServer
public class Oauth2ServerConfig extends AuthorizationServerConfigurerAdapter {
private final PasswordEncoder passwordEncoder;
private final UserServiceImpl userDetailsService;
private final AuthenticationManager authenticationManager;
private final JwtTokenEnhancer jwtTokenEnhancer;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("admin-app")
.secret(passwordEncoder.encode("123456"))
.scopes("all")
.authorizedGrantTypes("password", "refresh_token")
.accessTokenValiditySeconds(3600*24)
.refreshTokenValiditySeconds(3600*24*7)
.and()
.withClient("portal-app")
.secret(passwordEncoder.encode("123456"))
.scopes("all")
.authorizedGrantTypes("password", "refresh_token")
.accessTokenValiditySeconds(3600*24)
.refreshTokenValiditySeconds(3600*24*7);
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
TokenEnhancerChain enhancerChain = new TokenEnhancerChain();
List<TokenEnhancer> delegates = new ArrayList<>();
delegates.add(jwtTokenEnhancer);
delegates.add(accessTokenConverter());
enhancerChain.setTokenEnhancers(delegates); //配置JWT的内容增强器
endpoints.authenticationManager(authenticationManager)
.userDetailsService(userDetailsService) //配置加载用户信息的服务
.accessTokenConverter(accessTokenConverter())
.tokenEnhancer(enhancerChain);
}
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.allowFormAuthenticationForClients();
}
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
jwtAccessTokenConverter.setKeyPair(keyPair());
return jwtAccessTokenConverter;
}
@Bean
public KeyPair keyPair() {
//从classpath下的证书中获取秘钥对
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwt.jks"), "123456".toCharArray());
return keyStoreKeyFactory.getKeyPair("jwt", "123456".toCharArray());
}
}

View File

@@ -0,0 +1,52 @@
package com.macro.mall.auth.config;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* SpringDoc相关配置
* Created by macro on 2024/3/5.
*/
@Configuration
public class SpringDocConfig implements WebMvcConfigurer {
private static final String SECURITY_SCHEME_NAME = "Authorization";
@Bean
public OpenAPI mallAuthOpenAPI() {
return new OpenAPI()
.info(new Info().title("mall认证中心")
.description("mall认证中心相关接口文档")
.version("v1.0.0")
.license(new License().name("Apache 2.0")
.url("https://github.com/macrozheng/mall-learning")))
.externalDocs(new ExternalDocumentation()
.description("SpringBoot实战电商项目mall60K+Star全套文档")
.url("http://www.macrozheng.com"))
.addSecurityItem(new SecurityRequirement().addList(SECURITY_SCHEME_NAME))
.components(new Components()
.addSecuritySchemes(SECURITY_SCHEME_NAME,
new SecurityScheme()
.name(SECURITY_SCHEME_NAME)
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")));
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
//配置访问`/swagger-ui/`路径时可以直接跳转到`/swagger-ui/index.html`
registry.addViewController("/swagger-ui/").setViewName("redirect:/swagger-ui/index.html");
}
}

Some files were not shown because too many files have changed in this diff Show More