private boolean disbursementAlreadyIssued(DisbursementDTO disbursement) { boolean issued = false; for (DisbursementStatusDTO status : disbursement.getDisbursementStatuses()) { if (DisbursementConstants.DISB_STATUS_TYPE_CODE_ISSUED_PAYMENT.equals( status.getDisbursementStatusType())) { issued = true; break; } } return issued; }
private boolean updateManualCheckDisbursementStatus(DisbursementDTO disbursement) { boolean updated = false; if ((DisbursementConstants.PAY_PAYEE_CHECK.equals( disbursement.getDisbursementMethodPaymentCode())) && (disbursement.isManualCheckIndicator())) { Collection<DisbursementStatusDTO> disbursementStatusList = disbursement.getDisbursementStatuses(); for (DisbursementStatusDTO disbursementStatus : disbursementStatusList) { if (DisbursementConstants.DISB_STATUS_TYPE_CODE_ISSUED_PAYMENT.equals( disbursementStatus.getDisbursementStatusType()) && (DisbursementConstants.DISB_STATUS_REASON_CODE_MANUAL_PAYMENT.equals( disbursementStatus.getDisbursementStatusReason()))) { disbursementStatus.setDisbursementStatusReason( DisbursementConstants.DISB_STATUS_REASON_CODE_SENT_TO_PAYMENT_PROCESSOR); DTOUtils.saveEntityWithAssociations(lds, disbursement); updated = true; } } } return updated; }
/** * Update Disbursement Status. * * @param disbursements DisbursementDTO collection */ public void updateDisbursementStatus(Collection<DisbursementDTO> disbursements) { for (DisbursementDTO dto : disbursements) { Collection<DisbursementStatusDTO> statusColl = dto.getDisbursementStatuses(); /* This logic is updating the existing man_pay record, This should be no different from regular status update, expire the existing record * and create a new record for DISB_STATUS_REASON_CODE_SENT_TO_PAYMENT_PROCESSOR * if (updateManualCheckDisbursementStatus(dto)) { continue; }*/ DisbursementStatusDTO voidedDisbStatus = null; for (DisbursementStatusDTO disbursementStatusDTO : statusColl) { if (disbursementStatusDTO.getEndDateTime() == null) { disbursementStatusDTO.setEndDateTime(DateUtility.getSystemDateTime()); } // Check for voids and stop pay no issue statuses if (disbursementStatusDTO .getDisbursementStatusType() .equals(DisbursementConstants.DISB_STATUS_TYPE_CODE_PAYMENT_VOIDED_NOT_REISSUED) || disbursementStatusDTO .getDisbursementStatusType() .equals(DisbursementConstants.DISB_STATUS_TYPE_CODE_PAYMENT_STOPPED_NOT_REISSUED)) { voidedDisbStatus = disbursementStatusDTO; } } DisbursementStatusDTO currentStatus = new DisbursementStatusDTO(); if (voidedDisbStatus != null) { // If voided copy the current codes for the new status record. currentStatus.setDisbursementStatusType(voidedDisbStatus.getDisbursementStatusType()); currentStatus.setDisbursementState(voidedDisbStatus.getDisbursementState()); } else if ((dto.isManualCheckIndicator()) || (dto.getFinancialAgreementTypeCode().equals("dsb") && dto.getDisbursementTypeCode().equals("prenote"))) { currentStatus.setDisbursementStatusType( DisbursementConstants.DISB_STATUS_TYPE_CODE_ISSUED_PAYMENT); currentStatus.setDisbursementState(DisbursementConstants.DISB_STATE_TYPE_CODE_OPEN); } else { currentStatus.setDisbursementStatusType( DisbursementConstants.DISB_STATUS_TYPE_CODE_AWAITING_PAYMENT); currentStatus.setDisbursementState(DisbursementConstants.DISB_STATE_TYPE_CODE_INCOMPLETE); } currentStatus.setDisbursementStatusReason( DisbursementConstants.DISB_STATUS_REASON_CODE_SENT_TO_PAYMENT_PROCESSOR); currentStatus.setEffectiveDateTime(DateUtility.getSystemDateTime()); /** * AP Export Performance Fix - @GR - 03/30/2014 - Save just the Disbursement Status record. */ // dto.getDisbursementStatuses().add(currentStatus); statusColl.add(currentStatus); // DTOUtils.saveEntityWithAssociations(lds, dto); /* * Save the DisbursementStatusBO along with all its * associations from the values in DTO */ // fetch DisbursementBO DisbursementBO disbursement = getDisbursementDao().retrieveDisbursement(dto.getRecordId()); /* * Instantiate the custom mapper for * DisbursementStatusBO */ DisbursementStatusDTOMapper disbStatusDTOMapper = new DisbursementStatusDTOMapper(disbursement); for (DisbursementStatusDTO disbstatus : statusColl) { DTOUtils.saveEntityWithAssociations( lds, disbstatus, DisbursementStatusBO.class, disbStatusDTOMapper, true); } } }