产品统计

pull/451/head
starrysky 2020-01-04 15:44:57 +08:00
parent bfbfc28246
commit ca685659de
8 changed files with 100 additions and 1 deletions

View File

@ -33,6 +33,14 @@ public class ProductInfo implements Serializable {
@Column(name = "product_category_name",nullable = false) @Column(name = "product_category_name",nullable = false)
private String productCategoryName; private String productCategoryName;
// 产品系列主键
@Column(name = "product_series_id",nullable = false)
private Long productSeriesId;
// 产品系列名称
@Column(name = "product_series_name",nullable = false)
private String productSeriesName;
// 产品编号 // 产品编号
@Column(name = "product_code") @Column(name = "product_code")
private String productCode; private String productCode;

View File

@ -19,6 +19,10 @@ public class CreateProductInfoRequest implements Serializable {
// 产品分类名称 // 产品分类名称
private String productCategoryName; private String productCategoryName;
private Long productSeriesId;
private String productSeriesName;
// 产品编号 // 产品编号
private String productCode; private String productCode;

View File

@ -21,6 +21,10 @@ public class UpdateProductInfoRequest implements Serializable {
// 产品分类名称 // 产品分类名称
private String productCategoryName; private String productCategoryName;
private Long productSeriesId;
private String productSeriesName;
// 产品编号 // 产品编号
private String productCode; private String productCode;

View File

@ -44,4 +44,10 @@ public class ProductInfoDTO implements Serializable {
// 更新时间 // 更新时间
private Timestamp updateTime; private Timestamp updateTime;
// 产品系列主键
private Long productSeriesId;
// 产品系列名称
private String productSeriesName;
} }

View File

@ -9,5 +9,7 @@ import me.zhengjie.annotation.Query;
* @date 2020-01-04 * @date 2020-01-04
*/ */
@Data @Data
public class ProductSeriesQueryCriteria { public class
ProductSeriesQueryCriteria {
} }

View File

@ -6,6 +6,7 @@ import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.wms.bd.domain.*; import me.zhengjie.modules.wms.bd.domain.*;
import me.zhengjie.modules.wms.bd.repository.MeasureUnitRepository; import me.zhengjie.modules.wms.bd.repository.MeasureUnitRepository;
import me.zhengjie.modules.wms.bd.repository.ProductCategoryRepository; import me.zhengjie.modules.wms.bd.repository.ProductCategoryRepository;
import me.zhengjie.modules.wms.bd.repository.ProductSeriesRepository;
import me.zhengjie.modules.wms.bd.request.*; import me.zhengjie.modules.wms.bd.request.*;
import me.zhengjie.modules.wms.bd.service.dto.*; import me.zhengjie.modules.wms.bd.service.dto.*;
import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.ValidationUtil;
@ -57,6 +58,9 @@ public class ProductInfoServiceImpl implements ProductInfoService {
@Autowired @Autowired
private ProductCategoryRepository productCategoryRepository; private ProductCategoryRepository productCategoryRepository;
@Autowired
private ProductSeriesRepository productSeriesRepository;
@Override @Override
public Object queryAll(ProductInfoQueryCriteria criteria, Pageable pageable){ public Object queryAll(ProductInfoQueryCriteria criteria, Pageable pageable){
Specification<ProductInfo> specification = new Specification<ProductInfo>() { Specification<ProductInfo> specification = new Specification<ProductInfo>() {
@ -150,6 +154,15 @@ public class ProductInfoServiceImpl implements ProductInfoService {
throw new BadRequestException("产品类别不存在!"); throw new BadRequestException("产品类别不存在!");
} }
Long productSeriesId = createProductInfoRequest.getProductSeriesId();
if(null == productSeriesId){
throw new BadRequestException("产品系列不能为空!");
}
Optional<ProductSeries> productSeriesOptional = productSeriesRepository.findById(productSeriesId);
ProductSeries productSeries = productSeriesOptional.get();
if(null == productSeries){
throw new BadRequestException("产品系列不存在!");
}
ProductInfoDetailDTO productInfoDetailDTO = new ProductInfoDetailDTO(); ProductInfoDetailDTO productInfoDetailDTO = new ProductInfoDetailDTO();
@ -172,6 +185,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
productInfo.setProductCategoryName(productCategory.getName()); productInfo.setProductCategoryName(productCategory.getName());
productInfo.setMeasureUnitName(measureUnit.getName()); productInfo.setMeasureUnitName(measureUnit.getName());
productInfo.setProductSeriesName(productSeries.getProductSeriesName());
productInfo = productInfoRepository.save(productInfo); productInfo = productInfoRepository.save(productInfo);
ProductInfoDTO productInfoDTO = productInfoMapper.toDto(productInfo); ProductInfoDTO productInfoDTO = productInfoMapper.toDto(productInfo);

View File

@ -40,6 +40,39 @@ public class ProductCount implements Serializable {
@CreationTimestamp @CreationTimestamp
private Timestamp gmtUpdate; private Timestamp gmtUpdate;
@Column(name = "product_category_id")
private Long productCategoryId;
@Column(name = "product_category_name")
private String productCategoryName;
@Column(name = "product_series_id")
private Long productSeriesId;
@Column(name = "product_series_name")
private String productSeriesName;
@Column(name = "mp_number")
private Long mpNumber;
@Column(name = "hj_number")
private Long hjNumber;
@Column(name = "bjc_number")
private Long bjcNumber;
@Column(name = "jc_number")
private Long jcNumber;
@Column(name = "jm_number")
private Long jmNumber;
@Column(name = "dph_number")
private Long dphNumber;
@Column(name = "cm_number")
private Long cmNumber;
public void copy(ProductCount source){ public void copy(ProductCount source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }

View File

@ -1,6 +1,12 @@
package me.zhengjie.modules.wms.sr.productCount.service.dto; package me.zhengjie.modules.wms.sr.productCount.service.dto;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.io.Serializable; import java.io.Serializable;
@ -23,4 +29,26 @@ public class ProductCountDTO implements Serializable {
private Timestamp gmtCreate; private Timestamp gmtCreate;
private Timestamp gmtUpdate; private Timestamp gmtUpdate;
private Long productCategoryId;
private String productCategoryName;
private Long productSeriesId;
private String productSeriesName;
private Long mpNumber;
private Long hjNumber;
private Long bjcNumber;
private Long jcNumber;
private Long jmNumber;
private Long dphNumber;
private Long cmNumber;
} }