修改了添加商品的功能模块

This commit is contained in:
XinYi Song 2021-12-16 11:15:45 +08:00
parent 9f1d2613dd
commit 093db2928b
5 changed files with 115 additions and 5 deletions

View File

@ -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());
}
}

View File

@ -57,16 +57,28 @@ public class ProductEntity {
private BigDecimal productPrice;
/**
* 商品上架状态默认0 待审核1审核通过2审核不通过
* 商品上架状态默认01上架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 + '\'' +
'}';
}

View File

@ -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<String> 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<String> 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;
}
}

View File

@ -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);
}

View File

@ -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<String> 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<ProductCoverEntity> coverEntities = new ArrayList<>();