优化发票信息

This commit is contained in:
Mrking 2024-10-20 16:25:43 +08:00
parent 55feb08407
commit 6858a908c3
3 changed files with 37 additions and 0 deletions

View File

@ -70,6 +70,18 @@ public class CustomerRespVO {
@ExcelProperty("类型")
private String type;
@Schema(description = "发票抬头")
@ExcelProperty("发票抬头")
private String invoiceCode;
@Schema(description = "发票名称")
@ExcelProperty("发票名称")
private String invoiceName;
@Schema(description = "发票地址")
@ExcelProperty("发票地址")
private String invoiceAddress;
@Schema(description = "数据状态", example = "2")
@ExcelProperty(value = "数据状态", converter = DictConvert.class)
@DictFormat("oms_data_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中

View File

@ -32,6 +32,7 @@ import cn.hangtag.module.oms.dal.dataobject.salecontractentry.SaleContractEntryD
import cn.hangtag.module.oms.dal.dataobject.saleorder.SaleOrderDO;
import cn.hangtag.module.oms.dal.dataobject.saleorderentry.SaleOrderEntryDO;
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
import cn.hangtag.module.oms.dal.mysql.customer.CustomerMapper;
import cn.hangtag.module.oms.dal.mysql.saleorder.SaleOrderMapper;
import cn.hangtag.module.oms.dal.mysql.saleorderentry.SaleOrderEntryMapper;
import cn.hangtag.module.oms.dal.mysql.saleordersku.SaleOrderSkuMapper;
@ -102,6 +103,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
private final ProductInfoService productInfoService;
private final SaleContractService saleContractService;
private final CustomerService customerService;
private final CustomerMapper customerMapper;
private final ProductPriceService productPriceService;
private final TemplateEngine templateEngine;
@ -491,6 +493,8 @@ public class SaleOrderServiceImpl implements SaleOrderService {
saleOrderMapper.insert(order);
saleOrderEntryMapper.insertBatch(entryList);
skuOrderSkuMapper.insertBatch(skuList);
updateCustomerInvoiceData(order);
System.out.println(order);
return order.getId();
}
@ -601,5 +605,23 @@ public class SaleOrderServiceImpl implements SaleOrderService {
}
/**
* 更新客户发票数据
*/
private void updateCustomerInvoiceData(SaleOrderDO order){
String invoiceCode = order.getInvoiceCode();
String invoiceName = order.getInvoiceName();
String invoiceAddress = order.getInvoiceAddress();
Long customerId = order.getCustomerId();
if(customerId!=null){
CustomerDO customer = customerService.getCustomer(customerId);
if(customer!=null){
customer.setInvoiceCode(invoiceCode);
customer.setInvoiceName(invoiceName);
customer.setInvoiceAddress(invoiceAddress);
customerMapper.updateById(customer);
}
}
}
}

View File

@ -589,6 +589,9 @@ onMounted(async () => {
formData.value.company = customerData.company;
formData.value.contactName = customerData.contacts;
formData.value.phone = customerData.phone;
formData.value.invoiceCode = customerData.invoiceCode;
formData.value.invoiceName = customerData.invoiceName;
formData.value.invoiceAddress = customerData.invoiceAddress;
if(!formData.value.deliveryAddress && that.addressList.length > 0){
formData.value.deliveryAddress = that.addressList[0].address;
that.addressId = that.addressList[0].id;