use of org.kuali.kfs.sys.batch.BatchInputFileType in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImpl method processACHBatchDetails.
// Portions of this method are based on code and logic from CustomerLoadServiceImpl.
@Transactional
@Override
public boolean processACHBatchDetails() {
LOG.info("processACHBatchDetails: Beginning processing of ACH input files");
int numSuccess = 0;
int numPartial = 0;
int numFail = 0;
partialProcessingSummary = new HashMap<String, List<String>>();
Map<String, BatchInputFileType> fileNamesToLoad = getListOfFilesToProcess();
LOG.info("processACHBatchDetails: Found " + fileNamesToLoad.size() + " file(s) to process.");
List<String> processedFiles = new ArrayList<String>();
for (String inputFileName : fileNamesToLoad.keySet()) {
LOG.info("processACHBatchDetails: Beginning processing of filename: " + inputFileName);
processedFiles.add(inputFileName);
try {
List<String> errorList = new ArrayList();
errorList = loadACHBatchDetailFile(inputFileName, fileNamesToLoad.get(inputFileName));
if (errorList.isEmpty()) {
LOG.info("processACHBatchDetails: Successfully loaded ACH input file");
numSuccess++;
} else {
LOG.warn("processACHBatchDetails: ACH input file contained " + errorList.size() + " rows that could not be processed.");
partialProcessingSummary.put(inputFileName, errorList);
numPartial++;
}
} catch (Exception e) {
LOG.error("processACHBatchDetails: Failed to load ACH input file due to this Exception:", e);
numFail++;
}
}
removeDoneFiles(processedFiles);
LOG.info("processACHBatchDetails: ==============================================");
LOG.info("processACHBatchDetails: ==== Summary of Payee ACH Account Extract ====");
LOG.info("processACHBatchDetails: ==============================================");
LOG.info("processACHBatchDetails: Files loaded successfully: " + numSuccess);
LOG.info("processACHBatchDetails: Files loaded with one or more failed rows: " + numPartial);
if (!partialProcessingSummary.isEmpty()) {
for (String failingFileName : partialProcessingSummary.keySet()) {
List<String> errorsEncountered = partialProcessingSummary.get(failingFileName);
LOG.error("processACHBatchDetails: ACH input file contained " + errorsEncountered.size() + " rows that could not be processed.");
for (Iterator iterator = errorsEncountered.iterator(); iterator.hasNext(); ) {
String dataError = (String) iterator.next();
LOG.error("processACHBatchDetails: " + dataError);
}
}
}
LOG.info("processACHBatchDetails: Files with errors: " + numFail);
LOG.info("processACHBatchDetails: =====================");
LOG.info("processACHBatchDetails: ==== End Summary ====");
LOG.info("processACHBatchDetails: =====================");
// For now, return true even if files or rows did not load successfully. Functionals will address the failed rows/files accordingly.
return true;
}
use of org.kuali.kfs.sys.batch.BatchInputFileType in project cu-kfs by CU-CommunityApps.
the class CuReceiptProcessingServiceImplNegativeTest method setupBatchInputFileTypes.
private List<BatchInputFileType> setupBatchInputFileTypes() {
ReceiptProcessingCSVInputFileType batchInputFileType = new ReceiptProcessingCSVInputFileType();
batchInputFileType.setDirectoryPath(BATCH_DIRECTORY);
batchInputFileType.setFileExtension("csv");
batchInputFileType.setCsvEnumClass(ReceiptProcessingCSV.class);
List<BatchInputFileType> batchInputFileTypeList = new ArrayList<>();
batchInputFileTypeList.add(batchInputFileType);
return batchInputFileTypeList;
}
Aggregations