mirror of https://github.com/jeecgboot/jeecg-boot
feature: (WIP) debit + fix breakdownInvoice mail
parent
14ae44058f
commit
87241cc805
|
@ -358,10 +358,10 @@ public class InvoiceController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "/downloadInvoiceDetail")
|
||||
public byte[] downloadInvoiceDetail(@RequestParam("invoiceNumber") String invoiceNumber, @RequestParam("invoiceEntity") String invoiceEntity) throws IOException {
|
||||
public byte[] downloadInvoiceDetail(@RequestParam("invoiceNumber") String invoiceNumber, @RequestParam("invoiceEntity") String invoiceEntity, @RequestParam("internalCode") String internalCode) throws IOException {
|
||||
List<FactureDetail> factureDetails = shippingInvoiceService.getInvoiceDetail(invoiceNumber);
|
||||
List<SavRefundWithDetail> refunds = savRefundWithDetailService.getRefundsByInvoiceNumber(invoiceNumber);
|
||||
return shippingInvoiceService.exportToExcel(factureDetails, refunds, invoiceNumber, invoiceEntity);
|
||||
return shippingInvoiceService.exportToExcel(factureDetails, refunds, invoiceNumber, invoiceEntity, internalCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -487,14 +487,14 @@ public class InvoiceController {
|
|||
filenameList.add(INVOICE_DIR + "//" + metaData.getFilename());
|
||||
List<FactureDetail> factureDetails = shippingInvoiceService.getInvoiceDetail(metaData.getInvoiceCode());
|
||||
List<SavRefundWithDetail> refunds = savRefundWithDetailService.getRefundsByInvoiceNumber(metaData.getInvoiceCode());
|
||||
shippingInvoiceService.exportToExcel(factureDetails, refunds, metaData.getInvoiceCode(), metaData.getInvoiceEntity());
|
||||
filenameList.add(INVOICE_DETAIL_DIR + "//Détail_calcul_de_facture_" + metaData.getInvoiceCode() + "_(" + metaData.getInvoiceEntity() + ").xlsx");
|
||||
shippingInvoiceService.exportToExcel(factureDetails, refunds, metaData.getInvoiceCode(), metaData.getInvoiceEntity(), metaData.getInternalCode());
|
||||
filenameList.add(INVOICE_DETAIL_DIR + "//" + metaData.getInternalCode() + "_(" + metaData.getInvoiceEntity() + ")_" + metaData.getInvoiceCode() + "_Détail_calcul_de_facture.xlsx");
|
||||
}
|
||||
log.info("Generating detail files ...{}/{}", cpt++, invoiceList.size());
|
||||
}
|
||||
String zipFilename = shippingInvoiceService.zipInvoices(filenameList);
|
||||
String subject = "Invoices generated from Breakdown Page";
|
||||
String destEmail = sysUser.getEmail();
|
||||
String destEmail = sysUser.getEmail() == null ? env.getProperty("spring.mail.username") : sysUser.getEmail();
|
||||
Properties prop = emailService.getMailSender();
|
||||
Map <String, Object> templateModel = new HashMap<>();
|
||||
templateModel.put("errors", metaDataErrorList);
|
||||
|
|
|
@ -53,8 +53,8 @@ public class Credit implements Serializable {
|
|||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**client_id*/
|
||||
@Excel(name = "client_id", width = 15, dictTable = "client", dicText = "internal_code", dicCode = "id")
|
||||
@Dict(dictTable = "client", dicText = "internal_code", dicCode = "id")
|
||||
@Excel(name = "client_id", width = 15, dictTable = "client WHERE active = '1'", dicText = "internal_code", dicCode = "id")
|
||||
@Dict(dictTable = "client WHERE active = '1'", dicText = "internal_code", dicCode = "id")
|
||||
@ApiModelProperty(value = "client_id")
|
||||
private java.lang.String clientId;
|
||||
/**amount*/
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -27,40 +28,42 @@ import lombok.experimental.Accessors;
|
|||
public class Debit implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**client_id*/
|
||||
@Excel(name = "client_id", width = 15)
|
||||
/**client_id*/
|
||||
@Excel(name = "client_id", width = 15, dictTable = "client WHERE active = '1'", dicText = "internal_code", dicCode = "id")
|
||||
@Dict(dictTable = "client WHERE active = '1'", dicText = "internal_code", dicCode = "id")
|
||||
@ApiModelProperty(value = "client_id")
|
||||
private java.lang.String clientId;
|
||||
/**amount*/
|
||||
@Excel(name = "amount", width = 15)
|
||||
/**amount*/
|
||||
@Excel(name = "amount", width = 15)
|
||||
@ApiModelProperty(value = "amount")
|
||||
private java.math.BigDecimal amount;
|
||||
/**currency_id*/
|
||||
@Excel(name = "currency_id", width = 15)
|
||||
/**currency_id*/
|
||||
@Excel(name = "currency_id", width = 15, dictTable = "currency WHERE code <> 'RMB'", dicText = "code", dicCode = "id")
|
||||
@Dict(dictTable = "currency WHERE code <> 'RMB'", dicText = "code", dicCode = "id")
|
||||
@ApiModelProperty(value = "currency_id")
|
||||
private java.lang.String currencyId;
|
||||
/**invoice_number*/
|
||||
@Excel(name = "invoice_number", width = 15)
|
||||
/**invoice_number*/
|
||||
@Excel(name = "invoice_number", width = 15)
|
||||
@ApiModelProperty(value = "invoice_number")
|
||||
private java.lang.String invoiceNumber;
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public class PlatformOrderShippingInvoiceService {
|
|||
invoice.paidAmount()
|
||||
);
|
||||
shippingInvoiceMapper.insert(shippingInvoiceEntity);
|
||||
return new InvoiceMetaData(filename, invoice.code(), invoice.client().getInvoiceEntity(), "");
|
||||
return new InvoiceMetaData(filename, invoice.code(), invoice.client().getInternalCode(), invoice.client().getInvoiceEntity(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,7 +341,7 @@ public class PlatformOrderShippingInvoiceService {
|
|||
return factureDetailMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
public byte[] exportToExcel(List<FactureDetail> details, List<SavRefundWithDetail> refunds, String invoiceNumber, String invoiceEntity) throws IOException {
|
||||
public byte[] exportToExcel(List<FactureDetail> details, List<SavRefundWithDetail> refunds, String invoiceNumber, String invoiceEntity, String internalCode) throws IOException {
|
||||
SheetManager sheetManager = SheetManager.createXLSX();
|
||||
sheetManager.startDetailsSheet();
|
||||
for (String title : DETAILS_TITLES) {
|
||||
|
@ -426,10 +426,10 @@ public class PlatformOrderShippingInvoiceService {
|
|||
sheetManager.nextRow();
|
||||
}
|
||||
|
||||
Path target = Paths.get(INVOICE_DETAIL_DIR, "Détail_calcul_de_facture_" + invoiceNumber + "_(" + invoiceEntity + ").xlsx");
|
||||
Path target = Paths.get(INVOICE_DETAIL_DIR, internalCode + "_(" + invoiceEntity + ")_" + invoiceNumber + "_Détail_calcul_de_facture.xlsx");
|
||||
int i = 2;
|
||||
while (Files.exists(target)) {
|
||||
target = Paths.get(INVOICE_DETAIL_DIR, "Détail_calcul_de_facture_" + invoiceNumber + "_(" + invoiceEntity + ")_" + i + ".xlsx");
|
||||
target = Paths.get(INVOICE_DETAIL_DIR, internalCode + "_(" + invoiceEntity + ")_" + invoiceNumber + "_Détail_calcul_de_facture_(" + i + ").xlsx");
|
||||
i++;
|
||||
}
|
||||
Files.createFile(target);
|
||||
|
@ -472,7 +472,7 @@ public class PlatformOrderShippingInvoiceService {
|
|||
metaData = makeCompleteInvoicePostShipping(param, "post");
|
||||
invoiceList.add(metaData);
|
||||
} catch (UserException | IOException | ParseException e) {
|
||||
invoiceList.add(new InvoiceMetaData("", "error", entry.getKey(), e.getMessage()));
|
||||
invoiceList.add(new InvoiceMetaData("", "error", "", entry.getKey(), e.getMessage()));
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
System.gc();
|
||||
|
|
|
@ -9,6 +9,8 @@ public class InvoiceMetaData {
|
|||
|
||||
private final String invoiceCode;
|
||||
|
||||
private final String internalCode;
|
||||
|
||||
private final String invoiceEntity;
|
||||
|
||||
private final String errorMsg;
|
||||
|
|
Loading…
Reference in New Issue