use of org.mifos.dto.screen.ClientInformationDto in project head by mifos.
the class PictureFormFile method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String clientSystemId = ((ClientCustActionForm) form).getGlobalCustNum();
ClientInformationDto clientInformationDto;
try {
clientInformationDto = clientServiceFacade.getClientInformationDto(clientSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
// John W - for breadcrumb or another other action downstream that exists business_key set (until refactored)
ClientBO clientBO = (ClientBO) this.customerDao.findCustomerById(clientInformationDto.getClientDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, clientBO, request);
SessionUtils.setAttribute(ClientConstants.IS_PHOTO_FIELD_HIDDEN, FieldConfig.getInstance().isFieldHidden("Client.Photo"), request);
setCurrentPageUrl(request, clientBO);
setQuestionGroupInstances(request, clientBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.removeThenSetAttribute("clientInformationDto", clientInformationDto, request);
request.getSession().setAttribute("guarantyClientInformation", loanAccountServiceFacade.retrieveGuarantyClientInformation(clientInformationDto));
QuestionnaireServiceFacade questionnaireServiceFacade = questionnaireServiceFacadeLocator.getService(request);
List<QuestionGroupInstanceDetail> questions = new ArrayList<QuestionGroupInstanceDetail>();
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Create", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "View", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Close", "Client"));
SessionUtils.setCollectionAttribute("questionGroups", questions, request);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("Client"), request);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.dto.screen.ClientInformationDto in project head by mifos.
the class ClientServiceFacadeWebTier method getClientInformationDto.
@Override
public ClientInformationDto getClientInformationDto(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
ClientBO client = customerDao.findClientBySystemId(globalCustNum);
if (client == null) {
throw new MifosRuntimeException("Client not found for globalCustNum, levelId: " + globalCustNum);
}
try {
personnelDao.checkAccessPermission(userContext, client.getOfficeId(), client.getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
ClientDisplayDto clientDisplay = this.customerDao.getClientDisplayDto(client.getCustomerId(), userContext);
Integer clientId = client.getCustomerId();
CustomerAccountSummaryDto customerAccountSummary = this.customerDao.getCustomerAccountSummaryDto(clientId);
ClientPerformanceHistoryDto clientPerformanceHistory = assembleClientPerformanceHistoryDto(client.getClientPerformanceHistory(), clientId);
CustomerAddressDto clientAddress = this.customerDao.getCustomerAddressDto(client);
List<CustomerNoteDto> recentCustomerNotes = customerDao.getRecentCustomerNoteDto(clientId);
List<CustomerFlagDto> customerFlags = customerDao.getCustomerFlagDto(client.getCustomerFlags());
List<LoanDetailDto> loanDetail = customerDao.getLoanDetailDto(client.getOpenLoanAccounts());
List<LoanDetailDto> groupLoanDetail = customerDao.getLoanDetailDto(client.getOpenGroupLoanAccounts());
List<SavingsDetailDto> savingsDetail = customerDao.getSavingsDetailDto(clientId, userContext);
CustomerMeetingDto customerMeeting = customerDao.getCustomerMeetingDto(client.getCustomerMeeting(), userContext);
List<AccountBO> allClosedLoanAndSavingsAccounts = customerDao.retrieveAllClosedLoanAndSavingsAccounts(clientId);
List<LoanDetailDto> closedLoanAccounts = new ArrayList<LoanDetailDto>();
List<SavingsDetailDto> closedSavingsAccounts = new ArrayList<SavingsDetailDto>();
for (AccountBO closedAccount : allClosedLoanAndSavingsAccounts) {
if (closedAccount.getAccountType().getAccountTypeId() == AccountTypes.LOAN_ACCOUNT.getValue().intValue()) {
closedLoanAccounts.add(new LoanDetailDto(closedAccount.getGlobalAccountNum(), ((LoanBO) closedAccount).getLoanOffering().getPrdOfferingName(), closedAccount.getAccountState().getId(), closedAccount.getAccountState().getName(), ((LoanBO) closedAccount).getLoanSummary().getOutstandingBalance().toString(), closedAccount.getTotalAmountDue().toString(), closedAccount.getTotalAmountInArrears().toString()));
} else {
closedSavingsAccounts.add(new SavingsDetailDto(closedAccount.getGlobalAccountNum(), ((SavingsBO) closedAccount).getSavingsOffering().getPrdOfferingName(), closedAccount.getAccountState().getId(), closedAccount.getAccountState().getName(), ((SavingsBO) closedAccount).getSavingsBalance().toString()));
}
}
Boolean activeSurveys = Boolean.FALSE;
// Boolean activeSurveys = new SurveysPersistence().isActiveSurveysForSurveyType(SurveyType.CLIENT);
List<SurveyDto> customerSurveys = new ArrayList<SurveyDto>();
List<LoanDetailDto> guarantedLoanAccounts = new ArrayList<LoanDetailDto>();
try {
List<GuarantyEntity> guaranties = legacyAccountDao.getGuarantyByGurantorId(clientId);
if (guaranties != null && guaranties.size() > 0) {
for (GuarantyEntity guaranty : guaranties) {
if (guaranty != null && guaranty.getState() != null && guaranty.getState()) {
LoanBO loan = loanDao.findById(guaranty.getLoanId());
guarantedLoanAccounts.add(new LoanDetailDto(loan.getGlobalAccountNum(), loan.getLoanOffering().getPrdOfferingName(), loan.getAccountState().getId(), loan.getAccountState().getName(), loan.getLoanSummary().getOutstandingBalance().toString(), loan.getTotalAmountDue().toString(), loan.getAccountType().getAccountTypeId(), loan.getTotalAmountInArrears().toString()));
}
}
}
} catch (PersistenceException e) {
throw new MifosRuntimeException("Can not get guaranted loan accounts", e);
}
return new ClientInformationDto(clientDisplay, customerAccountSummary, clientPerformanceHistory, clientAddress, recentCustomerNotes, customerFlags, loanDetail, groupLoanDetail, savingsDetail, customerMeeting, activeSurveys, customerSurveys, closedLoanAccounts, closedSavingsAccounts, guarantedLoanAccounts);
}
use of org.mifos.dto.screen.ClientInformationDto in project head by mifos.
the class ClientCustActionStrutsTest method testGet.
@Ignore
@Test
public void testGet() throws Exception {
createInitialCustomers();
accountBO = getLoanAccount(client, meeting);
ClientTestUtils.setDateOfBirth(client, offSetCurrentDate(50));
TestObjectFactory.updateObject(client);
StaticHibernateUtil.flushAndClearSession();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "get");
addRequestParameter("globalCustNum", client.getGlobalCustNum());
addRequestParameter("recordOfficeId", "12");
addRequestParameter("recordLoanOfficerId", "28");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.get_success.toString());
ClientInformationDto clientInformationDto = (ClientInformationDto) SessionUtils.getAttribute("clientInformationDto", request);
Assert.assertEquals("Age of customer should be 50 years", 50, (int) clientInformationDto.getClientDisplay().getAge());
Assert.assertEquals("No of active loan accounts should be 1", 1, clientInformationDto.getLoanAccountsInUse().size());
assertCurrentPageUrl(client.getGlobalCustNum(), 12, 28);
StaticHibernateUtil.flushAndClearSession();
group = (GroupBO) StaticHibernateUtil.getSessionTL().get(GroupBO.class, group.getCustomerId());
center = (CenterBO) StaticHibernateUtil.getSessionTL().get(CenterBO.class, center.getCustomerId());
client = (ClientBO) StaticHibernateUtil.getSessionTL().get(ClientBO.class, client.getCustomerId());
accountBO = (LoanBO) StaticHibernateUtil.getSessionTL().get(LoanBO.class, accountBO.getAccountId());
}
use of org.mifos.dto.screen.ClientInformationDto in project head by mifos.
the class ViewCustomerDetailsController method showClientDetails.
@RequestMapping(value = "/viewClientDetails", method = RequestMethod.GET)
public ModelAndView showClientDetails(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewClientDetails", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String clientSystemId = request.getParameter("globalCustNum");
ClientInformationDto clientInformationDto;
clientInformationDto = clientServiceFacade.getClientInformationDto(clientSystemId);
modelAndView.addObject("clientInformationDto", clientInformationDto);
boolean isPhotoFieldHidden = this.adminServiceFacade.isHiddenMandatoryField("photo");
modelAndView.addObject("isPhotoFieldHidden", isPhotoFieldHidden);
modelAndView.addObject("currentPageUrl", UrlHelper.constructCurrentPageUrl(request));
boolean containsQGForCloseClient = false;
containsQGForCloseClient = questionnaireServiceFacade.getQuestionGroupInstances(clientInformationDto.getClientDisplay().getCustomerId(), "Close", "Client").size() > 0;
modelAndView.addObject("containsQGForCloseClient", containsQGForCloseClient);
request.getSession().setAttribute("backPageUrl", request.getAttribute("currentPageUrl"));
clientServiceFacade.putClientBusinessKeyInSession(clientSystemId, request);
return modelAndView;
}
use of org.mifos.dto.screen.ClientInformationDto in project head by mifos.
the class ClientRESTController method createClient.
@RequestMapping(value = "client/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createClient(@RequestBody String request) throws Throwable {
ObjectMapper om = createClientMapping();
CreateClientCreationDetail creationDetail = null;
MeetingBO meetingBO = null;
try {
creationDetail = om.readValue(request, CreateClientCreationDetail.class);
} catch (JsonMappingException e) {
e.getCause();
}
validate(creationDetail);
meetingBO = (MeetingBO) creationDetail.getMeeting().toBO();
ClientCreationDetail client = createClient(creationDetail);
CustomerDetailsDto clientDetails = clientServiceFacade.createNewClient(client, meetingBO.toDto(), null);
ClientInformationDto clientInfo = clientServiceFacade.getClientInformationDto(clientDetails.getGlobalCustNum());
Map<String, String> map = new HashMap<String, String>();
map.put("status", "success");
map.put("globalCustNum", clientInfo.getClientDisplay().getGlobalCustNum());
map.put("accountNum", clientInfo.getCustomerAccountSummary().getGlobalAccountNum());
map.put("address", clientInfo.getAddress().getDisplayAddress());
map.put("city", clientInfo.getAddress().getCity());
map.put("state", clientInfo.getAddress().getState());
map.put("country", clientInfo.getAddress().getCountry());
map.put("postal code", clientInfo.getAddress().getZip());
map.put("phone", clientInfo.getAddress().getPhoneNumber());
map.put("dispalyName", clientInfo.getClientDisplay().getDisplayName());
map.put("externalId", clientInfo.getClientDisplay().getExternalId());
map.put("loanOfficer", clientInfo.getClientDisplay().getLoanOfficerName());
return map;
}
Aggregations