From commits-return-8159-archive-asf-public=cust-asf.ponee.io@fineract.apache.org Sun Apr 19 19:35:50 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1A6B3180630 for ; Sun, 19 Apr 2020 21:35:50 +0200 (CEST) Received: (qmail 79849 invoked by uid 500); 19 Apr 2020 19:35:49 -0000 Mailing-List: contact commits-help@fineract.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.apache.org Delivered-To: mailing list commits@fineract.apache.org Received: (qmail 79835 invoked by uid 99); 19 Apr 2020 19:35:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2020 19:35:49 +0000 From: GitBox To: commits@fineract.apache.org Subject: [GitHub] [fineract] nikpawar89 commented on a change in pull request #738: GSIM and GLIM with test cases (FINERACT-603) Message-ID: <158732494946.4984.3212868300054483571.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Sun, 19 Apr 2020 19:35:49 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit nikpawar89 commented on a change in pull request #738: GSIM and GLIM with test cases (FINERACT-603) URL: https://github.com/apache/fineract/pull/738#discussion_r410975072 ########## File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java ########## @@ -365,11 +387,106 @@ public CommandProcessingResult submitApplication(final JsonCommand command) { createAndPersistCalendarInstanceForInterestRecalculation(newLoanApplication); } + + // loan account number generation + String accountNumber=""; + GroupLoanIndividualMonitoringAccount glimAccount; + BigDecimal applicationId=BigDecimal.ZERO; + Boolean isLastChildApplication=false; + + if (newLoanApplication.isAccountNumberRequiresAutoGeneration()) { - final AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository - .findByAccountType(EntityAccountType.LOAN); - newLoanApplication.updateAccountNo(this.accountNumberGenerator.generate(newLoanApplication, accountNumberFormat)); - this.loanRepositoryWrapper.save(newLoanApplication); + + final AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository.findByAccountType(EntityAccountType.LOAN); + // if application is of GLIM type + if(newLoanApplication.getLoanType()==4) + { + Group group= this.groupRepository.findOneWithNotFoundDetection(groupId); + + //GLIM specific parameters + if(command.bigDecimalValueOfParameterNamedDefaultToNullIfZero("applicationId")!=null) + { + applicationId=command.bigDecimalValueOfParameterNamedDefaultToNullIfZero("applicationId"); + } + + if(command.booleanObjectValueOfParameterNamed("lastApplication")!=null) + { + isLastChildApplication=command.booleanPrimitiveValueOfParameterNamed("lastApplication"); + } + + if(command.booleanObjectValueOfParameterNamed("isParentAccount")!=null) + { + + //empty table check + if(glimRepository.count()!=0) + { + //**************Parent-Not an empty table******************** + accountNumber=this.accountNumberGenerator.generate(newLoanApplication, accountNumberFormat); + newLoanApplication.updateAccountNo(accountNumber+"-1"); Review comment: Including hyphens in account number would increase readability but some of the central banks won't like. I am aware of such incident, where one of the MF had account number with hyphen printed on cheque and clearing house refused to process it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services