Commit a4498e97 authored by neo's avatar neo

[DEV] ImportCustomsInvoice impl

parent ccaa0add
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.constant.enums.EnumValidationType;
import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
......@@ -99,7 +100,25 @@ public class CustomsInvoiceServiceImpl extends VatAbstractService {
return resultOpt;
}
public OperationResultDto ImportCustomsInvoice(List<CustomsInvoiceDto> customsList, int importType, String userId) {
return null;
public OperationResultDto ImportCustomsInvoice(List<CustomsInvoice> custList, int importType, String userId) {
try {
int periodId = 0;
if (importType == EnumTbImportType.CoverImport.getCode()) {
periodId = custList.get(0).getPeriodId().intValue();
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.createCriteria().andPeriodIdEqualTo(periodId);
customsInvoiceMapper.deleteByExample(example);
}
custList.forEach(c -> {
c.setCreatorID(userId);
});
custList.forEach(m -> customsInvoiceMapper.insert(m));
// UpdateCustomsInvoiceValidation(userId, periodId);//todo:[validation] to be continue (neo)
return new OperationResultDto(true, "");
} catch (Exception ex) {
return new OperationResultDto(false, ex.getMessage());
}
}
}
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