use of org.mifos.dto.domain.PersonnelDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveAllActiveBranchesAndLoanOfficerDetails.
@Override
public ChangeAccountStatusDto retrieveAllActiveBranchesAndLoanOfficerDetails() {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
List<PersonnelDto> loanOfficers = new ArrayList<PersonnelDto>();
List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
if (onlyOneActiveBranchExists(activeBranches)) {
OfficeDetailsDto singleOffice = activeBranches.get(0);
CenterCreation officeDetails = new CenterCreation(singleOffice.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
}
boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
if (loanPendingApprovalStateEnabled) {
accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
}
boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
return new ChangeAccountStatusDto(activeBranches, loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
use of org.mifos.dto.domain.PersonnelDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveLoanOfficerDetailsForBranch.
@Override
public ChangeAccountStatusDto retrieveLoanOfficerDetailsForBranch(Short officeId) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
CenterCreation officeDetails = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
if (loanPendingApprovalStateEnabled) {
accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
}
boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
return new ChangeAccountStatusDto(new ArrayList<OfficeDetailsDto>(), loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
use of org.mifos.dto.domain.PersonnelDto in project head by mifos.
the class PersonnelServiceFacadeWebTier method retrieveActiveLoanOfficersUnderOffice.
@Override
public List<PersonnelDto> retrieveActiveLoanOfficersUnderOffice(Short officeId) {
List<PersonnelBO> personnelList;
try {
personnelList = legacyPersonnelDao.getActiveLoanOfficersUnderOffice(officeId);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
List<PersonnelDto> personnelDtoList = new ArrayList<PersonnelDto>();
for (PersonnelBO personnelBO : personnelList) {
personnelDtoList.add(new PersonnelDto(personnelBO.getPersonnelId(), personnelBO.getDisplayName()));
}
return personnelDtoList;
}
use of org.mifos.dto.domain.PersonnelDto in project head by mifos.
the class GroupServiceFacadeWebTier method retrieveGroupDetailsForUpdate.
@Override
public CenterDto retrieveGroupDetailsForUpdate(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> activeLoanOfficersForBranch = new ArrayList<PersonnelDto>();
GroupBO group = this.customerDao.findGroupBySystemId(globalCustNum);
Short officeId = group.getOffice().getOfficeId();
String searchId = group.getSearchId();
Short loanOfficerId = extractLoanOfficerId(group);
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (!isCenterHierarchyExists) {
CenterCreation centerCreation = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
activeLoanOfficersForBranch = personnelDao.findActiveLoanOfficersForOffice(centerCreation);
}
List<CustomerDto> customerList = customerDao.findClientsThatAreNotCancelledOrClosed(searchId, officeId);
List<CustomerPositionDto> customerPositionDtos = generateCustomerPositionViews(group, userContext.getLocaleId());
DateTime mfiJoiningDate = new DateTime();
String mfiJoiningDateAsString = "";
if (group.getMfiJoiningDate() != null) {
mfiJoiningDate = new DateTime(group.getMfiJoiningDate());
mfiJoiningDateAsString = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), group.getMfiJoiningDate().toString());
}
AddressDto address = null;
if (group.getAddress() != null) {
address = Address.toDto(group.getAddress());
}
return new CenterDto(loanOfficerId, group.getCustomerId(), group.getGlobalCustNum(), mfiJoiningDate, mfiJoiningDateAsString, group.getExternalId(), address, customerPositionDtos, customerList, activeLoanOfficersForBranch, isCenterHierarchyExists);
}
use of org.mifos.dto.domain.PersonnelDto in project head by mifos.
the class GroupServiceFacadeWebTier method retrieveGroupFormCreationData.
@Override
public GroupFormCreationDto retrieveGroupFormCreationData(GroupCreation groupCreation) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CustomerBO parentCustomer = null;
Short parentOfficeId = groupCreation.getOfficeId();
CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.empty();
List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
CenterCreation centerCreation;
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (isCenterHierarchyExists) {
parentCustomer = this.customerDao.findCenterBySystemId(groupCreation.getParentSystemId());
parentOfficeId = parentCustomer.getOffice().getOfficeId();
centerCreation = new CenterCreation(parentOfficeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
MeetingBO customerMeeting = parentCustomer.getCustomerMeetingValue();
List<FeeBO> fees = customerDao.retrieveFeesApplicableToGroupsRefinedBy(customerMeeting);
applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
} else {
centerCreation = new CenterCreation(groupCreation.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
personnelList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
List<FeeBO> fees = customerDao.retrieveFeesApplicableToGroups();
applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
}
List<ApplicableAccountFeeDto> applicableDefaultAccountFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getDefaultFees()) {
applicableDefaultAccountFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<ApplicableAccountFeeDto> applicableDefaultAdditionalFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getAdditionalFees()) {
applicableDefaultAdditionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<PersonnelDto> formedByPersonnel = customerDao.findLoanOfficerThatFormedOffice(centerCreation.getOfficeId());
return new GroupFormCreationDto(isCenterHierarchyExists, personnelList, formedByPersonnel, applicableDefaultAccountFees, applicableDefaultAdditionalFees);
}
Aggregations