Merge branch 'develop' into swagger-documentation-integration
This commit is contained in:
+16
-7
@@ -18,7 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.importhandler.client;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -29,17 +33,19 @@ import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandler
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandlerUtils;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.helper.DateSerializer;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.*;
|
||||
import org.apache.fineract.portfolio.address.data.AddressData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientNonPersonData;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@Service
|
||||
public class ClientEntityImportHandler implements ImportHandler {
|
||||
|
||||
@@ -134,6 +140,7 @@ public class ClientEntityImportHandler implements ImportHandler {
|
||||
activationDate=submittedOn;
|
||||
}
|
||||
AddressData addressDataObj=null;
|
||||
Collection<AddressData> addressList = null;
|
||||
if (ImportHandlerUtils.readAsBoolean(ClientEntityConstants.ADDRESS_ENABLED,row)) {
|
||||
String addressType = ImportHandlerUtils.readAsString(ClientEntityConstants.ADDRESS_TYPE_COL, row);
|
||||
Long addressTypeId = null;
|
||||
@@ -167,10 +174,12 @@ public class ClientEntityImportHandler implements ImportHandler {
|
||||
}
|
||||
addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3,
|
||||
city, postalCode, isActiveAddress, stateProvinceId, countryId);
|
||||
addressList = new ArrayList<AddressData>(Arrays.asList(addressDataObj));
|
||||
}
|
||||
return ClientData.importClientEntityInstance(legalFormId,row.getRowNum(),name,officeId,clientTypeId,clientClassicationId,
|
||||
staffId,active,activationDate,submittedOn, externalId,incorportionDate,mobileNo,clientNonPersonData,addressDataObj,locale,dateFormat);
|
||||
}
|
||||
staffId, active, activationDate, submittedOn, externalId, incorportionDate, mobileNo,
|
||||
clientNonPersonData, addressList, locale, dateFormat);
|
||||
}
|
||||
|
||||
public Count importEntity(String dateFormat) {
|
||||
Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_ENTITY_SHEET_NAME);
|
||||
|
||||
+17
-9
@@ -18,7 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.importhandler.client;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -28,17 +32,18 @@ import org.apache.fineract.infrastructure.bulkimport.data.Count;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandler;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandlerUtils;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.helper.DateSerializer;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.*;
|
||||
import org.apache.fineract.portfolio.address.data.AddressData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
@Service
|
||||
public class ClientPersonImportHandler implements ImportHandler {
|
||||
@@ -120,6 +125,7 @@ public class ClientPersonImportHandler implements ImportHandler {
|
||||
Boolean isStaff = ImportHandlerUtils.readAsBoolean(ClientPersonConstants.IS_STAFF_COL, row);
|
||||
|
||||
AddressData addressDataObj=null;
|
||||
Collection<AddressData> addressList = null;
|
||||
if (ImportHandlerUtils.readAsBoolean(ClientPersonConstants.ADDRESS_ENABLED_COL,row)) {
|
||||
String addressType=ImportHandlerUtils.readAsString(ClientPersonConstants.ADDRESS_TYPE_COL, row);
|
||||
Long addressTypeId = null;
|
||||
@@ -154,11 +160,13 @@ public class ClientPersonImportHandler implements ImportHandler {
|
||||
}
|
||||
addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3,
|
||||
city, postalCode, isActiveAddress, stateProvinceId, countryId);
|
||||
addressList = new ArrayList<AddressData>(Arrays.asList(addressDataObj));
|
||||
}
|
||||
return ClientData.importClientPersonInstance(legalFormId,row.getRowNum(),firstName,lastName,middleName,submittedOn,activationDate,active,externalId,
|
||||
officeId,staffId,mobileNo,dob,clientTypeId,genderId,clientClassicationId,isStaff,addressDataObj,locale,dateFormat);
|
||||
officeId, staffId, mobileNo, dob, clientTypeId, genderId, clientClassicationId, isStaff,
|
||||
addressList, locale, dateFormat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Count importEntity(String dateFormat) {
|
||||
Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_PERSON_SHEET_NAME);
|
||||
@@ -174,7 +182,7 @@ public class ClientPersonImportHandler implements ImportHandler {
|
||||
.createClient() //
|
||||
.withJson(payload) //
|
||||
.build(); //
|
||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
successCount++;
|
||||
Cell statusCell = clientSheet.getRow(client.getRowIndex()).createCell(ClientPersonConstants.STATUS_COL);
|
||||
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
|
||||
|
||||
+19
-13
@@ -18,8 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.importhandler.loanrepayment;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -29,28 +31,32 @@ import org.apache.fineract.infrastructure.bulkimport.data.Count;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandler;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandlerUtils;
|
||||
import org.apache.fineract.infrastructure.bulkimport.importhandler.helper.DateSerializer;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.*;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
@Service
|
||||
public class LoanRepaymentImportHandler implements ImportHandler {
|
||||
private Workbook workbook;
|
||||
private List<LoanTransactionData> loanRepayments;
|
||||
private Integer loanAccountId;
|
||||
private Long loanAccountId;
|
||||
private final LoanReadPlatformService loanReadPlatformService;
|
||||
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
@Autowired
|
||||
public LoanRepaymentImportHandler(final PortfolioCommandSourceWritePlatformService
|
||||
commandsSourceWritePlatformService) {
|
||||
commandsSourceWritePlatformService, final LoanReadPlatformService loanReadPlatformService) {
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.loanReadPlatformService = loanReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +81,7 @@ public class LoanRepaymentImportHandler implements ImportHandler {
|
||||
String loanaccountInfo=ImportHandlerUtils.readAsString(LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, row);
|
||||
if (loanaccountInfo!=null){
|
||||
String loanAccountAr[]=loanaccountInfo.split("-");
|
||||
loanAccountId=Integer.parseInt(loanAccountAr[0]);
|
||||
loanAccountId = this.loanReadPlatformService.retrieveLoanIdByAccountNumber(loanAccountAr[0]);
|
||||
}
|
||||
BigDecimal repaymentAmount=null;
|
||||
if (ImportHandlerUtils.readAsDouble(LoanRepaymentConstants.AMOUNT_COL, row)!=null)
|
||||
@@ -107,10 +113,10 @@ public class LoanRepaymentImportHandler implements ImportHandler {
|
||||
loanRepaymentJsonob.remove("manuallyReversed");
|
||||
String payload=loanRepaymentJsonob.toString();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.loanRepaymentTransaction(loanRepayment.getAccountId().longValue()) //
|
||||
.loanRepaymentTransaction(loanRepayment.getAccountId()) //
|
||||
.withJson(payload) //
|
||||
.build(); //
|
||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
successCount++;
|
||||
Cell statusCell = loanRepaymentSheet.getRow(loanRepayment.getRowIndex()).createCell(LoanRepaymentConstants.STATUS_COL);
|
||||
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
|
||||
|
||||
+1
-1
@@ -213,7 +213,7 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
row = loanRepaymentSheet.createRow(rowIndex++);
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, row, loan.getClientName() + "(" + loan.getClientId() + ")");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,row, clientIdToClientExternalId.get(loan.getClientId()));
|
||||
writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, row, Long.parseLong(loan.getAccountNo())+"-"+loan.getStatusStringValue());
|
||||
writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, row, loan.getAccountNo()+"-"+loan.getStatusStringValue());
|
||||
writeString(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, row, loan.getLoanProductName());
|
||||
writeDouble(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, row, loan.getPrincipal().doubleValue());
|
||||
if (loan.getDisbursementDate() != null) {
|
||||
|
||||
+2
@@ -24,7 +24,9 @@ import java.util.Date;
|
||||
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class AddressData {
|
||||
|
||||
private final Long client_id;
|
||||
|
||||
private final String addressType;
|
||||
|
||||
+34
-32
@@ -115,42 +115,44 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
|
||||
long countryId;
|
||||
ClientAddress clientAddressobj = new ClientAddress();
|
||||
final JsonArray addressArray = command.arrayOfParameterNamed("address");
|
||||
|
||||
if(addressArray != null){
|
||||
for (int i = 0; i < addressArray.size(); i++) {
|
||||
final JsonObject jsonObject = addressArray.get(i).getAsJsonObject();
|
||||
|
||||
for (int i = 0; i < addressArray.size(); i++) {
|
||||
final JsonObject jsonObject = addressArray.get(i).getAsJsonObject();
|
||||
// validate every address
|
||||
this.fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), true);
|
||||
|
||||
// validate every address
|
||||
this.fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), true);
|
||||
if (jsonObject.get("stateProvinceId") != null) {
|
||||
stateId = jsonObject.get("stateProvinceId").getAsLong();
|
||||
stateIdobj = this.codeValueRepository.getOne(stateId);
|
||||
}
|
||||
|
||||
if (jsonObject.get("countryId") != null) {
|
||||
countryId = jsonObject.get("countryId").getAsLong();
|
||||
countryIdObj = this.codeValueRepository.getOne(countryId);
|
||||
}
|
||||
|
||||
final long addressTypeId = jsonObject.get("addressTypeId").getAsLong();
|
||||
final CodeValue addressTypeIdObj = this.codeValueRepository.getOne(addressTypeId);
|
||||
|
||||
final Address add = Address.fromJsonObject(jsonObject, stateIdobj, countryIdObj);
|
||||
this.addressRepository.save(add);
|
||||
final Long addressid = add.getId();
|
||||
final Address addobj = this.addressRepository.getOne(addressid);
|
||||
|
||||
//final boolean isActive = jsonObject.get("isActive").getAsBoolean();
|
||||
boolean isActive=false;
|
||||
if(jsonObject.get("isActive")!= null)
|
||||
{
|
||||
isActive= jsonObject.get("isActive").getAsBoolean();
|
||||
}
|
||||
|
||||
|
||||
clientAddressobj = ClientAddress.fromJson(isActive, client, addobj, addressTypeIdObj);
|
||||
this.clientAddressRepository.save(clientAddressobj);
|
||||
|
||||
if (jsonObject.get("stateProvinceId") != null) {
|
||||
stateId = jsonObject.get("stateProvinceId").getAsLong();
|
||||
stateIdobj = this.codeValueRepository.getOne(stateId);
|
||||
}
|
||||
|
||||
if (jsonObject.get("countryId") != null) {
|
||||
countryId = jsonObject.get("countryId").getAsLong();
|
||||
countryIdObj = this.codeValueRepository.getOne(countryId);
|
||||
}
|
||||
|
||||
final long addressTypeId = jsonObject.get("addressTypeId").getAsLong();
|
||||
final CodeValue addressTypeIdObj = this.codeValueRepository.getOne(addressTypeId);
|
||||
|
||||
final Address add = Address.fromJsonObject(jsonObject, stateIdobj, countryIdObj);
|
||||
this.addressRepository.save(add);
|
||||
final Long addressid = add.getId();
|
||||
final Address addobj = this.addressRepository.getOne(addressid);
|
||||
|
||||
//final boolean isActive = jsonObject.get("isActive").getAsBoolean();
|
||||
boolean isActive=false;
|
||||
if(jsonObject.get("isActive")!= null)
|
||||
{
|
||||
isActive= jsonObject.get("isActive").getAsBoolean();
|
||||
}
|
||||
|
||||
|
||||
clientAddressobj = ClientAddress.fromJson(isActive, client, addobj, addressTypeIdObj);
|
||||
this.clientAddressRepository.save(clientAddressobj);
|
||||
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId())
|
||||
|
||||
+10
-11
@@ -21,12 +21,10 @@ package org.apache.fineract.portfolio.client.data;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.builder.CompareToBuilder;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
|
||||
@@ -41,6 +39,7 @@ import org.joda.time.LocalDate;
|
||||
/**
|
||||
* Immutable data object representing client data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
final public class ClientData implements Comparable<ClientData> {
|
||||
|
||||
private final Long id;
|
||||
@@ -50,7 +49,6 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
private final EnumOptionData status;
|
||||
private final CodeValueData subStatus;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Boolean active;
|
||||
private final LocalDate activationDate;
|
||||
|
||||
@@ -102,12 +100,13 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
private final ClientFamilyMembersData familyMemberOptions;
|
||||
|
||||
private final ClientNonPersonData clientNonPersonDetails;
|
||||
|
||||
private final AddressData address;
|
||||
|
||||
private final Collection<AddressData> address;
|
||||
|
||||
private final Boolean isAddressEnabled;
|
||||
|
||||
private final List<DatatableData> datatables;
|
||||
|
||||
private final List<DatatableData> datatables;
|
||||
|
||||
//import fields
|
||||
private transient Integer rowIndex;
|
||||
@@ -122,7 +121,7 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
public static ClientData importClientEntityInstance(Long legalFormId,Integer rowIndex,String fullname,Long officeId, Long clientTypeId,
|
||||
Long clientClassificationId,Long staffId,Boolean active,LocalDate activationDate,LocalDate submittedOnDate,
|
||||
String externalId,LocalDate dateOfBirth,String mobileNo,ClientNonPersonData clientNonPersonDetails,
|
||||
AddressData address,String locale,String dateFormat){
|
||||
Collection<AddressData> address,String locale,String dateFormat){
|
||||
return new ClientData(legalFormId,rowIndex,fullname, null, null, null, submittedOnDate,activationDate,active, externalId,
|
||||
officeId, staffId,mobileNo,dateOfBirth,clientTypeId, null,clientClassificationId,null,
|
||||
address,clientNonPersonDetails, locale,dateFormat);
|
||||
@@ -131,7 +130,7 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
public static ClientData importClientPersonInstance(Long legalFormId,Integer rowIndex,String firstName,String lastName,String middleName,
|
||||
LocalDate submittedOn,LocalDate activationDate,Boolean active,String externalId,Long officeId,
|
||||
Long staffId,String mobileNo, LocalDate dob,Long clientTypeId,Long genderId,
|
||||
Long clientClassificationId, Boolean isStaff, AddressData address,String locale,String dateFormat){
|
||||
Long clientClassificationId, Boolean isStaff, Collection<AddressData> address,String locale,String dateFormat){
|
||||
|
||||
return new ClientData(legalFormId,rowIndex, null, firstName,lastName,middleName,submittedOn,activationDate,active,externalId,
|
||||
officeId,staffId,mobileNo,dob,clientTypeId,genderId,clientClassificationId,isStaff,address, null, locale,dateFormat);
|
||||
@@ -144,7 +143,7 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
private ClientData(Long legalFormId,Integer rowIndex, String fullname, String firstname,String lastname,String middlename,
|
||||
LocalDate submittedOn,LocalDate activationDate,Boolean active,String externalId,Long officeId,
|
||||
Long staffId,String mobileNo, LocalDate dob,Long clientTypeId,Long genderId,
|
||||
Long clientClassificationId,Boolean isStaff, AddressData address, ClientNonPersonData clientNonPersonDetails,
|
||||
Long clientClassificationId,Boolean isStaff, Collection<AddressData> address, ClientNonPersonData clientNonPersonDetails,
|
||||
String locale,String dateFormat ) {
|
||||
this.rowIndex=rowIndex;
|
||||
this.dateFormat=dateFormat;
|
||||
@@ -225,7 +224,7 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
final Collection<StaffData> staffOptions, final Collection<CodeValueData> narrations,
|
||||
final Collection<CodeValueData> genderOptions, final Collection<SavingsProductData> savingProductOptions,
|
||||
final Collection<CodeValueData> clientTypeOptions, final Collection<CodeValueData> clientClassificationOptions, final Collection<CodeValueData> clientNonPersonConstitutionOptions,
|
||||
final Collection<CodeValueData> clientNonPersonMainBusinessLineOptions, final List<EnumOptionData> clientLegalFormOptions,final ClientFamilyMembersData familyMemberOptions, final AddressData address,
|
||||
final Collection<CodeValueData> clientNonPersonMainBusinessLineOptions, final List<EnumOptionData> clientLegalFormOptions,final ClientFamilyMembersData familyMemberOptions, final Collection<AddressData> address,
|
||||
final Boolean isAddressEnabled, final List<DatatableData> datatables) {
|
||||
final String accountNo = null;
|
||||
final EnumOptionData status = null;
|
||||
@@ -456,7 +455,7 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
final CodeValueData clientClassification, final Collection<CodeValueData> clientTypeOptions,
|
||||
final Collection<CodeValueData> clientClassificationOptions, final Collection<CodeValueData> clientNonPersonConstitutionOptions,
|
||||
final Collection<CodeValueData> clientNonPersonMainBusinessLineOptions, final ClientNonPersonData clientNonPerson,
|
||||
final List<EnumOptionData> clientLegalFormOptions,final ClientFamilyMembersData familyMemberOptions, final EnumOptionData legalForm, final AddressData address,
|
||||
final List<EnumOptionData> clientLegalFormOptions,final ClientFamilyMembersData familyMemberOptions, final EnumOptionData legalForm, final Collection<AddressData> address,
|
||||
final Boolean isAddressEnabled, final List<DatatableData> datatables, final Boolean isStaff) {
|
||||
this.accountNo = accountNo;
|
||||
this.status = status;
|
||||
|
||||
+14
-2
@@ -29,6 +29,8 @@ import java.util.Set;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.configuration.data.GlobalConfigurationPropertyData;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ConfigurationReadPlatformService;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -49,11 +51,14 @@ import com.google.gson.reflect.TypeToken;
|
||||
public final class ClientDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final ConfigurationReadPlatformService configurationReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public ClientDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
public ClientDataValidator(final FromJsonHelper fromApiJsonHelper,
|
||||
final ConfigurationReadPlatformService configurationReadPlatformService) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
this.configurationReadPlatformService = configurationReadPlatformService;
|
||||
}
|
||||
|
||||
public void validateForCreate(final String json) {
|
||||
|
||||
@@ -217,6 +222,13 @@ public final class ClientDataValidator {
|
||||
baseDataValidator.reset().parameter("isStaff").value(isStaffFlag).notNull();
|
||||
}
|
||||
|
||||
|
||||
if(this.configurationReadPlatformService
|
||||
.retrieveGlobalConfiguration("Enable-Address").isEnabled()){
|
||||
final JsonArray address =this.fromApiJsonHelper.extractJsonArrayNamed(ClientApiConstants.address, element);
|
||||
baseDataValidator.reset().parameter(ClientApiConstants.address).value(address).notNull().jsonArrayNotEmpty();
|
||||
}
|
||||
|
||||
List<ApiParameterError> dataValidationErrorsForClientNonPerson = getDataValidationErrorsForCreateOnClientNonPerson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
|
||||
dataValidationErrors.addAll(dataValidationErrorsForClientNonPerson);
|
||||
|
||||
|
||||
+8
-7
@@ -169,8 +169,9 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
|
||||
return ClientData.template(defaultOfficeId, new LocalDate(), offices, staffOptions, null, genderOptions, savingsProductDatas,
|
||||
clientTypeOptions, clientClassificationOptions, clientNonPersonConstitutionOptions, clientNonPersonMainBusinessLineOptions,
|
||||
clientLegalFormOptions,familyMemberOptions,address,isAddressEnabled, datatableTemplates);
|
||||
}
|
||||
clientLegalFormOptions, familyMemberOptions, new ArrayList<AddressData>(Arrays.asList(address)),
|
||||
isAddressEnabled, datatableTemplates);
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Transactional(readOnly=true)
|
||||
@@ -427,7 +428,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
public ClientData mapRow(final ResultSet rs, final int rowNum) throws SQLException {
|
||||
|
||||
final String accountNo = rs.getString("accountNo");
|
||||
|
||||
@@ -612,7 +613,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
public ClientData mapRow(final ResultSet rs, final int rowNum) throws SQLException {
|
||||
|
||||
final String accountNo = rs.getString("accountNo");
|
||||
|
||||
@@ -714,7 +715,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
public GroupGeneralData mapRow(final ResultSet rs, final int rowNum) throws SQLException {
|
||||
|
||||
final Long groupId = JdbcSupport.getLong(rs, "groupId");
|
||||
final String groupName = rs.getString("groupName");
|
||||
@@ -744,7 +745,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
public ClientData mapRow(final ResultSet rs, final int rowNum) throws SQLException {
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final String displayName = rs.getString("displayName");
|
||||
@@ -778,7 +779,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
public ClientData mapRow(final ResultSet rs, final int rowNum) throws SQLException {
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final String accountNo = rs.getString("accountNo");
|
||||
|
||||
+4
-2
@@ -46,10 +46,10 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.security.service.RandomPasswordGenerator;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
@@ -334,7 +334,9 @@ public final class Group extends AbstractPersistableCustom<Long> {
|
||||
actualChanges.put(GroupingTypesApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
|
||||
this.activationDate = newValue.toDate();
|
||||
if (newValue != null) {
|
||||
this.activationDate = newValue.toDate();
|
||||
}
|
||||
}
|
||||
|
||||
if (command.isChangeInStringParameterNamed(GroupingTypesApiConstants.accountNoParamName, this.accountNumber)) {
|
||||
|
||||
+6
-8
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.portfolio.account.data.AccountTransferData;
|
||||
@@ -32,6 +31,7 @@ import org.joda.time.LocalDate;
|
||||
/**
|
||||
* Immutable data object representing a loan transaction.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class LoanTransactionData {
|
||||
|
||||
private final Long id;
|
||||
@@ -56,16 +56,14 @@ public class LoanTransactionData {
|
||||
private final AccountTransferData transfer;
|
||||
private final BigDecimal fixedEmiAmount;
|
||||
private final BigDecimal outstandingLoanBalance;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate submittedOnDate;
|
||||
private final boolean manuallyReversed;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate possibleNextRepaymentDate;
|
||||
|
||||
// templates
|
||||
final Collection<PaymentTypeData> paymentTypeOptions;
|
||||
|
||||
private Collection<CodeValueData> writeOffReasonOptions = null;
|
||||
private Collection<CodeValueData> writeOffReasonOptions = null;
|
||||
|
||||
//import fields
|
||||
private transient Integer rowIndex;
|
||||
@@ -79,7 +77,7 @@ public class LoanTransactionData {
|
||||
private Integer routingCode;
|
||||
private Integer receiptNumber;
|
||||
private Integer bankNumber;
|
||||
private transient Integer accountId;
|
||||
private transient Long accountId;
|
||||
private transient String transactionType;
|
||||
|
||||
public static LoanTransactionData importInstance(BigDecimal repaymentAmount,LocalDate lastRepaymentDate,
|
||||
@@ -120,7 +118,7 @@ public class LoanTransactionData {
|
||||
}
|
||||
public static LoanTransactionData importInstance(BigDecimal repaymentAmount,LocalDate repaymentDate,
|
||||
Long repaymentTypeId, String accountNumber,Integer checkNumber,Integer routingCode,
|
||||
Integer receiptNumber, Integer bankNumber,Integer loanAccountId,String transactionType,
|
||||
Integer receiptNumber, Integer bankNumber,Long loanAccountId,String transactionType,
|
||||
Integer rowIndex,String locale, String dateFormat){
|
||||
return new LoanTransactionData(repaymentAmount, repaymentDate, repaymentTypeId, accountNumber,
|
||||
checkNumber, routingCode, receiptNumber, bankNumber, loanAccountId, "",
|
||||
@@ -129,7 +127,7 @@ public class LoanTransactionData {
|
||||
|
||||
private LoanTransactionData(BigDecimal transactionAmount,LocalDate transactionDate, Long paymentTypeId,
|
||||
String accountNumber,Integer checkNumber,Integer routingCode,Integer receiptNumber,
|
||||
Integer bankNumber,Integer accountId,String transactionType,Integer rowIndex,String locale,
|
||||
Integer bankNumber,Long accountId,String transactionType,Integer rowIndex,String locale,
|
||||
String dateFormat) {
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.transactionDate = transactionDate;
|
||||
@@ -169,7 +167,7 @@ public class LoanTransactionData {
|
||||
this.writeOffReasonOptions = null;
|
||||
}
|
||||
|
||||
public Integer getAccountId() {
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -132,4 +132,6 @@ public interface LoanReadPlatformService {
|
||||
LoanTransactionData retrieveLoanForeclosureTemplate(final Long loanId, final LocalDate transactionDate);
|
||||
|
||||
LoanAccountData retrieveLoanByLoanAccount(String loanAccountNumber);
|
||||
|
||||
Long retrieveLoanIdByAccountNumber(String loanAccountNumber);
|
||||
}
|
||||
+12
-1
@@ -2197,5 +2197,16 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long retrieveLoanIdByAccountNumber(String loanAccountNumber) {
|
||||
try {
|
||||
return this.jdbcTemplate.queryForObject("select l.id from m_loan l where l.account_no = ?",
|
||||
new Object[] { loanAccountNumber }, Long.class);
|
||||
|
||||
} catch (final EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user