Search in sources :

Example 1 with ConcurRequestExtractRequestDetailFileLine

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;
    }
}
Also used : ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 2 with ConcurRequestExtractRequestDetailFileLine

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;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) ArrayList(java.util.ArrayList) ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) PdpFeedDetailEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) PdpFeedGroupEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)

Example 3 with ConcurRequestExtractRequestDetailFileLine

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;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) ArrayList(java.util.ArrayList) ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) IOException(java.io.IOException) FileStorageException(org.kuali.kfs.sys.exception.FileStorageException) ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) File(java.io.File)

Example 4 with ConcurRequestExtractRequestDetailFileLine

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;
    }
}
Also used : ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)

Aggregations

ConcurRequestExtractRequestDetailFileLine (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)4 ArrayList (java.util.ArrayList)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 ConcurRequestExtractFile (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile)1 ConcurRequestExtractBatchReportData (edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData)1 PdpFeedDetailEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry)1 PdpFeedFileBaseEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)1 PdpFeedGroupEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)1 File (java.io.File)1 IOException (java.io.IOException)1 FileStorageException (org.kuali.kfs.sys.exception.FileStorageException)1