购物车+订单
parent
da34dac07a
commit
7ad83f1600
|
@ -0,0 +1,103 @@
|
||||||
|
package com.ruoyi.system.domain.Dto;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.system.domain.vo.EsDocBaseVo;
|
||||||
|
import com.ruoyi.system.domain.vo.PageVo;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EsDocSelectDto extends EsDocBaseVo {
|
||||||
|
|
||||||
|
@Excel(name = "商品名称")
|
||||||
|
@ApiParam("商品名称")
|
||||||
|
private String name;
|
||||||
|
@ApiModelProperty("检索字段")
|
||||||
|
private List<String> searchlist;
|
||||||
|
@ApiModelProperty("高亮字段")
|
||||||
|
private List<String> hitslist;
|
||||||
|
|
||||||
|
/** 商品描述 */
|
||||||
|
@Excel(name = "商品描述")
|
||||||
|
private String productDesc;
|
||||||
|
|
||||||
|
/** 商品类型 */
|
||||||
|
@Excel(name = "商品类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 冗余字段 */
|
||||||
|
@Excel(name = "冗余字段")
|
||||||
|
private String typeIds;
|
||||||
|
|
||||||
|
@Excel(name = "规格信息")
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
@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 ruleName;
|
||||||
|
@Excel(name = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
@Excel(name = "品牌名称")
|
||||||
|
private String brandName;
|
||||||
|
|
||||||
|
/** 规格详情 */
|
||||||
|
@Excel(name = "规格详情")
|
||||||
|
private String ruleAttr;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
@ApiModelProperty("全文检索关键字")
|
||||||
|
private String keyWord;
|
||||||
|
@ApiModelProperty("分页条件")
|
||||||
|
private PageVo pageVo = new PageVo();
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.system.domain.model;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class ReflectionExample {
|
||||||
|
private int privateField;
|
||||||
|
public String publicField;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Class<?> clazz = ReflectionExample.class;
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
System.out.println("Field name: " + field.getName());
|
||||||
|
System.out.println("Field type: " + field.getType());
|
||||||
|
System.out.println("Field modifiers: " + Arrays.toString(new int[]{field.getModifiers()}));
|
||||||
|
System.out.println("------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
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="skulist_info";
|
||||||
|
@ApiModelProperty(value = "类型名称,默认_doc",required = true)
|
||||||
|
private String typeName="_doc";
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
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 EsDocDeleteVo extends EsDocBaseVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("数据唯一id")
|
||||||
|
public String id;
|
||||||
|
@ApiModelProperty(value = "数据内容",required = true)
|
||||||
|
private Map<String,Object> data;
|
||||||
|
@ApiModelProperty("是否立即刷新磁盘")
|
||||||
|
private boolean reflush = true;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("es文档查询参数")
|
||||||
|
public class EsDocQueryVo extends EsDocBaseVo{
|
||||||
|
@ApiModelProperty(value = "query参数",required = false)
|
||||||
|
private Map<String,Object> queryObj;
|
||||||
|
@ApiModelProperty(value = "全文检索关键字",required = false)
|
||||||
|
@NotBlank
|
||||||
|
private String keyWord;
|
||||||
|
@ApiModelProperty("分页条件")
|
||||||
|
private PageVo pageVo = new PageVo();
|
||||||
|
|
||||||
|
@ApiModelProperty("查询的条件")
|
||||||
|
private String queryname;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EsDocSelectVo extends EsDocBaseVo{
|
||||||
|
|
||||||
|
@Excel(name = "商品名称")
|
||||||
|
@ApiParam("商品名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 商品描述 */
|
||||||
|
@Excel(name = "商品描述")
|
||||||
|
private String productDesc;
|
||||||
|
|
||||||
|
/** 商品类型 */
|
||||||
|
@Excel(name = "商品类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 冗余字段 */
|
||||||
|
@Excel(name = "冗余字段")
|
||||||
|
private String typeIds;
|
||||||
|
|
||||||
|
@Excel(name = "规格信息")
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
@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 ruleName;
|
||||||
|
@Excel(name = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
@Excel(name = "品牌名称")
|
||||||
|
private String brandName;
|
||||||
|
|
||||||
|
/** 规格详情 */
|
||||||
|
@Excel(name = "规格详情")
|
||||||
|
private String ruleAttr;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
@ApiModelProperty("全文检索关键字")
|
||||||
|
private String keyWord;
|
||||||
|
@ApiModelProperty("分页条件")
|
||||||
|
private PageVo pageVo = new PageVo();
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MappingAndSettingRequest {
|
||||||
|
@ApiModelProperty
|
||||||
|
private Map<String, Objects> settings;
|
||||||
|
@ApiModelProperty
|
||||||
|
private Map<String, Objects> mappings;
|
||||||
|
@ApiModelProperty
|
||||||
|
private String indexName;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.es;
|
||||||
|
|
||||||
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* es全文检索模块
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableRyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class RuoYiEsApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(RuoYiEsApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ Es全文检索模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.ruoyi.es.conf;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class EsConfiguration {
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.es.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.es.service.EsDocService;
|
||||||
|
import com.ruoyi.system.domain.Dto.EsDocSelectDto;
|
||||||
|
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文档管理")
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/querydelDoce")
|
||||||
|
@ApiOperation(value = "根据传入条件删除Es的文档数据")
|
||||||
|
public R<Boolean> querydelDoce(@RequestBody List<EsDocInsertVo> esDocInsertVo){
|
||||||
|
return esDocService.batchInsertdelDocs(esDocInsertVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/queryDocsproduct")
|
||||||
|
@ApiOperation(value = "根据传入条件查询Es的文档数据(多个字段与高亮)")
|
||||||
|
public TableDataInfo queryDocsproduct(@RequestBody EsDocSelectDto esDocSelectDto){
|
||||||
|
|
||||||
|
return esDocService.queryDocsproduct(esDocSelectDto, esDocSelectDto.getSearchlist());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryDocsAuto")
|
||||||
|
@ApiOperation(value = "根据传入条件查询Es的文档数据")
|
||||||
|
public R queryDocsAuto(@RequestBody EsDocQueryVo esDocInsertVo){
|
||||||
|
return esDocService.queryDocsAuto(esDocInsertVo);
|
||||||
|
}
|
||||||
|
@PostMapping("/queryDocsSuggest/{indexName}")
|
||||||
|
@ApiOperation(value = "自动补全联想")
|
||||||
|
public R<List<String>> queryDocsSuggest(@PathVariable String indexName,
|
||||||
|
@RequestParam("keyWord") String keyWord,
|
||||||
|
@RequestParam("suggestFiled") String suggestFiled){
|
||||||
|
return esDocService.queryDocsSuggest(indexName,keyWord,suggestFiled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.ruoyi.es.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.es.service.EsIndexService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/esIndex")
|
||||||
|
@Api(value = "ES索引管理",tags = "ES索引管理")
|
||||||
|
public class EsIndexController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EsIndexService esIndexService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称、映射结构创建索引
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称创建索引
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/create")
|
||||||
|
@ApiOperation(value = "根据索引名称创建索引")
|
||||||
|
public R<Boolean> indexCreate(String indexName) {
|
||||||
|
return esIndexService.indexCreate(indexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称、映射结构创建索引
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/createWithMapping")
|
||||||
|
@ApiOperation(value = "根据索引名称、映射结构创建索引")
|
||||||
|
public R<Boolean> indexCreateWithMapping(String indexName, String indexMapping) {
|
||||||
|
|
||||||
|
return esIndexService.indexCreateWithMapping(indexName,indexMapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称查询索引是否存在
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/indexExit")
|
||||||
|
@ApiOperation(value = "根据索引名称查询索引是否存在")
|
||||||
|
public R<Boolean> indexExit(String indexName) {
|
||||||
|
|
||||||
|
return esIndexService.indexExit(indexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称删除索引
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/indexDelete")
|
||||||
|
@ApiOperation(value = "根据索引名称删除索引")
|
||||||
|
public R<Boolean> indexDelete(String indexName) {
|
||||||
|
|
||||||
|
return esIndexService.indexDelete(indexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引名称获取mapping
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/indexGetMapping")
|
||||||
|
@ApiOperation(value = "根据索引名称删除索引")
|
||||||
|
public R<Map> indexGetMapping(String indexName) {
|
||||||
|
|
||||||
|
return esIndexService.indexGetMapping(indexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/indexAll")
|
||||||
|
@ApiOperation("查询所有索引名称")
|
||||||
|
public R indexAll(){
|
||||||
|
return R.ok(esIndexService.indexAll());
|
||||||
|
}
|
||||||
|
@GetMapping("/indexAllmapping")
|
||||||
|
@ApiOperation("查询所有索引mapping")
|
||||||
|
public R indexAllmapping(@RequestParam String indexname){
|
||||||
|
return R.ok(esIndexService.indexAllmapping(indexname));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ruoyi.es.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.system.domain.Dto.EsDocSelectDto;
|
||||||
|
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
||||||
|
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EsDocService {
|
||||||
|
R<Boolean> batchInsertDocs(List<EsDocInsertVo> esDocInsertVo);
|
||||||
|
|
||||||
|
R queryDocs(EsDocQueryVo esDocInsertVo);
|
||||||
|
|
||||||
|
R<Boolean> batchInsertdelDocs(List<EsDocInsertVo> esDocInsertVo);
|
||||||
|
|
||||||
|
TableDataInfo queryDocsproduct(EsDocSelectDto esDocSelectDto,List<String> selectlist);
|
||||||
|
|
||||||
|
|
||||||
|
R queryDocsAuto(EsDocQueryVo esDocInsertVo);
|
||||||
|
|
||||||
|
|
||||||
|
R<List<String>> queryDocsSuggest(String indexName, String keyWord, String suggestFiled);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.es.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> indexAll();
|
||||||
|
|
||||||
|
Map<String, Object> indexAllmapping(String indexname);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,292 @@
|
||||||
|
package com.ruoyi.es.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.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.es.service.EsDocService;
|
||||||
|
import com.ruoyi.es.service.EsIndexService;
|
||||||
|
import com.ruoyi.system.domain.Dto.EsDocSelectDto;
|
||||||
|
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
||||||
|
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.lucene.search.TotalHits;
|
||||||
|
import org.elasticsearch.action.bulk.BulkRequest;
|
||||||
|
import org.elasticsearch.action.bulk.BulkResponse;
|
||||||
|
import org.elasticsearch.action.delete.DeleteRequest;
|
||||||
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.common.text.Text;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
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.elasticsearch.search.suggest.Suggest;
|
||||||
|
import org.elasticsearch.search.suggest.SuggestBuilder;
|
||||||
|
import org.elasticsearch.search.suggest.SuggestBuilders;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
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;
|
||||||
|
@Autowired
|
||||||
|
private EsIndexService esIndexService;
|
||||||
|
|
||||||
|
|
||||||
|
@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 queryDocs(EsDocQueryVo esDocInsertVo) {
|
||||||
|
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> batchInsertdelDocs(List<EsDocInsertVo> esDocInsertVo) {
|
||||||
|
|
||||||
|
if(esDocInsertVo==null && esDocInsertVo.isEmpty()){
|
||||||
|
throw new ServiceException("esDocInsertVo不能为空");
|
||||||
|
}
|
||||||
|
BulkRequest request = new BulkRequest();
|
||||||
|
|
||||||
|
esDocInsertVo.forEach(e -> {
|
||||||
|
DeleteRequest deleteRequest = new DeleteRequest(e.getIndexName());
|
||||||
|
if (StringUtils.hasText(e.getId())) { // 确保ID不为空
|
||||||
|
deleteRequest.id(e.getId());
|
||||||
|
} else {
|
||||||
|
// 如果ID为空,可能需要处理这种情况,因为无法确定要删除的文档
|
||||||
|
// 这里可以抛出异常或者记录日志并跳过此条
|
||||||
|
// throw new IllegalArgumentException("Document ID cannot be empty.");
|
||||||
|
// 或者
|
||||||
|
log.warn("Skipping delete operation for document with empty ID in index: {}", e.getIndexName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.add(deleteRequest);
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
BulkResponse bulkResponse = restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
|
||||||
|
if (bulkResponse.hasFailures()) {
|
||||||
|
// 如果有失败的请求,可以根据需要处理
|
||||||
|
// 这里简单地返回失败结果,实际应用中可能需要更详细的错误处理
|
||||||
|
return R.fail(false, "部分文档删除失败");
|
||||||
|
}
|
||||||
|
return R.ok(true, "所有文档删除成功");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return R.fail(false, "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo queryDocsproduct(EsDocSelectDto esDocSelectDto,List<String> selectlist) {
|
||||||
|
if(StringUtils.isEmpty(esDocSelectDto.getKeyWord())){
|
||||||
|
throw new ServiceException("搜索参数不能为空");
|
||||||
|
}
|
||||||
|
long total=0;
|
||||||
|
List<Map> list = new ArrayList<>();
|
||||||
|
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||||
|
try {
|
||||||
|
SearchRequest searchRequest = new SearchRequest(esDocSelectDto.getIndexName());
|
||||||
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||||
|
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
|
||||||
|
|
||||||
|
if(!StringUtils.isEmpty(esDocSelectDto.getKeyWord())){
|
||||||
|
String[] strings = new String[selectlist.size()];
|
||||||
|
for (int i = 0; i < selectlist.size(); i++) {
|
||||||
|
strings[i]= selectlist.get(i);
|
||||||
|
}
|
||||||
|
boolQueryBuilder.must(QueryBuilders.multiMatchQuery(esDocSelectDto.getKeyWord(),strings));
|
||||||
|
}
|
||||||
|
|
||||||
|
searchSourceBuilder.query(boolQueryBuilder);
|
||||||
|
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
||||||
|
//@ApiModelProperty("高亮字段,必须包含在fields,如果不传,默认对fields进行全部高亮")
|
||||||
|
List<String> hitslist = esDocSelectDto.getHitslist();
|
||||||
|
if(CollectionUtils.isEmpty(hitslist)){
|
||||||
|
List<String> searchlist = esDocSelectDto.getSearchlist();
|
||||||
|
for (String s : searchlist) {
|
||||||
|
highlightBuilder.field(s).
|
||||||
|
preTags("<span style=\"color:red;\">").
|
||||||
|
postTags("</span>");
|
||||||
|
searchSourceBuilder.highlighter(highlightBuilder);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
List<String> hitslist1 = esDocSelectDto.getHitslist();
|
||||||
|
for (String s : hitslist1) {
|
||||||
|
highlightBuilder.field(s).
|
||||||
|
preTags("<span style=\"color:red;\">").
|
||||||
|
postTags("</span>");
|
||||||
|
searchSourceBuilder.highlighter(highlightBuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
searchSourceBuilder.sort("sellingPrice");
|
||||||
|
searchSourceBuilder.from((esDocSelectDto.getPageVo().getCurrentPage()-1)*esDocSelectDto.getPageVo().getPageSize());
|
||||||
|
searchSourceBuilder.size(esDocSelectDto.getPageVo().getPageSize());
|
||||||
|
searchRequest.source(searchSourceBuilder);
|
||||||
|
|
||||||
|
SearchResponse search = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = search.getHits();
|
||||||
|
SearchHit[] hits1 = hits.getHits();
|
||||||
|
TotalHits totalHits = hits.getTotalHits();
|
||||||
|
total=totalHits.value;
|
||||||
|
for (SearchHit documentFields : hits1) {
|
||||||
|
String sourceAsString = documentFields.getSourceAsString();
|
||||||
|
Map map = JSONObject.parseObject(sourceAsString, Map.class);
|
||||||
|
|
||||||
|
Map<String, HighlightField> highlightFields = documentFields.getHighlightFields();
|
||||||
|
|
||||||
|
if(highlightFields!=null){
|
||||||
|
for (String s : selectlist) {
|
||||||
|
HighlightField highlightField = highlightFields.get(s);
|
||||||
|
if(highlightField!=null){
|
||||||
|
Text[] fragments = highlightField.getFragments();
|
||||||
|
if(fragments!=null){
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (Text fragment : fragments) {
|
||||||
|
stringBuilder.append(fragment);
|
||||||
|
}
|
||||||
|
map.put(s,stringBuilder.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e+"es查询列表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
tableDataInfo.setTotal(total);
|
||||||
|
tableDataInfo.setCode(200);
|
||||||
|
tableDataInfo.setRows(list);
|
||||||
|
return tableDataInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R queryDocsAuto(EsDocQueryVo esDocInsertVo) {
|
||||||
|
String keyWord = esDocInsertVo.getKeyWord();
|
||||||
|
if(StringUtils.isEmpty(keyWord)){
|
||||||
|
throw new RuntimeException("关键字不能为空");
|
||||||
|
}
|
||||||
|
SearchRequest request = new SearchRequest(esDocInsertVo.getIndexName());
|
||||||
|
request.source().suggest(new SuggestBuilder().addSuggestion(
|
||||||
|
"suggestion",
|
||||||
|
SuggestBuilders
|
||||||
|
.completionSuggestion(esDocInsertVo.getQueryname())
|
||||||
|
.prefix(keyWord)
|
||||||
|
.skipDuplicates(true)
|
||||||
|
.size(10)
|
||||||
|
));
|
||||||
|
SearchResponse response = null;
|
||||||
|
try {
|
||||||
|
response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
Suggest suggest = response.getSuggest();
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
suggest.getSuggestion("suggestion").forEach(suggestion -> {
|
||||||
|
suggestion.getOptions().forEach(entry -> {
|
||||||
|
list.add(entry.getText().string());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<String>> queryDocsSuggest(String indexName, String keyWord, String suggestFiled) {
|
||||||
|
if(StringUtils.isEmpty(keyWord)){
|
||||||
|
throw new RuntimeException("关键字不能为空");
|
||||||
|
}
|
||||||
|
Boolean data = esIndexService.indexExit(indexName).getData();
|
||||||
|
if (!data){
|
||||||
|
throw new RuntimeException("索引不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchRequest request = new SearchRequest(indexName);
|
||||||
|
request.source().suggest(new SuggestBuilder().addSuggestion(
|
||||||
|
"suggestion",
|
||||||
|
SuggestBuilders
|
||||||
|
.completionSuggestion(keyWord)
|
||||||
|
.prefix(suggestFiled)
|
||||||
|
.skipDuplicates(true)
|
||||||
|
.size(10)
|
||||||
|
));
|
||||||
|
SearchResponse response = null;
|
||||||
|
try {
|
||||||
|
response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
Suggest suggest = response.getSuggest();
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
suggest.getSuggestion("suggestion").forEach(suggestion -> {
|
||||||
|
suggestion.getOptions().forEach(entry -> {
|
||||||
|
list.add(entry.getText().string());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return R.ok(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
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 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 List<String> indexAll() {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
GetAliasesRequest request = new GetAliasesRequest();
|
||||||
|
GetAliasesResponse getAliasesResponse = restHighLevelClient.indices().getAlias(request,RequestOptions.DEFAULT);
|
||||||
|
Map<String, Set<AliasMetaData>> map = getAliasesResponse.getAliases();
|
||||||
|
Set<String> indices = map.keySet();
|
||||||
|
for (String key : indices) {
|
||||||
|
list.add(key);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> indexAllmapping(String indexname) {
|
||||||
|
Map<String, Object> mapping=new HashMap<>();
|
||||||
|
//构建请求
|
||||||
|
GetMappingsRequest request = new GetMappingsRequest().indices(indexname);
|
||||||
|
//使用RestHighLevelClient发起请求
|
||||||
|
GetMappingsResponse response = null;
|
||||||
|
try {
|
||||||
|
response = restHighLevelClient.indices().getMapping(request, RequestOptions.DEFAULT);
|
||||||
|
Map<String, MappingMetaData> mappingMap = response.mappings();
|
||||||
|
MappingMetaData indexMapping = mappingMap.get(indexname);
|
||||||
|
mapping = indexMapping.sourceAsMap();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.mall.car.config;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AliPayConstants {
|
||||||
|
/**
|
||||||
|
* 私有密钥
|
||||||
|
*/
|
||||||
|
public static final String PRIVATE_KEY="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCexq";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String PUBLIC_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtIR3PTbTkyGY4GNeDOT";
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:CarAssociation
|
||||||
|
* @Date:2024/5/6 16:21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "car_association")
|
||||||
|
public class CarAssociation {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 购物车id
|
||||||
|
*/
|
||||||
|
private String carId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
private String orderPrice;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购物车详情信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CarDetailInfo {
|
||||||
|
/**
|
||||||
|
* 商品详情信息
|
||||||
|
*/
|
||||||
|
private List<ProductDetailInfo> productDetailInfoList;
|
||||||
|
/**
|
||||||
|
* 商品小计
|
||||||
|
*/
|
||||||
|
private PriceDetail priceDetail;
|
||||||
|
|
||||||
|
/** 5.9
|
||||||
|
* 优惠券列表
|
||||||
|
*/
|
||||||
|
private List<Coupon> couponList;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:CarInfo
|
||||||
|
* @Date:2024/5/6 16:06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "car_info")
|
||||||
|
public class CarInfo {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 购物车id
|
||||||
|
*/
|
||||||
|
private String carId;
|
||||||
|
/**
|
||||||
|
* skuid
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 购买数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 总计金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy年MM月dd日:HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy年MM月dd日:HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy年MM月dd日:HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy年MM月dd日:HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:Copon
|
||||||
|
* @Date:2024/5/9 16:08
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class Coupon {
|
||||||
|
/**
|
||||||
|
* 优惠券id
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
/**
|
||||||
|
* 优惠券名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 使用门槛金额 减少金额可用 0表示 无门槛
|
||||||
|
*/
|
||||||
|
private BigDecimal threshold;
|
||||||
|
/**
|
||||||
|
* 优惠类型 1满减 2折扣 下拉框列表
|
||||||
|
*/
|
||||||
|
private Integer couponType;
|
||||||
|
/**
|
||||||
|
* 折扣力度
|
||||||
|
*/
|
||||||
|
private BigDecimal discount;
|
||||||
|
/**
|
||||||
|
* 优惠券面额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
/**
|
||||||
|
* 有效期 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
/**
|
||||||
|
* 有效期 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
/**
|
||||||
|
* 单词最大数量 0代表无限制
|
||||||
|
*/
|
||||||
|
private Integer maxNum;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:CouponMiddle
|
||||||
|
* @Date:2024/5/9 16:16
|
||||||
|
*/
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券中间表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CouponRel {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 优惠券id
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 优惠券状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 领取时间
|
||||||
|
*/
|
||||||
|
private String getTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:OrderAssociation
|
||||||
|
* @Date:2024/5/10 20:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName("order_association")
|
||||||
|
public class OrderAssociation {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* sku信息id
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String skuTitle;
|
||||||
|
/**
|
||||||
|
*图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
private BigDecimal orderPrice;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
private Long stock;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:Ordernfo
|
||||||
|
* @Date:2024/5/9 17:03
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "order_info")
|
||||||
|
public class OrderInfo {
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
/**
|
||||||
|
* 订单状态 0-待付款 1-待发货 2-待收获 3-待评价 4-已完成 5-已关闭
|
||||||
|
*/
|
||||||
|
private Integer status = 0;
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 订单更新时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
/**
|
||||||
|
* 订单支付时间
|
||||||
|
*/
|
||||||
|
private String payTime;
|
||||||
|
/**
|
||||||
|
* 订单发货时间
|
||||||
|
*/
|
||||||
|
private String deliveryTime;
|
||||||
|
/**
|
||||||
|
* 订单收获时间
|
||||||
|
*/
|
||||||
|
private String receiveTime;
|
||||||
|
/**
|
||||||
|
* 订单关闭时间
|
||||||
|
*/
|
||||||
|
private String closeTime;
|
||||||
|
/**
|
||||||
|
* 订单支付类型 0-在线支付 1-货到付款 2-代付
|
||||||
|
*/
|
||||||
|
private Integer payType;
|
||||||
|
/**
|
||||||
|
* 订单支付方式 0 - 微信支付 1 - 支付宝
|
||||||
|
*/
|
||||||
|
private Integer payWay;
|
||||||
|
/**
|
||||||
|
* 订单支付流水号
|
||||||
|
*/
|
||||||
|
private String payNo;
|
||||||
|
/**
|
||||||
|
* 下单人
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* skuid
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 商品详情集合
|
||||||
|
*/
|
||||||
|
private List<ProductDetailInfo> productDetails;
|
||||||
|
/**
|
||||||
|
* 优惠券id
|
||||||
|
*/
|
||||||
|
private List<Integer> couponIds;
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
private Integer integral;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:PriceDetail
|
||||||
|
* @Date:2024/5/8 10:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品小计
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class PriceDetail {
|
||||||
|
/**
|
||||||
|
* 商品总价
|
||||||
|
*/
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
/**
|
||||||
|
* 会员抵扣
|
||||||
|
*/
|
||||||
|
private BigDecimal memberPrice;
|
||||||
|
/**
|
||||||
|
* 积分抵扣
|
||||||
|
* pointPrice;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最终价格
|
||||||
|
*/
|
||||||
|
private BigDecimal finalPrice;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.ruoyi.mall.car.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:ProductDetailInfo
|
||||||
|
* @Date:2024/5/8 10:27
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 商品详情信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ProductDetailInfo {
|
||||||
|
/**
|
||||||
|
* skuId
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 规格名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 商品价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 购买数量
|
||||||
|
*/
|
||||||
|
private Integer buyNumber;
|
||||||
|
/**
|
||||||
|
* 商品标题
|
||||||
|
*/
|
||||||
|
private String productTitle;
|
||||||
|
/**
|
||||||
|
* 商品规格主图片
|
||||||
|
*/
|
||||||
|
private String skuImg;
|
||||||
|
/**
|
||||||
|
* sku库存
|
||||||
|
*/
|
||||||
|
private Integer skuStock;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* userId
|
||||||
|
* orderId 得要
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.ruoyi.mall.car.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain.request
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:OrderRequest
|
||||||
|
* @Date:2024/5/9 17:17
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单请求信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class OrderRequest {
|
||||||
|
/**
|
||||||
|
* skuIds
|
||||||
|
*/
|
||||||
|
private List<Long> skuIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券id
|
||||||
|
*/
|
||||||
|
private List<Integer> couponIds;
|
||||||
|
/**
|
||||||
|
* 支付类型
|
||||||
|
*/
|
||||||
|
private Integer payWay;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.ruoyi.mall.car.domain.response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zrk
|
||||||
|
* @Package:com.ruoyi.java.com.ruoyi.mall.car.domain.response
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:OrderResp
|
||||||
|
* @Date:2024/5/12 20:27
|
||||||
|
*/
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单详情信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class OrderDetailResp {
|
||||||
|
private Long orderId;
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
private String createTime;
|
||||||
|
private Long userId;
|
||||||
|
private String image;
|
||||||
|
private String sku;
|
||||||
|
private Long stock;
|
||||||
|
private String name;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.ruoyi.car;
|
||||||
|
|
||||||
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableRyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableScheduling//定时器
|
||||||
|
@ComponentScan("com.ruoyi")
|
||||||
|
public class RuoYiMallCarApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(RuoYiMallCarApplication.class,args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 商城 - 购物车模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.ruoyi.car.config;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.rabbit.config.RabbitMQConfig;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CarRabbitMQConfig implements RabbitTemplate.ConfirmCallback,RabbitTemplate.ReturnsCallback{
|
||||||
|
|
||||||
|
public static final String QUEUE = "msgQueue";
|
||||||
|
public static final String EXCHANGE = "msgExchange";
|
||||||
|
public static final String ROUTINGKEY = "msgKey";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final Logger logger = LoggerFactory.getLogger(RabbitMQConfig.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
//创建消息转换器
|
||||||
|
@Bean
|
||||||
|
public MessageConverter messageConverter(){
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue queue(){
|
||||||
|
return new Queue(QUEUE,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DirectExchange directExchange(){
|
||||||
|
|
||||||
|
return new DirectExchange(EXCHANGE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding binding(){
|
||||||
|
return BindingBuilder.bind(queue()).to(directExchange()).with(ROUTINGKEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Primary
|
||||||
|
// @Bean
|
||||||
|
// public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory){
|
||||||
|
// RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
|
||||||
|
// rabbitTemplate.setMessageConverter(messageConverter());
|
||||||
|
//
|
||||||
|
// this.rabbitTemplate = rabbitTemplate;
|
||||||
|
// rabbitTemplate();
|
||||||
|
// return rabbitTemplate;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启事务机制 针对生产者投递消息到交换机或队列 注意:事务机制和消息确认机制不能同时使用
|
||||||
|
* @param connectionFactory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @Bean
|
||||||
|
// public RabbitTransactionManager transactionManager(ConnectionFactory connectionFactory){
|
||||||
|
// return new RabbitTransactionManager(connectionFactory);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void rabbitTemplate(){
|
||||||
|
|
||||||
|
rabbitTemplate.setConfirmCallback(this);
|
||||||
|
rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean ack, String s) {
|
||||||
|
|
||||||
|
if (ack){
|
||||||
|
logger.info("{}消息到达交换机",correlationData.getId());
|
||||||
|
}else {
|
||||||
|
logger.info("{}消息丢失", correlationData.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
|
||||||
|
logger.error("{}消息未到达队列",returnedMessage.getMessage().getMessageProperties().getMessageId());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.car.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "pay.ali")
|
||||||
|
public class PayConfig {
|
||||||
|
@Value("${pay.ali.appid}")
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
|
||||||
|
private String gatewayUrl;
|
||||||
|
private String privateKey;
|
||||||
|
private String notifyUrl;
|
||||||
|
private String returnUrl;
|
||||||
|
private String format = "json";
|
||||||
|
private String charset;
|
||||||
|
private String alipayPublicKey;
|
||||||
|
private String signType;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.car.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisTemplateConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||||
|
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(connectionFactory);
|
||||||
|
GenericToStringSerializer genericToStringSerializer = new GenericToStringSerializer(Object.class);
|
||||||
|
redisTemplate.setValueSerializer(genericToStringSerializer);
|
||||||
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.afterPropertiesSet();
|
||||||
|
return redisTemplate;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.ruoyi.car.consumer;
|
||||||
|
|
||||||
|
import com.ruoyi.car.config.CarRabbitMQConfig;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderAssociation;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
//监听队列
|
||||||
|
@RabbitListener(queues = CarRabbitMQConfig.QUEUE)
|
||||||
|
@Log4j2
|
||||||
|
public class RabbitConsumer {
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@RabbitHandler
|
||||||
|
public void pushOrder(OrderAssociation orderAssociation, Channel channel, Message message) {
|
||||||
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
|
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||||
|
log.info("messageId:" + messageId, "签证:" + deliveryTag);
|
||||||
|
redisService.setCacheObject("orderAssociation:",orderAssociation);
|
||||||
|
try {
|
||||||
|
log.info("订单信息已经保存:"+orderAssociation);
|
||||||
|
System.out.println("mq中的消息"+orderAssociation);
|
||||||
|
// 确认消息已被消费
|
||||||
|
channel.basicNack(deliveryTag,false,false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("处理订单失败"+e.getMessage());
|
||||||
|
try {
|
||||||
|
// 拒绝消息并重新放入队列
|
||||||
|
channel.basicNack(deliveryTag,false,true);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.ruoyi.car.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.car.service.CarService;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.mall.car.domain.CarDetailInfo;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/car")
|
||||||
|
@ApiOperation(value = "购物车操作", tags = "首页")
|
||||||
|
public class CarController {
|
||||||
|
@Autowired
|
||||||
|
private CarService carService;
|
||||||
|
@PostMapping("/addCar")
|
||||||
|
@ApiOperation("新增购物车信息")
|
||||||
|
public R addCar(@RequestParam Long skuId, @RequestParam Integer status){
|
||||||
|
carService.addCar(skuId,status);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateCar")
|
||||||
|
@ApiOperation("修改购物车数量")
|
||||||
|
public R updateCarNumber(@RequestParam Long skuId,@RequestParam Integer number){
|
||||||
|
carService.updateCarNumber(skuId,number);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/deleteCar")
|
||||||
|
@ApiOperation("清除购物车")
|
||||||
|
public R deleteCar(){
|
||||||
|
carService.deleteCar();
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
@PostMapping("/selectCarInfo")
|
||||||
|
@ApiOperation("根据token查询购物车信息")
|
||||||
|
public R<CarDetailInfo> carInfo(){
|
||||||
|
return R.ok(carService.selectCarInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券
|
||||||
|
* @param flag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/detail")
|
||||||
|
@ApiOperation("详情")
|
||||||
|
public R<CarDetailInfo> getDetail(int flag){
|
||||||
|
carService.getDetail(flag);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ruoyi.car.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.car.service.OrderService;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.mall.car.domain.request.OrderRequest;
|
||||||
|
import com.ruoyi.mall.car.domain.response.OrderDetailResp;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "订单操作", tags = "首页")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order")
|
||||||
|
public class OrderController {
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
@ApiOperation("创建订单")
|
||||||
|
@PostMapping("/info")
|
||||||
|
public R<Long> createOrder(@RequestBody OrderRequest orderRequest){
|
||||||
|
return R.ok(orderService.createOrder(orderRequest));
|
||||||
|
}
|
||||||
|
@ApiOperation("订单详情")
|
||||||
|
@PostMapping("/getOrderDetail")
|
||||||
|
public R<List<OrderDetailResp>> getOrderDetail(@RequestBody OrderRequest orderRequest){
|
||||||
|
List<OrderDetailResp> orderDetail = orderService.getOrderDetail(orderRequest);
|
||||||
|
return R.ok(orderDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.car.img;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
public class ImgMain {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
/**
|
||||||
|
* http://127.0.0.1:9300/statics/2024/05/10/wallhaven-g7elo3_20240510152959A001.jpg
|
||||||
|
*/
|
||||||
|
// String inputImagePath = "http://127.0.0.1:9300/statics/2024/05/10/wallhaven-g7elo3_20240510152959A001.jpg";
|
||||||
|
|
||||||
|
//图片路径
|
||||||
|
String inputImagePath = "D:\\wallhaven-g7elo3.jpg";
|
||||||
|
// 输出图片路径
|
||||||
|
String outputImagePath ="D:\\wallhavenTarget.jpg";
|
||||||
|
/**
|
||||||
|
*压缩大小
|
||||||
|
*/
|
||||||
|
int targetWidth =180;
|
||||||
|
int targetHeight =180;
|
||||||
|
try {
|
||||||
|
BufferedImage inputImage = ImageIO.read(new File(inputImagePath));
|
||||||
|
// 获取原始图片尺寸
|
||||||
|
int originalWidth = inputImage.getWidth();
|
||||||
|
int originalHeight = inputImage.getHeight();
|
||||||
|
// 创建一个新的BufferedImage 存放出来后的图片
|
||||||
|
BufferedImage outputImage = new BufferedImage(targetWidth, targetHeight, inputImage.getType());
|
||||||
|
// 创建一个 Graphics2D 对象,用于绘制新图片
|
||||||
|
Graphics2D graphics =outputImage.createGraphics();
|
||||||
|
//如果原始图片大于目标尺寸,进行压缩
|
||||||
|
if (originalWidth > targetWidth || originalHeight > targetHeight){
|
||||||
|
Image scaledImage = inputImage.getScaledInstance(targetWidth,targetHeight,Image.SCALE_SMOOTH);
|
||||||
|
graphics.drawImage(scaledImage,0,0,null);
|
||||||
|
}else {
|
||||||
|
// 如果原始尺寸小于目标尺寸 进行拉伸
|
||||||
|
graphics.drawImage(inputImage,0,0,targetWidth,targetHeight,null);
|
||||||
|
}
|
||||||
|
//释放资源
|
||||||
|
graphics.dispose();
|
||||||
|
// 保存处理后的图片
|
||||||
|
ImageIO.write(outputImage,"jpg",new File(outputImagePath));
|
||||||
|
System.out.println("输出路径为"+outputImagePath+"宽高为"+targetWidth+"*"+targetHeight);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.ruoyi.car.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.car.domain.CarAssociation;
|
||||||
|
import com.ruoyi.mall.car.domain.CarInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CarMapper extends BaseMapper<CarInfo> {
|
||||||
|
/**
|
||||||
|
* 根据carId 获取购物车信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CarInfo findByCarInfo(@Param("carId") String carId);
|
||||||
|
/**
|
||||||
|
* 新增关联表
|
||||||
|
*/
|
||||||
|
void addCarAssociation(CarAssociation carAssociation);
|
||||||
|
/**
|
||||||
|
* 根据carId查看信息
|
||||||
|
*/
|
||||||
|
CarAssociation findByCarAssociationByCarId(@Param("carId") String carId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*查询商品sku信息
|
||||||
|
* 根据传过来的skuId查询sku信息
|
||||||
|
*/
|
||||||
|
MallProductSkuInfo findByMallProductSkuInfo(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数量
|
||||||
|
*/
|
||||||
|
void updateCarNumber(CarInfo carInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据购物车id来此查询
|
||||||
|
* @param carId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CarAssociation findByCarAssociation(Long carId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息表查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// CarAssociation selectCarAssociation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除购物车
|
||||||
|
*/
|
||||||
|
void deleteCar(@Param("carId") String carId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空购物车(2)
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteCarAssociation(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id查询car信息 拿到carId
|
||||||
|
*/
|
||||||
|
CarInfo findByUserIdGetByCarId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询集合
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MallProductSkuInfo> selectProductList(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查商品信息
|
||||||
|
* @param skuId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MallProductInfo selectProductInfo(Long skuId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据skuId查询购物车关联信息
|
||||||
|
*/
|
||||||
|
CarInfo selectFindSkuIdByCar(@Param("skuId") Long skuId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据skuId 查询购物车信息
|
||||||
|
*/
|
||||||
|
CarAssociation selectCarAssociationBySkuId(@Param("skuId") Long skuId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过skuIds 查询
|
||||||
|
* @param skuIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MallProductSkuInfo selectSkuIds(List<Long> skuIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id 查询价格
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BigDecimal findSumPrice(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderInfo> selectOrderInfo();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.ruoyi.car.mapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderAssociation;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.response.OrderDetailResp;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import java.util.List;
|
||||||
|
@Mapper
|
||||||
|
public interface OrderMapper extends BaseMapper<OrderInfo> {
|
||||||
|
/**
|
||||||
|
* 关联表信息新增
|
||||||
|
* @param orderAssociation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void insertOrderAssociation(OrderAssociation orderAssociation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息列表 联查
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderDetailResp> selectOrderList();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.ruoyi.car.pay;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.AlipayClient;
|
||||||
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||||
|
|
||||||
|
/* *
|
||||||
|
*类名:AlipayConfig
|
||||||
|
*功能:基础配置类
|
||||||
|
*详细:设置帐户有关信息及返回路径
|
||||||
|
*修改日期:2017-04-05
|
||||||
|
*说明:
|
||||||
|
*以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||||
|
*该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AlipayConfig {
|
||||||
|
public static void main(String[] args) throws AlipayApiException {
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient(
|
||||||
|
// 支付宝网关地址
|
||||||
|
"https://openapi-sandbox.dl.alipaydev.com/gateway.do",
|
||||||
|
"9021000136690041",
|
||||||
|
"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCexq+5q7A8QZBhRicv2gqG7k/5H2PhHYJ60QXnWwvbzixgZcEVJU1aRHFZxrSxQ2TZE7gQniPy0Gnob9xuhACytEA2XloKS1/pzP94qdF3wRj85irTTT+Wc3GLH7Oatd7zbDx2tiospsNy13PPFWnMbla+9TVV3ix9AHF4YD+pnacWSBPJoAgg/Jx1JOHBj4ffMCXHPlln5Zd46f9nUzpbtagmiIEAPj8Mz4dRnU7HXMOKr4MDiYkYBVdcrMdYGl8UOU/35a8RCjrpKPtkF+pbRoD75l+cVxmhfWdce5qqwi88CiMkQkopV4o9hEc08lGX+y30rIA57sv5TnDTbfzlAgMBAAECggEAFZnKRmRJMalpzxIQOr5bOEgrsSTIHdQ58COHvhXw4xKFjwfI4OuWPnWZRjF2W7djfPTl0bzx/xLDlc/CGXbz8Vv8cGkdrtDaV6CAERZpXPV0RNO7d8vGnt1N0TOa561ei5dqEmxuCG0XogQVyVKMdjd8rbYGb4wuWUM6LLpLbvPAwVgAHZMkX7h1/GdCfsfiVgFTYFer5tgFSMoYxORXJeDzwUqHnqf5lXll8SYeO8MW+GkKhvDohtswSeA3xPaZ0MKpXo3F60pog71TKoek1FQ15CaA14SSaXIe8HD3wLWqhKfeSM5xow/DQAx48i+3EqzZYsPTz48Tw3+0iqdicQKBgQDawj8eoC+DfJdCu4S5dWCi8UcQmanlp4T5TBQ4wld2CbO/KtW/Nu7KVoIAN6n7p0DyiMQboSqBCP6Vg8bpxGTJWmqzxeHHUJTu9UbIor1/QXP+/26NPKu+VjprIH5+E5T66ZZvzcCCntckBr3X7FvsnH+KvIjGkkJ53jcu5rmwZwKBgQC5zlQHCH+8uLNI0T+3HK6TN4nyj3WM8jlzUByX7f77RQbNPXEJayUvL7psCd6rZA/LKh3adtSnId6zAEbdxdShHUDTDwK+QrA4XdZJClEiSXR/OC23GKbSczbM17pDefbJrMUoz07UtJx4mGfFHWKPo0fWrtv8K6rY3Yvxk7Ko0wKBgQDDKbDuPbKl961q16idXF6Of/sKkEzGmiFD19/ik18764P09N4k7Xk0AuGQGBkKbji/J8ztaWdmHwQhl6MKQzA3gvbW05+OFhII7cHslWPB+D7oLDIQxyPhd0Q+9opjKE0tXN/ddw5ceiEt/uW3kSKhgS04NONBZJLx7pIEwcq/2QKBgHb3vyGJtZA2isSzBiLOgJDOXMssQ83tQg+tWcGFp19nQQWks32eVv6xhqGqaCJBPUOOQfMhZuNkcl0WbkmNY6mNO3ZoBA+iT4anvo6hxnU3pxnV9J9pb1cMYigicKbHrtZOgyawJf9XbWBh5P924yapG1RAPaZmp0uX/wS81wX1AoGBAM+IjIJT9s8DWotmo4XPAIj4ILrZfGkSBBBJwVgwmyj5XXbU6OMWdZxzjgPpBheTgcNxb6bcywF0KsMee/9bLy2SYcAX6+50j2OUp3stbmFYxNNDDgo8KV/xpweWDQYWr3QZVDUm28G1UdSgau1ohD6op8IACpBqdHWXwQhuq8p7\n",
|
||||||
|
"json",
|
||||||
|
"UTF-8",
|
||||||
|
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtIR3PTbTkyGY4GNeDOT+dhGq9Mdxn7oDspHABx0ZvMb0gMAwNMOkCJHRlXD+WB1E1SIEYFfC8iyB/n7EZ7xKsEkIqydx3RNq/GMXtOuGoPpLRqBbQJKhXoiOZy10iCu/eR3uQvS/rIJVK6Fy686Vd0+SrCx4M1u1E9tuenhjyQ+5r7/IpnWD+6Z/J2cmYLxDCJ771nsBSFtX6u+QhNN0WLtjwdkHV5ixqYXNoyjjHpoh5sfz5jDEW4bP0nmtSiFyWF6UAh19f1iBmeJ3wKBYXIRy9pNeqWLmDST2yqhDK/H0NWak/akZcbXnRBzWt72bwseqrcs0OQD/x+qJHI0tuQIDAQAB\n",
|
||||||
|
"RSA2");
|
||||||
|
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||||
|
//异步接收地址,仅支持http/https,公网可访问
|
||||||
|
request.setNotifyUrl("");
|
||||||
|
//同步跳转地址,仅支持http/https
|
||||||
|
request.setReturnUrl("");
|
||||||
|
/******必传参数******/
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
//商户订单号,商家自定义,保持唯一性
|
||||||
|
bizContent.put("out_trade_no", "20210817010101004");
|
||||||
|
//支付金额,最小值0.01元
|
||||||
|
bizContent.put("total_amount", 0.01);
|
||||||
|
//订单标题,不可使用特殊符号
|
||||||
|
bizContent.put("subject", "测试商品");
|
||||||
|
//电脑网站支付场景固定传值FAST_INSTANT_TRADE_PAY
|
||||||
|
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY");
|
||||||
|
|
||||||
|
/******可选参数******/
|
||||||
|
//bizContent.put("time_expire", "2022-08-01 22:00:00");
|
||||||
|
|
||||||
|
//// 商品明细信息,按需传入
|
||||||
|
//JSONArray goodsDetail = new JSONArray();
|
||||||
|
//JSONObject goods1 = new JSONObject();
|
||||||
|
//goods1.put("goods_id", "goodsNo1");
|
||||||
|
//goods1.put("goods_name", "子商品1");
|
||||||
|
//goods1.put("quantity", 1);
|
||||||
|
//goods1.put("price", 0.01);
|
||||||
|
//goodsDetail.add(goods1);
|
||||||
|
//bizContent.put("goods_detail", goodsDetail);
|
||||||
|
|
||||||
|
//// 扩展信息,按需传入
|
||||||
|
//JSONObject extendParams = new JSONObject();
|
||||||
|
//extendParams.put("sys_service_provider_id", "2088511833207846");
|
||||||
|
//bizContent.put("extend_params", extendParams);
|
||||||
|
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "POST");
|
||||||
|
// 如果需要返回GET请求,请使用
|
||||||
|
// AlipayTradePagePayResponse response = alipayClient.pageExecute(request,"GET");
|
||||||
|
String pageRedirectionData = response.getBody();
|
||||||
|
System.out.println(pageRedirectionData);
|
||||||
|
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
System.out.println("调用成功");
|
||||||
|
} else {
|
||||||
|
System.out.println("调用失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.ruoyi.car.pay.PayController;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.car.config.PayConfig;
|
||||||
|
import com.ruoyi.car.pay.service.PayService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pay")
|
||||||
|
public class PayController {
|
||||||
|
@Autowired
|
||||||
|
private PayService payService;
|
||||||
|
@Autowired
|
||||||
|
PayConfig payConfig;
|
||||||
|
|
||||||
|
@GetMapping("/toPay")
|
||||||
|
public void createOrder(@RequestParam Long orderId, HttpServletResponse response) {
|
||||||
|
// payService.toPay(orderId);
|
||||||
|
response.setContentType("text/html;charset=" + payConfig.getCharset());
|
||||||
|
try {
|
||||||
|
response.getWriter().write(payService.toPay(orderId));
|
||||||
|
response.getWriter().flush();
|
||||||
|
response.getWriter().close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@PostMapping("/notify")
|
||||||
|
public R notify(HttpServletRequest request) {
|
||||||
|
// 从request中获取所有参数
|
||||||
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||||
|
for (String key : parameterMap.keySet()) {
|
||||||
|
String[] values = parameterMap.get(key);
|
||||||
|
for (String value : values) {
|
||||||
|
System.out.println(key + ":" + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.ruoyi.car.pay.service;
|
||||||
|
|
||||||
|
public interface PayService {
|
||||||
|
public String toPay(Long orderId);
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.ruoyi.car.pay.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.AlipayClient;
|
||||||
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||||
|
import com.ruoyi.car.config.PayConfig;
|
||||||
|
import com.ruoyi.car.pay.service.PayService;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PayServiceImpl implements PayService {
|
||||||
|
@Autowired
|
||||||
|
private PayConfig payConfig;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Override
|
||||||
|
public String toPay(Long orderId) {
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient(
|
||||||
|
// 支付宝网关地址
|
||||||
|
"https://openapi-sandbox.dl.alipaydev.com/gateway.do",
|
||||||
|
"9021000136690041",
|
||||||
|
"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCexq+5q7A8QZBhRicv2gqG7k/5H2PhHYJ60QXnWwvbzixgZcEVJU1aRHFZxrSxQ2TZE7gQniPy0Gnob9xuhACytEA2XloKS1/pzP94qdF3wRj85irTTT+Wc3GLH7Oatd7zbDx2tiospsNy13PPFWnMbla+9TVV3ix9AHF4YD+pnacWSBPJoAgg/Jx1JOHBj4ffMCXHPlln5Zd46f9nUzpbtagmiIEAPj8Mz4dRnU7HXMOKr4MDiYkYBVdcrMdYGl8UOU/35a8RCjrpKPtkF+pbRoD75l+cVxmhfWdce5qqwi88CiMkQkopV4o9hEc08lGX+y30rIA57sv5TnDTbfzlAgMBAAECggEAFZnKRmRJMalpzxIQOr5bOEgrsSTIHdQ58COHvhXw4xKFjwfI4OuWPnWZRjF2W7djfPTl0bzx/xLDlc/CGXbz8Vv8cGkdrtDaV6CAERZpXPV0RNO7d8vGnt1N0TOa561ei5dqEmxuCG0XogQVyVKMdjd8rbYGb4wuWUM6LLpLbvPAwVgAHZMkX7h1/GdCfsfiVgFTYFer5tgFSMoYxORXJeDzwUqHnqf5lXll8SYeO8MW+GkKhvDohtswSeA3xPaZ0MKpXo3F60pog71TKoek1FQ15CaA14SSaXIe8HD3wLWqhKfeSM5xow/DQAx48i+3EqzZYsPTz48Tw3+0iqdicQKBgQDawj8eoC+DfJdCu4S5dWCi8UcQmanlp4T5TBQ4wld2CbO/KtW/Nu7KVoIAN6n7p0DyiMQboSqBCP6Vg8bpxGTJWmqzxeHHUJTu9UbIor1/QXP+/26NPKu+VjprIH5+E5T66ZZvzcCCntckBr3X7FvsnH+KvIjGkkJ53jcu5rmwZwKBgQC5zlQHCH+8uLNI0T+3HK6TN4nyj3WM8jlzUByX7f77RQbNPXEJayUvL7psCd6rZA/LKh3adtSnId6zAEbdxdShHUDTDwK+QrA4XdZJClEiSXR/OC23GKbSczbM17pDefbJrMUoz07UtJx4mGfFHWKPo0fWrtv8K6rY3Yvxk7Ko0wKBgQDDKbDuPbKl961q16idXF6Of/sKkEzGmiFD19/ik18764P09N4k7Xk0AuGQGBkKbji/J8ztaWdmHwQhl6MKQzA3gvbW05+OFhII7cHslWPB+D7oLDIQxyPhd0Q+9opjKE0tXN/ddw5ceiEt/uW3kSKhgS04NONBZJLx7pIEwcq/2QKBgHb3vyGJtZA2isSzBiLOgJDOXMssQ83tQg+tWcGFp19nQQWks32eVv6xhqGqaCJBPUOOQfMhZuNkcl0WbkmNY6mNO3ZoBA+iT4anvo6hxnU3pxnV9J9pb1cMYigicKbHrtZOgyawJf9XbWBh5P924yapG1RAPaZmp0uX/wS81wX1AoGBAM+IjIJT9s8DWotmo4XPAIj4ILrZfGkSBBBJwVgwmyj5XXbU6OMWdZxzjgPpBheTgcNxb6bcywF0KsMee/9bLy2SYcAX6+50j2OUp3stbmFYxNNDDgo8KV/xpweWDQYWr3QZVDUm28G1UdSgau1ohD6op8IACpBqdHWXwQhuq8p7\n",
|
||||||
|
"json",
|
||||||
|
"UTF-8",
|
||||||
|
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtIR3PTbTkyGY4GNeDOT+dhGq9Mdxn7oDspHABx0ZvMb0gMAwNMOkCJHRlXD+WB1E1SIEYFfC8iyB/n7EZ7xKsEkIqydx3RNq/GMXtOuGoPpLRqBbQJKhXoiOZy10iCu/eR3uQvS/rIJVK6Fy686Vd0+SrCx4M1u1E9tuenhjyQ+5r7/IpnWD+6Z/J2cmYLxDCJ771nsBSFtX6u+QhNN0WLtjwdkHV5ixqYXNoyjjHpoh5sfz5jDEW4bP0nmtSiFyWF6UAh19f1iBmeJ3wKBYXIRy9pNeqWLmDST2yqhDK/H0NWak/akZcbXnRBzWt72bwseqrcs0OQD/x+qJHI0tuQIDAQAB\n",
|
||||||
|
"RSA2");
|
||||||
|
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||||
|
//异步接收地址,仅支持http/https,公网可访问
|
||||||
|
request.setNotifyUrl(payConfig.getNotifyUrl());
|
||||||
|
//同步跳转地址,仅支持http/https
|
||||||
|
request.setReturnUrl(payConfig.getReturnUrl());
|
||||||
|
/******必传参数******/
|
||||||
|
|
||||||
|
// Object cacheObject = redisService.getCacheObject("orderId:"+orderId);
|
||||||
|
// if (cacheObject == null){
|
||||||
|
// throw new RuntimeException("订单不存在");
|
||||||
|
// }
|
||||||
|
// OrderInfo orderInfo = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), OrderInfo.class);
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
|
||||||
|
|
||||||
|
//商户订单号,商家自定义,保持唯一性
|
||||||
|
bizContent.put("out_trade_no", orderId);
|
||||||
|
//支付金额,最小值0.01元
|
||||||
|
bizContent.put("total_amount", 0.01);
|
||||||
|
//订单标题,不可使用特殊符号
|
||||||
|
bizContent.put("subject", "测试商品");
|
||||||
|
//电脑网站支付场景固定传值FAST_INSTANT_TRADE_PAY
|
||||||
|
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY");
|
||||||
|
|
||||||
|
/******可选参数******/
|
||||||
|
//bizContent.put("time_expire", "2022-08-01 22:00:00");
|
||||||
|
|
||||||
|
//// 商品明细信息,按需传入
|
||||||
|
//JSONArray goodsDetail = new JSONArray();
|
||||||
|
//JSONObject goods1 = new JSONObject();
|
||||||
|
//goods1.put("goods_id", "goodsNo1");
|
||||||
|
//goods1.put("goods_name", "子商品1");
|
||||||
|
//goods1.put("quantity", 1);
|
||||||
|
//goods1.put("price", 0.01);
|
||||||
|
//goodsDetail.add(goods1);
|
||||||
|
//bizContent.put("goods_detail", goodsDetail);
|
||||||
|
|
||||||
|
//// 扩展信息,按需传入
|
||||||
|
//JSONObject extendParams = new JSONObject();
|
||||||
|
//extendParams.put("sys_service_provider_id", "2088511833207846");
|
||||||
|
//bizContent.put("extend_params", extendParams);
|
||||||
|
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
AlipayTradePagePayResponse response = null;
|
||||||
|
try {
|
||||||
|
response = alipayClient.pageExecute(request, "POST");
|
||||||
|
|
||||||
|
} catch (AlipayApiException e) {
|
||||||
|
throw new RuntimeException("調用支付网关异常,");
|
||||||
|
}
|
||||||
|
// 如果需要返回GET请求,请使用
|
||||||
|
// AlipayTradePagePayResponse response = alipayClient.pageExecute(request,"GET");
|
||||||
|
String pageRedirectionData = response.getBody();
|
||||||
|
log.info(pageRedirectionData);
|
||||||
|
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
log.info("调用成功");
|
||||||
|
return pageRedirectionData;
|
||||||
|
} else {
|
||||||
|
log.error("调用失败");
|
||||||
|
throw new RuntimeException("调通支付网关异常!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ruoyi.car.producer;
|
||||||
|
|
||||||
|
import com.ruoyi.car.config.CarRabbitMQConfig;
|
||||||
|
import com.ruoyi.common.core.utils.uuid.UUID;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderAssociation;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mq")
|
||||||
|
public class Producer {
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@PostMapping("pushOrder2")
|
||||||
|
public void pushOrder(@RequestBody OrderAssociation orderAssociation) {
|
||||||
|
rabbitTemplate.convertAndSend(CarRabbitMQConfig.EXCHANGE, CarRabbitMQConfig.ROUTINGKEY, orderAssociation,
|
||||||
|
message -> {
|
||||||
|
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
|
return message;
|
||||||
|
}, new CorrelationData(UUID.randomUUID().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.ruoyi.car.producer;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.car.config.CarRabbitMQConfig;
|
||||||
|
import com.ruoyi.common.core.utils.uuid.UUID;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderAssociation;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mq生产者
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mq")
|
||||||
|
public class RabbitProducer {
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
@PostMapping("/pushOrder")
|
||||||
|
public void pushOrder(@RequestBody OrderAssociation orderAssociation){
|
||||||
|
rabbitTemplate.convertAndSend(CarRabbitMQConfig.EXCHANGE,CarRabbitMQConfig.ROUTINGKEY,orderAssociation,
|
||||||
|
message -> {
|
||||||
|
//唯一标识 生成UUID作为消息ID 讲ID设置到消息的属行中
|
||||||
|
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
|
return message;
|
||||||
|
},new CorrelationData(UUID.randomUUID().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.ruoyi.car.service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.mall.car.domain.CarDetailInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.CarInfo;
|
||||||
|
|
||||||
|
|
||||||
|
public interface CarService extends IService<CarInfo> {
|
||||||
|
/**
|
||||||
|
* 新增购物车
|
||||||
|
* @param skuId
|
||||||
|
* @param status
|
||||||
|
*/
|
||||||
|
void addCar(Long skuId, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param skuId
|
||||||
|
* @param number
|
||||||
|
*/
|
||||||
|
void updateCarNumber(Long skuId, Integer number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除购物车
|
||||||
|
*/
|
||||||
|
void deleteCar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CarDetailInfo selectCarInfo();
|
||||||
|
|
||||||
|
CarDetailInfo getDetail(int flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// BigDecimal getTotalPrice(List<Long> skuIds);
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.ruoyi.car.service;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.request.OrderRequest;
|
||||||
|
import com.ruoyi.mall.car.domain.response.OrderDetailResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单业务层
|
||||||
|
*/
|
||||||
|
public interface OrderService extends IService<OrderInfo> {
|
||||||
|
/**
|
||||||
|
* 创建订单
|
||||||
|
* @param orderRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
Long createOrder(OrderRequest orderRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单展示
|
||||||
|
* @param orderRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderDetailResp> getOrderDetail(OrderRequest orderRequest);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,279 @@
|
||||||
|
package com.ruoyi.car.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.car.mapper.CarMapper;
|
||||||
|
import com.ruoyi.car.service.CarService;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.mall.car.domain.*;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
||||||
|
import com.ruoyi.system.domain.model.LoginUser;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CarServiceImpl extends ServiceImpl<CarMapper, CarInfo>
|
||||||
|
implements CarService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarMapper carMapper;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Override
|
||||||
|
public void addCar(Long skuId, Integer status) {
|
||||||
|
// 1添加数量 2-减少数量
|
||||||
|
if (skuId == null || status != 1 && status != 2) {
|
||||||
|
throw new RuntimeException("skuId不存在 或状态值不合法");
|
||||||
|
}
|
||||||
|
// 根据用户id查询购物车id(购物车信息表)
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
CarAssociation byCarAssociation = carMapper.findByCarAssociation(userid);
|
||||||
|
//不存在 新增一条
|
||||||
|
if (byCarAssociation == null) {
|
||||||
|
// 根据传过来的skuId获取信息 skuInfo
|
||||||
|
MallProductSkuInfo skuInfo = carMapper.findByMallProductSkuInfo(skuId);
|
||||||
|
CarInfo carInfo = new CarInfo();
|
||||||
|
String uuId = UUID.randomUUID().toString();
|
||||||
|
carInfo.setCarId(uuId);
|
||||||
|
carInfo.setNumber(1);
|
||||||
|
carInfo.setUserId(userid);
|
||||||
|
carInfo.setSkuId(skuInfo.getId());
|
||||||
|
carInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
carInfo.setCreateTime(new Date());
|
||||||
|
//新增购物车表
|
||||||
|
this.save(carInfo);
|
||||||
|
//增加购物车关联表
|
||||||
|
CarAssociation carAssociation = CarAssociation.builder()
|
||||||
|
.carId(carInfo.getCarId())
|
||||||
|
.userId(userid)
|
||||||
|
.build();
|
||||||
|
carMapper.addCarAssociation(carAssociation);
|
||||||
|
} else if (status == 1){
|
||||||
|
// 存在则修改数量(+1)
|
||||||
|
List<CarInfo> carInfoList = this.list();
|
||||||
|
//TODO stream流过滤
|
||||||
|
carInfoList.stream()
|
||||||
|
.filter(info -> info.getSkuId().equals(skuId))
|
||||||
|
.forEach(info -> {
|
||||||
|
info.setNumber(info.getNumber() + 1);
|
||||||
|
info.setUpdateTime(new Date());
|
||||||
|
carMapper.updateCarNumber(info);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
List<CarInfo> carInfoList = this.list();
|
||||||
|
carInfoList.stream()
|
||||||
|
.filter(info -> info.getSkuId().equals(skuId))
|
||||||
|
.forEach(info -> {
|
||||||
|
info.setNumber(info.getNumber() - 1);
|
||||||
|
info.setUpdateTime(new Date());
|
||||||
|
carMapper.updateCarNumber(info);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCarNumber(Long skuId, Integer number) {
|
||||||
|
if (skuId == null || number<0 ) {
|
||||||
|
throw new RuntimeException("skuId不存在,或数量不合法");
|
||||||
|
}
|
||||||
|
// 根据用户id查询购物车id(购物车信息表)
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
CarAssociation byCarAssociation = carMapper.findByCarAssociation(userid);
|
||||||
|
if (byCarAssociation == null){
|
||||||
|
throw new RuntimeException("购物车内无信息!");
|
||||||
|
}
|
||||||
|
// 根据关联的购物车id 修改 购物车数量 f0ca9549-3001-4e8a-8fb6-1316442c432e
|
||||||
|
CarAssociation carInfos = carMapper.findByCarAssociationByCarId(byCarAssociation.getCarId());
|
||||||
|
// TODO Mybatis-Plus不能用 这里的carId不是主键!----> CarInfo carInfo = this.getById(carInfos.getCarId());
|
||||||
|
CarInfo byCarInfo = carMapper.findByCarInfo(carInfos.getCarId());
|
||||||
|
byCarInfo.setNumber(number);
|
||||||
|
this.updateById(byCarInfo);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteCar() {
|
||||||
|
// 根据用户id查询购物车id(购物车信息表)
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
// 根据token找到购物车id
|
||||||
|
CarAssociation byCarAssociation = carMapper.findByCarAssociation(userid);
|
||||||
|
carMapper.deleteCar(byCarAssociation.getCarId());
|
||||||
|
carMapper.deleteCarAssociation(byCarAssociation.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CarDetailInfo selectCarInfo() {
|
||||||
|
CarDetailInfo carDetailInfo =new CarDetailInfo();
|
||||||
|
String carId = getCarId();
|
||||||
|
// 根据购物车id 查询购物车信息
|
||||||
|
LambdaQueryWrapper<CarInfo> queryWrapper = new LambdaQueryWrapper<CarInfo>() {{
|
||||||
|
eq(CarInfo::getCarId, carId);
|
||||||
|
}};
|
||||||
|
CarInfo carInfo = getOne(queryWrapper);
|
||||||
|
// TODO 数据库查询信息 findByCarId 根据carId
|
||||||
|
// 根据购物车中的skuId 获取 购物车详情信息
|
||||||
|
// 返回对象.
|
||||||
|
MallProductSkuInfo skuInfo = carMapper.findByMallProductSkuInfo(carInfo.getSkuId());
|
||||||
|
if (skuInfo == null){
|
||||||
|
throw new RuntimeException("没有查到信息");
|
||||||
|
}
|
||||||
|
if (skuInfo.getId() == null){
|
||||||
|
throw new RuntimeException("skuId不存在");
|
||||||
|
}
|
||||||
|
// 根据skuid查询 信息
|
||||||
|
List<MallProductSkuInfo> mallProductSkuInfos = carMapper.selectProductList(carInfo.getSkuId());
|
||||||
|
// 根据购物车id查询商品信息
|
||||||
|
MallProductInfo productInfo = carMapper.selectProductInfo(carInfo.getSkuId());
|
||||||
|
|
||||||
|
List<ProductDetailInfo> productDetailInfoList = new ArrayList<>();
|
||||||
|
|
||||||
|
ProductDetailInfo productDetailInfos = new ProductDetailInfo();
|
||||||
|
|
||||||
|
mallProductSkuInfos.forEach(item ->{
|
||||||
|
productDetailInfos.setProductTitle(item.getSku());
|
||||||
|
productDetailInfos.setSkuImg(item.getImage());
|
||||||
|
productDetailInfos.setSkuId(item.getId());
|
||||||
|
productDetailInfos.setName(productInfo.getName());
|
||||||
|
productDetailInfos.setPrice(item.getPrice());
|
||||||
|
productDetailInfos.setProductTitle(item.getSku());
|
||||||
|
productDetailInfos.setBuyNumber(Integer.valueOf(item.getNumber()));
|
||||||
|
productDetailInfoList.add(productDetailInfos);
|
||||||
|
carDetailInfo.setProductDetailInfoList(productDetailInfoList);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 如果redis有这个数据 直接查出来返回
|
||||||
|
if (redisService.hasKey("list")){
|
||||||
|
List<ProductDetailInfo> list = redisService.getCacheList("list");
|
||||||
|
for (ProductDetailInfo productDetailInfo : list) {
|
||||||
|
productDetailInfoList.add(productDetailInfo);
|
||||||
|
carDetailInfo.setProductDetailInfoList(productDetailInfoList);
|
||||||
|
return carDetailInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
redisService.setCacheList("list",productDetailInfoList);
|
||||||
|
return carDetailInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CarDetailInfo getDetail(int flag) {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
CarDetailInfo carDetailInfo =new CarDetailInfo();
|
||||||
|
String carId = getCarId();
|
||||||
|
// 根据购物车id 查询购物车信息
|
||||||
|
LambdaQueryWrapper<CarInfo> queryWrapper = new LambdaQueryWrapper<CarInfo>() {{
|
||||||
|
eq(CarInfo::getCarId, carId);
|
||||||
|
}};
|
||||||
|
CarInfo carInfo = getOne(queryWrapper);
|
||||||
|
// TODO 数据库查询信息 findByCarId 根据carId
|
||||||
|
// 根据购物车中的skuId 获取 购物车详情信息
|
||||||
|
// 返回对象.
|
||||||
|
MallProductSkuInfo skuInfo = carMapper.findByMallProductSkuInfo(carInfo.getSkuId());
|
||||||
|
if (skuInfo == null){
|
||||||
|
throw new RuntimeException("没有查到信息");
|
||||||
|
}
|
||||||
|
if (skuInfo.getId() == null){
|
||||||
|
throw new RuntimeException("skuId不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据skuid查询 信息
|
||||||
|
List<MallProductSkuInfo> mallProductSkuInfos = carMapper.selectProductList(carInfo.getSkuId());
|
||||||
|
// 根据购物车id查询商品信息
|
||||||
|
MallProductInfo productInfo = carMapper.selectProductInfo(carInfo.getSkuId());
|
||||||
|
|
||||||
|
List<ProductDetailInfo> productDetailInfoList = new ArrayList<>();
|
||||||
|
|
||||||
|
ProductDetailInfo productDetailInfos = new ProductDetailInfo();
|
||||||
|
|
||||||
|
mallProductSkuInfos.forEach(item ->{
|
||||||
|
productDetailInfos.setProductTitle(item.getSku());
|
||||||
|
productDetailInfos.setSkuImg(item.getImage());
|
||||||
|
productDetailInfos.setSkuId(item.getId());
|
||||||
|
productDetailInfos.setName(productInfo.getName());
|
||||||
|
productDetailInfos.setPrice(item.getPrice());
|
||||||
|
productDetailInfos.setProductTitle(item.getSku());
|
||||||
|
productDetailInfoList.add(productDetailInfos);
|
||||||
|
carDetailInfo.setProductDetailInfoList(productDetailInfoList);
|
||||||
|
// 拿到ids 集合
|
||||||
|
});
|
||||||
|
List<Long> skuIds = productDetailInfoList.stream().map(ProductDetailInfo::getSkuId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// TODO 计算价格
|
||||||
|
// 或 总价
|
||||||
|
carDetailInfo.setPriceDetail(getPriceDetail(productDetailInfoList));
|
||||||
|
// TODO 优惠券id
|
||||||
|
carDetailInfo.setCouponList(getCouponList(userId));
|
||||||
|
if (flag == 1){
|
||||||
|
carDetailInfo.setCouponList(getCouponList(userId));
|
||||||
|
}
|
||||||
|
return carDetailInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public BigDecimal getTotalPrice(List<Long> skuIds) {
|
||||||
|
// Long userId = SecurityUtils.getUserId();
|
||||||
|
// carMapper.selectSkuIds(skuIds);
|
||||||
|
//// TODO 通过skuId查询
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
private List<Coupon> getCouponList(Long userId) {
|
||||||
|
// TODO 优惠券id 根据userId获取 关联查询优惠券列表
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 价格详情 计算价格
|
||||||
|
private PriceDetail getPriceDetail(List<ProductDetailInfo> productDetailInfoList) {
|
||||||
|
// 总价
|
||||||
|
BigDecimal totalPrice = new BigDecimal(0);
|
||||||
|
for (ProductDetailInfo productDetailInfo : productDetailInfoList) {// 总价
|
||||||
|
// 单品总价
|
||||||
|
BigDecimal multiply = productDetailInfo.getPrice().multiply(new BigDecimal(productDetailInfo.getBuyNumber()));
|
||||||
|
|
||||||
|
totalPrice = totalPrice.add(multiply);
|
||||||
|
// 会员优惠价
|
||||||
|
BigDecimal memberPrice = new BigDecimal(0);
|
||||||
|
if (true){
|
||||||
|
memberPrice = totalPrice.multiply(new BigDecimal(0.01));
|
||||||
|
}
|
||||||
|
// 最终价
|
||||||
|
BigDecimal finalPrice = totalPrice.subtract(memberPrice);
|
||||||
|
PriceDetail priceDetail = new PriceDetail();
|
||||||
|
priceDetail.setTotalPrice(totalPrice);
|
||||||
|
priceDetail.setMemberPrice(memberPrice);
|
||||||
|
priceDetail.setFinalPrice(finalPrice);
|
||||||
|
return priceDetail;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCarId() {
|
||||||
|
// 根据用户id查询购物车id
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (loginUser == null){
|
||||||
|
throw new RuntimeException("用户不存在");
|
||||||
|
}
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
if (userid == 0L){
|
||||||
|
throw new RuntimeException("用户未登录");
|
||||||
|
}
|
||||||
|
// 根据用户id查询购物车
|
||||||
|
CarInfo carInfo = carMapper.findByUserIdGetByCarId(userid);
|
||||||
|
String carId = carInfo.getCarId();
|
||||||
|
if (carId == null){
|
||||||
|
throw new RuntimeException("该用户没有购物车");
|
||||||
|
}
|
||||||
|
|
||||||
|
return carId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
package com.ruoyi.car.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.car.mapper.CarMapper;
|
||||||
|
import com.ruoyi.car.mapper.OrderMapper;
|
||||||
|
import com.ruoyi.car.producer.RabbitProducer;
|
||||||
|
import com.ruoyi.car.service.OrderService;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.mall.car.domain.CarInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderAssociation;
|
||||||
|
import com.ruoyi.mall.car.domain.OrderInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.PriceDetail;
|
||||||
|
import com.ruoyi.mall.car.domain.request.OrderRequest;
|
||||||
|
import com.ruoyi.mall.car.domain.response.OrderDetailResp;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
||||||
|
import com.ruoyi.system.domain.model.LoginUser;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo>
|
||||||
|
implements OrderService {
|
||||||
|
@Autowired
|
||||||
|
private OrderMapper orderMapper;
|
||||||
|
@Autowired
|
||||||
|
private CarMapper carMapper;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Autowired
|
||||||
|
private RabbitProducer rabbitProducer;
|
||||||
|
@Override
|
||||||
|
public Long createOrder(OrderRequest orderRequest) {
|
||||||
|
List<OrderInfo> orderInfos = carMapper.selectOrderInfo();
|
||||||
|
List<Long> skuIds = orderInfos.stream()
|
||||||
|
.map(OrderInfo::getSkuId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 获取用户id
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
if (userid == 0L) {
|
||||||
|
throw new RuntimeException("用户未登录");
|
||||||
|
}
|
||||||
|
OrderInfo orderInfo = new OrderInfo();
|
||||||
|
// 购物车信息
|
||||||
|
CarInfo carInfo = this.carMapper.findByUserIdGetByCarId(userid);
|
||||||
|
// 根据购物车信息 获取sku信息
|
||||||
|
MallProductSkuInfo skuInfo = carMapper.findByMallProductSkuInfo(carInfo.getSkuId());
|
||||||
|
MallProductInfo productInfo = this.carMapper.selectProductInfo(skuInfo.getId());
|
||||||
|
|
||||||
|
// 给订单赋值 生成订单编号
|
||||||
|
orderInfo.setOrderId(Long.parseLong(
|
||||||
|
System.currentTimeMillis()
|
||||||
|
+ String.format("%05d", new Random().nextInt(90000) + 10000)
|
||||||
|
));
|
||||||
|
redisService.setCacheObject("orderId:", orderInfo.getOrderId());
|
||||||
|
|
||||||
|
|
||||||
|
orderInfo.setTotalPrice(getTotalPrice(orderRequest));
|
||||||
|
orderInfo.setUserId(userid);
|
||||||
|
orderInfo.setSkuId(skuInfo.getId());
|
||||||
|
orderInfo.setSkuId(skuInfo.getId());
|
||||||
|
orderInfo.setCreateTime(new Date());
|
||||||
|
//新增关联表信息
|
||||||
|
OrderAssociation orderAssociation = OrderAssociation
|
||||||
|
.builder()
|
||||||
|
.orderId(orderInfo.getOrderId())
|
||||||
|
.skuId(skuInfo.getId())
|
||||||
|
.skuTitle(productInfo.getName())
|
||||||
|
.image(productInfo.getImg())
|
||||||
|
.createTime(new Date())
|
||||||
|
.orderPrice(orderInfo.getTotalPrice())
|
||||||
|
.stock(skuInfo.getStock())
|
||||||
|
.build();
|
||||||
|
orderMapper.insertOrderAssociation(orderAssociation);
|
||||||
|
//推送到mq
|
||||||
|
rabbitProducer.pushOrder(orderAssociation);
|
||||||
|
System.out.println(orderAssociation);
|
||||||
|
|
||||||
|
System.out.println(orderInfo);
|
||||||
|
// 生成订单
|
||||||
|
this.save(orderInfo);
|
||||||
|
return orderInfo.getOrderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderDetailResp> getOrderDetail(OrderRequest orderRequest) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
if (userid == null) {
|
||||||
|
throw new RuntimeException("请先登录!");
|
||||||
|
}
|
||||||
|
List<OrderDetailResp> orderInfos = this.orderMapper.selectOrderList();
|
||||||
|
if (orderInfos == null) {
|
||||||
|
throw new RuntimeException("没有该信息");
|
||||||
|
}
|
||||||
|
return orderInfos.stream()
|
||||||
|
.map(orderDetailResp ->
|
||||||
|
OrderDetailResp.builder()
|
||||||
|
.orderId(orderDetailResp.getOrderId())
|
||||||
|
.name(orderDetailResp.getName())
|
||||||
|
.sku(orderDetailResp.getSku())
|
||||||
|
.totalPrice(orderDetailResp.getTotalPrice())
|
||||||
|
.image(orderDetailResp.getImage())
|
||||||
|
.createTime(orderDetailResp.getCreateTime())
|
||||||
|
.stock(orderDetailResp.getStock())
|
||||||
|
.userId(orderDetailResp.getUserId())
|
||||||
|
.build()
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal getTotalPrice(OrderRequest orderRequest) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
if (userid == null) {
|
||||||
|
throw new RuntimeException("用户信息不存在");
|
||||||
|
}
|
||||||
|
PriceDetail priceDetail = new PriceDetail();
|
||||||
|
BigDecimal sumPrice = carMapper.findSumPrice(userid);
|
||||||
|
if (sumPrice == null) {
|
||||||
|
throw new RuntimeException("购物车为空");
|
||||||
|
}
|
||||||
|
// 总价赋值
|
||||||
|
priceDetail.setTotalPrice(sumPrice);
|
||||||
|
// TODO
|
||||||
|
Set<String> roles = loginUser.getRoles();
|
||||||
|
BigDecimal bigDecimal = new BigDecimal(0);
|
||||||
|
for (String role : roles) {
|
||||||
|
if ("vip".equals(role)) {
|
||||||
|
bigDecimal = sumPrice.multiply(new BigDecimal(0.01));
|
||||||
|
priceDetail.setMemberPrice(bigDecimal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CarInfo carInfo = carMapper.findByUserIdGetByCarId(userid);
|
||||||
|
MallProductSkuInfo skuInfo =
|
||||||
|
carMapper.findByMallProductSkuInfo(carInfo.getSkuId());
|
||||||
|
List<MallProductSkuInfo> mallProductSkuInfoList =
|
||||||
|
carMapper.selectProductList(skuInfo.getId());
|
||||||
|
// 获取skuIds
|
||||||
|
List<Long> skuIds = mallProductSkuInfoList.stream().
|
||||||
|
map(MallProductSkuInfo::getId).collect(Collectors.toList());
|
||||||
|
orderRequest.setSkuIds(skuIds);
|
||||||
|
orderRequest.setPayWay(1);
|
||||||
|
return sumPrice;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.ruoyi.car.sync;
|
||||||
|
|
||||||
|
import com.ruoyi.car.mapper.CarMapper;
|
||||||
|
import com.ruoyi.car.service.CarService;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.ruoyi.mall.car.domain.CarInfo;
|
||||||
|
import com.ruoyi.mall.car.domain.ProductDetailInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductSkuInfo;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class RedisSync {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Autowired
|
||||||
|
private CarService carService;
|
||||||
|
@Autowired
|
||||||
|
private CarMapper carMapper;
|
||||||
|
|
||||||
|
@Scheduled(cron = "0/5 * * * * ?")
|
||||||
|
public void getRedisCarInfo() {
|
||||||
|
List<ProductDetailInfo> list = redisService.getCacheList("list");
|
||||||
|
System.out.println("缓存中数据" + list);
|
||||||
|
if (redisService.hasKey("list")) {
|
||||||
|
for (ProductDetailInfo productDetailInfo : list) {
|
||||||
|
MallProductSkuInfo skuInfo = carMapper.findByMallProductSkuInfo(productDetailInfo.getSkuId());
|
||||||
|
Long id = skuInfo.getId();
|
||||||
|
CarInfo carInfo = carMapper.selectFindSkuIdByCar(id);
|
||||||
|
carInfo.setCarId(carInfo.getCarId());
|
||||||
|
carInfo.setNumber(productDetailInfo.getBuyNumber());
|
||||||
|
carInfo.setSkuId(carInfo.getSkuId());
|
||||||
|
carInfo.setUpdateTime(new Date());
|
||||||
|
log.info(carInfo);
|
||||||
|
if (carInfo.getSkuId().equals(productDetailInfo.getSkuId())) {
|
||||||
|
carService.updateById(carInfo);
|
||||||
|
}else {
|
||||||
|
carService.save(carInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9306
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: mall-car
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 115.159.78.103:8848
|
||||||
|
namespace: 09mall
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 115.159.78.103:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: 09mall
|
||||||
|
rabbitmq:
|
||||||
|
host: 115.159.78.103
|
||||||
|
port: 5672
|
||||||
|
username: guest
|
||||||
|
password: guest
|
||||||
|
|
||||||
|
main:
|
||||||
|
# 解决问题的 远程调用覆盖
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
#支付配置
|
||||||
|
pay:
|
||||||
|
#支付宝支付
|
||||||
|
ali:
|
||||||
|
#appid
|
||||||
|
appid: 9021000136690041
|
||||||
|
#支付宝网关url
|
||||||
|
gateway-url: https://openapi-sandbox.dl.alipaydev.com
|
||||||
|
#私有密钥
|
||||||
|
priave-key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCexq
|
||||||
|
# 回调地址
|
||||||
|
# notify-url: https://10.1.22.101:9306/pay/notify
|
||||||
|
notify-url: http://hdkb3x.natappfree.cc/pay/notify/
|
||||||
|
|
||||||
|
return-url: https://www.baidu.com/
|
||||||
|
format: json
|
||||||
|
#编码格式
|
||||||
|
charset: UTF-8
|
||||||
|
#阿里公钥
|
||||||
|
alipay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtIR3PTbTkyGY4GNeDOT
|
||||||
|
sign-type:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/mall/product" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.ruoyi" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<!--
|
||||||
|
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
||||||
|
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
||||||
|
-->
|
||||||
|
<mapper namespace="com.ruoyi.car.mapper.CarMapper">
|
||||||
|
<insert id="addCarAssociation">
|
||||||
|
INSERT INTO `mall_product`.`car_association`
|
||||||
|
( `car_id`, `user_id`)
|
||||||
|
VALUES ( #{carId}, #{userId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateCarNumber">
|
||||||
|
UPDATE `mall_product`.`car_info` SET `car_id` = #{carId}, `number` = #{number}, `update_by` = #{updateBy}, `update_time` = now() WHERE `id` =#{id};
|
||||||
|
</update>
|
||||||
|
<delete id="deleteCar">
|
||||||
|
delete from car_info where car_id=#{carId}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteCarAssociation">
|
||||||
|
delete from car_association where id=#{id}
|
||||||
|
</delete>
|
||||||
|
<!-- 添加 -->
|
||||||
|
|
||||||
|
|
||||||
|
<select id="findByCarInfo" resultType="com.ruoyi.mall.car.domain.CarInfo">
|
||||||
|
SELECT * FROM car_info where car_id=#{carId}
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="findByMallProductSkuInfo" resultType="com.ruoyi.mall.product.domain.MallProductSkuInfo">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
mall_product_sku_info sk
|
||||||
|
LEFT JOIN mall_product_info sp ON sk.product_id = sp.id
|
||||||
|
WHERE
|
||||||
|
sk.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCarByUserId" resultType="com.ruoyi.mall.product.domain.MallProductInfo">
|
||||||
|
|
||||||
|
select *
|
||||||
|
from mall_product_info
|
||||||
|
<where>
|
||||||
|
<if test="userId!=null">
|
||||||
|
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="findByCarAssociation" resultType="com.ruoyi.mall.car.domain.CarAssociation">
|
||||||
|
SELECT *FROM car_association where user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
<select id="selectCarAssociation" resultType="com.ruoyi.mall.car.domain.CarAssociation">
|
||||||
|
select *from car_association
|
||||||
|
</select>
|
||||||
|
<select id="findByCarAssociationByCarId"
|
||||||
|
resultType="com.ruoyi.mall.car.domain.CarAssociation">
|
||||||
|
select *from car_association where car_id=#{carId}
|
||||||
|
</select>
|
||||||
|
<select id="findByUserIdGetByCarId" resultType="com.ruoyi.mall.car.domain.CarInfo">
|
||||||
|
select *from car_info where user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
<select id="selectProductList" resultType="com.ruoyi.mall.product.domain.MallProductSkuInfo">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
mall_product_sku_info sk
|
||||||
|
LEFT JOIN mall_product_info sp ON sk.product_id = sp.id
|
||||||
|
WHERE
|
||||||
|
sk.id in (#{id})
|
||||||
|
</select>
|
||||||
|
<select id="selectProductInfo" resultType="com.ruoyi.mall.product.domain.MallProductInfo">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
mall_product_sku_info sk
|
||||||
|
LEFT JOIN mall_product_info sp ON sk.product_id = sp.id
|
||||||
|
WHERE
|
||||||
|
sk.id in (#{id})
|
||||||
|
</select>
|
||||||
|
<select id="selectFindSkuIdByCar" resultType="com.ruoyi.mall.car.domain.CarInfo">
|
||||||
|
select *from car_info where sku_id=#{skuId}
|
||||||
|
</select>
|
||||||
|
<select id="selectCarAssociationBySkuId"
|
||||||
|
resultType="com.ruoyi.mall.car.domain.CarAssociation">
|
||||||
|
select *from car_association where sku_id=#{skuId}
|
||||||
|
</select>
|
||||||
|
<select id="findSumPrice" resultType="java.math.BigDecimal">
|
||||||
|
SELECT
|
||||||
|
sum( car_info.number * price )
|
||||||
|
FROM
|
||||||
|
car_info
|
||||||
|
LEFT JOIN mall_product_sku_info ON car_info.sku_id = mall_product_sku_info.id
|
||||||
|
WHERE
|
||||||
|
user_id =#{userId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="selectOrderInfo" resultType="com.ruoyi.mall.car.domain.OrderInfo">
|
||||||
|
select *from order_info
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<!--
|
||||||
|
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
||||||
|
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
||||||
|
-->
|
||||||
|
<mapper namespace="com.ruoyi.car.mapper.OrderMapper">
|
||||||
|
<!-- 添加 -->
|
||||||
|
<insert id="insertOrderAssociation">
|
||||||
|
INSERT INTO `mall_product`.`order_association`
|
||||||
|
( `order_id`, `sku_id`, `sku_title`, `image`, `craete_time`, `order_price` , `stock`)
|
||||||
|
VALUES ( #{orderId}, #{skuId}, #{skuTitle}, #{image}, #{createTime}, #{orderPrice},#{stock});
|
||||||
|
</insert>
|
||||||
|
<select id="selectOrderList" resultType="com.ruoyi.mall.car.domain.response.OrderDetailResp">
|
||||||
|
SELECT
|
||||||
|
oi.order_id,
|
||||||
|
total_price,
|
||||||
|
oi.create_time,
|
||||||
|
user_id,
|
||||||
|
os.image,
|
||||||
|
mpsi.sku,
|
||||||
|
mpsi.stock,
|
||||||
|
mpi.name
|
||||||
|
FROM
|
||||||
|
order_info oi
|
||||||
|
LEFT JOIN order_association os ON oi.order_id = os.order_id
|
||||||
|
LEFT JOIN mall_product_sku_info mpsi ON oi.sku_id = mpsi.id
|
||||||
|
LEFT JOIN mall_product_info mpi ON mpsi.product_id = mpi.id
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:作者姓名
|
||||||
|
* @Package:com.ruoyi.mall.product.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:CMallProductAddress
|
||||||
|
* @Date:2024/6/30 11:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CMallProductAddress {
|
||||||
|
private Integer id;
|
||||||
|
private Long memberId;
|
||||||
|
private String name;
|
||||||
|
private String phoneNumber;
|
||||||
|
private Integer defaultStatus;
|
||||||
|
private String postCode;
|
||||||
|
private String province;
|
||||||
|
private String city;
|
||||||
|
private String region;
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String detailaddress;
|
||||||
|
private String defaultstatus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CMallProductInfo {
|
||||||
|
private List productAttributeList;
|
||||||
|
private List productAttributeValueList;
|
||||||
|
private List skuStockList;
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CMalllAdvertise {
|
||||||
|
/**
|
||||||
|
* 广告id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 广告表
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 点击数量
|
||||||
|
*/
|
||||||
|
private Integer clickCount;
|
||||||
|
/**
|
||||||
|
* 预售数量
|
||||||
|
*/
|
||||||
|
private Integer orderCount;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 品牌详情路径
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:作者姓名
|
||||||
|
* @Package:com.ruoyi.mall.product.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:CusProductBrandAttentionInfo
|
||||||
|
* @Date:2024/6/29 20:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CusProductBrandAttentionInfo {
|
||||||
|
private String id;
|
||||||
|
private Integer brandId;
|
||||||
|
private String brandLogo;
|
||||||
|
private String brandName;
|
||||||
|
private String brandCity;
|
||||||
|
private String createtime;
|
||||||
|
private String memberIcon;
|
||||||
|
private Long memberid;
|
||||||
|
private String membernickname;
|
||||||
|
private String attentiondate;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EsMallProductInfo extends MallProductInfo{
|
||||||
|
}
|
|
@ -0,0 +1,186 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:作者姓名
|
||||||
|
* @Package:com.ruoyi.mall.product.domain.request
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:MallCBrandInfo
|
||||||
|
* @Date:2024/6/28 19:13
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MallCBrandInfoInfo extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 品牌名称 */
|
||||||
|
@Excel(name = "品牌名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 品牌描述 */
|
||||||
|
@Excel(name = "品牌故事")
|
||||||
|
private String brandStory;
|
||||||
|
|
||||||
|
/** 品牌介绍 */
|
||||||
|
private String bigPic;
|
||||||
|
|
||||||
|
/** 品牌logo */
|
||||||
|
@Excel(name = "品牌logo")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
/** 品牌状态 */
|
||||||
|
@Excel(name = "品牌状态")
|
||||||
|
private String showStatus;
|
||||||
|
|
||||||
|
/** 乐观锁 */
|
||||||
|
private Long revision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*排序
|
||||||
|
*/
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setLogo(String logo) {
|
||||||
|
this.logo = logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setRevision(Long revision) {
|
||||||
|
this.revision = revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(String sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateby(String createby) {
|
||||||
|
this.createby = createby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstLetter(String firstLetter) {
|
||||||
|
this.firstLetter = firstLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductCommentCount(Integer productCommentCount) {
|
||||||
|
this.productCommentCount = productCommentCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductCount(Integer productCount) {
|
||||||
|
this.productCount = productCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String createby;
|
||||||
|
/**
|
||||||
|
* 品牌首字母
|
||||||
|
*/
|
||||||
|
private String firstLetter;
|
||||||
|
/**
|
||||||
|
*数量
|
||||||
|
*/
|
||||||
|
private Integer productCommentCount;
|
||||||
|
/**
|
||||||
|
*商品数量
|
||||||
|
*/
|
||||||
|
private Integer productCount;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getLogo() {
|
||||||
|
return logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Long getRevision() {
|
||||||
|
return revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateby() {
|
||||||
|
return createby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstLetter() {
|
||||||
|
return firstLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductCommentCount() {
|
||||||
|
return productCommentCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductCount() {
|
||||||
|
return productCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBigPic() {
|
||||||
|
return bigPic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShowStatus() {
|
||||||
|
return showStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBigPic(String bigPic) {
|
||||||
|
this.bigPic = bigPic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowStatus(String showStatus) {
|
||||||
|
this.showStatus = showStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBrandStory() {
|
||||||
|
return brandStory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrandStory(String brandStory) {
|
||||||
|
this.brandStory = brandStory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("productDesc", getBrandStory())
|
||||||
|
.append("content", getBigPic())
|
||||||
|
.append("logo", getLogo())
|
||||||
|
.append("status", getSort())
|
||||||
|
.append("revision", getRevision())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MallCProductSkuInfoAll {
|
||||||
|
// 商品品牌
|
||||||
|
private Integer brandId;
|
||||||
|
private String brandName;
|
||||||
|
private Integer giftGrowth;
|
||||||
|
private Integer giftPoint;
|
||||||
|
private Integer price;
|
||||||
|
private Integer originalPrice;
|
||||||
|
// 商品
|
||||||
|
private Integer id;
|
||||||
|
private String keywords;
|
||||||
|
private String name;
|
||||||
|
private Integer type;
|
||||||
|
private Integer brand;
|
||||||
|
|
||||||
|
|
||||||
|
private String pic;
|
||||||
|
//商品类型
|
||||||
|
private Integer productCategoryId;
|
||||||
|
private String productCategoryName;
|
||||||
|
|
||||||
|
|
||||||
|
private String subTitle;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer publishStatus;
|
||||||
|
private Integer recommandStatus;
|
||||||
|
|
||||||
|
private Integer sort=100;
|
||||||
|
private Integer sale=99;
|
||||||
|
private Integer newStatus= 1;
|
||||||
|
|
||||||
|
private Integer stock=100;
|
||||||
|
private String productSn= "7437788";
|
||||||
|
private Integer promotionPerLimit= 0;
|
||||||
|
private Integer promotionType= 3;
|
||||||
|
private String serviceIds= "1";
|
||||||
|
private String unit="";
|
||||||
|
private Integer usePointLimit=0;
|
||||||
|
private Integer verifyStatus= 0;
|
||||||
|
private Integer weight=0;
|
||||||
|
private Integer ruleId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品品牌对象 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,250 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息对象 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;
|
||||||
|
@Excel(name = "上下架")
|
||||||
|
private Integer islisting;
|
||||||
|
|
||||||
|
public Integer getIslisting() {
|
||||||
|
return islisting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIslisting(Integer islisting) {
|
||||||
|
this.islisting = islisting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 乐观锁 */
|
||||||
|
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())
|
||||||
|
.append("islisting", getIslisting())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品评价对象 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格详情对象 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格对象 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品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 = "商品信息")
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.TreeEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型对象 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.ruoyi.mall.product.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:作者姓名
|
||||||
|
* @Package:com.ruoyi.mall.product.domain
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:ProductMallAll
|
||||||
|
* @Date:2024/6/28 20:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductMallAll {
|
||||||
|
|
||||||
|
private List<CMalllAdvertise> advertiseList;
|
||||||
|
private List<MallCBrandInfoInfo> brandList;
|
||||||
|
private ArrayList hotProductList;
|
||||||
|
private ArrayList newProductList;
|
||||||
|
private ArrayList subjectList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,185 @@
|
||||||
|
package com.ruoyi.mall.product.domain.model;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
private Integer islisting;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.ruoyi.mall.product.domain.model;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
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.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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.ruoyi.mall.product;
|
||||||
|
|
||||||
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品模块
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableRyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class RuoYiMallProductApplication
|
||||||
|
{
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
SpringApplication.run(RuoYiMallProductApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 商城 - 商品模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.ruoyi.mall.product.config;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AnalyzeAddres {
|
||||||
|
String host = "https://jmkddzjx.market.alicloudapi.com";
|
||||||
|
String path = "/express/address-parse";
|
||||||
|
String method = "POST";
|
||||||
|
static String appcode = "6b97a20bb2de4db8a30664716094c257"; // 替换为你的实际 AppCode
|
||||||
|
public String analyzeAddres(String str) {
|
||||||
|
Map<String, String> headers = new HashMap<String, String>();
|
||||||
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||||
|
headers.put("Authorization", "APPCODE " + appcode);
|
||||||
|
//根据API的要求,定义相对应的Content-Type
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
Map<String, String> querys = new HashMap<String, String>();
|
||||||
|
Map<String, String> bodys = new HashMap<String, String>();
|
||||||
|
bodys.put("address", str);
|
||||||
|
try {
|
||||||
|
|
||||||
|
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||||
|
return EntityUtils.toString(response.getEntity());
|
||||||
|
//获取response的body
|
||||||
|
//System.out.println(EntityUtils.toString(response.getEntity()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,311 @@
|
||||||
|
package com.ruoyi.mall.product.config;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpPut;
|
||||||
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
|
import org.apache.http.entity.ByteArrayEntity;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class HttpUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doGet(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post form
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param bodys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
Map<String, String> bodys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bodys != null) {
|
||||||
|
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||||
|
|
||||||
|
for (String key : bodys.keySet()) {
|
||||||
|
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
||||||
|
}
|
||||||
|
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
||||||
|
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.setEntity(formEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post String
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post stream
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put String
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put stream
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doDelete(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
||||||
|
StringBuilder sbUrl = new StringBuilder();
|
||||||
|
sbUrl.append(host);
|
||||||
|
if (!StringUtils.isBlank(path)) {
|
||||||
|
sbUrl.append(path);
|
||||||
|
}
|
||||||
|
if (null != querys) {
|
||||||
|
StringBuilder sbQuery = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> query : querys.entrySet()) {
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbQuery.append("&");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append(query.getValue());
|
||||||
|
}
|
||||||
|
if (!StringUtils.isBlank(query.getKey())) {
|
||||||
|
sbQuery.append(query.getKey());
|
||||||
|
if (!StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append("=");
|
||||||
|
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbUrl.append("?").append(sbQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sbUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpClient wrapClient(String host) {
|
||||||
|
HttpClient httpClient = new DefaultHttpClient();
|
||||||
|
if (host.startsWith("https://")) {
|
||||||
|
sslClient(httpClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sslClient(HttpClient httpClient) {
|
||||||
|
try {
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||||
|
X509TrustManager tm = new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.init(null, new TrustManager[] { tm }, null);
|
||||||
|
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||||
|
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
||||||
|
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||||
|
registry.register(new Scheme("https", 443, ssf));
|
||||||
|
} catch (KeyManagementException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.mall.product.config;
|
||||||
|
import lombok.Data;
|
||||||
|
@Data
|
||||||
|
public class MallProductAddress {
|
||||||
|
private Integer id;
|
||||||
|
private Integer memberId;
|
||||||
|
private String name;
|
||||||
|
private String phoneNumber;
|
||||||
|
private Integer defaultStatus;
|
||||||
|
private String postCode;
|
||||||
|
private String province;
|
||||||
|
private String city;
|
||||||
|
private String region;
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.mall.product.domain.CusProductBrandAttentionInfo;
|
||||||
|
import com.ruoyi.mall.product.service.CusProductBrandIntoService;
|
||||||
|
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
|
||||||
|
@RequestMapping("/brand")
|
||||||
|
@Api(tags = "商品品牌管理")
|
||||||
|
public class CusProductBrandInfoController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CusProductBrandIntoService brandIntoService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/findAttention")
|
||||||
|
@ApiOperation("查询品牌关注信息")
|
||||||
|
public R<List<CusProductBrandAttentionInfo>> findAttention(){
|
||||||
|
List<CusProductBrandAttentionInfo> attentionInfos = brandIntoService.findAttention();
|
||||||
|
if(attentionInfos.size()==0){
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.ok(attentionInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/clear")
|
||||||
|
@ApiOperation("清空品牌关注信息")
|
||||||
|
public R delectAttention(){
|
||||||
|
int attentionInfos = brandIntoService.delectAttention();
|
||||||
|
|
||||||
|
return R.ok(attentionInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/attentionDetail")
|
||||||
|
@ApiOperation("根据id查询品牌关注信息")
|
||||||
|
public R<CusProductBrandAttentionInfo> attentionDetail(@RequestParam Integer brandId){
|
||||||
|
CusProductBrandAttentionInfo attentionInfo = brandIntoService.attentionDetail(brandId);
|
||||||
|
if(attentionInfo==null){
|
||||||
|
R.ok() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return R.ok(attentionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/addAttention")
|
||||||
|
@ApiOperation("添加品牌关注信息")
|
||||||
|
public R addAttention(@RequestBody CusProductBrandAttentionInfo cusProductBrandAttentionInfo){
|
||||||
|
int i = brandIntoService.addAttention(cusProductBrandAttentionInfo);
|
||||||
|
return R.ok(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/delAttention")
|
||||||
|
@ApiOperation("删除品牌关注信息")
|
||||||
|
public R delAttention(@RequestParam Integer brandId){
|
||||||
|
brandIntoService.delAttention(brandId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.mall.product.config.AnalyzeAddres;
|
||||||
|
import com.ruoyi.mall.product.config.MallProductAddress;
|
||||||
|
import com.ruoyi.mall.product.domain.*;
|
||||||
|
import com.ruoyi.mall.product.service.IMallCProductInfoService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息Controller
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2022-09-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cproduct")
|
||||||
|
@Api(tags = "商品维护 - API")
|
||||||
|
public class MallCProductInfoController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IMallCProductInfoService mallCProductInfoService;
|
||||||
|
@Autowired
|
||||||
|
private AnalyzeAddres analyzeAddres;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品信息列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/brand/productList")
|
||||||
|
public TableDataInfo syncList (@RequestParam(required = false) Integer brandId,
|
||||||
|
@RequestParam Integer pageNum,
|
||||||
|
@RequestParam Integer pageSize,
|
||||||
|
@RequestBody(required = false) MallCProductSkuInfoAll mallProductInfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
MallCProductSkuInfoAll mallCProductSkuInfoAll = new MallCProductSkuInfoAll();
|
||||||
|
if(brandId!=null){
|
||||||
|
mallCProductSkuInfoAll.setBrandId(brandId);
|
||||||
|
}
|
||||||
|
List<MallCProductSkuInfoAll> list = mallCProductInfoService.selectMallProductInfoList(mallCProductSkuInfoAll);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询商品信息总条数
|
||||||
|
*/
|
||||||
|
@PostMapping("/count")
|
||||||
|
public R<Long> count(@RequestBody MallProductInfo mallProductInfo)
|
||||||
|
{
|
||||||
|
return R.ok(mallCProductInfoService.selectMallProductInfoCount(mallProductInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品信息详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(mallCProductInfoService.selectMallProductInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加地址
|
||||||
|
*/
|
||||||
|
@PostMapping("/addressadd")
|
||||||
|
public R addressadd(@RequestBody CMallProductAddress mallProductAddress,HttpServletRequest request){
|
||||||
|
int add= mallCProductInfoService.addressadd(mallProductAddress,request);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改地址
|
||||||
|
*/
|
||||||
|
@PostMapping("/updaaddress/{id}")
|
||||||
|
public R updaaddress(@PathVariable Integer id,@RequestBody(required = false) CMallProductAddress mallProductAddress,HttpServletRequest request){
|
||||||
|
int updaaddress= mallCProductInfoService.updaaddress(mallProductAddress,request,id,request);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改回显
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectaddressId/{addressId}")
|
||||||
|
public R selectaddressId(@PathVariable Integer addressId, HttpServletRequest request){
|
||||||
|
CMallProductAddress selectaddressId= mallCProductInfoService.selectaddressId(addressId,request);
|
||||||
|
return R.ok(selectaddressId);
|
||||||
|
}
|
||||||
|
//删除地址
|
||||||
|
@PostMapping("/delectaddress/{addressId}")
|
||||||
|
public R delectaddress(@PathVariable Integer addressId, HttpServletRequest request){
|
||||||
|
int delectaddress= mallCProductInfoService.delectaddress(addressId,request);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询地址
|
||||||
|
*/
|
||||||
|
@PostMapping("/addresslist")
|
||||||
|
public R addresslist( HttpServletRequest request){
|
||||||
|
ArrayList<CMallProductAddress> list= mallCProductInfoService.addresslist(request);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取商品详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
public R<CMallProductInfo> getProductResponse(@PathVariable("id") Long id){
|
||||||
|
return R.ok(mallCProductInfoService.selectProductDetailsById(id));
|
||||||
|
}
|
||||||
|
@PostMapping("/address/{zdaddress}")
|
||||||
|
public R address(@PathVariable String zdaddress){
|
||||||
|
String str="木可-15038933321 河南省郑州市中原区河工大社区";
|
||||||
|
String s = analyzeAddres.analyzeAddres(zdaddress);
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
|
||||||
|
|
||||||
|
String province = data.getString("province");
|
||||||
|
String city = data.getString("city");
|
||||||
|
String county = data.getString("county");
|
||||||
|
String town = data.getString("town");
|
||||||
|
String phoneNum = data.getString("phoneNum");
|
||||||
|
String person = data.getString("person");
|
||||||
|
String detail = data.getString("detail");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MallProductAddress address = new MallProductAddress();
|
||||||
|
address.setId(1);
|
||||||
|
address.setMemberId(11);
|
||||||
|
address.setName(person);
|
||||||
|
address.setPhoneNumber(phoneNum);
|
||||||
|
address.setPostCode("518000");
|
||||||
|
address.setProvince(province);
|
||||||
|
address.setCity(city);
|
||||||
|
address.setRegion(county);
|
||||||
|
address.setDetailAddress(town+detail);
|
||||||
|
|
||||||
|
return R.ok(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品品牌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)
|
||||||
|
{
|
||||||
|
MallProductBrandInfo mallProductBrandInfo = mallProductBrandInfoService.selectMallProductBrandInfoById(id);
|
||||||
|
|
||||||
|
return AjaxResult.success(mallProductBrandInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("product:brand:query")
|
||||||
|
@GetMapping(value = "/getInfo1/{id}")
|
||||||
|
public MallProductBrandInfo getInfo1(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
MallProductBrandInfo mallProductBrandInfo = mallProductBrandInfoService.selectMallProductBrandInfoById(id);
|
||||||
|
|
||||||
|
return mallProductBrandInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品品牌
|
||||||
|
*/
|
||||||
|
@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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.CMalllAdvertise;
|
||||||
|
import com.ruoyi.mall.product.domain.MallCBrandInfoInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.ProductMallAll;
|
||||||
|
import com.ruoyi.mall.product.service.IMallProductCBrandInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:作者姓名
|
||||||
|
* @Package:com.ruoyi.mall.product.controller
|
||||||
|
* @Project:mall_cloud
|
||||||
|
* @name:MallProductCBrandInfoController
|
||||||
|
* @Date:2024/6/28 19:51
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/home")
|
||||||
|
public class MallProductCBrandInfoController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMallProductCBrandInfoService iMallProductCBrandInfoService;
|
||||||
|
/**
|
||||||
|
* 查询商品品牌列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/content")
|
||||||
|
public R list(@RequestBody(required = false) MallCBrandInfoInfo mallCBrandInfoInfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<MallCBrandInfoInfo> list = iMallProductCBrandInfoService.selectMallProductBrandInfoList(mallCBrandInfoInfo);
|
||||||
|
List<CMalllAdvertise> addvertiseList=iMallProductCBrandInfoService.selectMallAAdviseList();
|
||||||
|
|
||||||
|
ProductMallAll productMallAll = new ProductMallAll();
|
||||||
|
productMallAll.setBrandList(list);
|
||||||
|
productMallAll.setAdvertiseList(addvertiseList);
|
||||||
|
TableDataInfo dataTable = getDataTable(list);
|
||||||
|
return R.ok(productMallAll);
|
||||||
|
}
|
||||||
|
@GetMapping("/brand/recommendList")
|
||||||
|
public R recommendProductList(@RequestParam Integer pageNum,@RequestParam Integer pageSize,@RequestBody(required = false)MallCBrandInfoInfo mallCBrandInfoInfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<MallCBrandInfoInfo> list = iMallProductCBrandInfoService.selectMallProductBrandInfoList(mallCBrandInfoInfo);
|
||||||
|
ProductMallAll productMallAll = new ProductMallAll();
|
||||||
|
productMallAll.setBrandList(list);
|
||||||
|
TableDataInfo dataTable = getDataTable(list);
|
||||||
|
return R.ok(dataTable.getRows());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/brand/detail/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
MallCBrandInfoInfo mallCBrandInfoInfo = iMallProductCBrandInfoService.selectMallProductBrandInfoById(id);
|
||||||
|
|
||||||
|
return AjaxResult.success(mallCBrandInfoInfo);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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.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.IMallProductInfoService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息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 = "/getlisting/{id}")
|
||||||
|
@ApiOperation("上架商品")
|
||||||
|
public R uploadInfo(@PathVariable("id") Long id,Boolean isupload) {
|
||||||
|
mallProductInfoService.getuploadInfo(id,isupload);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架商品
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/upload/{id}")
|
||||||
|
@ApiOperation("上架商品")
|
||||||
|
public R uploadInfo(@PathVariable("id") Long id,boolean isUpload)
|
||||||
|
{
|
||||||
|
return mallProductInfoService.uploadInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/uploadling/{id}/{isUpload}")
|
||||||
|
@ApiOperation("上架商品")
|
||||||
|
public R getuploadInfo1(@PathVariable("id") Long id,@PathVariable("isUpload") boolean isUpload)
|
||||||
|
{
|
||||||
|
mallProductInfoService.uploadInfo1(id,isUpload);
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品评价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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格详情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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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.domain.request.RuleRequest;
|
||||||
|
import com.ruoyi.mall.product.service.IMallProductRuleInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.ruoyi.mall.product.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
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.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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.ruoyi.mall.product.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.mall.product.domain.CusProductBrandAttentionInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CusProductBrandInfoMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌关注信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CusProductBrandAttentionInfo> findAttention(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询品牌关注信息
|
||||||
|
* @param brandId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CusProductBrandAttentionInfo attentionDetail(@Param("brandId") Integer brandId, @Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加品牌关注信息
|
||||||
|
* @param cusProductBrandAttentionInfo
|
||||||
|
*/
|
||||||
|
int addAttention(CusProductBrandAttentionInfo cusProductBrandAttentionInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除品牌关注信息
|
||||||
|
* @param brandId
|
||||||
|
*/
|
||||||
|
void delAttention(@Param("brandId") Integer brandId, @Param("id") Long id);
|
||||||
|
|
||||||
|
int delectAttention();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.ruoyi.mall.product.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.mall.product.domain.CMallProductAddress;
|
||||||
|
import com.ruoyi.mall.product.domain.MallCProductSkuInfoAll;
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductInfo;
|
||||||
|
import com.ruoyi.mall.product.domain.model.ProductModel;
|
||||||
|
import com.ruoyi.mall.user.domain.CusUser;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2022-09-19
|
||||||
|
*/
|
||||||
|
public interface MallCProductInfoMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询商品信息
|
||||||
|
*
|
||||||
|
* @param id 商品信息主键
|
||||||
|
* @return 商品信息
|
||||||
|
*/
|
||||||
|
public MallProductInfo selectMallProductInfoById(@Param("id")Long id);
|
||||||
|
|
||||||
|
public ProductModel selectProductModelById(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品信息列表
|
||||||
|
*
|
||||||
|
* @param mallProductInfo 商品信息
|
||||||
|
* @return 商品信息集合
|
||||||
|
*/
|
||||||
|
public List<MallCProductSkuInfoAll> selectMallProductInfoList(MallCProductSkuInfoAll 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);
|
||||||
|
|
||||||
|
int updaload(@Param("id") Long id, @Param("isUpload") boolean isUpload);
|
||||||
|
|
||||||
|
int addressadd(CMallProductAddress mallProductAddress);
|
||||||
|
|
||||||
|
ArrayList<CMallProductAddress> listaddress(CusUser cusUser);
|
||||||
|
|
||||||
|
|
||||||
|
CMallProductAddress selectaddressId(@Param("addressId") Integer addressId, @Param("id") Long id);
|
||||||
|
|
||||||
|
int delectaddress(@Param("addressId")Integer addressId, @Param("id") Long id);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.mall.product.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.mall.product.domain.MallProductBrandInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品品牌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);
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue