diff --git a/src/main/java/com/xkrs/controller/ProductController.java b/src/main/java/com/xkrs/controller/ProductController.java index a41ba1a..ce270f5 100644 --- a/src/main/java/com/xkrs/controller/ProductController.java +++ b/src/main/java/com/xkrs/controller/ProductController.java @@ -46,6 +46,6 @@ public class ProductController { if(sysUserEntity == null){ return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); } - return productService.addingProduct(productQo,sysUserEntity.getId()); + return productService.addingProduct(productQo,sysUserEntity.getId(),sysUserEntity.getIdentity()); } } diff --git a/src/main/java/com/xkrs/model/entity/ProductEntity.java b/src/main/java/com/xkrs/model/entity/ProductEntity.java index 844143b..fb677a0 100644 --- a/src/main/java/com/xkrs/model/entity/ProductEntity.java +++ b/src/main/java/com/xkrs/model/entity/ProductEntity.java @@ -57,16 +57,28 @@ public class ProductEntity { private BigDecimal productPrice; /** - * 商品上架状态(默认0 待审核,1审核通过,2审核不通过) + * 商品上架状态(默认0,1上架,2下架) */ @Column(length = 32, columnDefinition = "varchar(32)") private String shelfType; + /** + * 审核状态(默认(待审核)0 ,1区县审核,2市级审核,3总部审核,4不通过) + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private String reviewType; + /** * 商家id */ private Integer businessId; + /** + * 用户身份 + */ + @Column(length = 32, columnDefinition = "varchar(32)") + private String userIdentity; + /** * 商品上架的时间 */ @@ -76,14 +88,19 @@ public class ProductEntity { public ProductEntity() { } - public ProductEntity(Integer id, String productName, String productDescription, Integer productCategories, BigDecimal productPrice, String shelfType, Integer businessId, String productTime) { + public ProductEntity(Integer id, String productName, String productPro, String productCity, String productCounty, String productDescription, Integer productCategories, BigDecimal productPrice, String shelfType, String reviewType, Integer businessId, String userIdentity, String productTime) { this.id = id; this.productName = productName; + this.productPro = productPro; + this.productCity = productCity; + this.productCounty = productCounty; this.productDescription = productDescription; this.productCategories = productCategories; this.productPrice = productPrice; this.shelfType = shelfType; + this.reviewType = reviewType; this.businessId = businessId; + this.userIdentity = userIdentity; this.productTime = productTime; } @@ -103,6 +120,30 @@ public class ProductEntity { this.productName = productName; } + public String getProductPro() { + return productPro; + } + + public void setProductPro(String productPro) { + this.productPro = productPro; + } + + public String getProductCity() { + return productCity; + } + + public void setProductCity(String productCity) { + this.productCity = productCity; + } + + public String getProductCounty() { + return productCounty; + } + + public void setProductCounty(String productCounty) { + this.productCounty = productCounty; + } + public String getProductDescription() { return productDescription; } @@ -135,6 +176,14 @@ public class ProductEntity { this.shelfType = shelfType; } + public String getReviewType() { + return reviewType; + } + + public void setReviewType(String reviewType) { + this.reviewType = reviewType; + } + public Integer getBusinessId() { return businessId; } @@ -143,6 +192,14 @@ public class ProductEntity { this.businessId = businessId; } + public String getUserIdentity() { + return userIdentity; + } + + public void setUserIdentity(String userIdentity) { + this.userIdentity = userIdentity; + } + public String getProductTime() { return productTime; } @@ -156,11 +213,16 @@ public class ProductEntity { return "ProductEntity{" + "id=" + id + ", productName='" + productName + '\'' + + ", productPro='" + productPro + '\'' + + ", productCity='" + productCity + '\'' + + ", productCounty='" + productCounty + '\'' + ", productDescription='" + productDescription + '\'' + ", productCategories=" + productCategories + ", productPrice=" + productPrice + ", shelfType='" + shelfType + '\'' + + ", reviewType='" + reviewType + '\'' + ", businessId=" + businessId + + ", userIdentity='" + userIdentity + '\'' + ", productTime='" + productTime + '\'' + '}'; } diff --git a/src/main/java/com/xkrs/model/qo/ProductQo.java b/src/main/java/com/xkrs/model/qo/ProductQo.java index d3ab239..da89317 100644 --- a/src/main/java/com/xkrs/model/qo/ProductQo.java +++ b/src/main/java/com/xkrs/model/qo/ProductQo.java @@ -2,6 +2,7 @@ package com.xkrs.model.qo; import com.xkrs.model.validation.ProductQoInsert; +import javax.persistence.Column; import javax.validation.constraints.NotBlank; import java.math.BigDecimal; import java.util.List; @@ -39,6 +40,24 @@ public class ProductQo { private List productContent; + /** + * 省 + */ + @NotBlank(message = "{Product.productPro.null}",groups={ProductQoInsert.class}) + private String productPro; + + /** + * 市 + */ + @NotBlank(message = "{Product.productCity.null}",groups={ProductQoInsert.class}) + private String productCity; + + /** + * 区 + */ + @NotBlank(message = "{Product.productCounty.null}",groups={ProductQoInsert.class}) + private String productCounty; + public String getProductName() { return productName; } @@ -86,4 +105,28 @@ public class ProductQo { public void setProductContent(List productContent) { this.productContent = productContent; } + + public String getProductPro() { + return productPro; + } + + public void setProductPro(String productPro) { + this.productPro = productPro; + } + + public String getProductCity() { + return productCity; + } + + public void setProductCity(String productCity) { + this.productCity = productCity; + } + + public String getProductCounty() { + return productCounty; + } + + public void setProductCounty(String productCounty) { + this.productCounty = productCounty; + } } diff --git a/src/main/java/com/xkrs/service/ProductService.java b/src/main/java/com/xkrs/service/ProductService.java index 72d42ce..618d0c7 100644 --- a/src/main/java/com/xkrs/service/ProductService.java +++ b/src/main/java/com/xkrs/service/ProductService.java @@ -16,5 +16,5 @@ public interface ProductService { * @param business 商家用户id * @return */ - String addingProduct(ProductQo productQo,Integer business); + String addingProduct(ProductQo productQo,Integer business, String userIdentity); } diff --git a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java index fc03422..dd81e48 100644 --- a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java @@ -49,7 +49,7 @@ public class ProductServiceImpl implements ProductService { * @return */ @Override - public String addingProduct(ProductQo productQo, Integer business) { + public String addingProduct(ProductQo productQo, Integer business, String userIdentity) { Locale locale = LocaleContextHolder.getLocale(); // 商品封面图片 List productCover = productQo.getProductCover(); @@ -71,8 +71,13 @@ public class ProductServiceImpl implements ProductService { productEntity.setProductDescription(productQo.getProductDescription()); productEntity.setProductCategories(productQo.getProductCategories()); productEntity.setProductPrice(productQo.getProductPrice()); + productEntity.setProductPro(productQo.getProductPro()); + productEntity.setProductCity(productQo.getProductCity()); + productEntity.setProductCounty(productQo.getProductCounty()); productEntity.setBusinessId(business); productEntity.setShelfType("0"); + productEntity.setUserIdentity(userIdentity); + productEntity.setReviewType("0"); productEntity.setProductTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); List coverEntities = new ArrayList<>();