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

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){ if(sysUserEntity == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); 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; private BigDecimal productPrice;
/** /**
* 商品上架状态默认0 待审核1审核通过2审核不通过 * 商品上架状态默认01上架2下架
*/ */
@Column(length = 32, columnDefinition = "varchar(32)") @Column(length = 32, columnDefinition = "varchar(32)")
private String shelfType; private String shelfType;
/**
* 审核状态默认待审核0 1区县审核2市级审核3总部审核4不通过
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String reviewType;
/** /**
* 商家id * 商家id
*/ */
private Integer businessId; private Integer businessId;
/**
* 用户身份
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String userIdentity;
/** /**
* 商品上架的时间 * 商品上架的时间
*/ */
@ -76,14 +88,19 @@ public class ProductEntity {
public 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.id = id;
this.productName = productName; this.productName = productName;
this.productPro = productPro;
this.productCity = productCity;
this.productCounty = productCounty;
this.productDescription = productDescription; this.productDescription = productDescription;
this.productCategories = productCategories; this.productCategories = productCategories;
this.productPrice = productPrice; this.productPrice = productPrice;
this.shelfType = shelfType; this.shelfType = shelfType;
this.reviewType = reviewType;
this.businessId = businessId; this.businessId = businessId;
this.userIdentity = userIdentity;
this.productTime = productTime; this.productTime = productTime;
} }
@ -103,6 +120,30 @@ public class ProductEntity {
this.productName = productName; 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() { public String getProductDescription() {
return productDescription; return productDescription;
} }
@ -135,6 +176,14 @@ public class ProductEntity {
this.shelfType = shelfType; this.shelfType = shelfType;
} }
public String getReviewType() {
return reviewType;
}
public void setReviewType(String reviewType) {
this.reviewType = reviewType;
}
public Integer getBusinessId() { public Integer getBusinessId() {
return businessId; return businessId;
} }
@ -143,6 +192,14 @@ public class ProductEntity {
this.businessId = businessId; this.businessId = businessId;
} }
public String getUserIdentity() {
return userIdentity;
}
public void setUserIdentity(String userIdentity) {
this.userIdentity = userIdentity;
}
public String getProductTime() { public String getProductTime() {
return productTime; return productTime;
} }
@ -156,11 +213,16 @@ public class ProductEntity {
return "ProductEntity{" + return "ProductEntity{" +
"id=" + id + "id=" + id +
", productName='" + productName + '\'' + ", productName='" + productName + '\'' +
", productPro='" + productPro + '\'' +
", productCity='" + productCity + '\'' +
", productCounty='" + productCounty + '\'' +
", productDescription='" + productDescription + '\'' + ", productDescription='" + productDescription + '\'' +
", productCategories=" + productCategories + ", productCategories=" + productCategories +
", productPrice=" + productPrice + ", productPrice=" + productPrice +
", shelfType='" + shelfType + '\'' + ", shelfType='" + shelfType + '\'' +
", reviewType='" + reviewType + '\'' +
", businessId=" + businessId + ", businessId=" + businessId +
", userIdentity='" + userIdentity + '\'' +
", productTime='" + productTime + '\'' + ", productTime='" + productTime + '\'' +
'}'; '}';
} }

View File

@ -2,6 +2,7 @@ package com.xkrs.model.qo;
import com.xkrs.model.validation.ProductQoInsert; import com.xkrs.model.validation.ProductQoInsert;
import javax.persistence.Column;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -39,6 +40,24 @@ public class ProductQo {
private List<String> productContent; 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() { public String getProductName() {
return productName; return productName;
} }
@ -86,4 +105,28 @@ public class ProductQo {
public void setProductContent(List<String> productContent) { public void setProductContent(List<String> productContent) {
this.productContent = 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 * @param business 商家用户id
* @return * @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 * @return
*/ */
@Override @Override
public String addingProduct(ProductQo productQo, Integer business) { public String addingProduct(ProductQo productQo, Integer business, String userIdentity) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
// 商品封面图片 // 商品封面图片
List<String> productCover = productQo.getProductCover(); List<String> productCover = productQo.getProductCover();
@ -71,8 +71,13 @@ public class ProductServiceImpl implements ProductService {
productEntity.setProductDescription(productQo.getProductDescription()); productEntity.setProductDescription(productQo.getProductDescription());
productEntity.setProductCategories(productQo.getProductCategories()); productEntity.setProductCategories(productQo.getProductCategories());
productEntity.setProductPrice(productQo.getProductPrice()); productEntity.setProductPrice(productQo.getProductPrice());
productEntity.setProductPro(productQo.getProductPro());
productEntity.setProductCity(productQo.getProductCity());
productEntity.setProductCounty(productQo.getProductCounty());
productEntity.setBusinessId(business); productEntity.setBusinessId(business);
productEntity.setShelfType("0"); productEntity.setShelfType("0");
productEntity.setUserIdentity(userIdentity);
productEntity.setReviewType("0");
productEntity.setProductTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); productEntity.setProductTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
List<ProductCoverEntity> coverEntities = new ArrayList<>(); List<ProductCoverEntity> coverEntities = new ArrayList<>();