mirror of https://github.com/jeecgboot/jeecg-boot
code cleanup
parent
e600fde681
commit
042849a820
|
@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
import org.jeecg.common.aspect.annotation.Dict;
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
@ -93,4 +94,25 @@ public class Invoice implements Serializable {
|
||||||
@Excel(name = "type", width = 15)
|
@Excel(name = "type", width = 15)
|
||||||
@ApiModelProperty(value = "type")
|
@ApiModelProperty(value = "type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum InvoiceType {
|
||||||
|
PURCHASE('1'),
|
||||||
|
SHIPPING('2'),
|
||||||
|
COMPLETE('7');
|
||||||
|
|
||||||
|
private final char type;
|
||||||
|
|
||||||
|
InvoiceType(char type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getType(String invoiceNumber) {
|
||||||
|
for(InvoiceType type : InvoiceType.values()) {
|
||||||
|
if(type.getType() == invoiceNumber.charAt(8))
|
||||||
|
return type.name();
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Incorrect invoice number : " + invoiceNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,13 +813,13 @@ public class PlatformOrderShippingInvoiceService {
|
||||||
purchaseOrderService, purchaseOrderContentMapper, skuPromotionHistoryMapper, savRefundService, savRefundWithDetailService, emailService, env);
|
purchaseOrderService, purchaseOrderContentMapper, skuPromotionHistoryMapper, savRefundService, savRefundWithDetailService, emailService, env);
|
||||||
Path out = null;
|
Path out = null;
|
||||||
if(filetype.equals("invoice")) {
|
if(filetype.equals("invoice")) {
|
||||||
if(invoiceNumber.charAt(8) == '1') {
|
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(Invoice.InvoiceType.PURCHASE.name())) {
|
||||||
PurchaseInvoice invoice = factory.buildExistingPurchaseInvoice(invoiceNumber);
|
PurchaseInvoice invoice = factory.buildExistingPurchaseInvoice(invoiceNumber);
|
||||||
InvoiceMetaData invoiceMetaData = getInvoiceMetaData(invoice);
|
InvoiceMetaData invoiceMetaData = getInvoiceMetaData(invoice);
|
||||||
String filename = "Invoice N°" + invoice.code() + " (" + invoice.client().getInvoiceEntity() + ").xlsx";
|
String filename = "Invoice N°" + invoice.code() + " (" + invoice.client().getInvoiceEntity() + ").xlsx";
|
||||||
out = Paths.get(PURCHASE_INVOICE_DIR, filename);
|
out = Paths.get(PURCHASE_INVOICE_DIR, filename);
|
||||||
}
|
}
|
||||||
if(invoiceNumber.charAt(8) == '2') {
|
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(Invoice.InvoiceType.SHIPPING.name())) {
|
||||||
Client client = shippingInvoiceMapper.getClientByInvoiceNumber(invoiceNumber);
|
Client client = shippingInvoiceMapper.getClientByInvoiceNumber(invoiceNumber);
|
||||||
Map<String, String> period = platformOrderService.fetchShippingPeriodAndType(invoiceNumber);
|
Map<String, String> period = platformOrderService.fetchShippingPeriodAndType(invoiceNumber);
|
||||||
String clientId = client.getId();
|
String clientId = client.getId();
|
||||||
|
@ -829,7 +829,7 @@ public class PlatformOrderShippingInvoiceService {
|
||||||
String filename = "Invoice N°" + invoice.code() + " (" + invoice.client().getInvoiceEntity() + ").xlsx";
|
String filename = "Invoice N°" + invoice.code() + " (" + invoice.client().getInvoiceEntity() + ").xlsx";
|
||||||
out = Paths.get(INVOICE_DIR, filename);
|
out = Paths.get(INVOICE_DIR, filename);
|
||||||
}
|
}
|
||||||
if(invoiceNumber.charAt(8) == '7') {
|
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(Invoice.InvoiceType.COMPLETE.name())) {
|
||||||
Client client = shippingInvoiceMapper.getClientByInvoiceNumber(invoiceNumber);
|
Client client = shippingInvoiceMapper.getClientByInvoiceNumber(invoiceNumber);
|
||||||
Map<String, String> period = platformOrderService.fetchShippingPeriodAndType(invoiceNumber);
|
Map<String, String> period = platformOrderService.fetchShippingPeriodAndType(invoiceNumber);
|
||||||
String clientId = client.getId();
|
String clientId = client.getId();
|
||||||
|
|
Loading…
Reference in New Issue