diff --git a/pom.xml b/pom.xml
index e5b83e5ef030b9f7dc7253c123d7cbe2023b467d..0a2dbbbf346c2823479080a4464cd7c41123c931 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,11 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ org.springframework.boot
+ spring-boot-starter-data-elasticsearch
+
+
org.springframework.boot
spring-boot-starter-data-redis
@@ -53,6 +58,11 @@
2.1.1
+
+ org.apache.commons
+ commons-pool2
+
+
org.springframework.boot
spring-boot-devtools
@@ -174,6 +184,21 @@
spring-boot-starter-cache
+
+
+ io.searchbox
+ jest
+ 5.3.3
+
+
+
+
+
+ net.java.dev.jna
+ jna
+ 4.5.1
+
+
diff --git a/src/main/java/com/hxtec/polaris/controller/OrderController.java b/src/main/java/com/hxtec/polaris/controller/OrderController.java
index f1369f7166921c8a1fff7a297adcddc90def86af..6c9ce4e8983e68be679a0378e7524e12e54dbd5c 100644
--- a/src/main/java/com/hxtec/polaris/controller/OrderController.java
+++ b/src/main/java/com/hxtec/polaris/controller/OrderController.java
@@ -1,9 +1,19 @@
package com.hxtec.polaris.controller;
+import com.hxtec.polaris.commons.api.vo.Result;
+import com.hxtec.polaris.entity.ShopAddress;
import com.hxtec.polaris.service.OrderService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.math.BigDecimal;
+import java.util.Map;
/**
* @Describtion 订单相关
@@ -64,4 +74,11 @@ public class OrderController {
public Object confirmReceive(){
return null;
}
+
+
+ @PostMapping("submitOrder")
+ public Result> submitOrder(ShopAddress shopAddress) {
+ Map map=orderService.submitOrder(shopAddress);
+ return Result.ok(map);
+ }
}
diff --git a/src/main/java/com/hxtec/polaris/controller/ProductController.java b/src/main/java/com/hxtec/polaris/controller/ProductController.java
index 1b9f3c65d4e9d67ecb235d0e7e0f141bb5a32350..909c095576bcd26e8ef9faa5811feffd6610e5c5 100644
--- a/src/main/java/com/hxtec/polaris/controller/ProductController.java
+++ b/src/main/java/com/hxtec/polaris/controller/ProductController.java
@@ -12,11 +12,15 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@@ -59,6 +63,7 @@ public class ProductController {
List pmsProductSaleAttrs = skuService.spuSaleAttrListCheckBySku(skuInfo.getSpu(),skuInfo.getSku());
map.put("spuSaleAttrListCheckBySku",pmsProductSaleAttrs);
List skuList=skuService.getSkuSaleAttrValueListBySpu(skuInfo.getSpu());
+ //销售属性hash表,k->销售值id,v->sku,
Map skuSaleAttrHash = new HashMap<>();
skuList.forEach(i->{
String v= String.valueOf(i.getSku());
@@ -76,4 +81,17 @@ public class ProductController {
map.put("stockInfo",shopStock);
return Result.ok(map);
}
+
+
+ @ApiOperation(value="保存商品信息", notes="商保存商品信息")
+ @PostMapping("saveSkuInfo")
+ public Result> saveSkuInfo(@RequestBody ShopProductVariant skuInfo){
+ // 处理默认图片
+ String skuDefaultImg = skuInfo.getImage();
+ if(StringUtils.isBlank(skuDefaultImg)){
+ skuInfo.setImage(skuInfo.getSkuImageList().get(0).getImgUrl());
+ }
+ skuService.saveSkuInfo(skuInfo);
+ return Result.ok("success");
+ }
}
diff --git a/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java b/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java
index 150d7a4ffc3e00902b2eb3170fa32f6922ede4b4..037d9a3d05e3b67ff946f69771a20189c5a39196 100644
--- a/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java
+++ b/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java
@@ -14,13 +14,13 @@ import lombok.NoArgsConstructor;
/**
* @author Caps
- * @date 2019/11/29
+ * @date 2019/12/4
*/
-@ApiModel(value="com.hxtec.polaris.entity.ShopCartItem")
-@Data
+@ApiModel(value = "com.hxtec.polaris.entity.ShopCartItem")
@Builder
-@AllArgsConstructor
@NoArgsConstructor
+@AllArgsConstructor
+@Data
@Table(name = "shop_cart_item")
public class ShopCartItem implements Serializable {
/**
@@ -29,113 +29,128 @@ public class ShopCartItem implements Serializable {
@Id
@Column(name = "id")
@GeneratedValue(generator = "JDBC")
- @ApiModelProperty(value="主键")
+ @ApiModelProperty(value = "主键")
private Integer id;
/**
* spu_id
*/
@Column(name = "product_id")
- @ApiModelProperty(value="spu_id")
+ @ApiModelProperty(value = "spu_id")
private Integer productId;
/**
* sku_id
*/
@Column(name = "product_sku_id")
- @ApiModelProperty(value="sku_id")
+ @ApiModelProperty(value = "sku_id")
private Integer productSkuId;
/**
* 用户id
*/
@Column(name = "member_id")
- @ApiModelProperty(value="用户id")
+ @ApiModelProperty(value = "用户id")
private Integer memberId;
/**
* 购买数量
*/
@Column(name = "quantity")
- @ApiModelProperty(value="购买数量")
+ @ApiModelProperty(value = "购买数量")
private Integer quantity;
/**
- * 添加到购物车的价格
+ * 折扣价
+ */
+ @Column(name = "discountPrice")
+ @ApiModelProperty(value = "折扣价")
+ private BigDecimal discountprice;
+
+ /**
+ * 原价
*/
@Column(name = "price")
- @ApiModelProperty(value="添加到购物车的价格")
+ @ApiModelProperty(value = "原价")
private BigDecimal price;
/**
* 商品主图
*/
@Column(name = "product_pic")
- @ApiModelProperty(value="商品主图")
+ @ApiModelProperty(value = "商品主图")
private String productPic;
/**
* 库存
*/
@Column(name = "stock")
- @ApiModelProperty(value="库存")
+ @ApiModelProperty(value = "库存")
private Integer stock;
/**
* 商品名称
*/
@Column(name = "product_name")
- @ApiModelProperty(value="商品名称")
+ @ApiModelProperty(value = "商品名称")
private String productName;
/**
* 商品副标题(卖点)
*/
@Column(name = "product_sub_title")
- @ApiModelProperty(value="商品副标题(卖点)")
+ @ApiModelProperty(value = "商品副标题(卖点)")
private String productSubTitle;
/**
* 会员昵称
*/
@Column(name = "member_nickname")
- @ApiModelProperty(value="会员昵称")
+ @ApiModelProperty(value = "会员昵称")
private String memberNickname;
/**
* 创建时间
*/
@Column(name = "create_time")
- @ApiModelProperty(value="创建时间")
+ @ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@Column(name = "update_time")
- @ApiModelProperty(value="修改时间")
+ @ApiModelProperty(value = "修改时间")
private Date updateTime;
/**
* 是否删除
*/
@Column(name = "delete_status")
- @ApiModelProperty(value="是否删除")
+ @ApiModelProperty(value = "是否删除")
private Integer deleteStatus;
/**
* 商品分类
*/
@Column(name = "product_category_id")
- @ApiModelProperty(value="商品分类")
+ @ApiModelProperty(value = "商品分类")
private Integer productCategoryId;
/**
* 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]
*/
@Column(name = "product_attr")
- @ApiModelProperty(value="商品销售属性:")
+ @ApiModelProperty(value = "商品销售属性:")
private String productAttr;
+ /**
+ * 是否选中
+ */
+ @Column(name = "is_checked")
+ @ApiModelProperty(value = "是否选中")
+ private String isChecked;
+
private static final long serialVersionUID = 1L;
+
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/entity/ShopOrder.java b/src/main/java/com/hxtec/polaris/entity/ShopOrder.java
index 8acad299a99ee4b75f91cc3ba6d6c0c6d3b91a19..f8083a230a83aee39c173f52a70e5052f42ad2ab 100644
--- a/src/main/java/com/hxtec/polaris/entity/ShopOrder.java
+++ b/src/main/java/com/hxtec/polaris/entity/ShopOrder.java
@@ -1,176 +1,154 @@
package com.hxtec.polaris.entity;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
import javax.persistence.*;
-import lombok.Data;
-/**
- * @author Caps
- * @date 2019/12/2
- */
-@ApiModel(value="com.hxtec.polaris.entity.ShopOrder")
+@Table(name = "hx_tec_shop.shop_order")
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
@Data
-@Table(name = "shop_order")
-public class ShopOrder implements Serializable {
+public class ShopOrder {
/**
* 订单表主键
*/
@Id
- @Column(name = "id")
- @GeneratedValue(generator = "JDBC")
- @ApiModelProperty(value="订单表主键")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 用户id
*/
@Column(name = "member_id")
- @ApiModelProperty(value="用户id")
private Integer memberId;
/**
- * 订单号
+ * 折前价
*/
- @Column(name = "order_code")
- @ApiModelProperty(value="订单号")
- private Integer orderCode;
+ @Column(name = "total_price")
+ private BigDecimal totalPrice;
/**
- * 订单总金额
+ * 应付金额(折后价+运费)
*/
- @Column(name = "total_price")
- @ApiModelProperty(value="订单总金额")
- private BigDecimal totalPrice;
+ @Column(name = "pay_price")
+ private BigDecimal payPrice;
/**
* 运费金额
*/
@Column(name = "freight_amount")
- @ApiModelProperty(value="运费金额")
- private Long freightAmount;
+ private BigDecimal freightAmount;
/**
* 支付方式:0->未支付;1->支付宝;2->微信
*/
@Column(name = "pay_type")
- @ApiModelProperty(value="支付方式:0->未支付;1->支付宝;2->微信")
private Integer payType;
/**
- * 应付金额(实际支付金额)
+ * 订单总金额(折后价)
*/
- @Column(name = "pay_amount")
- @ApiModelProperty(value="应付金额(实际支付金额)")
- private Long payAmount;
+ @Column(name = "discount_price")
+ private BigDecimal discountPrice;
/**
* 订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单
*/
- @Column(name = "`state`")
- @ApiModelProperty(value="订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
private Integer state;
/**
* 是否被删除(Y是/N否)
*/
@Column(name = "is_delete")
- @ApiModelProperty(value="是否被删除(Y是/N否)")
private String isDelete;
/**
* 物流公司
*/
@Column(name = "delivery_company")
- @ApiModelProperty(value="物流公司")
private String deliveryCompany;
/**
* 物流单号
*/
@Column(name = "delivery_code")
- @ApiModelProperty(value="物流单号")
private String deliveryCode;
/**
* 收货人姓名
*/
@Column(name = "receiver_name")
- @ApiModelProperty(value="收货人姓名")
private String receiverName;
/**
* 收货人电话
*/
@Column(name = "receiver_phone")
- @ApiModelProperty(value="收货人电话")
private String receiverPhone;
/**
* 收货人邮编
*/
@Column(name = "receiver_post_code")
- @ApiModelProperty(value="收货人邮编")
private String receiverPostCode;
/**
* 省
*/
- @Column(name = "province")
- @ApiModelProperty(value="省")
private String province;
/**
* 市
*/
- @Column(name = "city")
- @ApiModelProperty(value="市")
private String city;
/**
* 区
*/
- @Column(name = "region")
- @ApiModelProperty(value="区")
private String region;
/**
* 订单详细地址
*/
@Column(name = "address_detail")
- @ApiModelProperty(value="订单详细地址")
private String addressDetail;
/**
* 创建时间
*/
@Column(name = "create_time")
- @ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 修改时间
*/
@Column(name = "update_time")
- @ApiModelProperty(value="修改时间")
private Date updateTime;
/**
* 自动确认时间(天)
*/
@Column(name = "auto_confirm_day")
- @ApiModelProperty(value="自动确认时间(天)")
private Integer autoConfirmDay;
/**
* 确认收货状态:0->未确认;1->已确认
*/
@Column(name = "confirm_status")
- @ApiModelProperty(value="确认收货状态:0->未确认;1->已确认")
private Integer confirmStatus;
+
+ @Transient
+ List shopOrderItems;
+
private static final long serialVersionUID = 1L;
+
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java b/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java
index 0c30e65bf460230c5f395e393f4764555dac5819..224cfe70ce41fab78982da8805fd666ca32119df 100644
--- a/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java
+++ b/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java
@@ -5,105 +5,120 @@ import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Data;
+import lombok.NoArgsConstructor;
/**
* @author Caps
- * @date 2019/12/2
+ * @date 2019/12/5
*/
-@ApiModel(value="com.hxtec.polaris.entity.ShopOrderItem")
+@ApiModel(value = "com.hxtec.polaris.entity.ShopOrderItem")
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
@Data
@Table(name = "shop_order_item")
public class ShopOrderItem implements Serializable {
@Id
@Column(name = "id")
@GeneratedValue(generator = "JDBC")
- @ApiModelProperty(value="null")
+ @ApiModelProperty(value = "null")
private Integer id;
/**
* 订单id
*/
@Column(name = "order_id")
- @ApiModelProperty(value="订单id")
+ @ApiModelProperty(value = "订单id")
private Integer orderId;
/**
* 商品spu
*/
@Column(name = "product_id")
- @ApiModelProperty(value="商品spu")
+ @ApiModelProperty(value = "商品spu")
private Integer productId;
/**
* 商品图片
*/
@Column(name = "product_pic")
- @ApiModelProperty(value="商品图片")
+ @ApiModelProperty(value = "商品图片")
private String productPic;
/**
* 商品名称
*/
@Column(name = "product_name")
- @ApiModelProperty(value="商品名称")
+ @ApiModelProperty(value = "商品名称")
private String productName;
/**
* 商品介绍
*/
@Column(name = "product_introduce")
- @ApiModelProperty(value="商品介绍")
+ @ApiModelProperty(value = "商品介绍")
private String productIntroduce;
/**
- * 销售价格
+ * 原价
*/
@Column(name = "product_price")
- @ApiModelProperty(value="销售价格")
+ @ApiModelProperty(value = "原价")
private BigDecimal productPrice;
+ /**
+ * 折后价
+ */
+ @Column(name = "discount_price")
+ @ApiModelProperty(value = "折后价")
+ private BigDecimal discountPrice;
+
/**
* 购买数量
*/
@Column(name = "product_quantity")
- @ApiModelProperty(value="购买数量")
+ @ApiModelProperty(value = "购买数量")
private Integer productQuantity;
/**
* 商品sku编号
*/
@Column(name = "product_sku_id")
- @ApiModelProperty(value="商品sku编号")
+ @ApiModelProperty(value = "商品sku编号")
private Integer productSkuId;
/**
* 商品分类id
*/
@Column(name = "product_category_id")
- @ApiModelProperty(value="商品分类id")
+ @ApiModelProperty(value = "商品分类id")
private Integer productCategoryId;
/**
* 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]
*/
@Column(name = "product_attr")
- @ApiModelProperty(value="商品销售属性")
+ @ApiModelProperty(value = "商品销售属性")
private String productAttr;
/**
* 权重
*/
@Column(name = "weight")
- @ApiModelProperty(value="权重")
+ @ApiModelProperty(value = "权重")
private Double weight;
/**
* 是否被删除(Y是/N否)
*/
@Column(name = "is_delete")
- @ApiModelProperty(value="是否被删除(Y是/N否)")
+ @ApiModelProperty(value = "是否被删除(Y是/N否)")
private String isDelete;
private static final long serialVersionUID = 1L;
+
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java
index 7c6ef455a66496e4754c475c6c825fe388ea757a..590bc2792641efc29711c55f270c61df42bbd8c2 100644
--- a/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java
+++ b/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java
@@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper;
/**
* @author Caps
- * @date 2019/11/29
+ * @date 2019/12/4
*/
public interface ShopCartItemMapper extends MyMapper {
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java
index 4066817f626dfc53c12aa75d760126e4260f418a..22768f0e0f672346b42c99eb6a0f8e463aaa7dbf 100644
--- a/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java
+++ b/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java
@@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper;
/**
* @author Caps
- * @date 2019/12/2
+ * @date 2019/12/5
*/
public interface ShopOrderItemMapper extends MyMapper {
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java
index 3da274b364128c292953df24009f84b69ede4803..c40ac54cfff37af0451f933d6dad4e4afb8c7bec 100644
--- a/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java
+++ b/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java
@@ -3,9 +3,5 @@ package com.hxtec.polaris.mapper;
import com.hxtec.polaris.entity.ShopOrder;
import tk.mybatis.mapper.MyMapper;
-/**
- * @author Caps
- * @date 2019/12/2
- */
public interface ShopOrderMapper extends MyMapper {
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java
index 636985c222b45f6d47a81b132fb6911f2f23c57e..fc0fa0119339462c368b5319ed8d3e269281f7c1 100644
--- a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java
+++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java
@@ -8,7 +8,5 @@ import tk.mybatis.mapper.MyMapper;import java.util.List;import java.util.Map;
* @date 2019/11/29
*/
public interface ShopProductVariantMapper extends MyMapper {
- Map getProductInfoBySku(Integer sku);
-
List selectSkuSaleAttrValueListBySpu(Integer spu);
}
\ No newline at end of file
diff --git a/src/main/java/com/hxtec/polaris/model/ShopContainerEntity.java b/src/main/java/com/hxtec/polaris/model/ShopContainerEntity.java
deleted file mode 100644
index 1550faa7302486db4e61c0a614ce6c3dc31526fb..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/model/ShopContainerEntity.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.hxtec.polaris.model;
-
-import javax.persistence.*;
-
-/**
- * @Author Marcus lv
- * @create 2019/11/28 5:54 下午
- */
-@Entity
-@Table(name = "shop_container", schema = "hx_tec_shop", catalog = "")
-public class ShopContainerEntity {
- private String id;
- private String code;
- private String describe;
-
- @Id
- @Column(name = "id")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Basic
- @Column(name = "code")
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- @Basic
- @Column(name = "describe")
- public String getDescribe() {
- return describe;
- }
-
- public void setDescribe(String describe) {
- this.describe = describe;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ShopContainerEntity that = (ShopContainerEntity) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (code != null ? !code.equals(that.code) : that.code != null) return false;
- if (describe != null ? !describe.equals(that.describe) : that.describe != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (code != null ? code.hashCode() : 0);
- result = 31 * result + (describe != null ? describe.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/hxtec/polaris/model/ShopMediaEntity.java b/src/main/java/com/hxtec/polaris/model/ShopMediaEntity.java
deleted file mode 100644
index 18dfade1e5881b994b8ee30811266ea00f407f04..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/model/ShopMediaEntity.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.hxtec.polaris.model;
-
-import javax.persistence.*;
-import java.sql.Timestamp;
-
-/**
- * @Author Marcus lv
- * @create 2019/11/28 5:54 下午
- */
-@Entity
-@Table(name = "shop_media", schema = "hx_tec_shop", catalog = "")
-public class ShopMediaEntity {
- private String id;
- private String code;
- private String containerCode;
- private String url;
- private String name;
- private String altText;
- private Timestamp createTime;
- private Timestamp updateTime;
- private String comment1;
- private String comment2;
- private String comment3;
-
- @Id
- @Column(name = "id")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Basic
- @Column(name = "code")
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- @Basic
- @Column(name = "container_code")
- public String getContainerCode() {
- return containerCode;
- }
-
- public void setContainerCode(String containerCode) {
- this.containerCode = containerCode;
- }
-
- @Basic
- @Column(name = "url")
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- @Basic
- @Column(name = "name")
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Basic
- @Column(name = "alt_text")
- public String getAltText() {
- return altText;
- }
-
- public void setAltText(String altText) {
- this.altText = altText;
- }
-
- @Basic
- @Column(name = "create_time")
- public Timestamp getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- @Basic
- @Column(name = "update_time")
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- @Basic
- @Column(name = "comment1")
- public String getComment1() {
- return comment1;
- }
-
- public void setComment1(String comment1) {
- this.comment1 = comment1;
- }
-
- @Basic
- @Column(name = "comment2")
- public String getComment2() {
- return comment2;
- }
-
- public void setComment2(String comment2) {
- this.comment2 = comment2;
- }
-
- @Basic
- @Column(name = "comment3")
- public String getComment3() {
- return comment3;
- }
-
- public void setComment3(String comment3) {
- this.comment3 = comment3;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ShopMediaEntity that = (ShopMediaEntity) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (code != null ? !code.equals(that.code) : that.code != null) return false;
- if (containerCode != null ? !containerCode.equals(that.containerCode) : that.containerCode != null)
- return false;
- if (url != null ? !url.equals(that.url) : that.url != null) return false;
- if (name != null ? !name.equals(that.name) : that.name != null) return false;
- if (altText != null ? !altText.equals(that.altText) : that.altText != null) return false;
- if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
- if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;
- if (comment1 != null ? !comment1.equals(that.comment1) : that.comment1 != null) return false;
- if (comment2 != null ? !comment2.equals(that.comment2) : that.comment2 != null) return false;
- if (comment3 != null ? !comment3.equals(that.comment3) : that.comment3 != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (code != null ? code.hashCode() : 0);
- result = 31 * result + (containerCode != null ? containerCode.hashCode() : 0);
- result = 31 * result + (url != null ? url.hashCode() : 0);
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (altText != null ? altText.hashCode() : 0);
- result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
- result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
- result = 31 * result + (comment1 != null ? comment1.hashCode() : 0);
- result = 31 * result + (comment2 != null ? comment2.hashCode() : 0);
- result = 31 * result + (comment3 != null ? comment3.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/hxtec/polaris/model/ShopOrderDetailEntity.java b/src/main/java/com/hxtec/polaris/model/ShopOrderDetailEntity.java
deleted file mode 100644
index 19edac8da69813540ef4b2bb52d06b8cf77aca56..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/model/ShopOrderDetailEntity.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package com.hxtec.polaris.model;
-
-import javax.persistence.*;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-
-/**
- * @Author Marcus lv
- * @create 2019/11/28 5:54 下午
- */
-@Entity
-@Table(name = "shop_order_detail", schema = "hx_tec_shop", catalog = "")
-public class ShopOrderDetailEntity {
- private String id;
- private String orderCode;
- private Integer number;
- private BigDecimal price;
- private String isDelete;
- private String productBaseDetail;
- private String productBaseName;
- private String sku;
- private String image;
- private String attributeName;
- private String description;
- private Timestamp createTime;
- private Timestamp updateTime;
- private Double weight;
- private String comment1;
- private String comment2;
- private String comment3;
-
- @Id
- @Column(name = "id")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Basic
- @Column(name = "order_code")
- public String getOrderCode() {
- return orderCode;
- }
-
- public void setOrderCode(String orderCode) {
- this.orderCode = orderCode;
- }
-
- @Basic
- @Column(name = "number")
- public Integer getNumber() {
- return number;
- }
-
- public void setNumber(Integer number) {
- this.number = number;
- }
-
- @Basic
- @Column(name = "price")
- public BigDecimal getPrice() {
- return price;
- }
-
- public void setPrice(BigDecimal price) {
- this.price = price;
- }
-
- @Basic
- @Column(name = "is_delete")
- public String getIsDelete() {
- return isDelete;
- }
-
- public void setIsDelete(String isDelete) {
- this.isDelete = isDelete;
- }
-
- @Basic
- @Column(name = "product_base_detail")
- public String getProductBaseDetail() {
- return productBaseDetail;
- }
-
- public void setProductBaseDetail(String productBaseDetail) {
- this.productBaseDetail = productBaseDetail;
- }
-
- @Basic
- @Column(name = "product_base_name")
- public String getProductBaseName() {
- return productBaseName;
- }
-
- public void setProductBaseName(String productBaseName) {
- this.productBaseName = productBaseName;
- }
-
- @Basic
- @Column(name = "sku")
- public String getSku() {
- return sku;
- }
-
- public void setSku(String sku) {
- this.sku = sku;
- }
-
- @Basic
- @Column(name = "image")
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- @Basic
- @Column(name = "attribute_name")
- public String getAttributeName() {
- return attributeName;
- }
-
- public void setAttributeName(String attributeName) {
- this.attributeName = attributeName;
- }
-
- @Basic
- @Column(name = "description")
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Basic
- @Column(name = "create_time")
- public Timestamp getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- @Basic
- @Column(name = "update_time")
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- @Basic
- @Column(name = "weight")
- public Double getWeight() {
- return weight;
- }
-
- public void setWeight(Double weight) {
- this.weight = weight;
- }
-
- @Basic
- @Column(name = "comment1")
- public String getComment1() {
- return comment1;
- }
-
- public void setComment1(String comment1) {
- this.comment1 = comment1;
- }
-
- @Basic
- @Column(name = "comment2")
- public String getComment2() {
- return comment2;
- }
-
- public void setComment2(String comment2) {
- this.comment2 = comment2;
- }
-
- @Basic
- @Column(name = "comment3")
- public String getComment3() {
- return comment3;
- }
-
- public void setComment3(String comment3) {
- this.comment3 = comment3;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ShopOrderDetailEntity that = (ShopOrderDetailEntity) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (orderCode != null ? !orderCode.equals(that.orderCode) : that.orderCode != null) return false;
- if (number != null ? !number.equals(that.number) : that.number != null) return false;
- if (price != null ? !price.equals(that.price) : that.price != null) return false;
- if (isDelete != null ? !isDelete.equals(that.isDelete) : that.isDelete != null) return false;
- if (productBaseDetail != null ? !productBaseDetail.equals(that.productBaseDetail) : that.productBaseDetail != null)
- return false;
- if (productBaseName != null ? !productBaseName.equals(that.productBaseName) : that.productBaseName != null)
- return false;
- if (sku != null ? !sku.equals(that.sku) : that.sku != null) return false;
- if (image != null ? !image.equals(that.image) : that.image != null) return false;
- if (attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null)
- return false;
- if (description != null ? !description.equals(that.description) : that.description != null) return false;
- if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
- if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;
- if (weight != null ? !weight.equals(that.weight) : that.weight != null) return false;
- if (comment1 != null ? !comment1.equals(that.comment1) : that.comment1 != null) return false;
- if (comment2 != null ? !comment2.equals(that.comment2) : that.comment2 != null) return false;
- if (comment3 != null ? !comment3.equals(that.comment3) : that.comment3 != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (orderCode != null ? orderCode.hashCode() : 0);
- result = 31 * result + (number != null ? number.hashCode() : 0);
- result = 31 * result + (price != null ? price.hashCode() : 0);
- result = 31 * result + (isDelete != null ? isDelete.hashCode() : 0);
- result = 31 * result + (productBaseDetail != null ? productBaseDetail.hashCode() : 0);
- result = 31 * result + (productBaseName != null ? productBaseName.hashCode() : 0);
- result = 31 * result + (sku != null ? sku.hashCode() : 0);
- result = 31 * result + (image != null ? image.hashCode() : 0);
- result = 31 * result + (attributeName != null ? attributeName.hashCode() : 0);
- result = 31 * result + (description != null ? description.hashCode() : 0);
- result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
- result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
- result = 31 * result + (weight != null ? weight.hashCode() : 0);
- result = 31 * result + (comment1 != null ? comment1.hashCode() : 0);
- result = 31 * result + (comment2 != null ? comment2.hashCode() : 0);
- result = 31 * result + (comment3 != null ? comment3.hashCode() : 0);
- return result;
- }
-}
diff --git a/src/main/java/com/hxtec/polaris/service/CartItemService.java b/src/main/java/com/hxtec/polaris/service/CartItemService.java
index a8d0f463c060f24b5084a5400f38244b29b6f5eb..a17b36564f2a705df470e1cc4b7c48b180cabbb7 100644
--- a/src/main/java/com/hxtec/polaris/service/CartItemService.java
+++ b/src/main/java/com/hxtec/polaris/service/CartItemService.java
@@ -21,5 +21,7 @@ public interface CartItemService {
Map addTocart(int sku, int quantity);
List getCartList();
+
+ void delCart();
}
diff --git a/src/main/java/com/hxtec/polaris/service/OrderService.java b/src/main/java/com/hxtec/polaris/service/OrderService.java
index 547dddee220e1f0277667e94f02a20fd581ab86c..2b0fe6aef6d72f2e10124afb81f42242c54b770a 100644
--- a/src/main/java/com/hxtec/polaris/service/OrderService.java
+++ b/src/main/java/com/hxtec/polaris/service/OrderService.java
@@ -1,5 +1,10 @@
package com.hxtec.polaris.service;
+import com.hxtec.polaris.commons.api.vo.Result;
+import com.hxtec.polaris.entity.ShopAddress;
+
+import java.util.Map;
+
/**
* @Author yonyong
* @Description //订单相关service
@@ -37,4 +42,11 @@ public interface OrderService {
* @return
*/
Object getAfterSale();
+
+ /**
+ * 提交订单
+ * @param shopAddress
+ * @return
+ */
+ Map submitOrder(ShopAddress shopAddress);
}
diff --git a/src/main/java/com/hxtec/polaris/service/ProductService.java b/src/main/java/com/hxtec/polaris/service/ProductService.java
index 3a663fd5e2f3bd39c159d11f030854c582ed3d21..fe07f1835e8d4d718a39986bf16a6cb7d32c548b 100644
--- a/src/main/java/com/hxtec/polaris/service/ProductService.java
+++ b/src/main/java/com/hxtec/polaris/service/ProductService.java
@@ -14,6 +14,7 @@ import java.util.List;
* @date 2019/11/16
*/
public interface ProductService {
+
ShopProductVariant getSkuProductBySku(Integer sku);
List spuSaleAttrListCheckBySku(Integer spu, Integer sku);
@@ -24,4 +25,6 @@ public interface ProductService {
List getSkuSaleAttrValueBySku(Integer sku);
+ void saveSkuInfo(ShopProductVariant skuInfo);
+
}
diff --git a/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java b/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java
deleted file mode 100644
index 3338a961c0c9202b9e77c7baad8124c5ac78beb3..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.hxtec.polaris.service;
-
- /**
- * @author Caps
- * @date 2019/12/2
- */
-public interface ShopOrderItemService{
-
-
-}
diff --git a/src/main/java/com/hxtec/polaris/service/ShopOrderService.java b/src/main/java/com/hxtec/polaris/service/ShopOrderService.java
deleted file mode 100644
index 97cd12cb9644f47675e493db5c864ca1162ec6b3..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/service/ShopOrderService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.hxtec.polaris.service;
-
- /**
- * @author Caps
- * @date 2019/12/2
- */
-public interface ShopOrderService{
-
-
-}
diff --git a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java
index 99d5c4e161d056abd3aad422d2f55fbb441e0b03..0b8d85075eafde7bb45b994b4f5fc5a6e771be78 100644
--- a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java
+++ b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java
@@ -1,6 +1,5 @@
package com.hxtec.polaris.service.impl;
-import com.hxtec.polaris.commons.MapperUtils;
import com.hxtec.polaris.commons.contants.CommonContants;
import com.hxtec.polaris.entity.ShopCartItem;
import com.hxtec.polaris.entity.ShopProductBase;
@@ -73,16 +72,13 @@ public class CartItemServiceImpl implements CartItemService {
.productSkuId(skuInfo.getSku())
.productPic(skuInfo.getImage())
.productSubTitle(skuInfo.getDescription())
+ .price(skuInfo.getPrice())
+ .discountprice(skuInfo.getDiscountPrice())
.productAttr(substring).build();
ShopStock stockInfo = stockService.getStockInfoBuSku(skuInfo.getSku());
cartItem.setStock(stockInfo.getAvailable());
- if (StringUtils.isNotEmpty(skuInfo.getDiscount())){
- cartItem.setPrice(skuInfo.getDiscountPrice());
- }
- else {
- cartItem.setPrice(skuInfo.getPrice());
- }
+
ShopUser userInfo=userService.getUserInfoByPhone(phone);
ShopCartItem shopCartItem=this.ifCartExistByUser(userInfo.getId(),sku);
@@ -127,6 +123,16 @@ public class CartItemServiceImpl implements CartItemService {
return cartList;
}
+ /**
+ * 删除已选购物车
+ */
+ @Override
+ public void delCart() {
+ Example example=new Example(ShopCartItem.class);
+ example.createCriteria().andEqualTo("isChecked","Y");
+ cartItemMapper.deleteByExample(example);
+ }
+
private String getUser(){
return SecurityContextHolder.getContext().getAuthentication().getName();
@@ -175,4 +181,3 @@ public class CartItemServiceImpl implements CartItemService {
return flag;
}
}
-
diff --git a/src/main/java/com/hxtec/polaris/service/impl/OrderServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/OrderServiceImpl.java
index 2e6c1471b40a35b9591c2497eddc46a0ce129981..3bdc7b19ba7a6327e624edecaeed13b619712767 100644
--- a/src/main/java/com/hxtec/polaris/service/impl/OrderServiceImpl.java
+++ b/src/main/java/com/hxtec/polaris/service/impl/OrderServiceImpl.java
@@ -1,8 +1,32 @@
package com.hxtec.polaris.service.impl;
+import com.hxtec.polaris.commons.contants.CommonContants;
+import com.hxtec.polaris.entity.ShopAddress;
+import com.hxtec.polaris.entity.ShopCartItem;
+import com.hxtec.polaris.entity.ShopOrder;
+import com.hxtec.polaris.entity.ShopOrderItem;
+import com.hxtec.polaris.entity.ShopUser;
+import com.hxtec.polaris.mapper.ShopCartItemMapper;
+import com.hxtec.polaris.mapper.ShopOrderItemMapper;
+import com.hxtec.polaris.mapper.ShopOrderMapper;
+import com.hxtec.polaris.mapper.ShopProductVariantMapper;
+import com.hxtec.polaris.service.CartItemService;
import com.hxtec.polaris.service.OrderService;
+import com.hxtec.polaris.service.UserService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.entity.Example;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* @Describtion 订单相关service
@@ -13,6 +37,22 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class OrderServiceImpl implements OrderService{
+ @Resource
+ private ShopOrderItemMapper shopOrderItemMapper;
+ @Resource
+ private ShopOrderMapper shopOrderMapper ;
+ @Resource
+ private UserService userService;
+
+ @Resource
+ private CartItemService cartItemService;
+
+ @Resource
+ private ShopCartItemMapper cartItemMapper;
+
+ @Autowired
+ private ShopProductVariantMapper productVariantMapper;
+
@Override
public Object getAll() {
return null;
@@ -37,4 +77,79 @@ public class OrderServiceImpl implements OrderService{
public Object getAfterSale() {
return null;
}
+
+ @Override
+ public Map submitOrder(ShopAddress shopAddress) {
+ String phone="12345678900";
+ ShopUser userInfo=userService.getUserInfoByPhone(phone);
+ Map map=new HashMap<>();
+ //未登录
+ if(StringUtils.equals("anonymousUser",phone)){
+ map.put(CommonContants.STATUS,"error");
+ map.put(CommonContants.MESSAGE,"userError");
+ return map;
+ }
+
+ ShopOrder shopOrder =ShopOrder.builder()
+ .autoConfirmDay(7)
+ .createTime(new Date())
+ .memberId(userInfo.getId())
+ .state(0)
+ .receiverName(shopAddress.getComment1())
+ .receiverPhone(shopAddress.getComment2())
+ .addressDetail(shopAddress.getRegion()+shopAddress.getDetail())
+ .confirmStatus(0).build();
+
+ Example example=new Example(ShopCartItem.class);
+ example.createCriteria().andEqualTo("memberId",userInfo.getId())
+ .andEqualTo("isChecked","Y");
+ List shopCartItemList = cartItemMapper.selectByExample(example);
+ List shopOrderItems=new ArrayList<>();
+ BigDecimal price=new BigDecimal("0.0");
+ BigDecimal discountPrice=new BigDecimal("0.0");
+ shopCartItemList.forEach(cartItem -> {
+ ShopOrderItem shopOrderItem=ShopOrderItem.builder()
+ .productId(cartItem.getProductId())
+ .productPic(cartItem.getProductPic())
+ .productName(cartItem.getProductName())
+ .productIntroduce(cartItem.getProductSubTitle())
+ .productPrice(cartItem.getPrice())
+ .discountPrice(cartItem.getDiscountprice())
+ .productQuantity(cartItem.getQuantity())
+ .productSkuId(cartItem.getProductSkuId())
+ .productCategoryId(cartItem.getProductCategoryId())
+ .productAttr(cartItem.getProductAttr())
+ .isDelete("N").build();
+ price.add(cartItem.getPrice());
+ discountPrice.add(cartItem.getDiscountprice());
+ shopOrderItems.add(shopOrderItem);
+ });
+ shopOrder.setShopOrderItems(shopOrderItems);
+ shopOrder.setTotalPrice(price);
+ shopOrder.setDiscountPrice(discountPrice);
+ shopOrder.setPayPrice(price);
+ this.saveOrder(shopOrder);
+ map.put(CommonContants.STATUS,"success");
+ return map;
+ }
+
+ private void saveOrder(ShopOrder shopOrder) {
+ //订单表
+ shopOrderMapper.insertSelective(shopOrder);
+ Integer id = shopOrder.getId();
+ //订单明细表
+ List shopOrderItems = shopOrder.getShopOrderItems();
+ shopOrderItems.forEach(shopOrderItem -> {
+ shopOrderItem.setOrderId(id);
+ shopOrderItemMapper.insertSelective(shopOrderItem);
+
+ });
+ // 删除购物车数据
+ cartItemService.delCart();
+ }
+
+ private String getUser(){
+ return SecurityContextHolder.getContext().getAuthentication().getName();
+ }
+
}
diff --git a/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java
index 0ca185b74045cbe746f041366f2bed17e157940b..d96e5fb5b0d0944039a21331d898306ef5c2d76f 100644
--- a/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java
+++ b/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java
@@ -14,6 +14,7 @@ import com.hxtec.polaris.mapper.ShopProductVariantImageMapper;
import com.hxtec.polaris.mapper.ShopProductVariantMapper;
import com.hxtec.polaris.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
@@ -41,34 +42,98 @@ public class ProductServiceImpl implements ProductService {
@Autowired
private ShopProductVariantAttrValueMapper variantAttrValueMapper;
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ /**
+ * 根据sku从数据库获取带图片信息的商品信息
+ * @param sku
+ * @return
+ */
+ /* @Override
+ public ShopProductVariant getSkuProductBySkuFromDb(Integer sku) {
+ //商品
+ ShopProductVariant shopProductVariant = skuMapper.selectByPrimaryKey(sku);
+ Example example=new Example(ShopProductVariantImage.class);
+ example.createCriteria().andEqualTo("skuId",sku);
+ //图片列表
+ List shopProductVariantImages = imageMapper.selectByExample(example);
+ shopProductVariant.setSkuImageList(shopProductVariantImages);
+ return shopProductVariant;
+ }*/
+
@Override
public ShopProductVariant getSkuProductBySku(Integer sku) {
+ //商品
ShopProductVariant shopProductVariant = skuMapper.selectByPrimaryKey(sku);
Example example=new Example(ShopProductVariantImage.class);
example.createCriteria().andEqualTo("skuId",sku);
+ //图片列表
List shopProductVariantImages = imageMapper.selectByExample(example);
shopProductVariant.setSkuImageList(shopProductVariantImages);
return shopProductVariant;
}
+ /**
+ * 根据sku获取销售属性值列表,包括当前sku默认选中项
+ * @param spu
+ * @param sku
+ * @return
+ */
@Override
public List spuSaleAttrListCheckBySku(Integer spu, Integer sku) {
List pmsProductSaleAttrs = productSaleAttrMapper.selectSpuSaleAttrListCheckBySku(spu,sku);
return pmsProductSaleAttrs;
}
+ /**
+ * 获取spu下sku销售关联信息,用于生成hash表
+ * @param spu
+ * @return
+ */
@Override
public List getSkuSaleAttrValueListBySpu(Integer spu) {
return skuMapper.selectSkuSaleAttrValueListBySpu(spu);
}
+ /**
+ * 根据spu获取spu详细信息
+ * @param spu
+ * @return
+ */
@Override
public ShopProductBase getSpuInfoBySpu(Integer spu) {
return spumapper.selectByPrimaryKey(spu);
}
+ /**
+ * 根据sku获取sku销售关联信息,用于加购信息中的商品销售属性显示
+ * @param sku
+ * @return
+ */
@Override
public List getSkuSaleAttrValueBySku(Integer sku) {
return variantAttrValueMapper.selectSkuSaleAttrValueBySku(sku);
}
+
+ @Override
+ public void saveSkuInfo(ShopProductVariant skuInfo) {
+ //sku表
+ skuMapper.insertSelective(skuInfo);
+ Integer sku = skuInfo.getSku();
+ //商品图片表
+ List skuImageList = skuInfo.getSkuImageList();
+ skuImageList.forEach(i->{
+ i.setSkuId(sku);
+ imageMapper.insertSelective(i);
+ });
+
+ //销售属性值关联表
+ List skuSaleAttrValueList = skuInfo.getSkuSaleAttrValueList();
+ skuSaleAttrValueList.forEach(i->{
+ i.setSkuId(sku);
+ variantAttrValueMapper.insertSelective(i);
+ });
+
+ }
}
diff --git a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java
deleted file mode 100644
index 4788dd07060009206f7b77c9ccf73a226f6b442b..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.hxtec.polaris.service.impl;
-
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import com.hxtec.polaris.mapper.ShopOrderItemMapper;
-import com.hxtec.polaris.service.ShopOrderItemService;
-/**
- * @author Caps
- * @date 2019/12/2
- */
-@Service
-public class ShopOrderItemServiceImpl implements ShopOrderItemService{
-
- @Resource
- private ShopOrderItemMapper shopOrderItemMapper;
-
-}
diff --git a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java
deleted file mode 100644
index 4dd909b7c83b091a662d4fc22c8929d9170497f1..0000000000000000000000000000000000000000
--- a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.hxtec.polaris.service.impl;
-
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import com.hxtec.polaris.mapper.ShopOrderMapper;
-import com.hxtec.polaris.service.ShopOrderService;
-/**
- * @author Caps
- * @date 2019/12/2
- */
-@Service
-public class ShopOrderServiceImpl implements ShopOrderService{
-
- @Resource
- private ShopOrderMapper shopOrderMapper;
-
-}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 642ca8be40d4f8f2333def9d78a6f1dc77fcb834..40d88b473b84a5ea5988624b843da3fed57ca9f2 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -26,13 +26,18 @@ spring:
port: 5672
username: rabbit
password: 123456
+
redis:
- host: hx.anymre.top
- cache:
- type: redis
- cache-names: verifyCode
- redis:
- time-to-live: 60s
+ lettuce:
+ pool:
+ max-active: 8
+ max-idle: 8
+ max-wait: -1ms
+ min-idle: 0
+ sentinel:
+ master: mymaster
+ nodes: 47.100.220.7:26379, 47.100.220.7:26380, 47.100.220.7:26381
+
jpa:
hibernate:
ddl-auto: update
diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml
index 877babf858dc608c0603abf190b8716a2082433a..9d5be6c68ab1be2e42425cc1e7a7b9e74defc65c 100644
--- a/src/main/resources/generator/generatorConfig.xml
+++ b/src/main/resources/generator/generatorConfig.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/src/main/resources/mapper/ShopCartItemMapper.xml b/src/main/resources/mapper/ShopCartItemMapper.xml
index 101fb8f62a2fcd77921f78ab88155504d97db892..80efa884a9da67c80002998944c54e6cfe8ae2e7 100644
--- a/src/main/resources/mapper/ShopCartItemMapper.xml
+++ b/src/main/resources/mapper/ShopCartItemMapper.xml
@@ -2,12 +2,13 @@
-
+
+
@@ -19,11 +20,12 @@
+
-
- id, product_id, product_sku_id, member_id, quantity, price, product_pic, stock, product_name,
- product_sub_title, member_nickname, create_time, update_time, delete_status, product_category_id,
- product_attr
+
+ id, product_id, product_sku_id, member_id, quantity, discountPrice, price, product_pic,
+ stock, product_name, product_sub_title, member_nickname, create_time, update_time,
+ delete_status, product_category_id, product_attr, is_checked
\ No newline at end of file
diff --git a/src/main/resources/mapper/ShopOrderItemMapper.xml b/src/main/resources/mapper/ShopOrderItemMapper.xml
index 6cb9bf779bafd641940c8029532db9ab5acd0fd5..83f3a2d3cb2c812e3bf74c60ba6ff28d22205fec 100644
--- a/src/main/resources/mapper/ShopOrderItemMapper.xml
+++ b/src/main/resources/mapper/ShopOrderItemMapper.xml
@@ -2,7 +2,7 @@
-
+
@@ -10,6 +10,7 @@
+
@@ -18,8 +19,9 @@
-
+
id, order_id, product_id, product_pic, product_name, product_introduce, product_price,
- product_quantity, product_sku_id, product_category_id, product_attr, weight, is_delete
+ discount_price, product_quantity, product_sku_id, product_category_id, product_attr,
+ weight, is_delete
\ No newline at end of file
diff --git a/src/main/resources/mapper/ShopOrderMapper.xml b/src/main/resources/mapper/ShopOrderMapper.xml
index f7e24855727efaf883048ccfbad9830de7372557..a3c029900c1ee4f4239777a75ad4fd229899108f 100644
--- a/src/main/resources/mapper/ShopOrderMapper.xml
+++ b/src/main/resources/mapper/ShopOrderMapper.xml
@@ -2,14 +2,16 @@
-
+
-
+
-
+
@@ -26,11 +28,4 @@
-
-
- id, member_id, order_code, total_price, freight_amount, pay_type, pay_amount, `state`,
- is_delete, delivery_company, delivery_code, receiver_name, receiver_phone, receiver_post_code,
- province, city, region, address_detail, create_time, update_time, auto_confirm_day,
- confirm_status
-
\ No newline at end of file
diff --git a/src/main/resources/mapper/ShopProductVariantMapper.xml b/src/main/resources/mapper/ShopProductVariantMapper.xml
index f65184d60315d47d242ed4ffb1b12484043261ff..f4f1864f3d7137e8ac4f5525ce8cac8a100c63a2 100644
--- a/src/main/resources/mapper/ShopProductVariantMapper.xml
+++ b/src/main/resources/mapper/ShopProductVariantMapper.xml
@@ -26,15 +26,6 @@
-
-