购物车+订单
parent
6a0aa13c3c
commit
da34dac07a
24
pom.xml
24
pom.xml
|
@ -290,33 +290,47 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 系统服务公共依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car-common</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统服务远程调用 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car-remote</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- 商品服务公共依赖 -->
|
<!-- 商品服务公共依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-mall-product-common</artifactId>
|
<artifactId>ruoyi-mall-product-common</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 商品服务远程调用依赖 -->
|
<!-- 商品服务远程调用依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-mall-product-remote</artifactId>
|
<artifactId>ruoyi-mall-product-remote</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 商品搜索公共依赖 -->
|
<!-- 商品搜索公共依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-mall-search-common</artifactId>
|
<artifactId>ruoyi-mall-search-common</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 商品搜索远程调用依赖 -->
|
<!-- 商品搜索远程调用依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-mall-search-remote</artifactId>
|
<artifactId>ruoyi-mall-search-remote</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- ES官网 驱动包 -->
|
<!-- ES官网 驱动包 -->
|
||||||
|
@ -330,7 +344,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-mall-product-cache</artifactId>
|
<artifactId>ruoyi-mall-product-cache</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
package com.ruoyi.auth.controller;
|
package com.ruoyi.auth.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.auth.service.SysCUserService;
|
import com.ruoyi.auth.service.SysCUserService;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.ruoyi.system.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel("es访问必须参数")
|
|
||||||
public class EsDocBaseVo {
|
|
||||||
@ApiModelProperty(value = "索引名称",required = true)
|
|
||||||
private String indexName;
|
|
||||||
@ApiModelProperty(value = "类型名称,默认_doc",required = true)
|
|
||||||
private String typeName="_doc";
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.ruoyi.system.domain.vo;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.bawei.base.es.domain
|
|
||||||
* @Project:mall_cloud
|
|
||||||
* @name:EsDocEntity
|
|
||||||
* @Date:2024/4/24 9:36
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class EsDocEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 索引名称
|
|
||||||
*/
|
|
||||||
private String index;
|
|
||||||
/**
|
|
||||||
* 批量操作 集合 多个键值对的列表
|
|
||||||
*/
|
|
||||||
private List<Map<String,Object>> datas;
|
|
||||||
/**
|
|
||||||
* 唯一标识
|
|
||||||
*/
|
|
||||||
private String indexIdName;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.ruoyi.system.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel("插入Es数据实体")
|
|
||||||
public class EsDocInsertVo extends EsDocBaseVo {
|
|
||||||
|
|
||||||
@ApiModelProperty("数据唯一id")
|
|
||||||
public String id;
|
|
||||||
@ApiModelProperty(value = "数据内容",required = true)
|
|
||||||
private Map<String,Object> data;
|
|
||||||
@ApiModelProperty("是否立即刷新磁盘")
|
|
||||||
private boolean reflush = true;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ruoyi.system.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel("es文档查询参数")
|
|
||||||
public class EsDocQueryVo extends EsDocBaseVo{
|
|
||||||
@ApiModelProperty("query参数")
|
|
||||||
private Map<String,Object> queryObj;
|
|
||||||
@ApiModelProperty("全文检索关键字")
|
|
||||||
private String keyWord;
|
|
||||||
@ApiModelProperty("分页条件")
|
|
||||||
private PageVo pageVo = new PageVo();
|
|
||||||
|
|
||||||
@ApiModelProperty("检索字段")
|
|
||||||
private List<String> searchFields;
|
|
||||||
@ApiModelProperty("高亮字段,包含在检索字段,不传参则默认检索字段全部高亮")
|
|
||||||
private List<String> highLightFields;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.ruoyi.system.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel("分页参数")
|
|
||||||
public class PageVo {
|
|
||||||
@ApiModelProperty("每页条数")
|
|
||||||
private int pageSize = 10;
|
|
||||||
@ApiModelProperty("当前页")
|
|
||||||
private Integer currentPage = 1;
|
|
||||||
@ApiModelProperty("总数")
|
|
||||||
private Long totalDocs;
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||||
import com.ruoyi.system.remote.factory.RemoteEsDocFallbackFactory;
|
import com.ruoyi.system.remote.factory.RemoteEsDocFallbackFactory;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
|
@ -27,8 +28,7 @@ public interface RemoteEsDocService {
|
||||||
@PostMapping("/queryDocs")
|
@PostMapping("/queryDocs")
|
||||||
public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo);
|
public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo);
|
||||||
|
|
||||||
|
@DeleteMapping("/querydelDoce")
|
||||||
@PostMapping("/deleteDocs")
|
R<Boolean> querydelDoce(@RequestBody List<EsDocInsertVo> esDocInsertVo);
|
||||||
public R<Boolean> deleteDocsById(@RequestParam(value = "docsId") String docsId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,9 @@ public class RemoteEsDocFallbackFactory implements FallbackFactory<RemoteEsDocSe
|
||||||
return R.ok(false, "查询失败,请稍后重试");
|
return R.ok(false, "查询失败,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<Boolean> deleteDocsById(String docsId) {
|
public R<Boolean> querydelDoce(List<EsDocInsertVo> esDocInsertVo) {
|
||||||
return R.ok(false, "删除失败,请稍后重试");
|
return R.ok(false, "删除失败,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.ruoyi.es;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* es全文检索模块
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableCustomSwagger2
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class RuoYiEsApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(RuoYiEsApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ Es全文检索模块启动成功 ლ(´ڡ`ლ)゙ ");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.ruoyi.es.conf;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class EsConfiguration {
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.ruoyi.es.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.es.service.EsDocService;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@Api(tags = "Es文档管理")
|
|
||||||
//文档相当于mysql中的一行数据,类似DML和DQL
|
|
||||||
public class EsDocController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EsDocService esDocService;
|
|
||||||
|
|
||||||
@PostMapping("/batchInsertDocs")
|
|
||||||
@ApiOperation(value = "批量插入文档")
|
|
||||||
public R<Boolean> batchInsertDocs(@RequestBody List<EsDocInsertVo> esDocInsertVo){
|
|
||||||
return esDocService.batchInsertDocs(esDocInsertVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/queryDocs")
|
|
||||||
@ApiOperation(value = "根据传入条件查询Es的文档数据")
|
|
||||||
public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo){
|
|
||||||
return esDocService.queryDocs(esDocInsertVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/deleteDocs")
|
|
||||||
@ApiOperation("/根据索引名称和文档id删除索引数据")
|
|
||||||
public R<Boolean> deleteDocsById(@RequestParam(value = "docsId") String docsId){
|
|
||||||
return esDocService.deleteDocsById(docsId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO 自动补全联想
|
|
||||||
@GetMapping("/querySuggestions/{indexName}")
|
|
||||||
@ApiOperation(value = "自动补全联想")
|
|
||||||
public R querySuggestions(@PathVariable String indexName, @RequestParam("keyWord") String keyWord,@RequestParam("suggestField") String suggestField ){
|
|
||||||
return esDocService.querySuggestions(indexName,keyWord,suggestField);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
package com.ruoyi.es.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.es.service.EsIndexService;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/esIndex")
|
|
||||||
@Api(value = "ES索引管理",tags = "ES索引管理")
|
|
||||||
// 索引相当于mysql中的库,在es6之后,取消类型(相当于mysql中的表),索引默认只有一个类型-即库表合一 类似DDL
|
|
||||||
public class EsIndexController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EsIndexService esIndexService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引名称创建索引
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/create")
|
|
||||||
@ApiOperation(value = "根据索引名称创建索引")
|
|
||||||
public R<Boolean> indexCreate(@RequestParam String indexName) {
|
|
||||||
return esIndexService.indexCreate(indexName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引名称、映射结构创建索引
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/createWithMapping")
|
|
||||||
@ApiOperation(value = "根据索引名称、映射结构创建索引")
|
|
||||||
public R<Boolean> indexCreateWithMapping(@RequestParam String indexName, @RequestParam String indexMapping) {
|
|
||||||
|
|
||||||
return esIndexService.indexCreateWithMapping(indexName,indexMapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引名称查询索引是否存在
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/indexExit")
|
|
||||||
@ApiOperation(value = "根据索引名称查询索引是否存在")
|
|
||||||
public R<Boolean> indexExit(@RequestParam String indexName) {
|
|
||||||
|
|
||||||
return esIndexService.indexExit(indexName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引名称删除索引
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/indexDelete")
|
|
||||||
@ApiOperation(value = "根据索引名称删除索引")
|
|
||||||
public R<Boolean> indexDelete(@RequestParam String indexName) {
|
|
||||||
|
|
||||||
return esIndexService.indexDelete(indexName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引名称获取mapping
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/indexGetMapping")
|
|
||||||
@ApiOperation(value = "根据索引名称获取mapping")
|
|
||||||
public R<Map> indexGetMapping(@RequestParam String indexName) {
|
|
||||||
|
|
||||||
return esIndexService.indexGetMapping(indexName);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询所有已创建的索引
|
|
||||||
*/
|
|
||||||
@GetMapping("/queryAllIndex")
|
|
||||||
@ApiOperation(value = "查询所有索引列表")
|
|
||||||
public R<Map> queryAllIndex(@RequestBody EsDocQueryVo esDocInsertVo) {
|
|
||||||
return esIndexService.queryAllIndex(esDocInsertVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.ruoyi.es.service;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface EsDocService {
|
|
||||||
R<Boolean> batchInsertDocs(List<EsDocInsertVo> esDocInsertVo);
|
|
||||||
|
|
||||||
R<List<Map>> queryDocs(EsDocQueryVo esDocInsertVo);
|
|
||||||
|
|
||||||
R<Boolean> deleteDocsById(String docsId);
|
|
||||||
|
|
||||||
R querySuggestions(String indexName, String keyWord, String suggestField);
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.ruoyi.es.service;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface EsIndexService {
|
|
||||||
R<Boolean> indexCreate(String indexName);
|
|
||||||
|
|
||||||
R<Boolean> indexExit(String indexName);
|
|
||||||
|
|
||||||
R<Boolean> indexDelete(String indexName);
|
|
||||||
|
|
||||||
R<Boolean> indexCreateWithMapping(String indexName, String indexMapping);
|
|
||||||
|
|
||||||
R<Map> indexGetMapping(String indexName);
|
|
||||||
|
|
||||||
R<Map> queryAllIndex(EsDocQueryVo esDocInsertVo);
|
|
||||||
}
|
|
|
@ -1,110 +0,0 @@
|
||||||
package com.ruoyi.es.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.ruoyi.common.core.constant.EsConstant;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.es.service.EsDocService;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
|
||||||
import org.elasticsearch.action.bulk.BulkRequest;
|
|
||||||
import org.elasticsearch.action.bulk.BulkResponse;
|
|
||||||
import org.elasticsearch.action.delete.DeleteRequest;
|
|
||||||
import org.elasticsearch.action.delete.DeleteResponse;
|
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
|
||||||
import org.elasticsearch.client.RequestOptions;
|
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
|
||||||
import org.elasticsearch.rest.RestStatus;
|
|
||||||
import org.elasticsearch.search.SearchHit;
|
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class EsDocServiceImpl implements EsDocService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestHighLevelClient restHighLevelClient;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> batchInsertDocs(List<EsDocInsertVo> esDocInsertVo) {
|
|
||||||
BulkRequest request = new BulkRequest();
|
|
||||||
esDocInsertVo.forEach(e -> {
|
|
||||||
IndexRequest source = new IndexRequest(e.getIndexName()).source(e.getData(), XContentType.JSON);
|
|
||||||
if (StringUtils.isNotEmpty(e.getId())) {
|
|
||||||
source.id(e.getId());
|
|
||||||
}
|
|
||||||
request.add(source);
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
BulkResponse bulk = restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
|
|
||||||
return R.ok(true, "插入成功");
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return R.fail(false, "插入失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<List<Map>> queryDocs(EsDocQueryVo esDocInsertVo) {
|
|
||||||
if (StringUtils.isEmpty(esDocInsertVo.getKeyWord())){
|
|
||||||
throw new ServiceException("搜索参数不为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchRequest request = new SearchRequest(esDocInsertVo.getIndexName());
|
|
||||||
//构建查询参数
|
|
||||||
SearchSourceBuilder builder = new SearchSourceBuilder();
|
|
||||||
builder.query(QueryBuilders.matchAllQuery());
|
|
||||||
//构建分页参数
|
|
||||||
builder.from((esDocInsertVo.getPageVo().getCurrentPage() - 1) * esDocInsertVo.getPageVo().getPageSize());
|
|
||||||
builder.size(esDocInsertVo.getPageVo().getPageSize());
|
|
||||||
//构建排序参数
|
|
||||||
try {
|
|
||||||
SearchResponse search = restHighLevelClient.search(request, RequestOptions.DEFAULT);
|
|
||||||
log.info("查询结果:{}", JSONObject.toJSONString(search));
|
|
||||||
SearchHit[] hits = search.getHits().getHits();
|
|
||||||
List<Map<String,Object>> resultData = new ArrayList<>(hits.length);
|
|
||||||
Arrays.stream(hits).forEach(h->{
|
|
||||||
Map<String, Object> sourceAsMap = h.getSourceAsMap();
|
|
||||||
resultData.add(sourceAsMap);
|
|
||||||
});
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("根据条件查询es数据失败:{}", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> deleteDocsById(String docsId) {
|
|
||||||
DeleteRequest deleteRequest = new DeleteRequest(EsConstant.INDEX_NAME, docsId);
|
|
||||||
try {
|
|
||||||
DeleteResponse deleteResponse = restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
|
|
||||||
return R.ok(true,"删除成功");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("删除失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R querySuggestions(String indexName, String keyWord, String suggestField) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
package com.ruoyi.es.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.es.service.EsIndexService;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
|
||||||
import org.elasticsearch.client.GetAliasesResponse;
|
|
||||||
import org.elasticsearch.client.RequestOptions;
|
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.elasticsearch.client.indices.*;
|
|
||||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
|
||||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class EsIndexServiceImpl implements EsIndexService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestHighLevelClient restHighLevelClient;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> indexCreate(String indexName) {
|
|
||||||
//如果索引为空 抛出异常
|
|
||||||
if (StringUtils.isEmpty(indexName)) {
|
|
||||||
throw new ServiceException("索引名称不能为空");
|
|
||||||
}
|
|
||||||
CreateIndexRequest request = new CreateIndexRequest(indexName);
|
|
||||||
try {
|
|
||||||
CreateIndexResponse createIndexResponse = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
|
|
||||||
if (createIndexResponse.isAcknowledged()) {
|
|
||||||
return R.ok(true);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("连接ES服务异常:{}", e);
|
|
||||||
throw new RuntimeException("创建索引失败,请联系管理员或查看服务日志");
|
|
||||||
}
|
|
||||||
return R.fail(false, "索引创建失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> indexExit(String indexName) {
|
|
||||||
if (StringUtils.isEmpty(indexName)) {
|
|
||||||
throw new ServiceException("indexName不能为空");
|
|
||||||
}
|
|
||||||
GetIndexRequest indexRequest = new GetIndexRequest(indexName);
|
|
||||||
try {
|
|
||||||
boolean exists = restHighLevelClient.indices().exists(indexRequest, RequestOptions.DEFAULT);
|
|
||||||
return R.ok(exists);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return R.fail(false, "查询失败!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> indexDelete(String indexName) {
|
|
||||||
if (StringUtils.isEmpty(indexName)) {
|
|
||||||
throw new ServiceException("indexName不能为空 ");
|
|
||||||
}
|
|
||||||
DeleteIndexRequest request = new DeleteIndexRequest(indexName);
|
|
||||||
try {
|
|
||||||
AcknowledgedResponse delete = restHighLevelClient.indices().delete(request, RequestOptions.DEFAULT);
|
|
||||||
if (delete.isAcknowledged()) {
|
|
||||||
return R.ok(true, "删除成功!");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("删除索引失败:{}", e);
|
|
||||||
throw new RuntimeException("调用es服务删除索引失败,详情请查看日志");
|
|
||||||
}
|
|
||||||
return R.fail(false, "删除索引失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> indexCreateWithMapping(String indexName, String indexMapping) {
|
|
||||||
if (StringUtils.isEmpty(indexName) ||
|
|
||||||
StringUtils.isEmpty(indexMapping)) {
|
|
||||||
throw new ServiceException("indexName、indexMapping不能为空");
|
|
||||||
}
|
|
||||||
CreateIndexRequest request = new CreateIndexRequest(indexName);
|
|
||||||
request.source(indexMapping, XContentType.JSON);
|
|
||||||
try {
|
|
||||||
CreateIndexResponse createIndexResponse = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
|
|
||||||
if (createIndexResponse.isAcknowledged()){
|
|
||||||
return R.ok(true,"创建索引成功");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("调用es创建索引异常:{}",e);
|
|
||||||
throw new RuntimeException("创建索引失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.fail(false,"创建索引失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Map> indexGetMapping(String indexName) {
|
|
||||||
if (StringUtils.isEmpty(indexName)){
|
|
||||||
throw new ServiceException("indexName不能为空");
|
|
||||||
}
|
|
||||||
GetMappingsRequest request = new GetMappingsRequest().indices(indexName);
|
|
||||||
try {
|
|
||||||
GetMappingsResponse response = restHighLevelClient.indices().getMapping(request, RequestOptions.DEFAULT);
|
|
||||||
Map<String, MappingMetaData> mappings = response.mappings();
|
|
||||||
MappingMetaData mappingMetaData = mappings.get(indexName);
|
|
||||||
Map<String, Object> stringObjectMap = mappingMetaData.sourceAsMap();
|
|
||||||
return R.ok(stringObjectMap,"操作成功");
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("根据索引名称获取Mapping异常:{}",e);
|
|
||||||
throw new RuntimeException("根据索引名称获取Mapping异常");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Map> queryAllIndex(EsDocQueryVo esDocInsertVo) {
|
|
||||||
// TODO 关键字查询
|
|
||||||
|
|
||||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
||||||
GetAliasesRequest request = new GetAliasesRequest();
|
|
||||||
GetAliasesResponse alias = null;
|
|
||||||
try {
|
|
||||||
alias = restHighLevelClient.indices().getAlias(request, RequestOptions.DEFAULT);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
Map<String, Set<AliasMetaData>> map = alias.getAliases();
|
|
||||||
map.forEach((k, v) -> {
|
|
||||||
if (!k.startsWith(".")) {//忽略elasticesearch 默认的
|
|
||||||
Map map1 = new HashMap();
|
|
||||||
map1.put("indexName", k);
|
|
||||||
resultList.add(map1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
log.info(String.valueOf(resultList));
|
|
||||||
return R.ok((Map) resultList);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,6 +15,7 @@
|
||||||
<module>ruoyi-mall-product</module>
|
<module>ruoyi-mall-product</module>
|
||||||
<module>ruoyi-mall-search</module>
|
<module>ruoyi-mall-search</module>
|
||||||
<module>ruoyi-mall-user</module>
|
<module>ruoyi-mall-user</module>
|
||||||
|
<module>ruoyi-mall-car</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-mall-car</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>ruoyi-mall-car-common</module>
|
||||||
|
<module>ruoyi-mall-car-remote</module>
|
||||||
|
<module>ruoyi-mall-car-service</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-mall-car-common</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 项目公共核心依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mybatis-plus 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-mall-car-remote</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 引入 购物车commmon依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,167 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-mall-car-service</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.fox.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- BaWei Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- BaWei Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- BaWei Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- BaWei Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 商品服务公共依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-product-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 商品缓存 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-product-cache</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 消息队列 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-rabbit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 引入购物车公共模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 购物车远程调用-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-car-remote</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 引入商品服务-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.ruoyi</groupId>-->
|
||||||
|
<!-- <artifactId>ruoyi-mall-product-server</artifactId>-->
|
||||||
|
<!-- <version>3.6.0</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- knife4j -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
<version>2.0.9</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- redis引入 common-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- common core-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 对接阿里api-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alipay.sdk</groupId>
|
||||||
|
<artifactId>alipay-sdk-java</artifactId>
|
||||||
|
<version>4.39.68.ALL</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
|
||||||
|
<!-- <exclusions>-->
|
||||||
|
<!-- <exclusion>-->
|
||||||
|
<!-- <groupId>io.lettuce</groupId>-->
|
||||||
|
<!-- <artifactId>lettuce-core</artifactId>-->
|
||||||
|
<!-- </exclusion>-->
|
||||||
|
<!-- </exclusions>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>redis.clients</groupId>-->
|
||||||
|
<!-- <artifactId>jedis</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -1,8 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class EsMallProductInfo extends MallProductInfo{
|
|
||||||
}
|
|
|
@ -1,123 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品品牌对象 mall_product_brand_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-15
|
|
||||||
*/
|
|
||||||
public class MallProductBrandInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 品牌名称 */
|
|
||||||
@Excel(name = "品牌名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 品牌描述 */
|
|
||||||
@Excel(name = "品牌描述")
|
|
||||||
private String productDesc;
|
|
||||||
|
|
||||||
/** 品牌介绍 */
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/** 品牌logo */
|
|
||||||
@Excel(name = "品牌logo")
|
|
||||||
private String logo;
|
|
||||||
|
|
||||||
/** 品牌状态 */
|
|
||||||
@Excel(name = "品牌状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setProductDesc(String productDesc)
|
|
||||||
{
|
|
||||||
this.productDesc = productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDesc()
|
|
||||||
{
|
|
||||||
return productDesc;
|
|
||||||
}
|
|
||||||
public void setContent(String content)
|
|
||||||
{
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent()
|
|
||||||
{
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
public void setLogo(String logo)
|
|
||||||
{
|
|
||||||
this.logo = logo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLogo()
|
|
||||||
{
|
|
||||||
return logo;
|
|
||||||
}
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("productDesc", getProductDesc())
|
|
||||||
.append("content", getContent())
|
|
||||||
.append("logo", getLogo())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,239 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品信息对象 mall_product_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
public class MallProductInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
@ApiParam("ID自增")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 商品名称 */
|
|
||||||
@Excel(name = "商品名称")
|
|
||||||
@ApiParam("商品名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 商品描述 */
|
|
||||||
@Excel(name = "商品描述")
|
|
||||||
private String productDesc;
|
|
||||||
|
|
||||||
/** 商品类型 */
|
|
||||||
@Excel(name = "商品类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/** 冗余字段 */
|
|
||||||
@Excel(name = "冗余字段")
|
|
||||||
private String typeIds;
|
|
||||||
|
|
||||||
/** 商品主图 */
|
|
||||||
@Excel(name = "商品主图")
|
|
||||||
private String img;
|
|
||||||
|
|
||||||
/** 商品轮播图 */
|
|
||||||
@Excel(name = "商品轮播图")
|
|
||||||
private String carouselImages;
|
|
||||||
|
|
||||||
/** 商品评论数 */
|
|
||||||
@Excel(name = "商品评论数")
|
|
||||||
private Long commentCount;
|
|
||||||
|
|
||||||
/** 商品收藏人气 */
|
|
||||||
@Excel(name = "商品收藏人气")
|
|
||||||
private Long collectCount;
|
|
||||||
|
|
||||||
/** 品牌信息 */
|
|
||||||
@Excel(name = "品牌信息")
|
|
||||||
private String brand;
|
|
||||||
|
|
||||||
/** 商品状态 */
|
|
||||||
@Excel(name = "商品状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 单位 */
|
|
||||||
@Excel(name = "单位")
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/** 搜索关键字 */
|
|
||||||
@Excel(name = "搜索关键字")
|
|
||||||
private String keywords;
|
|
||||||
|
|
||||||
/** 规格信息 */
|
|
||||||
@Excel(name = "规格信息")
|
|
||||||
private Long ruleId;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setProductDesc(String productDesc)
|
|
||||||
{
|
|
||||||
this.productDesc = productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDesc()
|
|
||||||
{
|
|
||||||
return productDesc;
|
|
||||||
}
|
|
||||||
public void setType(String type)
|
|
||||||
{
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setTypeIds(String typeIds)
|
|
||||||
{
|
|
||||||
this.typeIds = typeIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeIds()
|
|
||||||
{
|
|
||||||
return typeIds;
|
|
||||||
}
|
|
||||||
public void setImg(String img)
|
|
||||||
{
|
|
||||||
this.img = img;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImg()
|
|
||||||
{
|
|
||||||
return img;
|
|
||||||
}
|
|
||||||
public void setCarouselImages(String carouselImages)
|
|
||||||
{
|
|
||||||
this.carouselImages = carouselImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCarouselImages()
|
|
||||||
{
|
|
||||||
return carouselImages;
|
|
||||||
}
|
|
||||||
public void setCommentCount(Long commentCount)
|
|
||||||
{
|
|
||||||
this.commentCount = commentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCommentCount()
|
|
||||||
{
|
|
||||||
return commentCount;
|
|
||||||
}
|
|
||||||
public void setCollectCount(Long collectCount)
|
|
||||||
{
|
|
||||||
this.collectCount = collectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCollectCount()
|
|
||||||
{
|
|
||||||
return collectCount;
|
|
||||||
}
|
|
||||||
public void setBrand(String brand)
|
|
||||||
{
|
|
||||||
this.brand = brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrand()
|
|
||||||
{
|
|
||||||
return brand;
|
|
||||||
}
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setUnit(String unit)
|
|
||||||
{
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnit()
|
|
||||||
{
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
public void setKeywords(String keywords)
|
|
||||||
{
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeywords()
|
|
||||||
{
|
|
||||||
return keywords;
|
|
||||||
}
|
|
||||||
public void setRuleId(Long ruleId)
|
|
||||||
{
|
|
||||||
this.ruleId = ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRuleId()
|
|
||||||
{
|
|
||||||
return ruleId;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("productDesc", getProductDesc())
|
|
||||||
.append("type", getType())
|
|
||||||
.append("typeIds", getTypeIds())
|
|
||||||
.append("img", getImg())
|
|
||||||
.append("carouselImages", getCarouselImages())
|
|
||||||
.append("commentCount", getCommentCount())
|
|
||||||
.append("collectCount", getCollectCount())
|
|
||||||
.append("brand", getBrand())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("unit", getUnit())
|
|
||||||
.append("keywords", getKeywords())
|
|
||||||
.append("ruleId", getRuleId())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,153 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品评价对象 mall_product_review_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-26
|
|
||||||
*/
|
|
||||||
public class MallProductReviewInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 商品名称 */
|
|
||||||
@Excel(name = "商品名称")
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
/** 商品SKU */
|
|
||||||
@Excel(name = "商品SKU")
|
|
||||||
private Long productSkuId;
|
|
||||||
|
|
||||||
/** 商品评价图片 */
|
|
||||||
@Excel(name = "商品评价图片")
|
|
||||||
private String reviewImages;
|
|
||||||
|
|
||||||
/** 商品评价信息 */
|
|
||||||
@Excel(name = "商品评价信息")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/** 评论分数 */
|
|
||||||
@Excel(name = "评论分数")
|
|
||||||
private BigDecimal start;
|
|
||||||
|
|
||||||
/** 是否隐藏 */
|
|
||||||
@Excel(name = "是否隐藏")
|
|
||||||
private String isDispaly;
|
|
||||||
|
|
||||||
/** 是否删除 */
|
|
||||||
@Excel(name = "是否删除")
|
|
||||||
private String isDel;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setProductId(Long productId)
|
|
||||||
{
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getProductId()
|
|
||||||
{
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
public void setProductSkuId(Long productSkuId)
|
|
||||||
{
|
|
||||||
this.productSkuId = productSkuId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getProductSkuId()
|
|
||||||
{
|
|
||||||
return productSkuId;
|
|
||||||
}
|
|
||||||
public void setReviewImages(String reviewImages)
|
|
||||||
{
|
|
||||||
this.reviewImages = reviewImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReviewImages()
|
|
||||||
{
|
|
||||||
return reviewImages;
|
|
||||||
}
|
|
||||||
public void setContent(String content)
|
|
||||||
{
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent()
|
|
||||||
{
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
public void setStart(BigDecimal start)
|
|
||||||
{
|
|
||||||
this.start = start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getStart()
|
|
||||||
{
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
public void setIsDispaly(String isDispaly)
|
|
||||||
{
|
|
||||||
this.isDispaly = isDispaly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsDispaly()
|
|
||||||
{
|
|
||||||
return isDispaly;
|
|
||||||
}
|
|
||||||
public void setIsDel(String isDel)
|
|
||||||
{
|
|
||||||
this.isDel = isDel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsDel()
|
|
||||||
{
|
|
||||||
return isDel;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("productId", getProductId())
|
|
||||||
.append("productSkuId", getProductSkuId())
|
|
||||||
.append("reviewImages", getReviewImages())
|
|
||||||
.append("content", getContent())
|
|
||||||
.append("start", getStart())
|
|
||||||
.append("isDispaly", getIsDispaly())
|
|
||||||
.append("isDel", getIsDel())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格详情对象 mall_product_rule_attr_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public class MallProductRuleAttrInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 规格 */
|
|
||||||
@Excel(name = "规格")
|
|
||||||
private Long ruleId;
|
|
||||||
|
|
||||||
/** 类目名称 */
|
|
||||||
@Excel(name = "类目名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 规格值 */
|
|
||||||
@Excel(name = "规格值")
|
|
||||||
private String attrValue;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setRuleId(Long ruleId)
|
|
||||||
{
|
|
||||||
this.ruleId = ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRuleId()
|
|
||||||
{
|
|
||||||
return ruleId;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setAttrValue(String attrValue)
|
|
||||||
{
|
|
||||||
this.attrValue = attrValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAttrValue()
|
|
||||||
{
|
|
||||||
return attrValue;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("ruleId", getRuleId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("attrValue", getAttrValue())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格对象 mall_product_rule_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public class MallProductRuleInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 规格名称 */
|
|
||||||
@Excel(name = "规格名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 规格详情 */
|
|
||||||
@Excel(name = "规格详情")
|
|
||||||
private String ruleAttr;
|
|
||||||
|
|
||||||
/** 规格状态 */
|
|
||||||
@Excel(name = "规格状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setRuleAttr(String ruleAttr)
|
|
||||||
{
|
|
||||||
this.ruleAttr = ruleAttr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRuleAttr()
|
|
||||||
{
|
|
||||||
return ruleAttr;
|
|
||||||
}
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("ruleAttr", getRuleAttr())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,196 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品SKU对象 mall_product_sku_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
public class MallProductSkuInfo extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 商品信息 */
|
|
||||||
@Excel(name = "商品id")
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
/** 商品规格 */
|
|
||||||
@Excel(name = "商品规格")
|
|
||||||
private String sku;
|
|
||||||
|
|
||||||
/** 商品库存 */
|
|
||||||
@Excel(name = "商品库存")
|
|
||||||
private Long stock;
|
|
||||||
|
|
||||||
/** 商品价格 */
|
|
||||||
@Excel(name = "商品价格")
|
|
||||||
private BigDecimal price;
|
|
||||||
|
|
||||||
/** 商品进价 */
|
|
||||||
@Excel(name = "商品进价")
|
|
||||||
private BigDecimal purchasePrice;
|
|
||||||
|
|
||||||
/** 商品售价 */
|
|
||||||
@Excel(name = "商品售价")
|
|
||||||
private BigDecimal sellingPrice;
|
|
||||||
|
|
||||||
/** 规格图片 */
|
|
||||||
@Excel(name = "规格图片")
|
|
||||||
private String image;
|
|
||||||
|
|
||||||
/** 编号 */
|
|
||||||
@Excel(name = "编号")
|
|
||||||
private String number;
|
|
||||||
|
|
||||||
/** 重量 */
|
|
||||||
@Excel(name = "重量")
|
|
||||||
private BigDecimal weight;
|
|
||||||
|
|
||||||
/** 体积 */
|
|
||||||
@Excel(name = "体积")
|
|
||||||
private BigDecimal volume;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
@Excel(name = "乐观锁")
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setProductId(Long productId)
|
|
||||||
{
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getProductId()
|
|
||||||
{
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
public void setSku(String sku)
|
|
||||||
{
|
|
||||||
this.sku = sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSku()
|
|
||||||
{
|
|
||||||
return sku;
|
|
||||||
}
|
|
||||||
public void setStock(Long stock)
|
|
||||||
{
|
|
||||||
this.stock = stock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getStock()
|
|
||||||
{
|
|
||||||
return stock;
|
|
||||||
}
|
|
||||||
public void setPrice(BigDecimal price)
|
|
||||||
{
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPrice()
|
|
||||||
{
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
public void setPurchasePrice(BigDecimal purchasePrice)
|
|
||||||
{
|
|
||||||
this.purchasePrice = purchasePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPurchasePrice()
|
|
||||||
{
|
|
||||||
return purchasePrice;
|
|
||||||
}
|
|
||||||
public void setSellingPrice(BigDecimal sellingPrice)
|
|
||||||
{
|
|
||||||
this.sellingPrice = sellingPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSellingPrice()
|
|
||||||
{
|
|
||||||
return sellingPrice;
|
|
||||||
}
|
|
||||||
public void setImage(String image)
|
|
||||||
{
|
|
||||||
this.image = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImage()
|
|
||||||
{
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
public void setNumber(String number)
|
|
||||||
{
|
|
||||||
this.number = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNumber()
|
|
||||||
{
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
public void setWeight(BigDecimal weight)
|
|
||||||
{
|
|
||||||
this.weight = weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getWeight()
|
|
||||||
{
|
|
||||||
return weight;
|
|
||||||
}
|
|
||||||
public void setVolume(BigDecimal volume)
|
|
||||||
{
|
|
||||||
this.volume = volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getVolume()
|
|
||||||
{
|
|
||||||
return volume;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("productId", getProductId())
|
|
||||||
.append("sku", getSku())
|
|
||||||
.append("stock", getStock())
|
|
||||||
.append("price", getPrice())
|
|
||||||
.append("purchasePrice", getPurchasePrice())
|
|
||||||
.append("sellingPrice", getSellingPrice())
|
|
||||||
.append("image", getImage())
|
|
||||||
.append("number", getNumber())
|
|
||||||
.append("weight", getWeight())
|
|
||||||
.append("volume", getVolume())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.TreeEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型对象 mall_product_type_info
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public class MallProductTypeInfo extends TreeEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 类型名称 */
|
|
||||||
@Excel(name = "类型名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 类型图片 */
|
|
||||||
@Excel(name = "类型图片")
|
|
||||||
private String image;
|
|
||||||
|
|
||||||
/** 类型状态 */
|
|
||||||
@Excel(name = "类型状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 类型排序 */
|
|
||||||
@Excel(name = "类型排序")
|
|
||||||
private Long orderBy;
|
|
||||||
|
|
||||||
/** 乐观锁 */
|
|
||||||
private Long revision;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setImage(String image)
|
|
||||||
{
|
|
||||||
this.image = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImage()
|
|
||||||
{
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setOrderBy(Long orderBy)
|
|
||||||
{
|
|
||||||
this.orderBy = orderBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getOrderBy()
|
|
||||||
{
|
|
||||||
return orderBy;
|
|
||||||
}
|
|
||||||
public void setRevision(Long revision)
|
|
||||||
{
|
|
||||||
this.revision = revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRevision()
|
|
||||||
{
|
|
||||||
return revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("image", getImage())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("orderBy", getOrderBy())
|
|
||||||
.append("parentId", getParentId())
|
|
||||||
.append("revision", getRevision())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,185 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.model;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 商品详情 - 基本信息
|
|
||||||
* @Date 2022-10-18 下午 01:57
|
|
||||||
*/
|
|
||||||
public class ProductModel extends BaseEntity {
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 商品名称 */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 商品描述 */
|
|
||||||
private String productDesc;
|
|
||||||
|
|
||||||
/** 商品类型 */
|
|
||||||
private String type;
|
|
||||||
private String typeName;
|
|
||||||
|
|
||||||
/** 冗余字段 */
|
|
||||||
private String typeIds;
|
|
||||||
|
|
||||||
/** 商品主图 */
|
|
||||||
private String img;
|
|
||||||
|
|
||||||
/** 商品轮播图 */
|
|
||||||
private String carouselImages;
|
|
||||||
|
|
||||||
/** 商品评论数 */
|
|
||||||
private Long commentCount;
|
|
||||||
|
|
||||||
/** 商品收藏人气 */
|
|
||||||
private Long collectCount;
|
|
||||||
|
|
||||||
/** 品牌信息 */
|
|
||||||
private String brand;
|
|
||||||
private String brandName;
|
|
||||||
|
|
||||||
/** 商品状态 */
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 单位 */
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/** 搜索关键字 */
|
|
||||||
private String keywords;
|
|
||||||
|
|
||||||
/** 规格信息 */
|
|
||||||
private Long ruleId;
|
|
||||||
|
|
||||||
public Long getId () {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId (Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName () {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName (String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDesc () {
|
|
||||||
return productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductDesc (String productDesc) {
|
|
||||||
this.productDesc = productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType () {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType (String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeName () {
|
|
||||||
return typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeName (String typeName) {
|
|
||||||
this.typeName = typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeIds () {
|
|
||||||
return typeIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeIds (String typeIds) {
|
|
||||||
this.typeIds = typeIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImg () {
|
|
||||||
return img;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImg (String img) {
|
|
||||||
this.img = img;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCarouselImages () {
|
|
||||||
return carouselImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCarouselImages (String carouselImages) {
|
|
||||||
this.carouselImages = carouselImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCommentCount () {
|
|
||||||
return commentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCommentCount (Long commentCount) {
|
|
||||||
this.commentCount = commentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCollectCount () {
|
|
||||||
return collectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCollectCount (Long collectCount) {
|
|
||||||
this.collectCount = collectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrand () {
|
|
||||||
return brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrand (String brand) {
|
|
||||||
this.brand = brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrandName () {
|
|
||||||
return brandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrandName (String brandName) {
|
|
||||||
this.brandName = brandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus () {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus (String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnit () {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit (String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeywords () {
|
|
||||||
return keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeywords (String keywords) {
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRuleId () {
|
|
||||||
return ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleId (Long ruleId) {
|
|
||||||
this.ruleId = ruleId;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.model;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 规格类型详情模型
|
|
||||||
* @Date 2022-9-17 上午 09:28
|
|
||||||
*/
|
|
||||||
public class RuleAttrModel {
|
|
||||||
|
|
||||||
private String ruleType;
|
|
||||||
|
|
||||||
private List<String> ruleAttrList;
|
|
||||||
|
|
||||||
private String ruleAttrStr;
|
|
||||||
|
|
||||||
public String getRuleType () {
|
|
||||||
return ruleType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleType (String ruleType) {
|
|
||||||
this.ruleType = ruleType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getRuleAttrList () {
|
|
||||||
return ruleAttrList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleAttrList (List<String> ruleAttrList) {
|
|
||||||
this.ruleAttrList = ruleAttrList;
|
|
||||||
if (this.ruleAttrList != null){
|
|
||||||
this.ruleAttrStr = this.ruleAttrList.stream().collect(Collectors.joining(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRuleAttrStr () {
|
|
||||||
return ruleAttrStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.model;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 规格模型
|
|
||||||
* @Date 2022-9-17 上午 09:33
|
|
||||||
*/
|
|
||||||
public class RuleModel {
|
|
||||||
|
|
||||||
private Long ruleId;
|
|
||||||
|
|
||||||
private List<RuleAttrModel> ruleList;
|
|
||||||
|
|
||||||
public Long getRuleId () {
|
|
||||||
return ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleId (Long ruleId) {
|
|
||||||
this.ruleId = ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RuleAttrModel> getRuleList () {
|
|
||||||
return ruleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleList (List<RuleAttrModel> ruleList) {
|
|
||||||
this.ruleList = ruleList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.model;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 批量添加sku
|
|
||||||
* @Date 2022-9-24 上午 10:23
|
|
||||||
*/
|
|
||||||
public class SkuModel {
|
|
||||||
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
private List<MallProductSkuInfo> skuInfoList;
|
|
||||||
|
|
||||||
private SkuModel () {
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkuModel (Long productId, List<MallProductSkuInfo> skuInfoList) {
|
|
||||||
this.productId = productId;
|
|
||||||
this.skuInfoList = skuInfoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SkuModel builderSkuModel(Long productId, List<MallProductSkuInfo> skuInfoList){
|
|
||||||
if (productId == null){
|
|
||||||
throw new ServiceException("商品ID不可为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SkuModel(productId, skuInfoList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getProductId () {
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductId (Long productId) {
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
|
||||||
return skuInfoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
|
||||||
this.skuInfoList = skuInfoList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.reponse;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.ProductModel;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 商品详情
|
|
||||||
* @Date 2022-10-18 下午 02:00
|
|
||||||
*/
|
|
||||||
public class ProductDetailsResponse {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品基本信息
|
|
||||||
*/
|
|
||||||
private ProductModel product;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品的sku信息
|
|
||||||
*/
|
|
||||||
private List<MallProductSkuInfo> skuList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格信息
|
|
||||||
*/
|
|
||||||
private MallProductRuleInfo productRule;
|
|
||||||
|
|
||||||
public ProductModel getProduct () {
|
|
||||||
return product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProduct (ProductModel product) {
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MallProductSkuInfo> getSkuList () {
|
|
||||||
return skuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkuList (List<MallProductSkuInfo> skuList) {
|
|
||||||
this.skuList = skuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MallProductRuleInfo getProductRule () {
|
|
||||||
return productRule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductRule (MallProductRuleInfo productRule) {
|
|
||||||
this.productRule = productRule;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.reponse;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description:
|
|
||||||
* @Date 2022-9-24 上午 11:27
|
|
||||||
*/
|
|
||||||
public class ProductInfoResponse extends MallProductInfo {
|
|
||||||
|
|
||||||
private List<MallProductSkuInfo> skuInfoList;
|
|
||||||
|
|
||||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
|
||||||
return skuInfoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
|
||||||
this.skuInfoList = skuInfoList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.request;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 商品信息入参
|
|
||||||
* @Date 2022-9-24 上午 10:34
|
|
||||||
*/
|
|
||||||
public class ProductInfoRequest extends MallProductInfo {
|
|
||||||
|
|
||||||
@ApiParam("sku集合")
|
|
||||||
private List<MallProductSkuInfo> skuInfoList;
|
|
||||||
|
|
||||||
public List<MallProductSkuInfo> getSkuInfoList () {
|
|
||||||
return skuInfoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkuInfoList (List<MallProductSkuInfo> skuInfoList) {
|
|
||||||
this.skuInfoList = skuInfoList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.ruoyi.mall.product.domain.request;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleAttrModel;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 规格请求对象
|
|
||||||
* @Date 2022-9-17 上午 09:29
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class RuleRequest extends MallProductRuleInfo {
|
|
||||||
|
|
||||||
private List<RuleAttrModel> ruleList;
|
|
||||||
|
|
||||||
public List<RuleAttrModel> getRuleList () {
|
|
||||||
return ruleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleList (List<RuleAttrModel> ruleList) {
|
|
||||||
this.ruleList = ruleList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,8 +9,6 @@ import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品模块
|
* 商品模块
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductBrandInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductBrandInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品品牌Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-15
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/brand")
|
|
||||||
public class MallProductBrandInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductBrandInfoService mallProductBrandInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品品牌列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductBrandInfo> list = mallProductBrandInfoService.selectMallProductBrandInfoList(mallProductBrandInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品品牌列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:export")
|
|
||||||
@Log(title = "商品品牌", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
List<MallProductBrandInfo> list = mallProductBrandInfoService.selectMallProductBrandInfoList(mallProductBrandInfo);
|
|
||||||
ExcelUtil<MallProductBrandInfo> util = new ExcelUtil<MallProductBrandInfo>(MallProductBrandInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品品牌数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品品牌详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductBrandInfoService.selectMallProductBrandInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品品牌
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:add")
|
|
||||||
@Log(title = "商品品牌", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductBrandInfoService.insertMallProductBrandInfo(mallProductBrandInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品品牌
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:edit")
|
|
||||||
@Log(title = "商品品牌", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductBrandInfoService.updateMallProductBrandInfo(mallProductBrandInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品品牌
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:brand:remove")
|
|
||||||
@Log(title = "商品品牌", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductBrandInfoService.deleteMallProductBrandInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,156 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductDetailsResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.request.ProductInfoRequest;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品信息Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/info")
|
|
||||||
@Api(tags = "商品维护 - API")
|
|
||||||
public class MallProductInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductInfoService mallProductInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品信息列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:list")
|
|
||||||
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
|
|
||||||
public TableDataInfo list(MallProductInfo mallProductInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/syncList")
|
|
||||||
public TableDataInfo syncList(@RequestBody MallProductInfo mallProductInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询商品信息总条数
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:list")
|
|
||||||
@PostMapping("/count")
|
|
||||||
public R<Long> count(@RequestBody MallProductInfo mallProductInfo)
|
|
||||||
{
|
|
||||||
return R.ok(mallProductInfoService.selectMallProductInfoCount(mallProductInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品信息列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:export")
|
|
||||||
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductInfo mallProductInfo)
|
|
||||||
{
|
|
||||||
List<MallProductInfo> list = mallProductInfoService.selectMallProductInfoList(mallProductInfo);
|
|
||||||
ExcelUtil<MallProductInfo> util = new ExcelUtil<MallProductInfo>(MallProductInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品信息数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品信息详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductInfoService.selectMallProductInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上架/下架商品
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/upload/{id}")
|
|
||||||
@ApiOperation("上架商品")
|
|
||||||
public R uploadInfo(@PathVariable("id") String id)
|
|
||||||
{
|
|
||||||
mallProductInfoService.uploadInfo(id);
|
|
||||||
return R.ok();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "/result/{id}")
|
|
||||||
public R<ProductInfoResponse> getResultInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return R.ok(mallProductInfoService.selectMallProductInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品详情
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/details/{id}")
|
|
||||||
public R<ProductDetailsResponse> getProductResponse(@PathVariable("id") Long id){
|
|
||||||
return R.ok(mallProductInfoService.selectProductDetailsById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:add")
|
|
||||||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
@ApiOperation("商品添加")
|
|
||||||
public AjaxResult add(@RequestBody @ApiParam("商品请求实体类") ProductInfoRequest productInfoRequest)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductInfoService.insertMallProductInfo(productInfoRequest));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:edit")
|
|
||||||
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody ProductInfoRequest productInfoRequest)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductInfoService.updateMallProductInfo(productInfoRequest));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:info:remove")
|
|
||||||
@Log(title = "商品信息", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductInfoService.deleteMallProductInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductReviewInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductReviewInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品评价Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-26
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/review")
|
|
||||||
public class MallProductReviewInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductReviewInfoService mallProductReviewInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品评价列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductReviewInfo> list = mallProductReviewInfoService.selectMallProductReviewInfoList(mallProductReviewInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品评价列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:export")
|
|
||||||
@Log(title = "商品评价", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
List<MallProductReviewInfo> list = mallProductReviewInfoService.selectMallProductReviewInfoList(mallProductReviewInfo);
|
|
||||||
ExcelUtil<MallProductReviewInfo> util = new ExcelUtil<MallProductReviewInfo>(MallProductReviewInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品评价数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品评价详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductReviewInfoService.selectMallProductReviewInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品评价
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:add")
|
|
||||||
@Log(title = "商品评价", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductReviewInfoService.insertMallProductReviewInfo(mallProductReviewInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品评价
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:edit")
|
|
||||||
@Log(title = "商品评价", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductReviewInfoService.updateMallProductReviewInfo(mallProductReviewInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品评价
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:review:remove")
|
|
||||||
@Log(title = "商品评价", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductReviewInfoService.deleteMallProductReviewInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleAttrInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleAttrInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格详情Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/attr")
|
|
||||||
public class MallProductRuleAttrInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductRuleAttrInfoService mallProductRuleAttrInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductRuleAttrInfo> list = mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品规格详情列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:export")
|
|
||||||
@Log(title = "商品规格详情", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
List<MallProductRuleAttrInfo> list = mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
|
||||||
ExcelUtil<MallProductRuleAttrInfo> util = new ExcelUtil<MallProductRuleAttrInfo>(MallProductRuleAttrInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品规格详情数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品规格详情详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductRuleAttrInfoService.selectMallProductRuleAttrInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格详情
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:add")
|
|
||||||
@Log(title = "商品规格详情", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleAttrInfoService.insertMallProductRuleAttrInfo(mallProductRuleAttrInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格详情
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:edit")
|
|
||||||
@Log(title = "商品规格详情", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleAttrInfoService.updateMallProductRuleAttrInfo(mallProductRuleAttrInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:attr:remove")
|
|
||||||
@Log(title = "商品规格详情", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleAttrInfoService.deleteMallProductRuleAttrInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,115 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.mall.product.domain.request.RuleRequest;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/rule")
|
|
||||||
public class MallProductRuleInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductRuleInfoService mallProductRuleInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(MallProductRuleInfo mallProductRuleInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(mallProductRuleInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
@RequiresPermissions("product:rule:list")
|
|
||||||
@GetMapping("/all")
|
|
||||||
public R all()
|
|
||||||
{
|
|
||||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(new MallProductRuleInfo());
|
|
||||||
return R.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品规格列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:export")
|
|
||||||
@Log(title = "商品规格", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductRuleInfo mallProductRuleInfo)
|
|
||||||
{
|
|
||||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(mallProductRuleInfo);
|
|
||||||
ExcelUtil<MallProductRuleInfo> util = new ExcelUtil<MallProductRuleInfo>(MallProductRuleInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品规格数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品规格详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductRuleInfoService.selectMallProductRuleInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:add")
|
|
||||||
@Log(title = "商品规格", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody RuleRequest ruleRequest)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleInfoService.insertMallProductRuleInfo(ruleRequest));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:edit")
|
|
||||||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody RuleRequest ruleRequest)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleInfoService.updateMallProductRuleInfo(ruleRequest));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:rule:remove")
|
|
||||||
@Log(title = "商品规格", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductRuleInfoService.deleteMallProductRuleInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductSkuInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品SKUController
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/sku")
|
|
||||||
public class MallProductSkuInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductSkuInfoService mallProductSkuInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品SKU列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<MallProductSkuInfo> list = mallProductSkuInfoService.selectMallProductSkuInfoList(mallProductSkuInfo);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品SKU列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:export")
|
|
||||||
@Log(title = "商品SKU", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
List<MallProductSkuInfo> list = mallProductSkuInfoService.selectMallProductSkuInfoList(mallProductSkuInfo);
|
|
||||||
ExcelUtil<MallProductSkuInfo> util = new ExcelUtil<MallProductSkuInfo>(MallProductSkuInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品SKU数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品SKU详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductSkuInfoService.selectMallProductSkuInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品SKU
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:add")
|
|
||||||
@Log(title = "商品SKU", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductSkuInfoService.insertMallProductSkuInfo(mallProductSkuInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品SKU
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:edit")
|
|
||||||
@Log(title = "商品SKU", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductSkuInfoService.updateMallProductSkuInfo(mallProductSkuInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品SKU
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:sku:remove")
|
|
||||||
@Log(title = "商品SKU", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductSkuInfoService.deleteMallProductSkuInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,114 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductTypeInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductTypeInfoService;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型Controller
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/type")
|
|
||||||
public class MallProductTypeInfoController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IMallProductTypeInfoService mallProductTypeInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品类型列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public AjaxResult list(MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
|
||||||
return AjaxResult.success(list);
|
|
||||||
}
|
|
||||||
@RequiresPermissions("product:type:list")
|
|
||||||
@GetMapping("/tree")
|
|
||||||
public AjaxResult tree()
|
|
||||||
{
|
|
||||||
MallProductTypeInfo mallProductTypeInfo = new MallProductTypeInfo();
|
|
||||||
mallProductTypeInfo.setParentId(0L);
|
|
||||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
|
||||||
return AjaxResult.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出商品类型列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:export")
|
|
||||||
@Log(title = "商品类型", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
List<MallProductTypeInfo> list = mallProductTypeInfoService.selectMallProductTypeInfoList(mallProductTypeInfo);
|
|
||||||
ExcelUtil<MallProductTypeInfo> util = new ExcelUtil<MallProductTypeInfo>(MallProductTypeInfo.class);
|
|
||||||
util.exportExcel(response, list, "商品类型数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取商品类型详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(mallProductTypeInfoService.selectMallProductTypeInfoById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品类型
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:add")
|
|
||||||
@Log(title = "商品类型", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductTypeInfoService.insertMallProductTypeInfo(mallProductTypeInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品类型
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:edit")
|
|
||||||
@Log(title = "商品类型", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductTypeInfoService.updateMallProductTypeInfo(mallProductTypeInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品类型
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("product:type:remove")
|
|
||||||
@Log(title = "商品类型", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(mallProductTypeInfoService.deleteMallProductTypeInfoByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package com.ruoyi.mall.product.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.rabbit.domain.Message;
|
|
||||||
import com.ruoyi.common.rabbit.enums.QueueEnum;
|
|
||||||
import com.ruoyi.mall.product.cache.ProductInfoCache;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductDetailsResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductInfoService;
|
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description:
|
|
||||||
* @Date 2022-10-19 下午 02:46
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProductInfoCache productInfoCache;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RabbitTemplate rabbitTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMallProductInfoService productInfoService;
|
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public R get(@PathVariable Long id){
|
|
||||||
ProductDetailsResponse productDetailsResponse = productInfoCache.get(id);
|
|
||||||
return R.ok(productDetailsResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/refreshData/{id}")
|
|
||||||
private R refreshData(@PathVariable Long id){
|
|
||||||
return R.ok(productInfoCache.refreshData(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/sendMsg/{msg}")
|
|
||||||
public R sendMsg(@PathVariable("msg") String msg){
|
|
||||||
|
|
||||||
|
|
||||||
// ProductInfoResponse productInfoResponse = productInfoService.selectMallProductInfoById(10L);
|
|
||||||
rabbitTemplate.convertAndSend(QueueEnum.PRODUCT_ADD.queueName(),
|
|
||||||
Message.builderMsg(11L));
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductBrandInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品品牌Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-15
|
|
||||||
*/
|
|
||||||
public interface MallProductBrandInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品品牌
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 商品品牌
|
|
||||||
*/
|
|
||||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品品牌列表
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 商品品牌集合
|
|
||||||
*/
|
|
||||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品品牌
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductBrandInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品品牌
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductBrandInfoByIds(Long[] ids);
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.ProductModel;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品信息Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public interface MallProductInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 商品信息
|
|
||||||
*/
|
|
||||||
public MallProductInfo selectMallProductInfoById(@Param("id")Long id);
|
|
||||||
|
|
||||||
public ProductModel selectProductModelById(@Param("id") Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品信息列表
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
|
||||||
* @return 商品信息集合
|
|
||||||
*/
|
|
||||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品信息
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductInfo(MallProductInfo mallProductInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品信息
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductInfo(MallProductInfo mallProductInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品总条数
|
|
||||||
* @param mallProductInfo 商品查询条件
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductReviewInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品评价Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-26
|
|
||||||
*/
|
|
||||||
public interface MallProductReviewInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品评价
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 商品评价
|
|
||||||
*/
|
|
||||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品评价列表
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 商品评价集合
|
|
||||||
*/
|
|
||||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品评价
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductReviewInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品评价
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleAttrInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleModel;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格详情Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface MallProductRuleAttrInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 商品规格详情
|
|
||||||
*/
|
|
||||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 商品规格详情集合
|
|
||||||
*/
|
|
||||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleAttrInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格详情
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量添加
|
|
||||||
* @param ruleModel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int bacthInsertRule (@Param("ruleModel") RuleModel ruleModel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除规格详情
|
|
||||||
* @param ids 规格Ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int deleteRuleAttrByRuleIds (Long[] ids);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface MallProductRuleInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品规格
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 商品规格
|
|
||||||
*/
|
|
||||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleInfo 商品规格
|
|
||||||
* @return 商品规格集合
|
|
||||||
*/
|
|
||||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格
|
|
||||||
*
|
|
||||||
* @param mallProductRuleInfo 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格
|
|
||||||
*
|
|
||||||
* @param mallProductRuleInfo 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.SkuModel;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品SKUMapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
public interface MallProductSkuInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品SKU
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 商品SKU
|
|
||||||
*/
|
|
||||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品SKU列表
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 商品SKU集合
|
|
||||||
*/
|
|
||||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品SKU
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductSkuInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品SKU
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductSkuInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量添加
|
|
||||||
* @param skuModel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int batchInsertProductSku (SkuModel skuModel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品下的SKU
|
|
||||||
* @param productId
|
|
||||||
*/
|
|
||||||
void deleteMallProductSkuInfoByProductId (@Param("productId") Long productId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过商品信息的ids进行删除
|
|
||||||
* @param ids
|
|
||||||
*/
|
|
||||||
void deleteMallProductSkuInfoByProductIds (Long[] ids);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductTypeInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型Mapper接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface MallProductTypeInfoMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品类型
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 商品类型
|
|
||||||
*/
|
|
||||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品类型列表
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 商品类型集合
|
|
||||||
*/
|
|
||||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品类型
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductTypeInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductTypeInfoByIds(Long[] ids);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductBrandInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品品牌Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-15
|
|
||||||
*/
|
|
||||||
public interface IMallProductBrandInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品品牌
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 商品品牌
|
|
||||||
*/
|
|
||||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品品牌列表
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 商品品牌集合
|
|
||||||
*/
|
|
||||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品品牌
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品品牌主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductBrandInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品品牌信息
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductBrandInfoById(Long id);
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductDetailsResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.request.ProductInfoRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品信息Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
public interface IMallProductInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 商品信息
|
|
||||||
*/
|
|
||||||
public ProductInfoResponse selectMallProductInfoById(Long id);
|
|
||||||
public ProductDetailsResponse selectProductDetailsById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品信息列表
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
|
||||||
* @return 商品信息集合
|
|
||||||
*/
|
|
||||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品信息
|
|
||||||
*
|
|
||||||
* @param productInfoRequest 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductInfo(ProductInfoRequest productInfoRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品信息
|
|
||||||
*
|
|
||||||
* @param productInfoRequest 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductInfo(ProductInfoRequest productInfoRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品信息主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品信息信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品总条数
|
|
||||||
* @param mallProductInfo 商品查询
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
|
||||||
|
|
||||||
void uploadInfo(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载商品数据到ES中
|
|
||||||
*/
|
|
||||||
void loadingProductInfoToEs();
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductReviewInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品评价Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-26
|
|
||||||
*/
|
|
||||||
public interface IMallProductReviewInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品评价
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 商品评价
|
|
||||||
*/
|
|
||||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品评价列表
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 商品评价集合
|
|
||||||
*/
|
|
||||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品评价
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品评价主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品评价信息
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductReviewInfoById(Long id);
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleAttrInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleAttrModel;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格详情Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface IMallProductRuleAttrInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 商品规格详情
|
|
||||||
*/
|
|
||||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 商品规格详情集合
|
|
||||||
*/
|
|
||||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格详情
|
|
||||||
*
|
|
||||||
* @param ruleModel 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertRuleModel(RuleModel ruleModel);
|
|
||||||
default int insertRuleModel (Long id, List<RuleAttrModel> ruleList){
|
|
||||||
return this.insertRuleModel(new RuleModel(){{
|
|
||||||
setRuleId(id);
|
|
||||||
setRuleList(ruleList);
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格详情
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品规格详情主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情信息
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleAttrInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情信息
|
|
||||||
* @param ids 规格Ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int deleteRuleAttrByRuleIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情
|
|
||||||
* @param id 规格ID
|
|
||||||
*/
|
|
||||||
default int deleteRuleAttrByRuleId (Long id){
|
|
||||||
return this.deleteRuleAttrByRuleIds(new Long[]{id});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.request.RuleRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface IMallProductRuleInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品规格
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 商品规格
|
|
||||||
*/
|
|
||||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleInfo 商品规格
|
|
||||||
* @return 商品规格集合
|
|
||||||
*/
|
|
||||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格
|
|
||||||
*
|
|
||||||
* @param ruleRequest 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductRuleInfo(RuleRequest ruleRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格
|
|
||||||
*
|
|
||||||
* @param ruleRequest 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductRuleInfo(RuleRequest ruleRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品规格主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格信息
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductRuleInfoById(Long id);
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.SkuModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品SKUService接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
public interface IMallProductSkuInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品SKU
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 商品SKU
|
|
||||||
*/
|
|
||||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品SKU列表
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 商品SKU集合
|
|
||||||
*/
|
|
||||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
/**
|
|
||||||
* 通过商品Id查询商品SKU列表
|
|
||||||
*
|
|
||||||
* @param productId 商品Id
|
|
||||||
* @return 商品SKU集合
|
|
||||||
*/
|
|
||||||
public default List<MallProductSkuInfo> selectMallProductSkuInfoList(Long productId){
|
|
||||||
return this.selectMallProductSkuInfoList(new MallProductSkuInfo(){{
|
|
||||||
setProductId(productId);
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
public int batchInsertProductSku(SkuModel skuModel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品SKU
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品SKU主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductSkuInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品SKU信息
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductSkuInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品的sku
|
|
||||||
* @param productId
|
|
||||||
*/
|
|
||||||
void deleteMallProductSkuInfoByProductId (Long productId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过商品信息的Ids进行删除
|
|
||||||
* @param ids
|
|
||||||
*/
|
|
||||||
void deleteMallProductSkuInfoByProductIds (Long[] ids);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductTypeInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型Service接口
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
public interface IMallProductTypeInfoService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询商品类型
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 商品类型
|
|
||||||
*/
|
|
||||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品类型列表
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 商品类型集合
|
|
||||||
*/
|
|
||||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品类型主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductTypeInfoByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品类型信息
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteMallProductTypeInfoById(Long id);
|
|
||||||
}
|
|
|
@ -1,98 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductBrandInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductBrandInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductBrandInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品品牌Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-15
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductBrandInfoServiceImpl implements IMallProductBrandInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductBrandInfoMapper mallProductBrandInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品品牌
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 商品品牌
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductBrandInfo selectMallProductBrandInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductBrandInfoMapper.selectMallProductBrandInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品品牌列表
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 商品品牌
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductBrandInfo> selectMallProductBrandInfoList(MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
return mallProductBrandInfoMapper.selectMallProductBrandInfoList(mallProductBrandInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
mallProductBrandInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductBrandInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductBrandInfoMapper.insertMallProductBrandInfo(mallProductBrandInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品品牌
|
|
||||||
*
|
|
||||||
* @param mallProductBrandInfo 商品品牌
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductBrandInfo(MallProductBrandInfo mallProductBrandInfo)
|
|
||||||
{
|
|
||||||
mallProductBrandInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductBrandInfoMapper.updateMallProductBrandInfo(mallProductBrandInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品品牌
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品品牌主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductBrandInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return mallProductBrandInfoMapper.deleteMallProductBrandInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品品牌信息
|
|
||||||
*
|
|
||||||
* @param id 商品品牌主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductBrandInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductBrandInfoMapper.deleteMallProductBrandInfoById(id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,352 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.ruoyi.common.core.constant.EsConstant;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.bean.BeanUtils;
|
|
||||||
import com.ruoyi.common.rabbit.domain.Message;
|
|
||||||
import com.ruoyi.common.rabbit.enums.QueueEnum;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.mall.product.cache.ProductInfoCache;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.model.ProductModel;
|
|
||||||
import com.ruoyi.mall.product.domain.model.SkuModel;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductDetailsResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.product.domain.request.ProductInfoRequest;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleInfoService;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductSkuInfoService;
|
|
||||||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
|
||||||
import com.ruoyi.system.remote.api.RemoteEsDocService;
|
|
||||||
import com.ruoyi.system.remote.api.RemoteEsIndexService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductInfoService;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品信息Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class MallProductInfoServiceImpl implements IMallProductInfoService {
|
|
||||||
@Autowired
|
|
||||||
private MallProductInfoMapper mallProductInfoMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMallProductSkuInfoService skuInfoService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMallProductRuleInfoService ruleInfoService;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProductInfoCache productInfoCache;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RabbitTemplate rabbitTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteEsDocService remoteEsDocService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteEsIndexService remoteEsIndexService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目启动时,把商品数据初始化到ES中
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
loadingProductInfoToEs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 商品信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ProductInfoResponse selectMallProductInfoById(Long id) {
|
|
||||||
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(id);
|
|
||||||
ProductInfoResponse productInfoResponse = new ProductInfoResponse();
|
|
||||||
BeanUtils.copyBeanProp(productInfoResponse, mallProductInfo);
|
|
||||||
productInfoResponse.setSkuInfoList(
|
|
||||||
skuInfoService.selectMallProductSkuInfoList(new MallProductSkuInfo() {{
|
|
||||||
setProductId(id);
|
|
||||||
}})
|
|
||||||
);
|
|
||||||
return productInfoResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ProductDetailsResponse selectProductDetailsById(Long productId) {
|
|
||||||
if (productId == null || productId == 0) {
|
|
||||||
throw new ServiceException("查询商品信息,依据不合法!");
|
|
||||||
}
|
|
||||||
ProductDetailsResponse productDetailsResponse = new ProductDetailsResponse();
|
|
||||||
ProductModel productModel = mallProductInfoMapper.selectProductModelById(productId);
|
|
||||||
if (productModel == null) {
|
|
||||||
throw new ServiceException("查询商品信息,商品数据为空");
|
|
||||||
}
|
|
||||||
productDetailsResponse.setProduct(productModel);
|
|
||||||
List<MallProductSkuInfo> mallProductSkuInfos = skuInfoService.selectMallProductSkuInfoList(productId);
|
|
||||||
if (mallProductSkuInfos == null || mallProductSkuInfos.size() == 0) {
|
|
||||||
throw new ServiceException("查询商品信息,SKU数据为空");
|
|
||||||
}
|
|
||||||
productDetailsResponse.setSkuList(mallProductSkuInfos);
|
|
||||||
MallProductRuleInfo ruleInfo = ruleInfoService.selectMallProductRuleInfoById(productModel.getRuleId());
|
|
||||||
if (ruleInfo == null) {
|
|
||||||
throw new ServiceException("查询商品信息,规格数据为空");
|
|
||||||
}
|
|
||||||
productDetailsResponse.setProductRule(ruleInfo);
|
|
||||||
return productDetailsResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品信息列表
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
|
||||||
* @return 商品信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductInfo> selectMallProductInfoList(MallProductInfo mallProductInfo) {
|
|
||||||
return mallProductInfoMapper.selectMallProductInfoList(mallProductInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品信息
|
|
||||||
*
|
|
||||||
* @param productInfoRequest 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public int insertMallProductInfo(ProductInfoRequest productInfoRequest) {
|
|
||||||
productInfoRequest.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
productInfoRequest.setCreateTime(DateUtils.getNowDate());
|
|
||||||
int i = mallProductInfoMapper.insertMallProductInfo(productInfoRequest);
|
|
||||||
if (i == 0) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
skuInfoService.batchInsertProductSku(
|
|
||||||
SkuModel.builderSkuModel(productInfoRequest.getId(), productInfoRequest.getSkuInfoList())
|
|
||||||
);
|
|
||||||
|
|
||||||
// 给搜索系统发送消息需要进行搜索更新
|
|
||||||
try {
|
|
||||||
rabbitTemplate.convertAndSend(QueueEnum.PRODUCT_ADD.queueName(),
|
|
||||||
Message.builderMsg(productInfoRequest.getId()));
|
|
||||||
} catch (ServiceException serviceException) {
|
|
||||||
throw new ServiceException("给搜索系统发送消息需要进行搜索更新失败!");
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品信息
|
|
||||||
*
|
|
||||||
* @param productInfoRequest 商品信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public int updateMallProductInfo(ProductInfoRequest productInfoRequest) {
|
|
||||||
productInfoRequest.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
productInfoRequest.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
int i = mallProductInfoMapper.updateMallProductInfo(productInfoRequest);
|
|
||||||
if (i == 0) {
|
|
||||||
//将商品信息推送至MQ,异步更新ES
|
|
||||||
try {
|
|
||||||
rabbitTemplate.convertAndSend(QueueEnum.PRODUCT_ADD.queueName(),
|
|
||||||
Message.builderMsg(productInfoRequest.getId()));
|
|
||||||
} catch (ServiceException serviceException) {
|
|
||||||
throw new ServiceException("给搜索系统发送消息需要进行搜索更新失败!");
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
skuInfoService.deleteMallProductSkuInfoByProductId(productInfoRequest.getId());
|
|
||||||
skuInfoService.batchInsertProductSku(
|
|
||||||
SkuModel.builderSkuModel(productInfoRequest.getId(), productInfoRequest.getSkuInfoList())
|
|
||||||
);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductInfoByIds(Long[] ids) {
|
|
||||||
skuInfoService.deleteMallProductSkuInfoByProductIds(ids);
|
|
||||||
for (Long id : ids) {
|
|
||||||
// 延迟执行
|
|
||||||
productInfoCache.delayRemove(id);
|
|
||||||
}
|
|
||||||
return mallProductInfoMapper.deleteMallProductInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品信息信息
|
|
||||||
*
|
|
||||||
* @param id 商品信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductInfoById(Long id) {
|
|
||||||
return mallProductInfoMapper.deleteMallProductInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品总条数
|
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品查询
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Long selectMallProductInfoCount(MallProductInfo mallProductInfo) {
|
|
||||||
return mallProductInfoMapper.selectMallProductInfoCount(mallProductInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品上下架
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void uploadInfo(String id) {
|
|
||||||
// 查询商品的spu信息
|
|
||||||
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(Long.valueOf(id));
|
|
||||||
|
|
||||||
// 校验商品信息是否存在
|
|
||||||
if (mallProductInfo == null) {
|
|
||||||
throw new ServiceException("该商品信息不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询商品的sku信息
|
|
||||||
List<MallProductSkuInfo> mallProductSkuInfos = skuInfoService.selectMallProductSkuInfoList(Long.valueOf(id));
|
|
||||||
|
|
||||||
// 校验sku信息是否为空
|
|
||||||
if (CollectionUtils.isEmpty(mallProductSkuInfos)) {
|
|
||||||
throw new ServiceException("该商品下sku信息不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 切换商品的上下架状态并且在es中删除下架的商品
|
|
||||||
String newStatus = mallProductInfo.getStatus().equals("1") ? "0" : "1";
|
|
||||||
mallProductInfo.setStatus(newStatus);
|
|
||||||
|
|
||||||
//判断该商品是上架状态还是下架状态
|
|
||||||
if (newStatus.equals("1")){
|
|
||||||
//修改该商品状态为上架 并且添加至es
|
|
||||||
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
|
|
||||||
// 检查商品索引是否存在
|
|
||||||
R<Boolean> indexExit = remoteEsIndexService.indexExit(EsConstant.INDEX_NAME);
|
|
||||||
if (!indexExit.getData()) {
|
|
||||||
throw new ServiceException("该商品索引不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
//构建es所需要的数据结构
|
|
||||||
List<EsDocInsertVo> esDocInsertVos = builderProductInfo2Es(mallProductInfo,mallProductSkuInfos);
|
|
||||||
//批量插入
|
|
||||||
remoteEsDocService.batchInsertDocs(esDocInsertVos);
|
|
||||||
}else {
|
|
||||||
//修改该商品状态为下架 并且删除es数据
|
|
||||||
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
|
|
||||||
// 检查商品索引是否存在
|
|
||||||
R<Boolean> indexExit = remoteEsIndexService.indexExit(EsConstant.INDEX_NAME);
|
|
||||||
if (!indexExit.getData()) {
|
|
||||||
throw new ServiceException("该商品索引不存在");
|
|
||||||
}
|
|
||||||
//根据商品spuId查询出skuId 进行es删
|
|
||||||
List<MallProductSkuInfo> skuInfoList = selectMallProductInfoById(Long.valueOf(mallProductInfo.getId())).getSkuInfoList();
|
|
||||||
skuInfoList.stream().forEach(skuInfo->{
|
|
||||||
Long docsId = skuInfo.getId();
|
|
||||||
remoteEsDocService.deleteDocsById(String.valueOf(docsId));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void loadingProductInfoToEs() {
|
|
||||||
//查询所有商品信息
|
|
||||||
List<MallProductInfo> mallProductInfos = mallProductInfoMapper.selectMallProductInfoList(new MallProductInfo());
|
|
||||||
if (mallProductInfos == null || mallProductInfos.size() == 0) {
|
|
||||||
log.info("暂无需要同步的商品");
|
|
||||||
}
|
|
||||||
//调用ES查询索引是否存在
|
|
||||||
R<Boolean> indexExit = remoteEsIndexService.indexExit("mall_product");
|
|
||||||
if (!indexExit.getData()) {
|
|
||||||
log.info("mall_product索引不存在,调用ES服务创建索引");
|
|
||||||
//创建索引
|
|
||||||
R<Boolean> indexCreate = remoteEsIndexService.indexCreate("mall_product");
|
|
||||||
if (!indexCreate.getData()) {
|
|
||||||
log.info("创建mall_product索引失败");
|
|
||||||
}
|
|
||||||
//批量同步商品信息到ES
|
|
||||||
//构建参数
|
|
||||||
List<EsDocInsertVo> esDocInsertVo = builderProductInfoToEs(mallProductInfos);
|
|
||||||
//调用ES服务批量插入文档
|
|
||||||
R<Boolean> batchInsert = remoteEsDocService.batchInsertDocs(esDocInsertVo);
|
|
||||||
if (batchInsert.getData()) {
|
|
||||||
log.info("批量同步商品信息到ES成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<EsDocInsertVo> builderProductInfoToEs(List<MallProductInfo> mallProductInfos) {
|
|
||||||
List<EsDocInsertVo> esDocInsertVos = new ArrayList<>();
|
|
||||||
mallProductInfos.stream().forEach(mallProductInfo -> {
|
|
||||||
EsDocInsertVo esDocInsertVo = new EsDocInsertVo();
|
|
||||||
esDocInsertVo.setId(String.valueOf(mallProductInfo.getId()));
|
|
||||||
esDocInsertVo.setIndexName("mall_product");
|
|
||||||
//对象转为Map
|
|
||||||
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(mallProductInfo), Map.class);
|
|
||||||
esDocInsertVo.setData(data);
|
|
||||||
esDocInsertVos.add(esDocInsertVo);
|
|
||||||
});
|
|
||||||
return esDocInsertVos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<EsDocInsertVo> builderProductInfo2Es(MallProductInfo mallProductInfo, List<MallProductSkuInfo> mallProductSkuInfos) {
|
|
||||||
//构建返回结果集
|
|
||||||
ArrayList<EsDocInsertVo> esDocInsertVos = new ArrayList<>();
|
|
||||||
mallProductSkuInfos.forEach(mallProductSkuInfo -> {
|
|
||||||
EsDocInsertVo esDocInsertVo = new EsDocInsertVo();
|
|
||||||
esDocInsertVo.setId(String.valueOf(mallProductInfo.getId()));
|
|
||||||
esDocInsertVo.setIndexName(EsConstant.INDEX_NAME);
|
|
||||||
esDocInsertVo.setTypeName("_doc");
|
|
||||||
//对象转为Map
|
|
||||||
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(mallProductInfo), Map.class);
|
|
||||||
esDocInsertVo.setData(data);
|
|
||||||
//将对象添加进数组
|
|
||||||
esDocInsertVos.add(esDocInsertVo);
|
|
||||||
});
|
|
||||||
return esDocInsertVos;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,100 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductReviewInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductReviewInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductReviewInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品评价Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-26
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductReviewInfoServiceImpl implements IMallProductReviewInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductReviewInfoMapper mallProductReviewInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品评价
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 商品评价
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品评价列表
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 商品评价
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoList(mallProductReviewInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
mallProductReviewInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductReviewInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductReviewInfoMapper.insertMallProductReviewInfo(mallProductReviewInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品评价
|
|
||||||
*
|
|
||||||
* @param mallProductReviewInfo 商品评价
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
|
||||||
{
|
|
||||||
mallProductReviewInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductReviewInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductReviewInfoMapper.updateMallProductReviewInfo(mallProductReviewInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品评价
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品评价主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductReviewInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品评价信息
|
|
||||||
*
|
|
||||||
* @param id 商品评价主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductReviewInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoById(id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleAttrModel;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleModel;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductRuleAttrInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleAttrInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleAttrInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格详情Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductRuleAttrInfoServiceImpl implements IMallProductRuleAttrInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductRuleAttrInfoMapper mallProductRuleAttrInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 商品规格详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductRuleAttrInfo selectMallProductRuleAttrInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.selectMallProductRuleAttrInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格详情列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 商品规格详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductRuleAttrInfo> selectMallProductRuleAttrInfoList(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.selectMallProductRuleAttrInfoList(mallProductRuleAttrInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.insertMallProductRuleAttrInfo(mallProductRuleAttrInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertRuleModel (RuleModel ruleModel) {
|
|
||||||
|
|
||||||
return mallProductRuleAttrInfoMapper.bacthInsertRule(ruleModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格详情
|
|
||||||
*
|
|
||||||
* @param mallProductRuleAttrInfo 商品规格详情
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductRuleAttrInfo(MallProductRuleAttrInfo mallProductRuleAttrInfo)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.updateMallProductRuleAttrInfo(mallProductRuleAttrInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格详情
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品规格详情主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductRuleAttrInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.deleteMallProductRuleAttrInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情信息
|
|
||||||
*
|
|
||||||
* @param id 商品规格详情主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductRuleAttrInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductRuleAttrInfoMapper.deleteMallProductRuleAttrInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格详情
|
|
||||||
* @param ids 规格Ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteRuleAttrByRuleIds (Long[] ids) {
|
|
||||||
return mallProductRuleAttrInfoMapper.deleteRuleAttrByRuleIds(ids);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.mall.product.domain.model.RuleModel;
|
|
||||||
import com.ruoyi.mall.product.domain.request.RuleRequest;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleAttrInfoService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductRuleInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductRuleInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductRuleInfoService;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品规格Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductRuleInfoServiceImpl implements IMallProductRuleInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductRuleInfoMapper mallProductRuleInfoMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMallProductRuleAttrInfoService ruleAttrInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 商品规格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品规格列表
|
|
||||||
*
|
|
||||||
* @param mallProductRuleInfo 商品规格
|
|
||||||
* @return 商品规格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo)
|
|
||||||
{
|
|
||||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoList(mallProductRuleInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品规格
|
|
||||||
*
|
|
||||||
* @param ruleRequest 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public int insertMallProductRuleInfo(RuleRequest ruleRequest)
|
|
||||||
{
|
|
||||||
ruleRequest.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
ruleRequest.setCreateTime(DateUtils.getNowDate());
|
|
||||||
int i = mallProductRuleInfoMapper.insertMallProductRuleInfo(ruleRequest);
|
|
||||||
if (i == 0){
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
// 组装了一个Model 用来添加规格属性
|
|
||||||
RuleModel ruleModel = new RuleModel();
|
|
||||||
ruleModel.setRuleId(ruleRequest.getId());
|
|
||||||
ruleModel.setRuleList(ruleRequest.getRuleList());
|
|
||||||
ruleAttrInfoService.insertRuleModel(ruleModel);
|
|
||||||
return i;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品规格
|
|
||||||
*
|
|
||||||
* @param ruleRequest 商品规格
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductRuleInfo(RuleRequest ruleRequest)
|
|
||||||
{
|
|
||||||
ruleRequest.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
ruleRequest.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
int i = mallProductRuleInfoMapper.updateMallProductRuleInfo(ruleRequest);
|
|
||||||
if (i == 0){
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
ruleAttrInfoService.deleteRuleAttrByRuleId(ruleRequest.getId());
|
|
||||||
ruleAttrInfoService.insertRuleModel(ruleRequest.getId(), ruleRequest.getRuleList());
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品规格
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品规格主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public int deleteMallProductRuleInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
ruleAttrInfoService.deleteRuleAttrByRuleIds(ids);
|
|
||||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品规格信息
|
|
||||||
*
|
|
||||||
* @param id 商品规格主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductRuleInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoById(id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,120 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.uuid.IdUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.mall.product.domain.model.SkuModel;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductSkuInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductSkuInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品SKUService业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-19
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductSkuInfoServiceImpl implements IMallProductSkuInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductSkuInfoMapper mallProductSkuInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品SKU
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 商品SKU
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductSkuInfo selectMallProductSkuInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductSkuInfoMapper.selectMallProductSkuInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品SKU列表
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 商品SKU
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductSkuInfo> selectMallProductSkuInfoList(MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
return mallProductSkuInfoMapper.selectMallProductSkuInfoList(mallProductSkuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
mallProductSkuInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductSkuInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductSkuInfoMapper.insertMallProductSkuInfo(mallProductSkuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int batchInsertProductSku (SkuModel skuModel) {
|
|
||||||
skuModel.getSkuInfoList().forEach(skuInfo -> {
|
|
||||||
skuInfo.setNumber(IdUtils.fastSimpleUUID());
|
|
||||||
});
|
|
||||||
return mallProductSkuInfoMapper.batchInsertProductSku(skuModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品SKU
|
|
||||||
*
|
|
||||||
* @param mallProductSkuInfo 商品SKU
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductSkuInfo(MallProductSkuInfo mallProductSkuInfo)
|
|
||||||
{
|
|
||||||
mallProductSkuInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductSkuInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductSkuInfoMapper.updateMallProductSkuInfo(mallProductSkuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品SKU
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品SKU主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductSkuInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return mallProductSkuInfoMapper.deleteMallProductSkuInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品SKU信息
|
|
||||||
*
|
|
||||||
* @param id 商品SKU主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductSkuInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductSkuInfoMapper.deleteMallProductSkuInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteMallProductSkuInfoByProductId (Long productId) {
|
|
||||||
mallProductSkuInfoMapper.deleteMallProductSkuInfoByProductId(productId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteMallProductSkuInfoByProductIds (Long[] ids) {
|
|
||||||
mallProductSkuInfoMapper.deleteMallProductSkuInfoByProductIds(ids);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
package com.ruoyi.mall.product.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.mall.product.mapper.MallProductTypeInfoMapper;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductTypeInfo;
|
|
||||||
import com.ruoyi.mall.product.service.IMallProductTypeInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型Service业务层处理
|
|
||||||
*
|
|
||||||
* @author DongZeLiang
|
|
||||||
* @date 2022-09-16
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MallProductTypeInfoServiceImpl implements IMallProductTypeInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private MallProductTypeInfoMapper mallProductTypeInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品类型
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 商品类型
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MallProductTypeInfo selectMallProductTypeInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductTypeInfoMapper.selectMallProductTypeInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品类型列表
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 商品类型
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MallProductTypeInfo> selectMallProductTypeInfoList(MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
List<MallProductTypeInfo> mallProductTypeInfos = mallProductTypeInfoMapper.selectMallProductTypeInfoList(mallProductTypeInfo);
|
|
||||||
if (mallProductTypeInfos == null || mallProductTypeInfos.size() == 0){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (MallProductTypeInfo productTypeInfo : mallProductTypeInfos) {
|
|
||||||
MallProductTypeInfo mallProductTypeParam = new MallProductTypeInfo();
|
|
||||||
mallProductTypeParam.setParentId(productTypeInfo.getId());
|
|
||||||
productTypeInfo.setChildren(this.selectMallProductTypeInfoList(mallProductTypeParam));
|
|
||||||
}
|
|
||||||
return mallProductTypeInfos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
mallProductTypeInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductTypeInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductTypeInfoMapper.insertMallProductTypeInfo(mallProductTypeInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改商品类型
|
|
||||||
*
|
|
||||||
* @param mallProductTypeInfo 商品类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateMallProductTypeInfo(MallProductTypeInfo mallProductTypeInfo)
|
|
||||||
{
|
|
||||||
mallProductTypeInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
||||||
mallProductTypeInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return mallProductTypeInfoMapper.updateMallProductTypeInfo(mallProductTypeInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除商品类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的商品类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductTypeInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return mallProductTypeInfoMapper.deleteMallProductTypeInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品类型信息
|
|
||||||
*
|
|
||||||
* @param id 商品类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteMallProductTypeInfoById(Long id)
|
|
||||||
{
|
|
||||||
return mallProductTypeInfoMapper.deleteMallProductTypeInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,163 +0,0 @@
|
||||||
package com.ruoyi.mall.search.domain;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 搜索实体类
|
|
||||||
* @Date 2022-10-15 上午 09:32
|
|
||||||
*/
|
|
||||||
public class ProductSearch {
|
|
||||||
/** ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 商品名称 */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 商品描述 */
|
|
||||||
private String productDesc;
|
|
||||||
|
|
||||||
/** 商品类型 */
|
|
||||||
private String type;
|
|
||||||
private String typeName;
|
|
||||||
|
|
||||||
|
|
||||||
/** 商品主图 */
|
|
||||||
private String img;
|
|
||||||
|
|
||||||
/** 商品轮播图 */
|
|
||||||
private String carouselImages;
|
|
||||||
|
|
||||||
/** 商品评论数 */
|
|
||||||
private Long commentCount;
|
|
||||||
|
|
||||||
/** 商品收藏人气 */
|
|
||||||
private Long collectCount;
|
|
||||||
|
|
||||||
/** 品牌信息 */
|
|
||||||
private String brand;
|
|
||||||
private String brandName;
|
|
||||||
|
|
||||||
/** 商品状态 */
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 单位 */
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/** 搜索关键字 */
|
|
||||||
private String keywords;
|
|
||||||
|
|
||||||
|
|
||||||
public Long getId () {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId (Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName () {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName (String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDesc () {
|
|
||||||
return productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductDesc (String productDesc) {
|
|
||||||
this.productDesc = productDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType () {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType (String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeName () {
|
|
||||||
return typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeName (String typeName) {
|
|
||||||
this.typeName = typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImg () {
|
|
||||||
return img;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImg (String img) {
|
|
||||||
this.img = img;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCarouselImages () {
|
|
||||||
return carouselImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCarouselImages (String carouselImages) {
|
|
||||||
this.carouselImages = carouselImages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCommentCount () {
|
|
||||||
return commentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCommentCount (Long commentCount) {
|
|
||||||
this.commentCount = commentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCollectCount () {
|
|
||||||
return collectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCollectCount (Long collectCount) {
|
|
||||||
this.collectCount = collectCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrand () {
|
|
||||||
return brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrand (String brand) {
|
|
||||||
this.brand = brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrandName () {
|
|
||||||
return brandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrandName (String brandName) {
|
|
||||||
this.brandName = brandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus () {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus (String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnit () {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit (String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeywords () {
|
|
||||||
return keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeywords (String keywords) {
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.ruoyi.mall.search.domain.request;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class HotWordsReq {
|
|
||||||
private Integer id;
|
|
||||||
private String hotWords;
|
|
||||||
private Integer searchFrequency;
|
|
||||||
private Date lastTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
package com.ruoyi.mall.search.domain.request;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.constant.Constants;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 查询请求对象
|
|
||||||
* @Date 2022-10-24 下午 03:07
|
|
||||||
*/
|
|
||||||
public class SearchReq {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
private String keyWord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符集
|
|
||||||
*/
|
|
||||||
private String ev = Constants.UTF8;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页大小
|
|
||||||
*/
|
|
||||||
private Integer pageSize = 5;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页页数
|
|
||||||
*/
|
|
||||||
private Integer pageNum = 1;
|
|
||||||
|
|
||||||
public String getKeyWord () {
|
|
||||||
return keyWord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyWord (String keyWord) {
|
|
||||||
this.keyWord = keyWord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEv () {
|
|
||||||
return ev;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEv (String ev) {
|
|
||||||
this.ev = ev;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPageSize () {
|
|
||||||
return pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPageSize (Integer pageSize) {
|
|
||||||
this.pageSize = pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPageNum () {
|
|
||||||
return pageNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPageNum (Integer pageNum) {
|
|
||||||
this.pageNum = pageNum;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package com.ruoyi.mall.search.utils;
|
|
||||||
|
|
||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 线程变量工具类
|
|
||||||
* @Date 2022-10-24 下午 04:48
|
|
||||||
*/
|
|
||||||
public class SearchResultUtils {
|
|
||||||
|
|
||||||
private static final String LIST_NAME = "list";
|
|
||||||
|
|
||||||
private static final String TOTAL_NAME = "total";
|
|
||||||
|
|
||||||
private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>();
|
|
||||||
|
|
||||||
private static Map<String, Object> get(){
|
|
||||||
Map<String, Object> map = THREAD_LOCAL.get();
|
|
||||||
if (map != null){
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
THREAD_LOCAL.set(new HashMap<>());
|
|
||||||
return THREAD_LOCAL.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 集合
|
|
||||||
* @return
|
|
||||||
* @param <T>
|
|
||||||
*/
|
|
||||||
public static <T> List<T> getList(){
|
|
||||||
return (List<T>) get().get(LIST_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储List
|
|
||||||
* @param list
|
|
||||||
*/
|
|
||||||
public static void setList(List list){
|
|
||||||
get().put(LIST_NAME, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总条数
|
|
||||||
* @return
|
|
||||||
* @param <T>
|
|
||||||
*/
|
|
||||||
public static <T> T getTotal(){
|
|
||||||
return (T) get().get(TOTAL_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储
|
|
||||||
* @param total
|
|
||||||
*/
|
|
||||||
public static void setTotal(Object total){
|
|
||||||
get().put(TOTAL_NAME, total);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -127,6 +127,10 @@
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-mall-search-remote</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.ruoyi.mall.search;
|
|
||||||
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 搜索服务启动类
|
|
||||||
* @Date 2022-10-14 上午 10:22
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableCustomSwagger2
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
@ComponentScan( value = "com.ruoyi.common")
|
|
||||||
@Slf4j
|
|
||||||
public class RuoYiMallSearchApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(RuoYiMallSearchApplication.class, args);
|
|
||||||
log.info("(♥◠‿◠)ノ゙ 商城 - 搜索模块启动成功 ლ(´ڡ`ლ)゙ ");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
package com.ruoyi.mall.search.controller;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.search.domain.request.SearchReq;
|
|
||||||
import com.ruoyi.mall.search.service.SearchService;
|
|
||||||
import com.ruoyi.mall.search.utils.SearchResultUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 搜索控制层
|
|
||||||
* @Date 2022-10-24 下午 02:54
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/search")
|
|
||||||
public class SearchController {
|
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(SearchController.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SearchService searchService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 1、查询到数据
|
|
||||||
* 2、指定模板
|
|
||||||
* 3、渲染模板
|
|
||||||
* 4、返回页面
|
|
||||||
*
|
|
||||||
* @param searchReq
|
|
||||||
* @param model
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping
|
|
||||||
public String search(SearchReq searchReq, Model model){
|
|
||||||
log.info("搜索:[{}]", JSONObject.toJSONString(searchReq));
|
|
||||||
if (StringUtils.isEmpty(searchReq.getKeyWord())){
|
|
||||||
return "search";
|
|
||||||
}
|
|
||||||
|
|
||||||
searchService.search(searchReq);
|
|
||||||
|
|
||||||
List<ProductInfoResponse> list = SearchResultUtils.getList();
|
|
||||||
Long total = SearchResultUtils.getTotal();
|
|
||||||
log.info(JSONObject.toJSONString(list));
|
|
||||||
model.addAttribute("dataList", list);
|
|
||||||
model.addAttribute("total", total);
|
|
||||||
model.addAttribute("searchReq",searchReq);
|
|
||||||
return "search";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/suggestion")
|
|
||||||
public R suggestion(@RequestParam String keyWord){
|
|
||||||
return R.ok(searchService.suggestion(keyWord));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.ruoyi.mall.search.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.mall.product.cache.ProductInfoCache;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductDetailsResponse;
|
|
||||||
import com.ruoyi.mall.search.es.config.EsConfig;
|
|
||||||
import com.ruoyi.mall.search.sync.ShopItemSync;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 测试
|
|
||||||
* @Date 2022-10-14 上午 11:17
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ShopItemSync sync;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProductInfoCache productInfoCache;
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@ResponseBody
|
|
||||||
private R test(){
|
|
||||||
sync.productSync();
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
@ResponseBody
|
|
||||||
private R get(@PathVariable Long id){
|
|
||||||
ProductDetailsResponse productDetailsResponse = productInfoCache.get(id);
|
|
||||||
return R.ok(productDetailsResponse);
|
|
||||||
}
|
|
||||||
@GetMapping("/refreshData/{id}")
|
|
||||||
@ResponseBody
|
|
||||||
private R refreshData(@PathVariable Long id){
|
|
||||||
return R.ok(productInfoCache.refreshData(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/index")
|
|
||||||
public String index(Model model){
|
|
||||||
model.addAttribute("test","你好");
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.ruoyi.mall.search.es.config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: Es连接地址
|
|
||||||
* @Date 2022-10-14 下午 01:45
|
|
||||||
*/
|
|
||||||
public class EsAddressConfig {
|
|
||||||
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
public String getHost () {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost (String host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPort () {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPort (int port) {
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString () {
|
|
||||||
return "EsConfig{" +
|
|
||||||
"host='" + host + '\'' +
|
|
||||||
", port=" + port +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.ruoyi.mall.search.es.config;
|
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: es配置
|
|
||||||
* @Date 2022-10-14 上午 11:15
|
|
||||||
*/
|
|
||||||
@ConfigurationProperties(
|
|
||||||
prefix = "es"
|
|
||||||
)
|
|
||||||
@Configuration
|
|
||||||
public class EsConfig implements Serializable {
|
|
||||||
|
|
||||||
private List<EsAddressConfig> addressList = null;
|
|
||||||
|
|
||||||
public List<EsAddressConfig> getAddressList () {
|
|
||||||
return addressList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAddressList (List<EsAddressConfig> addressList) {
|
|
||||||
this.addressList = addressList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString () {
|
|
||||||
return "EsConfig{" +
|
|
||||||
"addressList=" + addressList +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
package com.ruoyi.mall.search.es.instance;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.mall.search.es.config.EsAddressConfig;
|
|
||||||
import com.ruoyi.mall.search.es.config.EsConfig;
|
|
||||||
import org.apache.http.HttpHost;
|
|
||||||
import org.elasticsearch.action.delete.DeleteRequest;
|
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
|
||||||
import org.elasticsearch.client.RestClient;
|
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: Es实例化对象
|
|
||||||
* @Date 2022-10-14 上午 11:26
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class EsInstance {
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(EsInstance.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ES实例对象
|
|
||||||
*/
|
|
||||||
private RestHighLevelClient client = null;
|
|
||||||
|
|
||||||
private EsConfig esConfig;
|
|
||||||
|
|
||||||
public EsInstance (EsConfig esConfig) {
|
|
||||||
this.esConfig = esConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init(){
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
try {
|
|
||||||
log.info("Es初始开始");
|
|
||||||
List<EsAddressConfig> addressList = this.esConfig.getAddressList();
|
|
||||||
int hostSize = addressList.size();
|
|
||||||
HttpHost[] httpHosts = new HttpHost[hostSize];
|
|
||||||
for (int index = 0 ; index < hostSize ; index ++) {
|
|
||||||
EsAddressConfig esAddressConfig = addressList.get(index);
|
|
||||||
log.info("实例化Es客户端程序地址:[{}],端口:[{}]",
|
|
||||||
esAddressConfig.getHost(),
|
|
||||||
esAddressConfig.getPort());
|
|
||||||
httpHosts[index] = new HttpHost(esAddressConfig.getHost(),
|
|
||||||
esAddressConfig.getPort(),
|
|
||||||
"http");
|
|
||||||
}
|
|
||||||
client = new RestHighLevelClient(
|
|
||||||
RestClient.builder(httpHosts));
|
|
||||||
log.info("Es初始化成功 耗时:[{}MS]", System.currentTimeMillis() - startTime);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("Es初始化失败", e);
|
|
||||||
// 阻止程序启动
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RestHighLevelClient getClient () {
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取索引操作对象
|
|
||||||
* @param index
|
|
||||||
* @return 索引操作对象
|
|
||||||
*/
|
|
||||||
public IndexRequest indexRequestBuilder(String index){
|
|
||||||
if (StringUtils.isEmpty(index)){
|
|
||||||
throw new ServiceException("Es 索引不可以为空");
|
|
||||||
}
|
|
||||||
return new IndexRequest(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取索引操作对象
|
|
||||||
* @param index
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public DeleteRequest DeleteRequestBuilder(String index){
|
|
||||||
if (StringUtils.isEmpty(index)){
|
|
||||||
throw new ServiceException("Es 索引不可以为空");
|
|
||||||
}
|
|
||||||
return new DeleteRequest(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 索引搜索对象
|
|
||||||
* @param index
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public SearchRequest SearchRequestBuilder(String index){
|
|
||||||
if (StringUtils.isEmpty(index)){
|
|
||||||
throw new ServiceException("Es 索引不可以为空");
|
|
||||||
}
|
|
||||||
return new SearchRequest(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
package com.ruoyi.mall.search.es.service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.reflect.ReflectUtils;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.search.es.instance.EsInstance;
|
|
||||||
import org.elasticsearch.action.DocWriteResponse;
|
|
||||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
|
||||||
import org.elasticsearch.action.bulk.BulkRequest;
|
|
||||||
import org.elasticsearch.action.bulk.BulkResponse;
|
|
||||||
import org.elasticsearch.action.delete.DeleteRequest;
|
|
||||||
import org.elasticsearch.action.delete.DeleteResponse;
|
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
|
||||||
import org.elasticsearch.action.index.IndexResponse;
|
|
||||||
import org.elasticsearch.action.update.UpdateResponse;
|
|
||||||
import org.elasticsearch.client.RequestOptions;
|
|
||||||
import org.elasticsearch.rest.RestStatus;
|
|
||||||
import org.elasticsearch.xcontent.XContentType;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: Es操作数据
|
|
||||||
* @Date 2022-10-14 下午 02:09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EsDataService {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(EsDataService.class);
|
|
||||||
|
|
||||||
|
|
||||||
private final EsInstance clientInstance;
|
|
||||||
|
|
||||||
public EsDataService (EsInstance clientInstance) {
|
|
||||||
this.clientInstance = clientInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品搜索
|
|
||||||
* 1、索引的类型、结构
|
|
||||||
* 2、同步数据(全量、增量)
|
|
||||||
* 3、搜索方式
|
|
||||||
* 4、数据维护
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 进行添加数据
|
|
||||||
* @param index 索引
|
|
||||||
* @param dataJson 数据json
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean insertOrUpdate(String index , ProductInfoResponse dataJson){
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(dataJson));
|
|
||||||
jsonObject.put("createTime", dataJson.getCreateTime().getTime());
|
|
||||||
IndexRequest indexRequest = clientInstance.indexRequestBuilder(index).source(
|
|
||||||
jsonObject.toJSONString(),
|
|
||||||
XContentType.JSON
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
IndexResponse indexResponse = clientInstance.getClient().index(
|
|
||||||
indexRequest, RequestOptions.DEFAULT
|
|
||||||
);
|
|
||||||
RestStatus status = indexResponse.status();
|
|
||||||
if (status.getStatus() == RestStatus.OK.getStatus()){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.info("索引数据添加异常:[{},{}]",index,dataJson);
|
|
||||||
throw new ServiceException(e.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量数据
|
|
||||||
* @param index
|
|
||||||
* @param dataList
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean bulkInsertOrUpdate(String index , List<?> dataList){
|
|
||||||
BulkRequest bulkRequest = new BulkRequest();
|
|
||||||
dataList.forEach( data -> bulkRequest.add(
|
|
||||||
clientInstance.indexRequestBuilder(index).source(
|
|
||||||
JSONObject.toJSONString(data),
|
|
||||||
XContentType.JSON
|
|
||||||
).id(ReflectUtils.invokeGetter(data,"id").toString())
|
|
||||||
));
|
|
||||||
try {
|
|
||||||
BulkResponse bulkItemResponses =
|
|
||||||
clientInstance.getClient().bulk(bulkRequest, RequestOptions.DEFAULT);
|
|
||||||
BulkItemResponse[] bulkResponse = bulkItemResponses.getItems();
|
|
||||||
for (BulkItemResponse bulkItemResponse : bulkResponse) {
|
|
||||||
DocWriteResponse itemResponse = bulkItemResponse.getResponse();
|
|
||||||
switch (bulkItemResponse.getOpType()) {
|
|
||||||
case INDEX:
|
|
||||||
case CREATE:
|
|
||||||
IndexResponse indexResponse = (IndexResponse) itemResponse;
|
|
||||||
RestStatus createStatus = indexResponse.status();
|
|
||||||
if (createStatus.getStatus() != RestStatus.CREATED.getStatus()
|
|
||||||
&& createStatus.getStatus() != RestStatus.OK.getStatus() ){
|
|
||||||
log.error("请求失败: 索引:[{}] , itemId:[{}]",
|
|
||||||
bulkItemResponse.getIndex(),
|
|
||||||
bulkItemResponse.getItemId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case UPDATE:
|
|
||||||
UpdateResponse updateResponse = (UpdateResponse) itemResponse;
|
|
||||||
RestStatus updateStatus = updateResponse.status();
|
|
||||||
if (updateStatus.getStatus() != RestStatus.OK.getStatus()){
|
|
||||||
log.error("请求失败: 索引:[{}] , itemId:[{}]",
|
|
||||||
bulkItemResponse.getIndex(),
|
|
||||||
bulkItemResponse.getItemId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DELETE:
|
|
||||||
DeleteResponse deleteResponse = (DeleteResponse) itemResponse;
|
|
||||||
RestStatus deleteStatus = deleteResponse.status();
|
|
||||||
if (deleteStatus.getStatus() != RestStatus.OK.getStatus()){
|
|
||||||
log.error("请求失败: 索引:[{}] , itemId:[{}]",
|
|
||||||
bulkItemResponse.getIndex(),
|
|
||||||
bulkItemResponse.getItemId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.info("批量请求异常", e);
|
|
||||||
throw new ServiceException(e.getMessage());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除索引
|
|
||||||
* @param index
|
|
||||||
* @param docId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean deleteByDocId(String index, String docId){
|
|
||||||
DeleteRequest deleteRequest = clientInstance.DeleteRequestBuilder(index).id(docId);
|
|
||||||
try {
|
|
||||||
DeleteResponse deleteResponse = clientInstance.getClient().delete(deleteRequest, RequestOptions.DEFAULT);
|
|
||||||
RestStatus status = deleteResponse.status();
|
|
||||||
if (status.getStatus() == RestStatus.OK.getStatus()){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("文档删除出现异常 索引:[{}],文档:[{}]", index , docId, e);
|
|
||||||
throw new ServiceException(e.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.ruoyi.mall.search.es.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 索引能力
|
|
||||||
* @Date 2022-10-14 下午 02:08
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EsIndexService {
|
|
||||||
/**
|
|
||||||
* 判断索引是否存在、修改索引、创建索引、删除索引
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ruoyi.mall.search.rabbit;
|
|
||||||
|
|
||||||
import com.ruoyi.common.rabbit.enums.QueueEnum;
|
|
||||||
import org.springframework.amqp.core.Queue;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import static com.ruoyi.common.rabbit.enums.QueueEnum.TEST;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 队列配置
|
|
||||||
* @Date 2022-10-21 下午 01:42
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class QueueConfig {
|
|
||||||
@Bean
|
|
||||||
public Queue myQueue() {
|
|
||||||
return new Queue(TEST.queueName(), true);
|
|
||||||
}
|
|
||||||
@Bean
|
|
||||||
public Queue productAddQueue() {
|
|
||||||
return new Queue(QueueEnum.PRODUCT_ADD.queueName(), true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.ruoyi.mall.search.rabbit;
|
|
||||||
|
|
||||||
import com.ruoyi.common.rabbit.constant.QueueConstant;
|
|
||||||
import com.ruoyi.common.rabbit.domain.Message;
|
|
||||||
import com.ruoyi.common.rabbit.enums.QueueEnum;
|
|
||||||
import com.ruoyi.mall.search.service.SearchService;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: rabbit商品消息处理
|
|
||||||
* @Date 2022-10-21 下午 02:48
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class RabbitProductMsg {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志
|
|
||||||
*/
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(RabbitProductMsg.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SearchService searchService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品新增消息
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
@RabbitListener( queues = QueueConstant.PRODUCT_ADD)
|
|
||||||
public void productAdd(Message<Long> message){
|
|
||||||
log.info("消息队列:[{}],接受到消息:[{}]", QueueEnum.PRODUCT_ADD.queueStr(),
|
|
||||||
message);
|
|
||||||
searchService.syncProductInfo(message.getBody());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.ruoyi.mall.search.rabbit;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.ruoyi.common.rabbit.constant.QueueConstant;
|
|
||||||
import com.ruoyi.common.rabbit.domain.Message;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: rabbit测试
|
|
||||||
* @Date 2022-10-21 下午 01:56
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class RabbitTest {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志
|
|
||||||
*/
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(RabbitTest.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接受测试消息
|
|
||||||
* @param msg
|
|
||||||
*/
|
|
||||||
@RabbitListener(queues = QueueConstant.TEST_NAME)
|
|
||||||
public void listen(Message<ProductInfoResponse> msg) {
|
|
||||||
log.info(JSONObject.toJSONString(msg));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.ruoyi.mall.search.service;
|
|
||||||
|
|
||||||
import com.ruoyi.mall.search.domain.request.SearchReq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 搜索业务层
|
|
||||||
* @Date 2022-10-21 下午 02:52
|
|
||||||
*/
|
|
||||||
public interface SearchService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过商品ID同步商品信息
|
|
||||||
* @param productId
|
|
||||||
*/
|
|
||||||
public void syncProductInfo(Long productId);
|
|
||||||
|
|
||||||
void search (SearchReq searchReq);
|
|
||||||
|
|
||||||
|
|
||||||
Object suggestion(String keyWord);
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
package com.ruoyi.mall.search.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
|
||||||
import com.ruoyi.mall.product.remote.RemoteProductInfo;
|
|
||||||
import com.ruoyi.mall.search.domain.request.SearchReq;
|
|
||||||
import com.ruoyi.mall.search.es.instance.EsInstance;
|
|
||||||
import com.ruoyi.mall.search.es.service.EsDataService;
|
|
||||||
import com.ruoyi.mall.search.service.SearchService;
|
|
||||||
import com.ruoyi.mall.search.utils.SearchResultUtils;
|
|
||||||
import org.apache.lucene.search.TotalHits;
|
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
|
||||||
import org.elasticsearch.client.RequestOptions;
|
|
||||||
import org.elasticsearch.common.text.Text;
|
|
||||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
||||||
import org.elasticsearch.index.query.MatchQueryBuilder;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
|
||||||
import org.elasticsearch.search.SearchHit;
|
|
||||||
import org.elasticsearch.search.SearchHits;
|
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
||||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
|
||||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 搜索业务实现类
|
|
||||||
* @Date 2022-10-21 下午 02:53
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SearchServiceImpl implements SearchService {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(SearchServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteProductInfo remoteProductInfo;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EsDataService esDataService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EsInstance esInstance;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void syncProductInfo (Long productId) {
|
|
||||||
R<ProductInfoResponse> resultInfo = remoteProductInfo.getResultInfo(productId);
|
|
||||||
esDataService.insertOrUpdate("shop_item", resultInfo.getData());
|
|
||||||
log.info("商品:[{}]同步完成", productId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索
|
|
||||||
*
|
|
||||||
* @param searchReq
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void search (SearchReq searchReq) {
|
|
||||||
if (StringUtils.isEmpty(searchReq.getKeyWord())){
|
|
||||||
throw new ServiceException("搜索参数不可以为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchRequest searchRequest = esInstance.SearchRequestBuilder("shop_item");
|
|
||||||
SearchSourceBuilder searchSourceBuilder = SearchSourceBuilder.searchSource();
|
|
||||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
|
||||||
// 商品名称搜索
|
|
||||||
MatchQueryBuilder matchQueryBuilder = QueryBuilders.matchQuery(
|
|
||||||
"name", searchReq.getKeyWord()
|
|
||||||
);
|
|
||||||
boolQueryBuilder.must(matchQueryBuilder);
|
|
||||||
// 分页
|
|
||||||
searchSourceBuilder.from((searchReq.getPageNum() - 1) * searchReq.getPageSize());
|
|
||||||
searchSourceBuilder.size(searchReq.getPageSize());
|
|
||||||
|
|
||||||
searchSourceBuilder.query(boolQueryBuilder);
|
|
||||||
|
|
||||||
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
|
||||||
highlightBuilder.field("name");
|
|
||||||
highlightBuilder.preTags("<span style='color:red'>");
|
|
||||||
highlightBuilder.postTags("</span>");
|
|
||||||
searchSourceBuilder.highlighter(highlightBuilder);
|
|
||||||
searchRequest.source(searchSourceBuilder);
|
|
||||||
try {
|
|
||||||
SearchResponse searchResponse = esInstance.getClient().search(searchRequest, RequestOptions.DEFAULT);
|
|
||||||
SearchHits searchResponseHits = searchResponse.getHits();
|
|
||||||
TotalHits totalHits = searchResponseHits.getTotalHits();
|
|
||||||
// 若未查询到数量结果,直接进行返回
|
|
||||||
if (totalHits.value != 0){
|
|
||||||
SearchResultUtils.setTotal(totalHits.value);
|
|
||||||
}
|
|
||||||
List<ProductInfoResponse> productInfoResponseList = new ArrayList<>();
|
|
||||||
SearchHit[] searchHits = searchResponseHits.getHits();
|
|
||||||
for (SearchHit searchHit : searchHits) {
|
|
||||||
// 源数据
|
|
||||||
String sourceAsString = searchHit.getSourceAsString();
|
|
||||||
ProductInfoResponse productInfoResponse =
|
|
||||||
JSONObject.parseObject(sourceAsString, ProductInfoResponse.class);
|
|
||||||
// 高亮
|
|
||||||
Map<String, HighlightField> highlightFields =
|
|
||||||
searchHit.getHighlightFields();
|
|
||||||
if (highlightFields != null){
|
|
||||||
HighlightField highlightField = highlightFields.get("name");
|
|
||||||
if (highlightField != null){
|
|
||||||
// 拼装
|
|
||||||
Text[] fragments = highlightField.getFragments();
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (Text fragment : fragments) {
|
|
||||||
sb.append(fragment);
|
|
||||||
}
|
|
||||||
productInfoResponse.setName(sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
productInfoResponseList.add(productInfoResponse);
|
|
||||||
}
|
|
||||||
SearchResultUtils.setList(productInfoResponseList);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object suggestion(String keyWord) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
package com.ruoyi.mall.search.sync;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.mall.product.domain.MallProductInfo;
|
|
||||||
import com.ruoyi.mall.product.remote.RemoteProductInfo;
|
|
||||||
import com.ruoyi.mall.search.domain.ProductSearch;
|
|
||||||
import com.ruoyi.mall.search.es.service.EsDataService;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: 商品信息同步
|
|
||||||
* @Date 2022-10-15 上午 08:32
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class ShopItemSync {
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ShopItemSync.class);
|
|
||||||
|
|
||||||
private static int syncSize = 10;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteProductInfo remoteProductInfo;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EsDataService esDataService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步商品信息
|
|
||||||
*/
|
|
||||||
public void productSync(){
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
log.info("商品搜索同步开始");
|
|
||||||
// 获取商品总条数
|
|
||||||
R<Long> resultCount = remoteProductInfo.count("内部请求",new MallProductInfo());
|
|
||||||
log.info("远程调用商品总数结果:{}", JSONObject.toJSONString(resultCount));
|
|
||||||
if (resultCount.isError()){
|
|
||||||
log.error("查询商品总数失败,错误信息:{}",resultCount.getMsg());
|
|
||||||
throw new ServiceException(StringUtils.format("查询商品总数失败,错误信息:{}",resultCount.getMsg()));
|
|
||||||
}
|
|
||||||
Long productCount = resultCount.getData();
|
|
||||||
// 计算分页条数
|
|
||||||
int productPage = (int) ((productCount / syncSize) + (productCount % syncSize == 0 ? 0 : 1));
|
|
||||||
log.info("商品分段调用,分段条数:[{}]", productPage);
|
|
||||||
for (int productIndex = 0 ; productIndex < productPage ; productIndex++) {
|
|
||||||
log.info("第{}段同步开始", productIndex + 1);
|
|
||||||
MallProductInfo mallProductInfo = new MallProductInfo();
|
|
||||||
TableDataInfo tableDataInfo = remoteProductInfo.syncList(syncSize, productIndex + 1, mallProductInfo);
|
|
||||||
List<ProductSearch> productSearchList = new ArrayList<>();
|
|
||||||
List<?> rows = tableDataInfo.getRows();
|
|
||||||
for (Object row : rows) {
|
|
||||||
productSearchList.add(JSONObject.parseObject(JSONObject.toJSONString(row), ProductSearch.class));
|
|
||||||
}
|
|
||||||
esDataService.bulkInsertOrUpdate("shop_item",productSearchList);
|
|
||||||
log.info("第{}段同步结束", productIndex + 1);
|
|
||||||
}
|
|
||||||
log.info("商品同步完成,耗时:[{}MS]", System.currentTimeMillis() - startTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,13 +6,6 @@ import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:sheyudie
|
|
||||||
* @Package:com.bawei.mall.user.domain
|
|
||||||
* @Project:mall_cloud
|
|
||||||
* @name:CusUser
|
|
||||||
* @Date:2024/6/27 15:31
|
|
||||||
*/
|
|
||||||
@ApiModel(description = "C端用户表")
|
@ApiModel(description = "C端用户表")
|
||||||
@Data
|
@Data
|
||||||
public class CusUser {
|
public class CusUser {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.ruoyi.mall.user.domain.CusUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:sheyudie
|
* @Author:sheyudie
|
||||||
* @Package:com.bawei.mall.user.service
|
* @Package:com.ruoyi.mall.user.service
|
||||||
* @Project:mall_cloud
|
* @Project:mall_cloud
|
||||||
* @name:UserService
|
* @name:UserService
|
||||||
* @Date:2024/6/27 15:28
|
* @Date:2024/6/27 15:28
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:sheyudie
|
* @Author:sheyudie
|
||||||
* @Package:com.bawei.mall.user.service.impl
|
* @Package:com.ruoyi.mall.user.service.impl
|
||||||
* @Project:mall_cloud
|
* @Project:mall_cloud
|
||||||
* @name:UserServiceImpl
|
* @name:UserServiceImpl
|
||||||
* @Date:2024/6/27 15:28
|
* @Date:2024/6/27 15:28
|
||||||
|
|
Loading…
Reference in New Issue