Commit df6963f3 authored by neo's avatar neo

[dev] ImportInputInvoiceData impl

parent 42dd42e1
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.constant.enums.EnumInvoiceType;
import pwc.taxtech.atms.vat.entity.InputVATInvoice;
import java.math.BigDecimal;
import java.util.Date;
......@@ -137,4 +138,25 @@ public class InputVATInvoiceDto extends InputVATInvoiceBaseDto {
public String getInvoiceTypeName() {
return EnumInvoiceType.values()[this.invoiceType].getName();
}
public InputVATInvoice extractInvoice(){
InputVATInvoice invoice = new InputVATInvoice();
invoice.setID(getID());
invoice.setPeriodID(getPeriodID());
invoice.setInvoiceCode(getInvoiceCode());
invoice.setInvoiceNumber(getInvoiceNumber());
invoice.setInvoiceDate(getInvoiceDate());
invoice.setSellerTaxNumber(getSellerTaxNumber());
invoice.setAmount(getAmount());
invoice.setTaxAmount(getTaxAmount());
invoice.setInvoiceType(getInvoiceType());
invoice.setCertificationResult(getCertificationResult());
invoice.setCertificationDate(getCertificationDate());
invoice.setCreatorID(getCreatorID());
invoice.setCreateTime(getCreateTime());
// invoice.setStatus(getStatus());
// invoice.setPartAccntedPeriod(getPartAccntedPeriod());
// invoice.setAccntedPeriod(getAccntedPeriod());
return invoice;
}
}
......@@ -117,8 +117,34 @@ public class InputInvoiceDataImportServiceImpl extends VatAbstractService {
return new OperationResultDto(true);
}
public OperationResultDto ImportInputInvoiceData(List<InputVATInvoiceDto> inputInvoiceList, int importType, String id) {
return null;
public OperationResultDto ImportInputInvoiceData(List<InputVATInvoiceDto> inputInvoiceDtoList, int importType, String userID) {
if (inputInvoiceDtoList.size() > 0) {
int period = inputInvoiceDtoList.get(0).getPeriodID();
inputInvoiceDtoList.forEach(item -> {
item.setID(UUID.randomUUID().toString());
if (item.getCertificationDate().equals(new Date(0))) {
item.setCertificationDate(null);
}
item.setCreatorID(userID);
item.setCreateTime(new Date());
});
//如果是覆盖导入,则先删除该期间的数据,再进行数据导入
if (importType == EnumTbImportType.CoverImport.getCode()) {
ClearTableData(period, _tableName, EnumValidationType.InputVoice.getCode());
}
// DealWithTheDuplicateData(inputInvoiceDtoList);//todo:[validation] to be continue (neo)
//导入之前转换为与数据库字段一致的dto
//将进项发票数据转换为datatable
inputInvoiceDtoList.forEach(m -> inputVATInvoiceMapper.insert(m.extractInvoice()));
//验证发票信息,包括重复验证和错误验证
// ValidateInputInvoiceInfo(period, userID);//todo:[validation] to be continue (neo)
}
return new OperationResultDto(true);
}
private void ClearTableData(int period, String tableName, int importTypeId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment