mirror of https://github.com/elunez/eladmin
产品统计
parent
ca685659de
commit
aa4e3dc6ef
|
@ -16,8 +16,6 @@ import java.sql.Timestamp;
|
||||||
public class ProductSeriesDTO implements Serializable {
|
public class ProductSeriesDTO implements Serializable {
|
||||||
|
|
||||||
// 主键
|
// 主键
|
||||||
// 处理精度丢失问题
|
|
||||||
@JsonSerialize(using= ToStringSerializer.class)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// 产品系列名称
|
// 产品系列名称
|
||||||
|
|
|
@ -223,6 +223,15 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long productSeriesId = updateProductInfoRequest.getProductSeriesId();
|
||||||
|
if(null == productSeriesId){
|
||||||
|
throw new BadRequestException("产品系列不能为空!");
|
||||||
|
}
|
||||||
|
Optional<ProductSeries> productSeriesOptional = productSeriesRepository.findById(productSeriesId);
|
||||||
|
ProductSeries productSeries = productSeriesOptional.get();
|
||||||
|
if(null == productSeries){
|
||||||
|
throw new BadRequestException("产品系列不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
// 产品资料-仓库预警修改目标
|
// 产品资料-仓库预警修改目标
|
||||||
List<ProductInventoryWarning> productInventoryWarningListTarget = updateProductInfoRequest.getProductInventoryWarning();
|
List<ProductInventoryWarning> productInventoryWarningListTarget = updateProductInfoRequest.getProductInventoryWarning();
|
||||||
|
@ -255,6 +264,9 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
||||||
productInfo.setProductInitialSetup(productInitialSetupStr);
|
productInfo.setProductInitialSetup(productInitialSetupStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
productInfo.setProductCategoryName(productCategory.getName());
|
||||||
|
productInfo.setMeasureUnitName(measureUnit.getName());
|
||||||
|
productInfo.setProductSeriesName(productSeries.getProductSeriesName());
|
||||||
productInfo.setCreateTime(createTime);
|
productInfo.setCreateTime(createTime);
|
||||||
productInfo.setStatus(true);
|
productInfo.setStatus(true);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package me.zhengjie.modules.wms.customerOrder.domain;
|
package me.zhengjie.modules.wms.customerOrder.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
@ -36,6 +38,8 @@ public class CustomerOrder implements Serializable {
|
||||||
private Timestamp orderDate;
|
private Timestamp orderDate;
|
||||||
|
|
||||||
// 交货日期
|
// 交货日期
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Column(name = "delivery_date")
|
@Column(name = "delivery_date")
|
||||||
private Timestamp deliveryDate;
|
private Timestamp deliveryDate;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,10 @@ package me.zhengjie.modules.wms.customerOrder.request;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import me.zhengjie.modules.wms.customerOrder.service.dto.CustomerOrderProductDTO;
|
import me.zhengjie.modules.wms.customerOrder.service.dto.CustomerOrderProductDTO;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
@ -28,6 +30,8 @@ public class UpdateCustomerOrderRequest implements Serializable {
|
||||||
private Timestamp orderDate;
|
private Timestamp orderDate;
|
||||||
|
|
||||||
// 交货日期
|
// 交货日期
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Timestamp deliveryDate;
|
private Timestamp deliveryDate;
|
||||||
|
|
||||||
// 客户订单编号
|
// 客户订单编号
|
||||||
|
|
|
@ -21,6 +21,7 @@ import me.zhengjie.modules.wms.customerOrder.request.CreateCustomerOrderRequest;
|
||||||
import me.zhengjie.modules.wms.customerOrder.request.CustomerOrderProductRequest;
|
import me.zhengjie.modules.wms.customerOrder.request.CustomerOrderProductRequest;
|
||||||
import me.zhengjie.modules.wms.customerOrder.service.dto.CustomerOrderDTO;
|
import me.zhengjie.modules.wms.customerOrder.service.dto.CustomerOrderDTO;
|
||||||
import me.zhengjie.modules.wms.customerOrder.service.mapper.CustomerOrderMapper;
|
import me.zhengjie.modules.wms.customerOrder.service.mapper.CustomerOrderMapper;
|
||||||
|
import me.zhengjie.utils.StringUtils;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -139,6 +140,19 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public CustomerOrderDTO create(CreateCustomerOrderRequest createCustomerOrderRequest) {
|
public CustomerOrderDTO create(CreateCustomerOrderRequest createCustomerOrderRequest) {
|
||||||
|
|
||||||
|
List<String> repeatProductCodeList =createCustomerOrderRequest.getCustomerOrderProductList().stream().
|
||||||
|
collect(Collectors.groupingBy(dog->dog.getProductCode() ,Collectors.counting()))
|
||||||
|
.entrySet().stream()
|
||||||
|
.filter(entry->entry.getValue()>1)
|
||||||
|
.map(entry->entry.getKey())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(!CollectionUtils.isEmpty(repeatProductCodeList)){
|
||||||
|
String repeatProductCodeStr = StringUtils.join(repeatProductCodeList.toArray(), ",");
|
||||||
|
throw new BadRequestException("产品" + repeatProductCodeStr + "请合并为一条记录");
|
||||||
|
}
|
||||||
|
|
||||||
Long totalMoney = 0L;
|
Long totalMoney = 0L;
|
||||||
//插入客户订单对应的产品信息
|
//插入客户订单对应的产品信息
|
||||||
List<CustomerOrderProductRequest> customerOrderProductRequestList = createCustomerOrderRequest.getCustomerOrderProductList();
|
List<CustomerOrderProductRequest> customerOrderProductRequestList = createCustomerOrderRequest.getCustomerOrderProductList();
|
||||||
|
@ -202,6 +216,18 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(UpdateCustomerOrderRequest updateCustomerOrderRequest) {
|
public void update(UpdateCustomerOrderRequest updateCustomerOrderRequest) {
|
||||||
|
|
||||||
|
List<String> repeatProductCodeList =updateCustomerOrderRequest.getCustomerOrderProductList().stream().
|
||||||
|
collect(Collectors.groupingBy(dog->dog.getProductCode() ,Collectors.counting()))
|
||||||
|
.entrySet().stream()
|
||||||
|
.filter(entry->entry.getValue()>1)
|
||||||
|
.map(entry->entry.getKey())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(!CollectionUtils.isEmpty(repeatProductCodeList)){
|
||||||
|
String repeatProductCodeStr = StringUtils.join(repeatProductCodeList.toArray(), ",");
|
||||||
|
throw new BadRequestException("产品" + repeatProductCodeStr + "请合并为一条记录");
|
||||||
|
}
|
||||||
|
|
||||||
CustomerOrder customerOrder = new CustomerOrder();
|
CustomerOrder customerOrder = new CustomerOrder();
|
||||||
BeanUtils.copyProperties(updateCustomerOrderRequest, customerOrder);
|
BeanUtils.copyProperties(updateCustomerOrderRequest, customerOrder);
|
||||||
// 修改客户订单概要信息
|
// 修改客户订单概要信息
|
||||||
|
|
Loading…
Reference in New Issue