销售发货单单价

pull/451/head
starrysky 2020-01-04 17:42:33 +08:00
parent aa4e3dc6ef
commit e5bd305c22
2 changed files with 31 additions and 1 deletions

View File

@ -61,10 +61,14 @@ public class InvoiceProduct implements Serializable {
@Column(name = "actual_invoice_number",nullable = false)
private Long actualInvoiceNumber;
// 瘦瘦金额
// 销售金额
@Column(name = "sale_price")
private Long salePrice;
// 单价
@Column(name = "unit_price")
private Long unitPrice;
// 备注
@Column(name = "remark")
private String remark;

View File

@ -155,6 +155,19 @@ public class InvoiceServiceImpl implements InvoiceService {
@Override
@Transactional(rollbackFor = Exception.class)
public InvoiceDetailDTO create(CreateInvoiceRequest createInvoiceRequest) {
List<String> repeatProductCodeList =createInvoiceRequest.getInvoiceProductList().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 = me.zhengjie.utils.StringUtils.join(repeatProductCodeList.toArray(), ",");
throw new BadRequestException("产品" + repeatProductCodeStr + "请合并为一条记录");
}
Invoice invoice = new Invoice();
// 客户订单编号
String customerOrderCode = createInvoiceRequest.getCustomerOrderCode();
@ -223,6 +236,19 @@ public class InvoiceServiceImpl implements InvoiceService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UpdateInvoiceRequest updateInvoiceRequest) {
List<String> repeatProductCodeList =updateInvoiceRequest.getInvoiceProductList().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 = me.zhengjie.utils.StringUtils.join(repeatProductCodeList.toArray(), ",");
throw new BadRequestException("产品" + repeatProductCodeStr + "请合并为一条记录");
}
Invoice invoice = new Invoice();
BeanUtils.copyProperties(updateInvoiceRequest, invoice);
// 修改发货单概要信息