迁移搜索服务

This commit is contained in:
YunaiV
2020-08-03 20:38:12 +08:00
parent 72ed490334
commit 128b9dc21a
57 changed files with 366 additions and 871 deletions

View File

@@ -0,0 +1,13 @@
package cn.iocoder.mall.shopweb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ShopWebApplication {
public static void main(String[] args) {
SpringApplication.run(ShopWebApplication.class, args);
}
}

View File

@@ -0,0 +1,4 @@
### /user-address/get-default 成功
GET {{user-api-base-url}}/product-category/list?pid=0
###

View File

@@ -0,0 +1,40 @@
package cn.iocoder.mall.shopweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.userweb.controller.product.vo.category.ProductCategoryRespVO;
import cn.iocoder.mall.userweb.manager.product.ProductCategoryManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品分类 Controller
*/
@RestController
@RequestMapping("/product-category")
@Api(tags = "商品分类")
@Validated
// TODO 芋艿:稍后迁移到 shop-web-app 服务下
public class ProductCategoryController {
@Autowired
private ProductCategoryManager productCategoryManager;
@GetMapping("/list")
@ApiOperation("获得商品分类的列表")
@ApiImplicitParam(name = "pid", value = "父分类编号", required = true, example = "1024")
public CommonResult<List<ProductCategoryRespVO>> listProductCategories(@RequestParam("pid") Integer pid) {
return success(productCategoryManager.listProductCategories(pid));
}
}

View File

@@ -0,0 +1,18 @@
package cn.iocoder.mall.shopweb.controller.product.vo.category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品分类 Response VO")
@Data
public class ProductCategoryRespVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
}

View File

@@ -0,0 +1 @@
package cn.iocoder.mall.shopweb.controller.product.vo;

View File

@@ -0,0 +1,14 @@
spring:
# Spring Cloud 配置项
cloud:
nacos:
# Spring Cloud Nacos Discovery 配置项
discovery:
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
namespace: dev # Nacos 命名空间
# Dubbo 配置项
dubbo:
# Dubbo 注册中心
registry:
address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址

View File

@@ -0,0 +1,15 @@
spring:
# Spring Cloud 配置项
cloud:
nacos:
# Spring Cloud Nacos Discovery 配置项
discovery:
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
namespace: dev # Nacos 命名空间
# Dubbo 配置项
dubbo:
# Dubbo 注册中心
registry:
# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址

View File

@@ -0,0 +1,48 @@
# 服务器的配置项
server:
port: 18083
servlet:
context-path: /user-api/
spring:
# Application 的配置项
application:
name: shop-web
# Profile 的配置项
profiles:
active: local
# SpringMVC 配置项
mvc:
throw-exception-if-no-handler-found: true # 匹配不到路径时,抛出 NoHandlerFoundException 异常
static-path-pattern: /doc.html # 静态资源的路径
# Dubbo 配置项
dubbo:
# Spring Cloud Alibaba Dubbo 专属配置
cloud:
subscribed-services: 'user-service,system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用
# Dubbo 服务消费者的配置
consumer:
timeout: 10000
validation: true # 开启 Consumer 的参数校验
UserSmsCodeRpc:
version: 1.0.0
UserRpc:
version: 1.0.0
OAuth2Rpc:
version: 1.0.0
SystemAccessLogRpc:
version: 1.0.0
SystemExceptionLogRpc:
version: 1.0.0
UserAddressRpc:
version: 1.0.0
ProductCategoryRpc:
version: 1.0.0
# Swagger 配置项
swagger:
title: 商城中心
description: 提供用户商城购物流程中的 API
version: 1.0.0
base-package: cn.iocoder.mall.shopweb.controller