wip: fixed issues in Group add/edit and add client functionality

This commit is contained in:
ashok-conflux
2013-04-17 19:18:01 +05:30
parent f212b78b99
commit 8f18f847f5
4 changed files with 19 additions and 5 deletions
@@ -27,6 +27,9 @@ public class GroupingTypesApiConstants {
public static final String hierarchyParamName = "hierarchy";
public static final String officeNameParamName = "officeName";
public static final String staffNameParamName = "staffName";
public static final String officeOptionsParamName = "officeOptions";
public static final String staffOptionsParamName = "staffOptions";
public static final String clientOptionsParamName = "clientOptions";
public static final Set<String> CENTER_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
dateFormatParamName, nameParamName, externalIdParamName, officeIdParamName, staffIdParamName));
@@ -42,9 +45,9 @@ public class GroupingTypesApiConstants {
public static final Set<String> CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName,
externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName,
"officeOptions", "staffOptions"));
officeOptionsParamName, staffOptionsParamName,clientOptionsParamName));
public static final Set<String> GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName,
externalIdParamName, officeIdParamName, officeNameParamName, "parentId", "parentName", staffIdParamName, staffNameParamName,
hierarchyParamName, "officeOptions", "staffOptions", "clientOptions"));
hierarchyParamName, officeOptionsParamName, staffOptionsParamName,clientOptionsParamName));
}
@@ -230,8 +230,8 @@ public class LoansApiResource {
final Collection<LoanChargeData> charges = loanBasicDetails.charges();
if (productId != null) {
final Long officeId = loanBasicDetails.officeId();
allowedLoanOfficers = this.staffReadPlatformService.retrieveAllLoanOfficersByOffice(officeId);
final Long officeId = loanBasicDetails.groupOfficeId();
if(officeId != null) allowedLoanOfficers = this.staffReadPlatformService.retrieveAllLoanOfficersByOffice(officeId);
}
newLoanAccount = LoanAccountData.associationsAndTemplate(loanBasicDetails, repaymentSchedule, loanRepayments, charges,
@@ -599,4 +599,8 @@ public class LoanAccountData {
public Collection<LoanChargeData> charges() {
return this.charges;
}
public Long groupOfficeId(){
return group == null? null : group.officeId();
}
}
@@ -57,6 +57,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
@@ -183,7 +184,13 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
context.authenticatedUser();
final GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
//get group associations
Collection<ClientData> membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
if (!CollectionUtils.isEmpty(membersOfGroup)) {
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup);
}
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
LoanAccountData loanDetails = LoanAccountData.groupDefaults(groupAccount, expectedDisbursementDate);