use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImpl method calculateFileTotalApprovedAmountAggregatedByRequestId.
private KualiDecimal calculateFileTotalApprovedAmountAggregatedByRequestId(ConcurRequestExtractFile requestExtractFile) {
KualiDecimal detailLinesTotalApprovedAmountSum = KualiDecimal.ZERO;
if (CollectionUtils.isEmpty(requestExtractFile.getRequestDetails())) {
return detailLinesTotalApprovedAmountSum;
} else {
List<ConcurRequestExtractRequestDetailFileLine> requestDetailLines = requestExtractFile.getRequestDetails();
List<String> uniqueRequestIds = findAllUniqueRequestIds(requestDetailLines);
for (String uniqueRequestId : uniqueRequestIds) {
boolean approvedAmountForRequestIdNotFound = true;
ListIterator<ConcurRequestExtractRequestDetailFileLine> requestDetailFileLineIterator = requestDetailLines.listIterator();
while (requestDetailFileLineIterator.hasNext() && approvedAmountForRequestIdNotFound) {
ConcurRequestExtractRequestDetailFileLine detailLine = requestDetailFileLineIterator.next();
if (StringUtils.equals(detailLine.getRequestId(), uniqueRequestId)) {
approvedAmountForRequestIdNotFound = false;
detailLinesTotalApprovedAmountSum = detailLinesTotalApprovedAmountSum.add(detailLine.getTotalApprovedAmount());
}
}
}
return detailLinesTotalApprovedAmountSum;
}
}
use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine in project cu-kfs by CU-CommunityApps.
the class ConcurCashAdvancePdpFeedFileServiceImpl method buildPdpFeedBaseEntry.
private PdpFeedFileBaseEntry buildPdpFeedBaseEntry(ConcurRequestExtractFile requestExtractFile, ConcurRequestExtractBatchReportData reportData) {
int totalPdpDetailRecordsCount = 0;
KualiDecimal totalPdpDetailRecordsAmount = KualiDecimal.ZERO;
PdpFeedFileBaseEntry pdpBaseEntry = new PdpFeedFileBaseEntry();
pdpBaseEntry.setHeader(buildPdpFeedHeaderEntry(requestExtractFile.getBatchDate()));
List<PdpFeedGroupEntry> groupEntries = new ArrayList<PdpFeedGroupEntry>();
for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
if (isDetailFileLineValidCashAdvanceRequest(detailFileLine)) {
PdpFeedDetailEntry pdpDetailEntry = buildPdpFeedDetailEntry(detailFileLine, buildPdpFeedAccountingEntry(detailFileLine));
List<PdpFeedDetailEntry> pdpDetailEntries = new ArrayList<PdpFeedDetailEntry>();
pdpDetailEntries.add(pdpDetailEntry);
groupEntries.add(buildPdpFeedGroupEntry(detailFileLine, buildPdpFeedPayeeIdEntry(detailFileLine), pdpDetailEntries));
recordCashAdvanceGenerationInDuplicateTrackingTable(detailFileLine, pdpDetailEntry.getSourceDocNbr(), requestExtractFile.getFileName());
totalPdpDetailRecordsCount++;
totalPdpDetailRecordsAmount = totalPdpDetailRecordsAmount.add(detailFileLine.getRequestAmount());
}
updateReportDataForDetailFileLineBeingProcessed(reportData, detailFileLine, totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount);
}
pdpBaseEntry.setGroup(groupEntries);
pdpBaseEntry.setTrailer(buildPdpFeedTrailerEntry(totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount));
pdpBaseEntry.setVersion(ConcurConstants.FEED_FILE_ENTRY_HEADER_VERSION);
return pdpBaseEntry;
}
use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileServiceImpl method processFile.
public boolean processFile(String requestExtractFullyQualifiedFileName) {
boolean processingSuccessful = false;
ConcurRequestExtractFile requestExtractFile = loadFileIntoParsedDataObject(requestExtractFullyQualifiedFileName);
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
reportData.setConcurFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
if (getConcurRequestExtractFileValidationService().requestExtractHeaderRowValidatesToFileContents(requestExtractFile, reportData)) {
List<String> uniqueRequestIdsInFile = new ArrayList<String>();
for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
getConcurRequestExtractFileValidationService().performRequestDetailLineValidation(detailFileLine, uniqueRequestIdsInFile);
}
requestExtractFile.setFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
processingSuccessful = getConcurCashAdvancePdpFeedFileService().createPdpFeedFileForValidatedDetailFileLines(requestExtractFile, reportData);
if (processingSuccessful && StringUtils.isNotBlank(requestExtractFile.getFullyQualifiedPdpFileName())) {
try {
getConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile(requestExtractFile.getFullyQualifiedPdpFileName());
} catch (IOException ioe) {
LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated IOException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
processingSuccessful = false;
} catch (FileStorageException fse) {
LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated FileStorageException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
processingSuccessful = false;
}
}
}
File reportFile = getConcurRequestExtractReportService().generateReport(reportData);
getConcurRequestExtractReportService().sendResultsEmail(reportData, reportFile);
LOG.debug("method processFile:: requestExtractFile data after processing: " + KFSConstants.NEWLINE + requestExtractFile.toString());
return processingSuccessful;
}
use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImpl method customerProfileIsValidOnAllRequestDetailLines.
private boolean customerProfileIsValidOnAllRequestDetailLines(ConcurRequestExtractFile requestExtractFile) {
if (CollectionUtils.isEmpty(requestExtractFile.getRequestDetails())) {
return false;
} else {
List<ConcurRequestExtractRequestDetailFileLine> requestDetailLines = requestExtractFile.getRequestDetails();
boolean foundOnAllLines = true;
for (ConcurRequestExtractRequestDetailFileLine detailLine : requestDetailLines) {
foundOnAllLines &= concurEmployeeInfoValidationService.isEmployeeGroupIdValid(detailLine.getEmployeeGroupId());
}
return foundOnAllLines;
}
}
Aggregations